Skip to content

Commit

Permalink
bundle: add init container for console to wait for reconciliation
Browse files Browse the repository at this point in the history
Signed-off-by: Leela Venkaiah G <[email protected]>
  • Loading branch information
leelavg committed Jul 29, 2024
1 parent b2bf377 commit fccd17f
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 4 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
$(KUSTOMIZE) build config/crd | kubectl delete -f -

deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} && \
$(KUSTOMIZE) edit set image reconcile-waiter=$(IMG)
cd config/default && $(KUSTOMIZE) edit set image kube-rbac-proxy=$(RBAC_PROXY_IMG)
cd config/console && $(KUSTOMIZE) edit set image ocs-client-operator-console=$(OCS_CLIENT_CONSOLE_IMG)
cd config/console && $(KUSTOMIZE) edit set image ocs-client-operator-console=$(OCS_CLIENT_CONSOLE_IMG) && \
$(KUSTOMIZE) edit set image reconcile-waiter=$(IMG)
$(KUSTOMIZE) build config/default | sed "s|STATUS_REPORTER_IMAGE_VALUE|$(IMG)|g" | awk '{print}' | kubectl apply -f -

remove: ## Remove controller from the K8s cluster specified in ~/.kube/config.
Expand All @@ -121,6 +123,7 @@ bundle: manifests kustomize operator-sdk yq ## Generate bundle manifests and met
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG) && \
$(KUSTOMIZE) edit set image reconcile-waiter=$(IMG)
cd config/console && $(KUSTOMIZE) edit set image ocs-client-operator-console=$(OCS_CLIENT_CONSOLE_IMG) && \
$(KUSTOMIZE) edit set image reconcile-waiter=$(IMG) && \
$(KUSTOMIZE) edit set nameprefix $(OPERATOR_NAMEPREFIX)
cd config/default && \
$(KUSTOMIZE) edit set image kube-rbac-proxy=$(RBAC_PROXY_IMG) && \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
creationTimestamp: null
name: ocs-client-operator-console-init-rb
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: ocs-client-operator-consoler-init-role
subjects:
- kind: ServiceAccount
name: ocs-client-operator-console-init-sa
namespace: system
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
creationTimestamp: null
name: ocs-client-operator-console-init-role
rules:
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- get
- list
- apiGroups:
- ocs.openshift.io
resources:
- storageclusters
verbs:
- get
- list
14 changes: 13 additions & 1 deletion bundle/manifests/ocs-client-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
categories: Storage
console.openshift.io/plugins: '["odf-client-console"]'
containerImage: quay.io/ocs-dev/ocs-client-operator:latest
createdAt: "2024-07-29T14:03:35Z"
createdAt: "2024-07-29T14:43:47Z"
description: OpenShift Data Foundation client operator enables consumption of
storage services from a remote centralized OpenShift Data Foundation provider
cluster.
Expand Down Expand Up @@ -830,8 +830,20 @@ spec:
name: ocs-client-operator-console-nginx-log
- mountPath: /var/lib/nginx/tmp
name: ocs-client-operator-console-nginx-tmp
initContainers:
- command:
- /reconcile-waiter
env:
- name: OPERATOR_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: quay.io/ocs-dev/ocs-client-operator:latest
name: reconcile-waiter
resources: {}
securityContext:
runAsNonRoot: true
serviceAccountName: ocs-client-operator-console-init-sa
volumes:
- name: ocs-client-operator-console-serving-cert
secret:
Expand Down
11 changes: 11 additions & 0 deletions config/console/console_init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ spec:
labels:
app.kubernetes.io/name: ocs-client-operator-console
spec:
initContainers:
- name: reconcile-waiter
image: reconcile-waiter:latest
command:
- /reconcile-waiter
env:
- name: OPERATOR_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
serviceAccountName: ocs-client-operator-console-init-sa
containers:
- name: ocs-client-operator-console
image: ocs-client-operator-console:latest
Expand Down
3 changes: 3 additions & 0 deletions config/console/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ images:
- name: ocs-client-operator-console
newName: quay.io/ocs-dev/ocs-client-console
newTag: latest
- name: reconcile-waiter
newName: quay.io/ocs-dev/ocs-client-operator
newTag: latest
namePrefix: ocs-client-operator-
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
runAsNonRoot: true
initContainers:
- name: reconcile-waiter
image: controller:latest
image: reconcile-waiter:latest
command:
- /reconcile-waiter
env:
Expand Down
19 changes: 19 additions & 0 deletions config/rbac/console_init_role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: console-init-role
rules:
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- get
- list
- apiGroups:
- ocs.openshift.io
resources:
- storageclusters
verbs:
- get
- list
12 changes: 12 additions & 0 deletions config/rbac/console_init_role_binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: console-init-rb
subjects:
- kind: ServiceAccount
name: ocs-client-operator-console-init-sa
namespace: system
roleRef:
kind: Role
name: ocs-client-operator-consoler-init-role
apiGroup: rbac.authorization.k8s.io
5 changes: 5 additions & 0 deletions config/rbac/console_init_service_account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: reconcile-waiter
namespace: system
3 changes: 3 additions & 0 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ resources:
- csi_rbd_provisioner_role.yaml
- csi_rbd_provisioner_role_binding.yaml
- csi_rbd_provisioner_service_account.yaml
- console_init_role.yaml
- console_init_role_binding.yaml
- console_init_service_account.yaml

0 comments on commit fccd17f

Please sign in to comment.