diff --git a/.github/workflows/build-openstack-operator.yaml b/.github/workflows/build-openstack-operator.yaml index a6e1b7ee6..5c4d0f15d 100644 --- a/.github/workflows/build-openstack-operator.yaml +++ b/.github/workflows/build-openstack-operator.yaml @@ -17,7 +17,7 @@ jobs: operator_name: openstack go_version: 1.20.x operator_sdk_version: 1.31.0 - bundle_dockerfile: ./custom-bundle.Dockerfile + bundle_dockerfile: ./bundle.Dockerfile catalog_extra_bundles_script: ./hack/pin-bundle-images.sh secrets: IMAGENAMESPACE: ${{ secrets.IMAGENAMESPACE }} diff --git a/.prow_ci.env b/.prow_ci.env index 564ca8958..48fc5e272 100644 --- a/.prow_ci.env +++ b/.prow_ci.env @@ -1,3 +1,3 @@ export USE_IMAGE_DIGESTS=true -export BUNDLE_DOCKERFILE=custom-bundle.Dockerfile +export BUNDLE_DOCKERFILE=bundle.Dockerfile export FAIL_FIPS_CHECK=true diff --git a/Makefile b/Makefile index 473e59d6d..b596d9e28 100644 --- a/Makefile +++ b/Makefile @@ -189,7 +189,6 @@ cover: test ## Run tests and display functional test coverage .PHONY: build build: generate fmt vet ## Build manager binary. go build -o bin/manager main.go - go build -o bin/csv-merger cmd/csv-merger/csv-merger.go .PHONY: run run: export METRICS_PORT?=8080 @@ -330,7 +329,7 @@ endif endif .PHONY: bundle -bundle: build manifests kustomize bundle-cache-extra-data operator-sdk ## Generate bundle manifests and metadata, then validate generated files. +bundle: build manifests kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files. $(OPERATOR_SDK) generate kustomize manifests -q cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG) $(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS) @@ -339,7 +338,7 @@ bundle: build manifests kustomize bundle-cache-extra-data operator-sdk ## Genera .PHONY: bundle-build bundle-build: bundle ## Build the bundle image. - podman build -f custom-bundle.Dockerfile -t $(BUNDLE_IMG) . + podman build -f bundle.Dockerfile -t $(BUNDLE_IMG) . .PHONY: bundle-push bundle-push: ## Push the bundle image. @@ -469,10 +468,3 @@ run-with-webhook: manifests generate fmt vet ## Run a controller from your host. .PHONY: webhook-cleanup webhook-cleanup: /bin/bash hack/clean_local_webhook.sh - -# refresh the bundle extra data based on go.mod entries -# bundle extra data includes: -# - extracted ENV vars from all operators (required for webhooks) -.PHONY: bundle-cache-extra-data -bundle-cache-extra-data: build - bash hack/bundle-cache-data.sh diff --git a/README.md b/README.md index 2be7b0932..ad00113bd 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ bundle. make dep-bundle-build-push ``` -3. Run bundle-build. This will execute podman to build the custom-bundle.Dockerfile. +3. Run bundle-build. This will execute podman to build the bundle.Dockerfile. ```sh make bundle-build diff --git a/cmd/csv-merger/csv-merger.go b/cmd/csv-merger/csv-merger.go deleted file mode 100644 index c0eb6d41f..000000000 --- a/cmd/csv-merger/csv-merger.go +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright 2022 Red Hat, Inc. - * - */ - -package main - -import ( - "encoding/json" - "flag" - "os" - "runtime/debug" - "strings" - - "github.com/ghodss/yaml" - "github.com/imdario/mergo" - "github.com/openstack-k8s-operators/openstack-operator/pkg/util" - - semver "github.com/blang/semver/v4" - "github.com/operator-framework/api/pkg/lib/version" - csvv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1" - - v1 "k8s.io/api/core/v1" -) - -func getEnvsFromFile(filename string) []v1.EnvVar { - csvBytes, err := os.ReadFile(filename) - if err != nil { - exitWithError(err.Error()) - } - envVarList := &[]v1.EnvVar{} - - err = yaml.Unmarshal(csvBytes, envVarList) - if err != nil { - exitWithError(err.Error()) - } - return *envVarList -} - -func writeEnvToYaml(filename string, data interface{}) { - yamlBytes, err := yaml.Marshal(data) - if err != nil { - exitWithError(err.Error()) - } - - file, err := os.Create(filename) - if err != nil { - exitWithError(err.Error()) - } - defer file.Close() - _, err = file.Write(yamlBytes) - if err != nil { - exitWithError(err.Error()) - } -} - -func exitWithError(msg string) { - os.Stderr.WriteString(msg) - debug.PrintStack() - os.Exit(1) -} - -var ( - baseCsv = flag.String("base-csv", "", "Base CSV filename") - keystoneCsv = flag.String("keystone-csv", "", "Keystone CSV filename") - mariadbCsv = flag.String("mariadb-csv", "", "Mariadb CSV filename") - rabbitmqCsv = flag.String("rabbitmq-csv", "", "RabbitMQ CSV filename") - infraCsv = flag.String("infra-csv", "", "Infra CSV filename") - ansibleEECsv = flag.String("ansibleee-csv", "", "Ansible EE CSV filename") - novaCsv = flag.String("nova-csv", "", "Nova CSV filename") - heatCsv = flag.String("heat-csv", "", "Heat CSV filename") - neutronCsv = flag.String("neutron-csv", "", "Neutron CSV filename") - glanceCsv = flag.String("glance-csv", "", "Glance CSV filename") - ironicCsv = flag.String("ironic-csv", "", "Ironic CSV filename") - baremetalCsv = flag.String("baremetal-csv", "", "Baremetal CSV filename") - manilaCsv = flag.String("manila-csv", "", "Manila CSV filename") - placementCsv = flag.String("placement-csv", "", "Placement CSV filename") - telemetryCsv = flag.String("telemetry-csv", "", "Telemetry CSV filename") - ovnCsv = flag.String("ovn-csv", "", "OVN CSV filename") - cinderCsv = flag.String("cinder-csv", "", "Cinder CSV filename") - horizonCsv = flag.String("horizon-csv", "", "Horizon CSV filename") - swiftCsv = flag.String("swift-csv", "", "Swift CSV filename") - octaviaCsv = flag.String("octavia-csv", "", "Octavia CSV filename") - designateCsv = flag.String("designate-csv", "", "Designate CSV filename") - barbicanCsv = flag.String("barbican-csv", "", "Barbican CSV filename") - testCsv = flag.String("test-csv", "", "Test Operator CSV filename") - csvOverrides = flag.String("csv-overrides", "", "CSV like string with punctual changes that will be recursively applied (if possible)") - importEnvFiles = flag.String("import-env-files", "", "Comma separated list of file names to read default operator ENVs from. Used for inter-bundle ENV merging.") - exportEnvFile = flag.String("export-env-file", "", "Name the external file to write operator ENVs to. Used for inter-bundle ENV merging.") - almExamples = flag.Bool("alm-examples", false, "Merge almExamples into the CSV") - visibleCRDList = flag.String("visible-crds-list", "openstackversions.core.openstack.org,openstackcontrolplanes.core.openstack.org,openstackdataplanenodesets.dataplane.openstack.org,openstackdataplanedeployments.dataplane.openstack.org", - "Comma separated list of all the CRDs that should be visible in OLM console") -) - -func getCSVBase(filename string) *csvv1alpha1.ClusterServiceVersion { - csvBytes, err := os.ReadFile(filename) - if err != nil { - exitWithError(err.Error()) - } - csvStruct := &csvv1alpha1.ClusterServiceVersion{} - - err = yaml.Unmarshal(csvBytes, csvStruct) - if err != nil { - exitWithError(err.Error()) - } - return csvStruct -} - -func main() { - flag.Parse() - - csvs := []string{ - *keystoneCsv, - *mariadbCsv, - *rabbitmqCsv, - *infraCsv, - *ansibleEECsv, - *novaCsv, - *neutronCsv, - *manilaCsv, - *glanceCsv, - *ironicCsv, - *baremetalCsv, - *placementCsv, - *telemetryCsv, - *ovnCsv, - *cinderCsv, - *horizonCsv, - *heatCsv, - *swiftCsv, - *octaviaCsv, - *designateCsv, - *barbicanCsv, - *testCsv, - } - - csvVersion := os.Getenv("CSV_VERSION") - - // BaseCSV is built on the bundle/manifests/openstack-operator.clusterserviceversion.yaml from this repo - csvBase := getCSVBase(*baseCsv) - csvNew := csvv1alpha1.ClusterServiceVersion{ - TypeMeta: csvBase.TypeMeta, - ObjectMeta: csvBase.ObjectMeta, - Spec: csvBase.Spec, - Status: csvBase.Status} - - installStrategyBase := csvBase.Spec.InstallStrategy.StrategySpec - csvNew.Spec.RelatedImages = csvBase.Spec.RelatedImages - - envVarList := []v1.EnvVar{} - if len(*importEnvFiles) > 0 { - for _, filename := range strings.Split(*importEnvFiles, ",") { - envVarList = append(envVarList, getEnvsFromFile(filename)...) - } - } - for _, csvFile := range csvs { - if csvFile != "" { - csvBytes, err := os.ReadFile(csvFile) - if err != nil { - exitWithError(err.Error()) - } - - csvStruct := &csvv1alpha1.ClusterServiceVersion{} - - err = yaml.Unmarshal(csvBytes, csvStruct) - if err != nil { - exitWithError(err.Error()) - } - - // 1. We need to add the "env" section from the operator deployment in case there - // are default values configured. - for _, container := range csvStruct.Spec.InstallStrategy.StrategySpec.DeploymentSpecs[0].Spec.Template.Spec.Containers { - // Copy env vars from the Service Operator into the OpenStack Operator - if container.Name == "manager" { - envVarList = append(envVarList, container.Env...) - } - } - - installStrategyBase.DeploymentSpecs = append(installStrategyBase.DeploymentSpecs, csvStruct.Spec.InstallStrategy.StrategySpec.DeploymentSpecs...) - installStrategyBase.ClusterPermissions = append(installStrategyBase.ClusterPermissions, csvStruct.Spec.InstallStrategy.StrategySpec.ClusterPermissions...) - installStrategyBase.Permissions = append(installStrategyBase.Permissions, csvStruct.Spec.InstallStrategy.StrategySpec.Permissions...) - csvNew.Spec.RelatedImages = append(csvNew.Spec.RelatedImages, csvStruct.Spec.RelatedImages...) - - for _, owned := range csvStruct.Spec.CustomResourceDefinitions.Owned { - csvNew.Spec.CustomResourceDefinitions.Owned = append( - csvNew.Spec.CustomResourceDefinitions.Owned, - csvv1alpha1.CRDDescription{ - Name: owned.Name, - Version: owned.Version, - Kind: owned.Kind, - Description: owned.Description, - DisplayName: owned.DisplayName, - }, - ) - } - - if *almExamples { - csvBaseAlmString := csvNew.Annotations["alm-examples"] - csvStructAlmString := csvStruct.Annotations["alm-examples"] - var baseAlmCrs []interface{} - var structAlmCrs []interface{} - if err = json.Unmarshal([]byte(csvBaseAlmString), &baseAlmCrs); err != nil { - print(csvBaseAlmString) - exitWithError(err.Error()) - } - if err = json.Unmarshal([]byte(csvStructAlmString), &structAlmCrs); err == nil { - //panic(err) - baseAlmCrs = append(baseAlmCrs, structAlmCrs...) - } - almB, err := json.Marshal(baseAlmCrs) - if err != nil { - exitWithError(err.Error()) - } - csvNew.Annotations["alm-examples"] = string(almB) - } - csvNew.Spec.WebhookDefinitions = append(csvNew.Spec.WebhookDefinitions, csvStruct.Spec.WebhookDefinitions...) - } - - } - if len(*exportEnvFile) > 0 { - writeEnvToYaml(*exportEnvFile, envVarList) - } else { - installStrategyBase.DeploymentSpecs[0].Spec.Template.Spec.Containers[1].Env = append( - // OpenStack Operator controller-manager container env vars - installStrategyBase.DeploymentSpecs[0].Spec.Template.Spec.Containers[1].Env, - // Service Operator controller-manager container env vars - envVarList..., - ) - } - - // by default we hide all CRDs in the Console - hiddenCrds := []string{} - visibleCrds := strings.Split(*visibleCRDList, ",") - for _, owned := range csvNew.Spec.CustomResourceDefinitions.Owned { - found := false - for _, name := range visibleCrds { - if owned.Name == name { - found = true - } - } - if !found { - hiddenCrds = append( - hiddenCrds, - owned.Name, - ) - } - } - hiddenCrdsJ, err := json.Marshal(hiddenCrds) - if err != nil { - exitWithError(err.Error()) - } - csvNew.Annotations["operators.operatorframework.io/internal-objects"] = string(hiddenCrdsJ) - - csvNew.Spec.InstallStrategy.StrategyName = "deployment" - csvNew.Spec.InstallStrategy = csvv1alpha1.NamedInstallStrategy{ - StrategyName: "deployment", - StrategySpec: installStrategyBase, - } - - if csvVersion != "" { - csvNew.Spec.Version = version.OperatorVersion{ - Version: semver.MustParse(csvVersion), - } - csvNew.Name = strings.Replace(csvNew.Name, "0.0.1", csvVersion, 1) - } - - if *csvOverrides != "" { - csvOBytes := []byte(*csvOverrides) - - csvO := &csvv1alpha1.ClusterServiceVersion{} - - err := yaml.Unmarshal(csvOBytes, csvO) - if err != nil { - exitWithError(err.Error()) - } - - err = mergo.Merge(&csvNew, csvO, mergo.WithOverride) - if err != nil { - exitWithError(err.Error()) - } - - } - - err = util.MarshallObject(csvNew, os.Stdout) - if err != nil { - exitWithError(err.Error()) - } - -} diff --git a/custom-bundle.Dockerfile b/custom-bundle.Dockerfile deleted file mode 100644 index 206c1a534..000000000 --- a/custom-bundle.Dockerfile +++ /dev/null @@ -1,76 +0,0 @@ -ARG GOLANG_CTX=registry.access.redhat.com/ubi9/go-toolset:1.20 - -FROM $GOLANG_CTX as builder - -WORKDIR /workspace -# Copy the Go Modules manifests -COPY go.mod go.mod -COPY go.sum go.sum - -COPY apis/ apis/ - -# cache deps before building and copying source so that we don't need to re-download as much -# and so that source changes don't invalidate our downloaded layer -RUN go mod download - -# Copy the go source -USER root -COPY cmd/csv-merger/csv-merger.go csv-merger.go -COPY pkg/ pkg/ - -# Build the csv-merger -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o csv-merger csv-merger.go - -USER $USER_ID - -FROM $GOLANG_CTX as merger -WORKDIR /workspace -COPY --from=builder /workspace/csv-merger . - -USER root -# local operator manifests -COPY bundle/manifests /manifests/ -COPY bundle_extra_data /bundle_extra_data - -# Merge things into our openstack-operator CSV: -# -openstack-operator CSV -# -ENV vars from all operators (for webhooks) -RUN /workspace/csv-merger \ - --import-env-files=/bundle_extra_data/env-vars.yaml \ - --base-csv=/manifests/openstack-operator.clusterserviceversion.yaml | tee /openstack-operator.clusterserviceversion.yaml.new - -# remove all individual operator CSV's -RUN rm /manifests/*clusterserviceversion.yaml - -USER $USER_ID - -### Put everything together -FROM scratch - -# Core bundle labels. -LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1 -LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/ -LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/ -LABEL operators.operatorframework.io.bundle.package.v1=openstack-operator -LABEL operators.operatorframework.io.bundle.channels.v1=alpha -LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.22.1 -LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1 -LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3 - -# Labels for testing. -LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1 -LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/ - -# Copy files to locations specified by labels. -USER root -COPY bundle/metadata /metadata/ -COPY bundle/tests/scorecard /tests/scorecard/ - -# copy in manifests from operators -COPY bundle/manifests /manifests/ -COPY --from=merger /manifests/* /manifests/ - -# overwrite with the final merged CSV -COPY --from=merger /openstack-operator.clusterserviceversion.yaml.new /manifests/openstack-operator.clusterserviceversion.yaml - -USER $USER_ID diff --git a/go.mod b/go.mod index 782c14bc8..3dc51cd21 100644 --- a/go.mod +++ b/go.mod @@ -3,14 +3,12 @@ module github.com/openstack-k8s-operators/openstack-operator go 1.20 require ( - github.com/blang/semver/v4 v4.0.0 github.com/cert-manager/cert-manager v1.13.6 github.com/ghodss/yaml v1.0.0 github.com/go-logr/logr v1.4.2 github.com/go-playground/validator/v10 v10.22.0 github.com/google/uuid v1.6.0 github.com/iancoleman/strcase v0.3.0 - github.com/imdario/mergo v0.3.16 github.com/onsi/ginkgo/v2 v2.20.0 github.com/onsi/gomega v1.34.1 github.com/openshift/api v3.9.0+incompatible @@ -76,6 +74,7 @@ require ( github.com/google/gofuzz v1.2.0 // indirect github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect github.com/gophercloud/gophercloud v1.14.0 // indirect + github.com/imdario/mergo v0.3.16 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.4.0 // indirect @@ -95,7 +94,6 @@ require ( github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring v0.69.0-rhobs1 // indirect github.com/rhobs/observability-operator v0.0.28 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect - github.com/sirupsen/logrus v1.9.3 // indirect github.com/spf13/pflag v1.0.5 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.26.0 // indirect diff --git a/go.sum b/go.sum index 12367f1d6..c2b43e2f3 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= -github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/cert-manager/cert-manager v1.13.6 h1:yngKM4ZQoyFQ3LGHTx95fWqyiNJP11UM5PWq7pAr3T0= github.com/cert-manager/cert-manager v1.13.6/go.mod h1:iWFePja8XKEl+Dv1kZtwPshT8D0SmC4Hyu5Qc5KS0tM= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= @@ -175,13 +173,10 @@ github.com/rhobs/observability-operator v0.0.28/go.mod h1:LbxNGGlKlcD7NBt0axiTeR github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -227,7 +222,6 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= @@ -270,7 +264,6 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/api v0.28.13 h1:0Sw8MjdkmrJAF/uVv09HXSZ3cQauVyZHQWKt8hiiKo4= diff --git a/hack/bundle-cache-data.sh b/hack/bundle-cache-data.sh deleted file mode 100755 index 330c7544c..000000000 --- a/hack/bundle-cache-data.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -# extract select data from bundles: -# -env vars from all service operators -set -ex - -function extract_csv { - local IN_DIR=$1 - local OUT_DIR=$2 - - for X in $(file ${IN_DIR}/* | grep gzip | cut -f 1 -d ':'); do - # NOTE(gibi): There might be multiple gzip in the bundle and - # not all of them hand csv file in it. If none of them has - # the csv then the build will fail at the csv-merger call - tar xvf $X -C ${OUT_DIR} --wildcards --no-anchor '**/*clusterserviceversion.yaml' || true - done -} - -OUT_BUNDLE=bundle_extra_data -EXTRACT_DIR=tmp/bundle_extract - -mkdir -p "$EXTRACT_DIR" -mkdir -p "$EXTRACT_DIR/csvs" -mkdir -p "$OUT_BUNDLE" - -for BUNDLE in $(hack/pin-bundle-images.sh | tr "," " "); do - skopeo copy "docker://$BUNDLE" dir:${EXTRACT_DIR}/tmp; - extract_csv "${EXTRACT_DIR}/tmp" "${EXTRACT_DIR}/csvs" -done - -# Extract the ENV vars from all the CSVs -CSV_DIR="${EXTRACT_DIR}/csvs/manifests" -bin/csv-merger \ - --export-env-file=$OUT_BUNDLE/env-vars.yaml \ - --mariadb-csv=$CSV_DIR/mariadb-operator.clusterserviceversion.yaml \ - --infra-csv=$CSV_DIR/infra-operator.clusterserviceversion.yaml \ - --keystone-csv=$CSV_DIR/keystone-operator.clusterserviceversion.yaml \ - --placement-csv=$CSV_DIR/placement-operator.clusterserviceversion.yaml \ - --ovn-csv=$CSV_DIR/ovn-operator.clusterserviceversion.yaml \ - --neutron-csv=$CSV_DIR/neutron-operator.clusterserviceversion.yaml \ - --ansibleee-csv=$CSV_DIR/openstack-ansibleee-operator.clusterserviceversion.yaml \ - --nova-csv=$CSV_DIR/nova-operator.clusterserviceversion.yaml \ - --heat-csv=$CSV_DIR/heat-operator.clusterserviceversion.yaml \ - --ironic-csv=$CSV_DIR/ironic-operator.clusterserviceversion.yaml \ - --baremetal-csv=$CSV_DIR/openstack-baremetal-operator.clusterserviceversion.yaml \ - --horizon-csv=$CSV_DIR/horizon-operator.clusterserviceversion.yaml \ - --telemetry-csv=$CSV_DIR/telemetry-operator.clusterserviceversion.yaml \ - --glance-csv=$CSV_DIR/glance-operator.clusterserviceversion.yaml \ - --cinder-csv=$CSV_DIR/cinder-operator.clusterserviceversion.yaml \ - --manila-csv=$CSV_DIR/manila-operator.clusterserviceversion.yaml \ - --swift-csv=$CSV_DIR/swift-operator.clusterserviceversion.yaml \ - --octavia-csv=$CSV_DIR/octavia-operator.clusterserviceversion.yaml \ - --designate-csv=$CSV_DIR/designate-operator.clusterserviceversion.yaml \ - --barbican-csv=$CSV_DIR/barbican-operator.clusterserviceversion.yaml \ - --test-csv=$CSV_DIR/test-operator.clusterserviceversion.yaml \ - --base-csv=config/manifests/bases/openstack-operator.clusterserviceversion.yaml | tee "$EXTRACT_DIR/out.yaml" - -# cleanup our temporary dir used for extraction -rm -Rf "$EXTRACT_DIR" - -# we only keep manifests from extracted (merged) bundles -rm -Rf "$OUT_BUNDLE/metadata" -rm -Rf "$OUT_BUNDLE/tests"