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 30, 2024
1 parent ad1a0c8 commit e6d3383
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 25 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,16 +37,31 @@ 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
if [ "${linux_arch}" == "ppc64le" ] || [ "${linux_arch}" == "s390x" ]; then
argocd_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}" \
Expand Down
2 changes: 0 additions & 2 deletions config/argocd-cloudpaks/cp4d/templates/0100-cp4d-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ spec:
value: "{{.Values.iam_integration}}"
- 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 @@ -24,8 +24,6 @@ spec:
value: "{{.Values.iam_integration}}"
- 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
2 changes: 0 additions & 2 deletions config/argocd-cloudpaks/cp4d/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ storageclass:

iam_integration: true

image_arch: amd64

version: 4.8.0
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ spec:
- name: config
image: registry.redhat.io/openshift4/ose-cli:latest
imagePullPolicy: IfNotPresent
resources:
requests:
memory: "64Mi"
cpu: "150m"
limits:
memory: "128Mi"
cpu: "200m"
env:
- name: ARGOCD_NAMESPACE
value: {{.Values.metadata.argocd_namespace}}
Expand Down Expand Up @@ -60,9 +53,24 @@ spec:
argo_cmd="${HOME}/argocd"
result=0
linux_arch=$(uname -p)
argocd_cli_arch=amd64
if [ "${linux_arch}" == "ppc64le" ] || [ "${linux_arch}" == "s390x" ]; then
argocd_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 \
|| result=1
Expand Down
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
2 changes: 0 additions & 2 deletions config/cloudpaks/cp4d/templates/0090-sync-cluster-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion config/cloudpaks/cp4d/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ storageclass:
targetRevision: main

iam_integration: "set in presync-hook of parent app"
image_arch: "set in parent app"

version: "set in parent app"

0 comments on commit e6d3383

Please sign in to comment.