Skip to content

Commit

Permalink
Merge pull request #2251 from openshift-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…2231-to-release-4.12

[release-4.12] fix(cpo): Delete multus validatingwebhookconfiguration on CNO init
  • Loading branch information
openshift-merge-robot committed Mar 6, 2023
2 parents 9cc10e0 + b6852f1 commit 48221da
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,30 @@ kubectl --kubeconfig $kc config use-context default`,
},
}

if semver.MustParse(params.ReleaseVersion).Minor == uint64(12) {
dep.Spec.Template.Spec.InitContainers = append(dep.Spec.Template.Spec.InitContainers, corev1.Container{
Command: []string{"/bin/bash"},
Args: []string{
"-c",
`
set -xeuo pipefail
kc=/etc/hosted-kubernetes/kubeconfig
sc=$(kubectl --kubeconfig $kc get --ignore-not-found validatingwebhookconfiguration multus.openshift.io -o jsonpath='{.webhooks[?(@.name == "multus-validating-config.k8s.io")].clientConfig.service}')
if [[ -n $sc ]]; then kubectl --kubeconfig $kc delete --ignore-not-found validatingwebhookconfiguration multus.openshift.io; fi`,
},
Name: "remove-old-multus-validating-webhook-configuration",
Image: params.Images.CLI,
Resources: corev1.ResourceRequirements{Requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("10m"),
corev1.ResourceMemory: resource.MustParse("50Mi"),
}},
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError,
VolumeMounts: []corev1.VolumeMount{
{Name: "hosted-etc-kube", MountPath: "/etc/hosted-kubernetes"},
},
})
}

dep.Spec.Template.Spec.ServiceAccountName = manifests.ClusterNetworkOperatorServiceAccount("").Name
dep.Spec.Template.Spec.Containers = []corev1.Container{{
Command: []string{"/usr/bin/cluster-network-operator"},
Expand Down

0 comments on commit 48221da

Please sign in to comment.