Skip to content

Commit 02d73f4

Browse files
author
Anton
authored
CLOUDP-84606: common labels (#187)
1 parent 307fdf6 commit 02d73f4

File tree

9 files changed

+26
-22
lines changed

9 files changed

+26
-22
lines changed

.github/actions/deploy/entrypoint.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ cd - && kustomize build --load-restrictor LoadRestrictionsNone config/release/de
2020
kubectl delete secrets my-atlas-key --ignore-not-found -n "${ns}"
2121
kubectl create secret generic my-atlas-key --from-literal="orgId=${INPUT_ATLAS_ORG_ID}" --from-literal="publicApiKey=${INPUT_ATLAS_PUBLIC_KEY}" --from-literal="privateApiKey=${INPUT_ATLAS_PRIVATE_KEY}" -n "${ns}"
2222

23+
label="app.kubernetes.io/instance=mongodb-atlas-kubernetes-operator"
2324
# Wait for the Operator to start
24-
cmd="while ! kubectl -n ${ns} get pods -l control-plane=controller-manager -o jsonpath={.items[0].status.phase} 2>/dev/null | grep -q Running ; do printf .; sleep 1; done"
25+
cmd="while ! kubectl -n ${ns} get pods -l $label -o jsonpath={.items[0].status.phase} 2>/dev/null | grep -q Running ; do printf .; sleep 1; done"
2526
timeout --foreground "1m" bash -c "${cmd}" || true
26-
if ! kubectl -n "${ns}" get pods -l "control-plane=controller-manager" -o 'jsonpath="{.items[0].status.phase}"' | grep -q "Running"; then
27+
if ! kubectl -n "${ns}" get pods -l "$label" -o 'jsonpath="{.items[0].status.phase}"' | grep -q "Running"; then
2728
echo "Operator hasn't reached RUNNING state after 1 minute. The full yaml configuration for the pod is:"
28-
kubectl -n "${ns}" get pods -l "control-plane=controller-manager" -o yaml
29+
kubectl -n "${ns}" get pods -l "$label" -o yaml
2930

3031
echo "Operator failed to start, exiting"
3132
exit 1

config/manager/manager.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
11
apiVersion: v1
22
kind: Namespace
33
metadata:
4-
labels:
5-
control-plane: controller-manager
64
name: system
75
---
86
apiVersion: apps/v1
97
kind: Deployment
108
metadata:
119
name: operator
1210
namespace: system
13-
labels:
14-
control-plane: operator
1511
spec:
1612
selector:
1713
matchLabels:
18-
control-plane: controller-manager
1914
replicas: 1
2015
template:
2116
metadata:
2217
labels:
23-
control-plane: controller-manager
2418
spec:
2519
securityContext:
2620
runAsNonRoot: true

config/managerwithproxy/kustomization.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# Labels to add to all resources and selectors.
2-
#commonLabels:
3-
# app.kubernetes.io/component: controller
4-
# app.kubernetes.io/name: mongodb-atlas-kubernetes-operator
5-
# app.kubernetes.io/instance: mongodb-atlas-kubernetes-operator
1+
#
2+
# This is the main source of config for Deployment that is reused by all the configurations in 'release' folder
3+
#
64

75
resources:
86
- ../manager
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
apiVersion: v1
22
kind: Service
33
metadata:
4-
labels:
5-
control-plane: controller-manager
64
name: controller-manager-metrics-service
75
namespace: system
86
spec:
97
ports:
108
- name: https
119
port: 8443
1210
targetPort: https
13-
selector:
14-
control-plane: controller-manager

config/release/base/allinone/kustomization.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ namespace: mongodb-atlas-system
22

33
namePrefix: mongodb-atlas-
44

5+
# Labels to add to all resources and selectors.
6+
commonLabels:
7+
app.kubernetes.io/component: controller
8+
app.kubernetes.io/name: mongodb-atlas-kubernetes-operator
9+
app.kubernetes.io/instance: mongodb-atlas-kubernetes-operator
10+
511
resources:
612
- ../../../managerwithproxy
713
- ../../../crd

config/release/base/clusterwide/kustomization.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ namespace: mongodb-atlas-system
22

33
namePrefix: mongodb-atlas-
44

5+
# Labels to add to all resources and selectors.
6+
commonLabels:
7+
app.kubernetes.io/component: controller
8+
app.kubernetes.io/name: mongodb-atlas-kubernetes-operator
9+
app.kubernetes.io/instance: mongodb-atlas-kubernetes-operator
510

611
resources:
712
- ../../../managerwithproxy

config/release/base/namespaced/kustomization.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ namespace: mongodb-atlas-system
22

33
namePrefix: mongodb-atlas-
44

5+
# Labels to add to all resources and selectors.
6+
commonLabels:
7+
app.kubernetes.io/component: controller
8+
app.kubernetes.io/name: mongodb-atlas-kubernetes-operator
9+
app.kubernetes.io/instance: mongodb-atlas-kubernetes-operator
10+
511
resources:
612
- ../../../managerwithproxy
713
- ../../../rbac/namespaced

config/webhook/service.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,3 @@ spec:
88
ports:
99
- port: 443
1010
targetPort: 9443
11-
selector:
12-
control-plane: controller-manager

test/e2e/cli/kube/kubectl.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ func GenKubeVersion(fullVersion string) string {
2626
// GetPodStatus status.phase
2727
func GetPodStatus(ns string) func() string {
2828
return func() string {
29-
session := cli.Execute("kubectl", "get", "pods", "-l", "control-plane=controller-manager", "-o", "jsonpath={.items[0].status.phase}", "-n", ns)
29+
session := cli.Execute("kubectl", "get", "pods", "-l", "app.kubernetes.io/instance=mongodb-atlas-kubernetes-operator", "-o", "jsonpath={.items[0].status.phase}", "-n", ns)
3030
return string(session.Wait("1m").Out.Contents())
3131
}
3232
}
3333

3434
// DescribeOperatorPod performs "kubectl describe" to get Operator pod information
3535
func DescribeOperatorPod(ns string) func() string {
3636
return func() string {
37-
session := cli.Execute("kubectl", "describe", "pods", "-l", "control-plane=controller-manager", "-n", ns)
37+
session := cli.Execute("kubectl", "describe", "pods", "-l", "app.kubernetes.io/instance=mongodb-atlas-kubernetes-operator", "-n", ns)
3838
return string(session.Wait("1m").Out.Contents())
3939
}
4040
}

0 commit comments

Comments
 (0)