diff --git a/charts/operators-installer/Chart.yaml b/charts/operators-installer/Chart.yaml index 17ec9e8e..ebcb09d1 100644 --- a/charts/operators-installer/Chart.yaml +++ b/charts/operators-installer/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 2.2.0 +version: 2.3.0 home: https://github.com/redhat-cop/helm-charts diff --git a/charts/operators-installer/README.md b/charts/operators-installer/README.md index 770c367f..aa34bc39 100644 --- a/charts/operators-installer/README.md +++ b/charts/operators-installer/README.md @@ -18,7 +18,9 @@ For all of the Subscription parameters see | operators[].name | | Yes | [Subscription](https://docs.openshift.com/container-platform/4latest/rest_api/operatorhub_apis/subscription-operators-coreos-com-v1alpha1) name. | operators[].source | | Yes | [Subscription](https://docs.openshift.com/container-platform/4latest/rest_api/operatorhub_apis/subscription-operators-coreos-com-v1alpha1) source. | operators[].sourceNamespace | | Yes | [Subscription](https://docs.openshift.com/container-platform/4latest/rest_api/operatorhub_apis/subscription-operators-coreos-com-v1alpha1) sourceNamespace. -| operators[].csv | | Yes | The CSV to install. +| operators[].csv | | Yes | The CSV to install. +| operators[].installPlanApproverRetries | `10 | No | Number of times to try to approve the InstallPlan. This may need to be increased for unpredictable reasons about some clusters taking longer to create InstallPlans. +| operators[].installPlanApproverActiveDeadlineSeconds | `120` | No | Total amount of time that can be spent waiting for InstallPlan to be approved. This may need to be increased for unpredictable reasons about some clusters taking longer to create InstallPlans. | operators[].installPlanVerifierRetries | `10` | No | Number of times to check if the InstallPlan has actually been installed. This may need to increase of an operator takes a long time to install. | operators[].installPlanVerifierActiveDeadlineSeconds | `120` | No | Total amount of time that can be spent waiting for InstallPlan to finish installing. This may need to increase of an operator takes a long time to install. | operators[].namespace | `.Release.Namespace` | No | Specify the namespace to install the operator into, which allows different operators to be installed into different namespaces from the same chart. If @@ -51,11 +53,11 @@ if obj.status ~= nil then for i, condition in pairs(obj.status.conditions) do msg = msg .. i .. ": " .. condition.type .. " | " .. condition.status .. "\n" if condition.type == "InstallPlanPending" and condition.status == "True" then - numPending = numPending + 1 + numPending = numPending + 1 elseif (condition.type == "InstallPlanMissing" and condition.reason ~= "ReferencedInstallPlanNotFound") then - numDegraded = numDegraded + 1 + numDegraded = numDegraded + 1 elseif (condition.type == "CatalogSourcesUnhealthy" or condition.type == "InstallPlanFailed" or condition.type == "ResolutionFailed") and condition.status == "True" then - numDegraded = numDegraded + 1 + numDegraded = numDegraded + 1 end end if numDegraded == 0 and numPending == 0 then @@ -68,17 +70,14 @@ if obj.status ~= nil then return health_status elseif numPending > 0 and numDegraded == 0 then health_status.status = "Progressing" - health_status.message = "An install plan for a subscription is pending installation - ian was here 1" + health_status.message = "An install plan for a subscription is pending installation" return health_status else health_status.status = "Degraded" health_status.message = msg return health_status end - end end -health_status.status = "Progressing" -health_status.message = "An install plan for a subscription is pending installation - ian was here 2" return health_status ``` diff --git a/charts/operators-installer/templates/Job_installplan-approver.yaml b/charts/operators-installer/templates/Job_installplan-approver.yaml index 455b78ec..f71bc366 100644 --- a/charts/operators-installer/templates/Job_installplan-approver.yaml +++ b/charts/operators-installer/templates/Job_installplan-approver.yaml @@ -9,17 +9,19 @@ metadata: namespace: {{ .namespace | default $.Release.Namespace }} labels: {{- include "operators-installer.labels" $ | nindent 4 }} - {{- if $.Values.approveManualInstallPlanViaHook }} annotations: + {{- if $.Values.approveManualInstallPlanViaHook }} "helm.sh/hook": post-install,post-upgrade "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded - "helm.sh/hook-weight": "0" - {{- end }} + "helm.sh/hook-weight": "20" + {{- else }} + argocd.argoproj.io/sync-wave: 20 + {{- end }} spec: completions: 1 - backoffLimit: 5 parallelism: 1 - activeDeadlineSeconds: 30 + backoffLimit: {{ .installPlanApproverRetries | default 10 }} + activeDeadlineSeconds: {{ .installPlanApproverActiveDeadlineSeconds | default 120 }} template: spec: containers: diff --git a/charts/operators-installer/templates/Job_installplan-complete-verifier.yaml b/charts/operators-installer/templates/Job_installplan-complete-verifier.yaml index 719b870d..80d32f06 100644 --- a/charts/operators-installer/templates/Job_installplan-complete-verifier.yaml +++ b/charts/operators-installer/templates/Job_installplan-complete-verifier.yaml @@ -9,16 +9,18 @@ metadata: namespace: {{ .namespace | default $.Release.Namespace }} labels: {{- include "operators-installer.labels" $ | nindent 4 }} - {{- if $.Values.approveManualInstallPlanViaHook }} annotations: + {{- if $.Values.approveManualInstallPlanViaHook }} "helm.sh/hook": post-install,post-upgrade "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded - "helm.sh/hook-weight": "10" - {{- end }} + "helm.sh/hook-weight": "30" + {{- else }} + argocd.argoproj.io/sync-wave: 30 + {{- end }} spec: completions: 1 - backoffLimit: {{ .installPlanVerifierRetries | default 10 }} parallelism: 1 + backoffLimit: {{ .installPlanVerifierRetries | default 10 }} activeDeadlineSeconds: {{ .installPlanVerifierActiveDeadlineSeconds | default 120 }} template: spec: diff --git a/charts/operators-installer/templates/RoleBinding_installplan-approvers.yaml b/charts/operators-installer/templates/RoleBinding_installplan-approvers.yaml index 30f65bff..01f3a215 100644 --- a/charts/operators-installer/templates/RoleBinding_installplan-approvers.yaml +++ b/charts/operators-installer/templates/RoleBinding_installplan-approvers.yaml @@ -8,12 +8,14 @@ metadata: namespace: {{ $namespace }} labels: {{- include "operators-installer.labels" $ | nindent 4 }} - {{- if $.Values.approveManualInstallPlanViaHook }} annotations: + {{- if $.Values.approveManualInstallPlanViaHook }} "helm.sh/hook": post-install,post-upgrade "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded - "helm.sh/hook-weight": "-1" - {{- end }} + "helm.sh/hook-weight": "10" + {{- else }} + argocd.argoproj.io/sync-wave: 10 + {{- end }} roleRef: apiGroup: rbac.authorization.k8s.io kind: Role diff --git a/charts/operators-installer/templates/Role_installplan-approver.yaml b/charts/operators-installer/templates/Role_installplan-approver.yaml index 3d349768..49324f11 100644 --- a/charts/operators-installer/templates/Role_installplan-approver.yaml +++ b/charts/operators-installer/templates/Role_installplan-approver.yaml @@ -8,12 +8,14 @@ metadata: namespace: {{ $namespace }} labels: {{- include "operators-installer.labels" $ | nindent 4 }} - {{- if $.Values.approveManualInstallPlanViaHook }} annotations: + {{- if $.Values.approveManualInstallPlanViaHook }} "helm.sh/hook": post-install,post-upgrade "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded - "helm.sh/hook-weight": "-1" - {{- end }} + "helm.sh/hook-weight": "10" + {{- else }} + argocd.argoproj.io/sync-wave: 10 + {{- end }} rules: - apiGroups: - operators.coreos.com diff --git a/charts/operators-installer/templates/ServiceAccount_installplan-approver.yaml b/charts/operators-installer/templates/ServiceAccount_installplan-approver.yaml index 2e0e60b4..3cab407c 100644 --- a/charts/operators-installer/templates/ServiceAccount_installplan-approver.yaml +++ b/charts/operators-installer/templates/ServiceAccount_installplan-approver.yaml @@ -8,10 +8,12 @@ metadata: namespace: {{ $namespace }} labels: {{- include "operators-installer.labels" $ | nindent 4 }} - {{- if $.Values.approveManualInstallPlanViaHook }} annotations: + {{- if $.Values.approveManualInstallPlanViaHook }} "helm.sh/hook": post-install,post-upgrade "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded - "helm.sh/hook-weight": "-1" - {{- end }} + "helm.sh/hook-weight": "10" + {{- else }} + argocd.argoproj.io/sync-wave: 10 + {{- end }} {{- end }} diff --git a/charts/operators-installer/templates/Subscription.yaml b/charts/operators-installer/templates/Subscription.yaml index 8da39813..32b90579 100644 --- a/charts/operators-installer/templates/Subscription.yaml +++ b/charts/operators-installer/templates/Subscription.yaml @@ -1,6 +1,6 @@ -# create one Subscription per operator {{- range .Values.operators }} --- +# create one Subscription per operator apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: diff --git a/charts/operators-installer/test-install-approve-not-via-hook.yaml b/charts/operators-installer/test-install-approve-not-via-hook.yaml new file mode 100644 index 00000000..d985f9fc --- /dev/null +++ b/charts/operators-installer/test-install-approve-not-via-hook.yaml @@ -0,0 +1,12 @@ +approveManualInstallPlanViaHook: false + +operators: +- channel: stable + installPlanApproval: Manual + name: external-secrets-operator + source: community-operators + sourceNamespace: openshift-marketplace + csv: external-secrets-operator.v0.8.1 + namespace: openshift-operators +commonLabels: + test-label: xyz123 diff --git a/charts/operators-installer/test-install-multiple-operators-in-different-namespacesyaml b/charts/operators-installer/test-install-multiple-operators-in-different-namespaces.yaml similarity index 100% rename from charts/operators-installer/test-install-multiple-operators-in-different-namespacesyaml rename to charts/operators-installer/test-install-multiple-operators-in-different-namespaces.yaml