Skip to content

Commit

Permalink
fix: Patch Zen database for CP4D
Browse files Browse the repository at this point in the history
Signed-off-by: Denilson Nastacio <[email protected]>
  • Loading branch information
nastacio committed Dec 8, 2023
1 parent cfa0c21 commit afed9e8
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/cloudpaks/cp4d/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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: 0.8.0
version: 0.8.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
7 changes: 6 additions & 1 deletion config/cloudpaks/cp4d/templates/0100-config-placeholder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: gitops-cp4d-dummy
namespace: {{.Values.metadata.operators_namespace}}
namespace: {{.Values.metadata.operands_namespace}}
data:
components: {{.Values.components}}
stg_class_block: {{.Values.storageclass.rwo}}
stg_class_file: {{.Values.storageclass.rwx}}
version: {{.Values.version}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
# https://www.ibm.com/support/pages/node/7087504
apiVersion: batch/v1
kind: Job
metadata:
annotations:
argocd.argoproj.io/hook: Sync
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
argocd.argoproj.io/sync-wave: "101"
name: sync-cp4d-install-zen-workaround
namespace: {{.Values.metadata.argocd_namespace}}
spec:
template:
spec:
containers:
- name: patch-zen-database
image: "icr.io/cpopen/cpd/olm-utils-v2:{{.Values.version}}"
env:
- name: PROJECT_CPD_INST_OPERANDS
value: {{.Values.metadata.operands_namespace}}
command:
- /bin/bash
- -c
- |
set -eo pipefail
set -x
result=1
while [ ${result} -eq 1 ] && [ ${SECONDS} -lt 7200 ]
do
oc get deployment zen-databases \
-n ${PROJECT_CPD_INST_OPERANDS} \
&& result=0 \
|| {
echo "INFO: Waiting on Zen database deployment to patch it"
sleep 60
}
done
if [ ${result} -eq 0 ]; then
oc patch deployment zen-databases \
-n ${PROJECT_CPD_INST_OPERANDS} \
--type='json' \
-p='[{"op": "add", "path": "/spec/template/spec/containers/0/env/-", "value": {"name": "npm_config_cache", "value": "/tmp"}}]' \
|| {
echo "ERROR: CP4D installation failed."
result=1
}
fi
exit ${result}
restartPolicy: Never
serviceAccountName: {{.Values.serviceaccount.argocd_application_controller}}

backoffLimit: 2

0 comments on commit afed9e8

Please sign in to comment.