Skip to content

Commit

Permalink
update for KubeVirt MCP
Browse files Browse the repository at this point in the history
Signed-off-by: Sébastien Chabrolles <[email protected]>
  • Loading branch information
schabrolles committed Jun 19, 2024
1 parent 5e07e23 commit d30ad80
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 43 deletions.
4 changes: 2 additions & 2 deletions charts/cpd-install-pipeline/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ 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: 1.5.5
version: 1.5.6

# 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
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.5.5"
appVersion: "1.5.6"
#
Original file line number Diff line number Diff line change
Expand Up @@ -74,40 +74,52 @@ spec:
name: CP-INSTALL-OPTIONS
type: string
tasks:
- name: kubelet-db2-limited-priv
params:
- name: OLM_UTILS_IMAGE
value: '$(params.OLM_UTILS_IMAGE):$(params.VERSION){{- if ne .Values.arch "x86" -}} .{{ .Values.arch }}{{- end }}'
- name: CP-INSTALL-OPTIONS
value: $(params.CP-INSTALL-OPTIONS)
- name: OLM_CMD
value: |-
if [[ $(oc get mcp -o name | wc -l) -gt 0 ]]; then
apply-db2-kubelet
else
echo "No MachineConfig Found ..."
platformSpec=$(oc get Infrastructure/cluster -o jsonpath='{.spec.platformSpec.type}')
- name: kubelet-db2-limited-priv
retries: 10
params:
- name: OLM_UTILS_IMAGE
value: $(params.OLM_UTILS_IMAGE):$(params.VERSION){{- if ne .Values.arch "x86" -}} .{{ .Values.arch }}{{- end }}
- name: CP-INSTALL-OPTIONS
value: $(params.CP-INSTALL-OPTIONS)
- name: OLM_CMD
value: |-
if [[ $(oc get mcp -o name | wc -l) -gt 0 ]]; then
apply-db2-kubelet
else
echo "No MachineConfig Found ..."
platformSpec=$(oc get Infrastructure/cluster -o jsonpath='{.spec.platformSpec.type}')
case $platformSpec in
IBMCloud)
echo "IBMCloud ROKS detected"
apply-db2-kubelet --openshift_type=roks
;;
*)
echo "Can't detect CloudProvider. Don't know how to apply configuration"
;;
esac
fi
retries: 10
taskRef:
kind: Task
name: olm-utils
when:
- input: $(params.DB2_LIMITED_PRIV)
operator: in
values:
- 'true'
- 'yes'
case $platformSpec in
IBMCloud)
echo "\nIBMCloud ROKS detected"
apply-db2-kubelet --openshift_type=roks
echo "* [Applying kubelet config without reboot]"
echo "* Fetching cp4d-kubelet.conf"
oc extract cm/cp4d-kubelet-conf -n kube-system --to=/tmp
echo "* Deploying new kebelet"
for n in `oc get node -o name`; do
oc adm copy-to-node --copy=/tmp/cp4d-kubelet.conf=/etc/kubernetes/kubelet.conf $n
done
echo "* Restarting kubelet"
oc adm restart-kubelet nodes --all --directive=RemoveKubeletKubeconfig
;;
*)
echo "Can't detect CloudProvider. Don't know how to apply configuration"
;;
esac
fi
taskRef:
kind: Task
name: olm-utils
when:
- input: $(params.DB2_LIMITED_PRIV)
operator: in
values:
- "true"
- "yes"
- name: apply-scheduler
params:
- name: OLM_UTILS_IMAGE
Expand Down
38 changes: 30 additions & 8 deletions charts/cpd-install-pipeline/templates/cpd-install-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,20 @@ spec:
case $platformSpec in
IBMCloud)
echo "IBMCloud ROKS detected"
apply-db2-kubelet --openshift_type=roks
echo "\nIBMCloud ROKS detected"
apply-db2-kubelet --openshift_type=roks
echo "* [Applying kubelet config without reboot]"
echo "* Fetching cp4d-kubelet.conf"
oc extract cm/cp4d-kubelet-conf -n kube-system --to=/tmp
echo "* Deploying new kebelet"
for n in `oc get node -o name`; do
oc adm copy-to-node --copy=/tmp/cp4d-kubelet.conf=/etc/kubernetes/kubelet.conf $n
done
echo "* Restarting kubelet"
oc adm restart-kubelet nodes --all --directive=RemoveKubeletKubeconfig
;;
*)
echo "Can't detect CloudProvider. Don't know how to apply configuration"
Expand Down Expand Up @@ -196,16 +208,26 @@ spec:
--entitled_registry_key=$(params.IBM_ENTITLEMENT_KEY)
if [[ $(oc get mcp -o name | wc -l) -eq 0 ]]; then
platformSpec=$(oc get Infrastructure/cluster -o jsonpath='{.spec.platformSpec.type}')
echo
echo "non-MCP cluster detected, activating workaround"
oc debug $(oc get node -o name | head -n1) -- chroot /host cat /.docker/config.json > /tmp/config.json
case $platformSpec in
KubeVirt)
echo "KubeVirt detected, nothing to do"
echo
;;
IBMCloud)
echo "ROKS detected, activating workaround"
echo
oc debug $(oc get node -o name | head -n1) -- chroot /host cat /.docker/config.json > /tmp/config.json
cat /tmp/config.json | jq --arg auth cp:$(params.IBM_ENTITLEMENT_KEY) '.auths += {"cp.icr.io": {"auth": $auth|@base64}}' > /tmp/config.json.new
sleep 1
cat /tmp/config.json | jq --arg auth cp:$(params.IBM_ENTITLEMENT_KEY) '.auths += {"cp.icr.io": {"auth": $auth|@base64}}' > /tmp/config.json.new
sleep 1
for n in `oc get node -o name`; do
oc adm copy-to-node --copy=/tmp/config.json.new=/.docker/config.json $n
done
for n in `oc get node -o name`; do
oc adm copy-to-node --copy=/tmp/config.json.new=/.docker/config.json $n
done
;;
fi
taskRef:
kind: Task
Expand Down

0 comments on commit d30ad80

Please sign in to comment.