Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/actions/deploy/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ cd - && kustomize build --load-restrictor LoadRestrictionsNone config/release/de
kubectl delete secrets my-atlas-key --ignore-not-found -n "${ns}"
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}"

label="app.kubernetes.io/instance=mongodb-atlas-kubernetes-operator"
# Wait for the Operator to start
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"
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"
timeout --foreground "1m" bash -c "${cmd}" || true
if ! kubectl -n "${ns}" get pods -l "control-plane=controller-manager" -o 'jsonpath="{.items[0].status.phase}"' | grep -q "Running"; then
if ! kubectl -n "${ns}" get pods -l "$label" -o 'jsonpath="{.items[0].status.phase}"' | grep -q "Running"; then
echo "Operator hasn't reached RUNNING state after 1 minute. The full yaml configuration for the pod is:"
kubectl -n "${ns}" get pods -l "control-plane=controller-manager" -o yaml
kubectl -n "${ns}" get pods -l "$label" -o yaml

echo "Operator failed to start, exiting"
exit 1
Expand Down
6 changes: 0 additions & 6 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
control-plane: controller-manager
name: system
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: operator
namespace: system
labels:
control-plane: operator
spec:
selector:
matchLabels:
control-plane: controller-manager
replicas: 1
template:
metadata:
labels:
control-plane: controller-manager
spec:
securityContext:
runAsNonRoot: true
Expand Down
8 changes: 3 additions & 5 deletions config/managerwithproxy/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Labels to add to all resources and selectors.
#commonLabels:
# app.kubernetes.io/component: controller
# app.kubernetes.io/name: mongodb-atlas-kubernetes-operator
# app.kubernetes.io/instance: mongodb-atlas-kubernetes-operator
#
# This is the main source of config for Deployment that is reused by all the configurations in 'release' folder
#

resources:
- ../manager
Expand Down
4 changes: 0 additions & 4 deletions config/rbac/auth_proxy_service.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
apiVersion: v1
kind: Service
metadata:
labels:
control-plane: controller-manager
name: controller-manager-metrics-service
namespace: system
spec:
ports:
- name: https
port: 8443
targetPort: https
selector:
control-plane: controller-manager
6 changes: 6 additions & 0 deletions config/release/base/allinone/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ namespace: mongodb-atlas-system

namePrefix: mongodb-atlas-

# Labels to add to all resources and selectors.
commonLabels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: mongodb-atlas-kubernetes-operator
app.kubernetes.io/instance: mongodb-atlas-kubernetes-operator

resources:
- ../../../managerwithproxy
- ../../../crd
Expand Down
5 changes: 5 additions & 0 deletions config/release/base/clusterwide/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ namespace: mongodb-atlas-system

namePrefix: mongodb-atlas-

# Labels to add to all resources and selectors.
commonLabels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: mongodb-atlas-kubernetes-operator
app.kubernetes.io/instance: mongodb-atlas-kubernetes-operator

resources:
- ../../../managerwithproxy
Expand Down
6 changes: 6 additions & 0 deletions config/release/base/namespaced/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ namespace: mongodb-atlas-system

namePrefix: mongodb-atlas-

# Labels to add to all resources and selectors.
commonLabels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: mongodb-atlas-kubernetes-operator
app.kubernetes.io/instance: mongodb-atlas-kubernetes-operator

resources:
- ../../../managerwithproxy
- ../../../rbac/namespaced
Expand Down
2 changes: 0 additions & 2 deletions config/webhook/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ spec:
ports:
- port: 443
targetPort: 9443
selector:
control-plane: controller-manager
4 changes: 2 additions & 2 deletions test/e2e/cli/kube/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ func GenKubeVersion(fullVersion string) string {
// GetPodStatus status.phase
func GetPodStatus(ns string) func() string {
return func() string {
session := cli.Execute("kubectl", "get", "pods", "-l", "control-plane=controller-manager", "-o", "jsonpath={.items[0].status.phase}", "-n", ns)
session := cli.Execute("kubectl", "get", "pods", "-l", "app.kubernetes.io/instance=mongodb-atlas-kubernetes-operator", "-o", "jsonpath={.items[0].status.phase}", "-n", ns)
return string(session.Wait("1m").Out.Contents())
}
}

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