Skip to content

Commit

Permalink
Properly exclude quay.io/coreos/etcd for Cilium >=v1.15
Browse files Browse the repository at this point in the history
afcb36d didn't quite work because it missed a couple of places that
referenced clustermeshEtcdImage. Use the same pattern as f2f792f to
conditionally include quay.io/coreos/etcd in the related image list
depending on Cilium version.

Fixes: afcb36d ("Exclude quay.io/coreos/etcd for Cilium >=v1.15")
Signed-off-by: Michi Mutsuzaki <michi@isovalent.com>
  • Loading branch information
michi-covalent committed Feb 20, 2024
1 parent 1419a06 commit 187b84e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
18 changes: 9 additions & 9 deletions config/operator/olm.cue
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ _related_images: [
}
]

// quay.io/coreos/etcd is not included in Cilium >= 1.15 Helm charts.
// Ref: https://github.com/cilium/cilium/blob/v1.15.1/install/kubernetes/cilium/values.yaml
if strings.HasPrefix(parameters.ciliumVersion, "1.12") || strings.HasPrefix(parameters.ciliumVersion, "1.13") || strings.HasPrefix(parameters.ciliumVersion, "1.14") {
_related_images: _related_images + [{
name: "clustermesh-etcd"
image: parameters.clustermeshEtcdImage
}]
}
_extra_related_images: [
if parameters.clustermeshEtcdImage != "nothing" {
{
name: "clustermesh-etcd"
image: parameters.clustermeshEtcdImage
},
},
]

#CSVWorkloadTemplate: {
apiVersion: "operators.coreos.com/v1alpha1"
Expand All @@ -195,7 +195,7 @@ if strings.HasPrefix(parameters.ciliumVersion, "1.12") || strings.HasPrefix(para
if parameters.replaces != "nothing" {
replaces: parameters.replaces
}
relatedImages: _related_images
relatedImages: _related_images + _extra_related_images
apiservicedefinitions: {}
customresourcedefinitions: owned: [{
name: "ciliumconfigs.cilium.io"
Expand Down
15 changes: 10 additions & 5 deletions config/operator/operator.cue
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,17 @@ _related_images_env_vars: [{
{
name: "RELATED_IMAGE_NODEINIT"
value: parameters.nodeInitImage
},
{
name: "RELATED_IMAGE_CLUSTERMESH_ETCD"
value: parameters.clustermeshEtcdImage
}]

_extra_related_images_env_vars: [
if parameters.clustermeshEtcdImage != "nothing" {
{
name: "RELATED_IMAGE_CLUSTERMESH_ETCD"
value: parameters.clustermeshEtcdImage
},
},
]

_workloadSpec: {
template: {
metadata: labels: _commonMetadata.labels
Expand All @@ -86,7 +91,7 @@ _workloadSpec: {
env: [{
name: "WATCH_NAMESPACE"
valueFrom: fieldRef: fieldPath: "metadata.namespace"
}] + _related_images_env_vars
}] + _related_images_env_vars + _extra_related_images_env_vars
volumeMounts: [{
name: "tmp"
mountPath: "/tmp"
Expand Down
11 changes: 8 additions & 3 deletions scripts/generate-configs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ hubble_ui_be_image="$(get_image "$(yq e '.hubble.ui.backend.image.repository' "$
hubble_ui_fe_image="$(get_image "$(yq e '.hubble.ui.frontend.image.repository' "$values_file")" "$(yq e '.hubble.ui.frontend.image.tag' "$values_file")")"
etcd_operator_image="$(get_image "$(yq e '.etcd.image.repository' "$values_file")" "$(yq e '.etcd.image.tag' "$values_file")")"
nodeinit_image="$(get_image "$(yq e '.nodeinit.image.repository' "$values_file")" "$(yq e '.nodeinit.image.tag' "$values_file")")"
clustermesh_etcd_image="$(get_image "$(yq e '.clustermesh.apiserver.etcd.image.repository' "$values_file")" "$(yq e '.clustermesh.apiserver.etcd.image.tag' "$values_file")")"
# quay.io/coreos/etcd is not included in Cilium >= 1.15 Helm charts.
# Ref: https://github.com/cilium/cilium/blob/v1.15.1/install/kubernetes/cilium/values.yaml
cilium_minor_number=$(cut -d '.' -f 2 <<< "$cilium_version")
if [[ $cilium_minor_number -lt 15 ]]; then
clustermesh_etcd_image="$(get_image "$(yq e '.clustermesh.apiserver.etcd.image.repository' "$values_file")" "$(yq e '.clustermesh.apiserver.etcd.image.tag' "$values_file")")"
fi

cilium_major_minor="$(echo "${cilium_version}" | cut -d . -f -2)"
# to not make 1.13.0 as previous release cause failure
Expand Down Expand Up @@ -99,7 +104,7 @@ instances: [
hubbleUIFrontendImage: "${hubble_ui_fe_image}"
etcdOperatorImage: "${etcd_operator_image}"
nodeInitImage: "${nodeinit_image}"
clustermeshEtcdImage: "${clustermesh_etcd_image}"
clustermeshEtcdImage: "${clustermesh_etcd_image:-nothing}"
}
},
{
Expand All @@ -123,7 +128,7 @@ instances: [
hubbleUIFrontendImage: "${hubble_ui_fe_image}"
etcdOperatorImage: "${etcd_operator_image}"
nodeInitImage: "${nodeinit_image}"
clustermeshEtcdImage: "${clustermesh_etcd_image}"
clustermeshEtcdImage: "${clustermesh_etcd_image:-nothing}"
}
},
]
Expand Down

0 comments on commit 187b84e

Please sign in to comment.