Skip to content

Commit

Permalink
chore: Use multi-arch images 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 Jan 31, 2024
1 parent de32c9c commit 5cab806
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 20 deletions.
2 changes: 1 addition & 1 deletion config/argocd-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.1
version: 0.8.2

# 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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
spec:
containers:
- name: config
image: quay.io/openshift/origin-cli:latest
image: registry.redhat.io/openshift4/ose-cli:latest
imagePullPolicy: IfNotPresent
env:
- name: ARGOCD_APP_NAME
Expand All @@ -37,21 +37,39 @@ spec:
echo "INFO: Install Argo CLI."
# Install it from cluster, not from Internet, so airgap scenarios still work
argo_route=openshift-gitops-server
argo_secret=openshift-gitops-cluster
argo_route="${ARGOCD_NAMESPACE}-server"
argo_secret="${ARGOCD_NAMESPACE}-cluster"
export HOME=/tmp
argo_cmd="${HOME}/argocd"
result=0
linux_arch=$(uname -p)
argocd_cli_arch=amd64
cpd_cli_arch=""
if [ "${linux_arch}" == "ppc64le" ] || [ "${linux_arch}" == "s390x" ]; then
argocd_cli_arch=${linux_arch}
cpd_cli_arch=".${linux_arch}"
fi
argo_url=$(oc get route ${argo_route} -n ${ARGOCD_NAMESPACE} -ojsonpath='{.spec.host}') \
&& curl -skL "${argo_url}/download/argocd-linux-amd64" -o "${argo_cmd}" \
&& chmod 755 "${argo_cmd}" \
&& cli_status=$(curl -skL "${argo_url}/download/argocd-linux-${argocd_cli_arch}" \
-o "${argo_cmd}" \
-w "%{http_code}") \
|| result=1
if [ "${cli_status}" != "200" ]; then
echo "ERROR: Unable to download argocd client."
exit 2
fi
chmod 755 "${argo_cmd}" \
&& argo_pwd=$(oc get secret ${argo_secret} -n ${ARGOCD_NAMESPACE} -ojsonpath='{.data.admin\.password}' | base64 -d ; echo ) \
&& "${argo_cmd}" login "${argo_url}" --username admin --password "${argo_pwd}" --insecure \
&& "${argo_cmd}" app set "${ARGOCD_APP_NAME}" \
--helm-set-string storageclass.rwo="${storage_class_rwo}" \
--helm-set-string storageclass.rwx="${storage_class_rwx}" \
--helm-set-string image_arch="${cpd_cli_arch}" \
&& echo "INFO: ${ARGOCD_APP_NAME} successfully updated storage classes." \
|| result=1
Expand Down
4 changes: 2 additions & 2 deletions config/argocd-cloudpaks/cp4d/templates/0100-cp4d-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ spec:
value: {{.Values.components}}
- name: iam_integration
value: "{{.Values.iam_integration}}"
- name: image_arch
value: {{.Values.image_arch}}
- name: metadata.argocd_app_namespace
value: {{.Values.metadata.argocd_app_namespace}}
- name: metadata.image_arch
value: {{.Values.metadata.image_arch}}
- name: metadata.operators_namespace
value: {{.Values.metadata.operators_namespace}}
- name: metadata.operands_namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ spec:
value: {{.Values.components}}
- name: iam_integration
value: "{{.Values.iam_integration}}"
- name: image_arch
value: {{.Values.image_arch}}
- name: metadata.argocd_app_namespace
value: {{.Values.metadata.argocd_app_namespace}}
- name: metadata.image_arch
value: {{.Values.metadata.image_arch}}
- name: metadata.operators_namespace
value: {{.Values.metadata.operators_namespace}}
- name: metadata.operands_namespace
Expand Down
5 changes: 4 additions & 1 deletion config/argocd-cloudpaks/cp4d/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ storageclass:

iam_integration: true

image_arch: amd64
# suffix for labels for the olm-v2 utils image
image_arch: ""
# image_arch: .s390x
# image_arch: .ppc64le

version: 4.8.0
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.1
version: 0.8.2

# 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
4 changes: 1 addition & 3 deletions config/cloudpaks/cp4d/templates/0090-sync-cluster-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
spec:
containers:
- name: configure-cluster
image: "icr.io/cpopen/cpd/olm-utils-v2:{{.Values.version}}"
image: "icr.io/cpopen/cpd/olm-utils-v2:{{.Values.version}}{{.Values.image_arch}}"
env:
- name: PROJECT_CERT_MANAGER
value: ibm-cert-manager
Expand All @@ -25,8 +25,6 @@ spec:
value: {{.Values.version}}
- name: COMPONENTS
value: {{.Values.components}}
- name: IMAGE_ARCH
value: {{.Values.image_arch}}
command:
- /bin/bash
- -c
Expand Down
8 changes: 7 additions & 1 deletion config/cloudpaks/cp4d/templates/0100-sync-install-olm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: install-olm
image: "icr.io/cpopen/cpd/olm-utils-v2:{{.Values.version}}"
image: "icr.io/cpopen/cpd/olm-utils-v2:{{.Values.version}}{{.Values.image_arch}}"
env:
- name: PROJECT_CPD_INST_OPERATORS
value: {{.Values.metadata.operators_namespace}}
Expand Down Expand Up @@ -45,6 +45,12 @@ spec:
exit 1
}
# https://www.ibm.com/docs/en/cloud-paks/cp-data/4.8.x?topic=requirements-hardware#hardware-reqs__svc-power
linux_arch=$(uname -p)
if [ "${linux_arch}" == "ppc64le" ] || [ "${linux_arch}" == "s390x" ]; then
COMPONENTS=${COMPONENTS/,rstudio/}
fi
# https://www.ibm.com/docs/en/cloud-paks/cp-data/4.8.x?topic=services-creating-informix-scc
echo "INFO: Creating custom security context constraints for services."
if [[ ${COMPONENTS} =~ informix ]]; then
Expand Down
16 changes: 15 additions & 1 deletion config/cloudpaks/cp4d/templates/0100-sync-install-platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: install-components
image: "icr.io/cpopen/cpd/olm-utils-v2:{{.Values.version}}"
image: "icr.io/cpopen/cpd/olm-utils-v2:{{.Values.version}}{{.Values.image_arch}}"
env:
- name: PROJECT_CPD_INST_OPERANDS
value: {{.Values.metadata.operands_namespace}}
Expand All @@ -35,6 +35,20 @@ spec:
result=0
export KUBECONFIG=/tmp/kubeconfig
api_url=$(oc get Infrastructure cluster -o jsonpath='{.status.apiServerURL}')
oc login "${api_url}" --token="$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" --insecure-skip-tls-verify \
|| {
echo "WARNING: Unable to login to the cluster."
exit 1
}
# https://www.ibm.com/docs/en/cloud-paks/cp-data/4.8.x?topic=requirements-hardware#hardware-reqs__svc-power
linux_arch=$(uname -p)
if [ "${linux_arch}" == "ppc64le" ] || [ "${linux_arch}" == "s390x" ]; then
COMPONENTS=${COMPONENTS/,rstudio/}
fi
# https://www.ibm.com/docs/en/cloud-paks/cp-data/4.8.x?topic=data-installing-cloud-pak
echo "INFO: Installing components in a specialized installation." \
&& bin/apply-cr \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: patch-zen-database
image: "icr.io/cpopen/cpd/olm-utils-v2:{{.Values.version}}"
image: "icr.io/cpopen/cpd/olm-utils-v2:{{.Values.version}}{{.Values.image_arch}}"
env:
- name: COMPONENTS
value: {{.Values.components}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
spec:
containers:
- name: config
image: "icr.io/cpopen/cpd/olm-utils-v2:{{.Values.version}}"
image: "icr.io/cpopen/cpd/olm-utils-v2:{{.Values.version}}{{.Values.image_arch}}"
imagePullPolicy: IfNotPresent
env:
- name: PROJECT_CPD_INST_OPERANDS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
spec:
containers:
- name: install-olm
image: "icr.io/cpopen/cpd/olm-utils-v2:{{.Values.version}}"
image: "icr.io/cpopen/cpd/olm-utils-v2:{{.Values.version}}{{.Values.image_arch}}"
env:
- name: PROJECT_CPD_INST_OPERANDS
value: {{.Values.metadata.operands_namespace}}
Expand Down

0 comments on commit 5cab806

Please sign in to comment.