From 5384bbb31bfe2c780d89dfa49b072c778203efa7 Mon Sep 17 00:00:00 2001 From: Nahshon Unna Tsameret <60659093+nunnatsa@users.noreply.github.com> Date: Fri, 9 Feb 2024 06:02:24 -0500 Subject: [PATCH] [release 1.10] Fix community CSV (#2804) * Allow running in community hub CI The community hub CI is trying to install HCO at namespace named community-kubevirt-hyperconverged. This is not allowed by the operator code. This PR adds this namespace to the allowed namesapce list. Signed-off-by: Nahshon Unna-Tsameret * Handle the kubevirt-template-validator image in CSV The kubevirt-template-validator was missing in the related-image list in the CSV. Also, it was listed with tag instead of with digest, in the SSP deployment. Signed-off-by: Nahshon Unna-Tsameret * add missing annotations to the csv Signed-off-by: Nahshon Unna-Tsameret * set kvci tag to the last working one, 2401211710-a250111 Signed-off-by: Nahshon Unna-Tsameret --------- Signed-off-by: Nahshon Unna-Tsameret --- cluster/kubevirtci.sh | 2 +- cmd/cmdcommon/cmdcommon.go | 17 ++++++++++++++++- deploy/images.csv | 1 + deploy/images.env | 2 ++ ...-operator.v1.10.7.clusterserviceversion.yaml | 14 +++++++++++++- ...-operator.v1.10.7.clusterserviceversion.yaml | 16 ++++++++++++++-- deploy/operator.yaml | 2 +- hack/build-manifests.sh | 1 + pkg/components/components.go | 16 +++++++++++++--- pkg/util/consts.go | 2 -- .../pkg/util/consts.go | 2 -- tools/csv-merger/csv-merger.go | 2 +- 12 files changed, 63 insertions(+), 14 deletions(-) diff --git a/cluster/kubevirtci.sh b/cluster/kubevirtci.sh index 7bef7dd10b..418805c523 100644 --- a/cluster/kubevirtci.sh +++ b/cluster/kubevirtci.sh @@ -13,7 +13,7 @@ # limitations under the License. export KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER:-'k8s-1.26-centos9'} -export KUBEVIRTCI_TAG=$(curl -L -Ss https://storage.googleapis.com/kubevirt-prow/release/kubevirt/kubevirtci/latest) +export KUBEVIRTCI_TAG=2401211710-a250111 KUBEVIRTCI_PATH="${PWD}/_kubevirtci" KUBEVIRTCI_REPO='https://github.com/kubevirt/kubevirtci.git' diff --git a/cmd/cmdcommon/cmdcommon.go b/cmd/cmdcommon/cmdcommon.go index acaf3e27a9..725a84e34f 100644 --- a/cmd/cmdcommon/cmdcommon.go +++ b/cmd/cmdcommon/cmdcommon.go @@ -20,6 +20,14 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log/zap" ) +// list of namespace allowed for HCO installations (for tests) +const ( + operatorTestNamespace = "test-operators" + operatorHubNamespace = "operators" + communityHubNamespace = "community-kubevirt-hyperconverged" + communityHubTargetNamespace = "community-kubevirt-hyperconverged-target" +) + type HcCmdHelper struct { Logger logr.Logger runInLocal bool @@ -139,7 +147,14 @@ func (h HcCmdHelper) checkNameSpace() { // Allowing the operator to be deployed in OperatorTestNamespace, in addition to OPERATOR_NAMESPACE env var, // to unblock its publish in OperatorHub.io - nsAllowList := []string{requiredNS, hcoutil.OperatorTestNamespace, hcoutil.OperatorHubNamespace} + nsAllowList := []string{ + requiredNS, + operatorTestNamespace, + operatorHubNamespace, + communityHubNamespace, + communityHubTargetNamespace, + } + if !StringInSlice(actualNS, nsAllowList) { err := fmt.Errorf("%s is running in different namespace than expected", h.Name) msg := fmt.Sprintf("Please re-deploy this %s into %v namespace", h.Name, requiredNS) diff --git a/deploy/images.csv b/deploy/images.csv index da86923954..b9248e1619 100644 --- a/deploy/images.csv +++ b/deploy/images.csv @@ -10,6 +10,7 @@ KUBEVIRT_EXPORTPROXY_IMAGE,quay.io/kubevirt/virt-exportproxy,KUBEVIRT_VERSION,f1 KUBEVIRT_EXPORSERVER_IMAGE,quay.io/kubevirt/virt-exportserver,KUBEVIRT_VERSION,73311f79a9c71007f8572b3cc40cd6f6da404c7ef0a9c6509fb717d979546582 CNA_OPERATOR_IMAGE,quay.io/kubevirt/cluster-network-addons-operator,NETWORK_ADDONS_VERSION,f64ab5981d9ddef1662dd0a05888783f5dbadda8ede596585ba80bfc97a0f51e SSP_OPERATOR_IMAGE,quay.io/kubevirt/ssp-operator,SSP_VERSION,49cac00844f091d6e80301573e00235d685415185ec29c89b4bd7361f938711e +SSP_VALIDATOR_IMAGE,quay.io/kubevirt/kubevirt-template-validator,SSP_VERSION,a148b6e812b70f326b48d0439b1e44a967a6e1f8cf2f98b1a08e9294a93674eb CDI_OPERATOR_IMAGE,quay.io/kubevirt/cdi-operator,CDI_VERSION,6c63521d835578b0fbb77d3145b648f95ab0932d5d1b36ff2068ed8fcd91bc5a CDI_CONTROLLER_IMAGE,quay.io/kubevirt/cdi-controller,CDI_VERSION,27c47883a08226f83757971d3adafb0cd9bcb26e58fbcf7208236070e0adf37e CDI_APISERVER_IMAGE,quay.io/kubevirt/cdi-apiserver,CDI_VERSION,e9e39408413b1478d2e98eba68913f9e20c93000558b190b47de73bdfd1d9ac4 diff --git a/deploy/images.env b/deploy/images.env index e5496928e1..24a753c26d 100755 --- a/deploy/images.env +++ b/deploy/images.env @@ -9,6 +9,7 @@ KUBEVIRT_EXPORTPROXY_IMAGE=quay.io/kubevirt/virt-exportproxy@sha256:f14444b0200a KUBEVIRT_EXPORSERVER_IMAGE=quay.io/kubevirt/virt-exportserver@sha256:73311f79a9c71007f8572b3cc40cd6f6da404c7ef0a9c6509fb717d979546582 CNA_OPERATOR_IMAGE=quay.io/kubevirt/cluster-network-addons-operator@sha256:f64ab5981d9ddef1662dd0a05888783f5dbadda8ede596585ba80bfc97a0f51e SSP_OPERATOR_IMAGE=quay.io/kubevirt/ssp-operator@sha256:49cac00844f091d6e80301573e00235d685415185ec29c89b4bd7361f938711e +SSP_VALIDATOR_IMAGE=quay.io/kubevirt/kubevirt-template-validator@sha256:a148b6e812b70f326b48d0439b1e44a967a6e1f8cf2f98b1a08e9294a93674eb CDI_OPERATOR_IMAGE=quay.io/kubevirt/cdi-operator@sha256:6c63521d835578b0fbb77d3145b648f95ab0932d5d1b36ff2068ed8fcd91bc5a CDI_CONTROLLER_IMAGE=quay.io/kubevirt/cdi-controller@sha256:27c47883a08226f83757971d3adafb0cd9bcb26e58fbcf7208236070e0adf37e CDI_APISERVER_IMAGE=quay.io/kubevirt/cdi-apiserver@sha256:e9e39408413b1478d2e98eba68913f9e20c93000558b190b47de73bdfd1d9ac4 @@ -40,6 +41,7 @@ DIGEST_LIST="${DIGEST_LIST},quay.io/kubevirt/virt-exportproxy@sha256:f14444b0200 DIGEST_LIST="${DIGEST_LIST},quay.io/kubevirt/virt-exportserver@sha256:73311f79a9c71007f8572b3cc40cd6f6da404c7ef0a9c6509fb717d979546582" DIGEST_LIST="${DIGEST_LIST},quay.io/kubevirt/cluster-network-addons-operator@sha256:f64ab5981d9ddef1662dd0a05888783f5dbadda8ede596585ba80bfc97a0f51e" DIGEST_LIST="${DIGEST_LIST},quay.io/kubevirt/ssp-operator@sha256:49cac00844f091d6e80301573e00235d685415185ec29c89b4bd7361f938711e" +DIGEST_LIST="${DIGEST_LIST},quay.io/kubevirt/kubevirt-template-validator@sha256:a148b6e812b70f326b48d0439b1e44a967a6e1f8cf2f98b1a08e9294a93674eb" DIGEST_LIST="${DIGEST_LIST},quay.io/kubevirt/cdi-operator@sha256:6c63521d835578b0fbb77d3145b648f95ab0932d5d1b36ff2068ed8fcd91bc5a" DIGEST_LIST="${DIGEST_LIST},quay.io/kubevirt/cdi-controller@sha256:27c47883a08226f83757971d3adafb0cd9bcb26e58fbcf7208236070e0adf37e" DIGEST_LIST="${DIGEST_LIST},quay.io/kubevirt/cdi-apiserver@sha256:e9e39408413b1478d2e98eba68913f9e20c93000558b190b47de73bdfd1d9ac4" diff --git a/deploy/index-image/community-kubevirt-hyperconverged/1.10.7/manifests/kubevirt-hyperconverged-operator.v1.10.7.clusterserviceversion.yaml b/deploy/index-image/community-kubevirt-hyperconverged/1.10.7/manifests/kubevirt-hyperconverged-operator.v1.10.7.clusterserviceversion.yaml index 486942e0f7..d1f0ff761e 100644 --- a/deploy/index-image/community-kubevirt-hyperconverged/1.10.7/manifests/kubevirt-hyperconverged-operator.v1.10.7.clusterserviceversion.yaml +++ b/deploy/index-image/community-kubevirt-hyperconverged/1.10.7/manifests/kubevirt-hyperconverged-operator.v1.10.7.clusterserviceversion.yaml @@ -12,6 +12,16 @@ metadata: createdAt: "2020-10-23 08:58:25" description: A unified operator deploying and controlling KubeVirt and its supporting operators with opinionated defaults + features.operators.openshift.io/cnf: "false" + features.operators.openshift.io/cni: "true" + features.operators.openshift.io/csi: "true" + features.operators.openshift.io/disconnected: "true" + features.operators.openshift.io/fips-compliant: "false" + features.operators.openshift.io/proxy-aware: "true" + features.operators.openshift.io/tls-profiles: "true" + features.operators.openshift.io/token-auth-aws: "false" + features.operators.openshift.io/token-auth-azure: "false" + features.operators.openshift.io/token-auth-gcp: "false" operatorframework.io/initialization-resource: '{"apiVersion":"hco.kubevirt.io/v1beta1","kind":"HyperConverged","metadata":{"annotations":{"deployOVS":"false"},"name":"kubevirt-hyperconverged","namespace":"kubevirt-hyperconverged"},"spec":{}}' operatorframework.io/suggested-namespace: kubevirt-hyperconverged operators.openshift.io/infrastructure-features: '["disconnected","proxy-aware"]' @@ -3491,7 +3501,7 @@ spec: - /manager env: - name: VALIDATOR_IMAGE - value: quay.io/kubevirt/kubevirt-template-validator:v0.18.3 + value: quay.io/kubevirt/kubevirt-template-validator@sha256:a148b6e812b70f326b48d0439b1e44a967a6e1f8cf2f98b1a08e9294a93674eb - name: VIRTIO_IMG - name: OPERATOR_VERSION value: v0.18.3 @@ -4342,6 +4352,8 @@ spec: name: kubevirt-apiserver-proxy - image: quay.io/kubevirt-ui/kubevirt-plugin@sha256:e79027973b09aac75860f267c7d7f830599978c38a081001f404b9a1c3d2990f name: kubevirt-plugin + - image: quay.io/kubevirt/kubevirt-template-validator@sha256:a148b6e812b70f326b48d0439b1e44a967a6e1f8cf2f98b1a08e9294a93674eb + name: kubevirt-template-validator - image: quay.io/kubevirt/libguestfs-tools@sha256:b7e248be783691daad1326cf41641d5042be80c5c057ebc5315ca7a1619b0581 name: libguestfs-tools - image: registry.k8s.io/sig-storage/livenessprobe@sha256:4dc0b87ccd69f9865b89234d8555d3a614ab0a16ed94a3016ffd27f8106132ce diff --git a/deploy/olm-catalog/community-kubevirt-hyperconverged/1.10.7/manifests/kubevirt-hyperconverged-operator.v1.10.7.clusterserviceversion.yaml b/deploy/olm-catalog/community-kubevirt-hyperconverged/1.10.7/manifests/kubevirt-hyperconverged-operator.v1.10.7.clusterserviceversion.yaml index 0cd0b56f43..31e50731d0 100644 --- a/deploy/olm-catalog/community-kubevirt-hyperconverged/1.10.7/manifests/kubevirt-hyperconverged-operator.v1.10.7.clusterserviceversion.yaml +++ b/deploy/olm-catalog/community-kubevirt-hyperconverged/1.10.7/manifests/kubevirt-hyperconverged-operator.v1.10.7.clusterserviceversion.yaml @@ -9,9 +9,19 @@ metadata: certified: "false" console.openshift.io/disable-operand-delete: "true" containerImage: quay.io/kubevirt/hyperconverged-cluster-operator:1.10.7-unstable - createdAt: "2024-01-28 07:58:00" + createdAt: "2024-02-08 15:51:32" description: A unified operator deploying and controlling KubeVirt and its supporting operators with opinionated defaults + features.operators.openshift.io/cnf: "false" + features.operators.openshift.io/cni: "true" + features.operators.openshift.io/csi: "true" + features.operators.openshift.io/disconnected: "true" + features.operators.openshift.io/fips-compliant: "false" + features.operators.openshift.io/proxy-aware: "true" + features.operators.openshift.io/tls-profiles: "true" + features.operators.openshift.io/token-auth-aws: "false" + features.operators.openshift.io/token-auth-azure: "false" + features.operators.openshift.io/token-auth-gcp: "false" operatorframework.io/initialization-resource: '{"apiVersion":"hco.kubevirt.io/v1beta1","kind":"HyperConverged","metadata":{"annotations":{"deployOVS":"false"},"name":"kubevirt-hyperconverged","namespace":"kubevirt-hyperconverged"},"spec":{}}' operatorframework.io/suggested-namespace: kubevirt-hyperconverged operators.openshift.io/infrastructure-features: '["disconnected","proxy-aware"]' @@ -3491,7 +3501,7 @@ spec: - /manager env: - name: VALIDATOR_IMAGE - value: quay.io/kubevirt/kubevirt-template-validator:v0.18.3 + value: quay.io/kubevirt/kubevirt-template-validator@sha256:a148b6e812b70f326b48d0439b1e44a967a6e1f8cf2f98b1a08e9294a93674eb - name: VIRTIO_IMG - name: OPERATOR_VERSION value: v0.18.3 @@ -4342,6 +4352,8 @@ spec: name: kubevirt-apiserver-proxy - image: quay.io/kubevirt-ui/kubevirt-plugin@sha256:e79027973b09aac75860f267c7d7f830599978c38a081001f404b9a1c3d2990f name: kubevirt-plugin + - image: quay.io/kubevirt/kubevirt-template-validator@sha256:a148b6e812b70f326b48d0439b1e44a967a6e1f8cf2f98b1a08e9294a93674eb + name: kubevirt-template-validator - image: quay.io/kubevirt/libguestfs-tools@sha256:b7e248be783691daad1326cf41641d5042be80c5c057ebc5315ca7a1619b0581 name: libguestfs-tools - image: registry.k8s.io/sig-storage/livenessprobe@sha256:4dc0b87ccd69f9865b89234d8555d3a614ab0a16ed94a3016ffd27f8106132ce diff --git a/deploy/operator.yaml b/deploy/operator.yaml index 56d5a230a6..926fb8ea38 100644 --- a/deploy/operator.yaml +++ b/deploy/operator.yaml @@ -510,7 +510,7 @@ spec: - /manager env: - name: VALIDATOR_IMAGE - value: quay.io/kubevirt/kubevirt-template-validator:v0.18.3 + value: quay.io/kubevirt/kubevirt-template-validator@sha256:a148b6e812b70f326b48d0439b1e44a967a6e1f8cf2f98b1a08e9294a93674eb - name: VIRTIO_IMG - name: OPERATOR_VERSION value: v0.18.3 diff --git a/hack/build-manifests.sh b/hack/build-manifests.sh index 8309c80872..1330ed6062 100755 --- a/hack/build-manifests.sh +++ b/hack/build-manifests.sh @@ -147,6 +147,7 @@ function create_ssp_csv() { --csv-version=${CSV_VERSION} \ --operator-image=${SSP_OPERATOR_IMAGE} \ --operator-version=${SSP_VERSION} \ + --validator-image=${SSP_VALIDATOR_IMAGE} \ " gen_csv ${SSP_CSV_GENERATOR} ${operatorName} "${SSP_OPERATOR_IMAGE}" ${dumpCRDsArg} ${operatorArgs} diff --git a/pkg/components/components.go b/pkg/components/components.go index d5fb3483ac..c584149d71 100644 --- a/pkg/components/components.go +++ b/pkg/components/components.go @@ -860,9 +860,19 @@ func GetCSVBase(params *CSVBaseParams) *csvv1alpha1.ClusterServiceVersion { "description": params.MetaDescription, "repository": "https://github.com/kubevirt/hyperconverged-cluster-operator", "support": "false", - "operatorframework.io/suggested-namespace": params.Namespace, - "operators.openshift.io/infrastructure-features": `["disconnected","proxy-aware"]`, - "operatorframework.io/initialization-resource": string(almExamples), + "operatorframework.io/suggested-namespace": params.Namespace, + "operators.openshift.io/infrastructure-features": `["disconnected","proxy-aware"]`, + "operatorframework.io/initialization-resource": string(almExamples), + "features.operators.openshift.io/disconnected": "true", + "features.operators.openshift.io/fips-compliant": "false", + "features.operators.openshift.io/proxy-aware": "true", + "features.operators.openshift.io/cnf": "false", + "features.operators.openshift.io/cni": "true", + "features.operators.openshift.io/csi": "true", + "features.operators.openshift.io/tls-profiles": "true", + "features.operators.openshift.io/token-auth-aws": "false", + "features.operators.openshift.io/token-auth-azure": "false", + "features.operators.openshift.io/token-auth-gcp": "false", }, }, Spec: csvv1alpha1.ClusterServiceVersionSpec{ diff --git a/pkg/util/consts.go b/pkg/util/consts.go index 6ab2abc187..cc9093827d 100644 --- a/pkg/util/consts.go +++ b/pkg/util/consts.go @@ -24,8 +24,6 @@ const ( AppLabel = "app" UndefinedNamespace = "" OpenshiftNamespace = "openshift" - OperatorTestNamespace = "test-operators" - OperatorHubNamespace = "operators" APIVersionAlpha = "v1alpha1" APIVersionBeta = "v1beta1" CurrentAPIVersion = APIVersionBeta diff --git a/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/pkg/util/consts.go b/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/pkg/util/consts.go index 6ab2abc187..cc9093827d 100644 --- a/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/pkg/util/consts.go +++ b/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/pkg/util/consts.go @@ -24,8 +24,6 @@ const ( AppLabel = "app" UndefinedNamespace = "" OpenshiftNamespace = "openshift" - OperatorTestNamespace = "test-operators" - OperatorHubNamespace = "operators" APIVersionAlpha = "v1alpha1" APIVersionBeta = "v1beta1" CurrentAPIVersion = APIVersionBeta diff --git a/tools/csv-merger/csv-merger.go b/tools/csv-merger/csv-merger.go index 4ba44f32cc..331d5452c4 100644 --- a/tools/csv-merger/csv-merger.go +++ b/tools/csv-merger/csv-merger.go @@ -589,7 +589,7 @@ func appendOnce(slice []string, item string) []string { func appendRelatedImageIfMissing(slice []csvv1alpha1.RelatedImage, ri csvv1alpha1.RelatedImage) []csvv1alpha1.RelatedImage { for _, ele := range slice { - if ele.Name == ri.Name { + if ele.Image == ri.Image { return slice } }