From d0bbdc2e1e8c2917f3d4493bf2aff3f418f9f527 Mon Sep 17 00:00:00 2001 From: Yuwen Ma Date: Mon, 9 Dec 2024 18:40:43 +0000 Subject: [PATCH 1/2] chore: simplfy building operator manifest --- Makefile | 44 +++---------------- .../autopilot/kustomization.yaml | 6 +-- .../standard/kustomization.yaml | 6 +-- 3 files changed, 11 insertions(+), 45 deletions(-) diff --git a/Makefile b/Makefile index e424106a39..e466b1eb38 100644 --- a/Makefile +++ b/Makefile @@ -302,59 +302,25 @@ gke-addon-poststart: operator-manager-bin: go build -o bin/operator-manager github.com/GoogleCloudPlatform/k8s-config-connector/operator/cmd/manager -# Build kcc manifests for both standard and autopilot clusters -.PHONY: all-manifests -all-manifests: crd-manifests rbac-manifests build-operator-manifests - cp config/installbundle/release-manifests/crds.yaml config/installbundle/release-manifests/standard/crds.yaml - cp config/installbundle/release-manifests/rbac.yaml config/installbundle/release-manifests/standard/rbac.yaml - kustomize build config/installbundle/release-manifests/standard -o config/installbundle/release-manifests/standard/manifests.yaml - cp config/installbundle/release-manifests/crds.yaml config/installbundle/release-manifests/autopilot/crds.yaml - cp config/installbundle/release-manifests/rbac.yaml config/installbundle/release-manifests/autopilot/rbac.yaml - kustomize build config/installbundle/release-manifests/autopilot -o config/installbundle/release-manifests/autopilot/manifests.yaml - - # Build kcc manifests for standard GKE clusters .PHONY: config-connector-manifests-standard -config-connector-manifests-standard: build-crd-manifests build-rbac-manifests build-operator-manifests - cp config/installbundle/release-manifests/crds.yaml config/installbundle/release-manifests/standard/crds.yaml - cp config/installbundle/release-manifests/rbac.yaml config/installbundle/release-manifests/standard/rbac.yaml - kustomize build config/installbundle/release-manifests/standard -o config/installbundle/release-manifests/standard/manifests.yaml +config-connector-manifests-standard: build-operator-manifests + kustomize build config/installbundle/release-manifests/standard # Build kcc manifests for autopilot clusters .PHONY: config-connector-manifests-autopilot -config-connector-manifests-autopilot: build-crd-manifests build-rbac-manifests build-operator-manifests - cp config/installbundle/release-manifests/crds.yaml config/installbundle/release-manifests/autopilot/crds.yaml - cp config/installbundle/release-manifests/rbac.yaml config/installbundle/release-manifests/autopilot/rbac.yaml - kustomize build config/installbundle/release-manifests/autopilot -o config/installbundle/release-manifests/autopilot/manifests.yaml - -.PHONY: build-crd-manifests -build-crd-manifests: - go run sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0 crd paths="./operator/pkg/apis/..." output:crd:artifacts:config=operator/config/crd/bases - kustomize build operator/config/crd -o config/installbundle/release-manifests/crds.yaml - -.PHONY: build-rbac-manifests -build-rbac-manifests: - kustomize build operator/config/rbac -o config/installbundle/release-manifests/rbac.yaml +config-connector-manifests-autopilot: build-operator-manifests + kustomize build config/installbundle/release-manifests/autopilot .PHONY: build-operator-manifests build-operator-manifests: + go run sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0 crd paths="./operator/pkg/apis/..." output:crd:artifacts:config=operator/config/crd/bases make -C operator docker-build - kustomize build operator/config/autopilot-manager -o config/installbundle/release-manifests/autopilot/manager.yaml - kustomize build operator/config/manager -o config/installbundle/release-manifests/standard/manager.yaml .PHONY: push-operator-manifest push-operator-manifest: make -C operator docker-push -.PHONY: clean-operator-manifests -clean-release-manifests: - rm config/installbundle/release-manifests/crds.yaml - rm config/installbundle/release-manifests/rbac.yaml - rm config/installbundle/release-manifests/standard/manager.yaml - rm config/installbundle/release-manifests/autopilot/manager.yaml - rm config/installbundle/release-manifests/standard/manifests.yaml - rm config/installbundle/release-manifests/autopilot/manifests.yaml - .PHONY: deploy-kcc-standard deploy-kcc-standard: docker-build docker-push config-connector-manifests-standard push-operator-manifest kubectl apply -f config/installbundle/release-manifests/standard/manifests.yaml ${CONTEXT_FLAG} diff --git a/config/installbundle/release-manifests/autopilot/kustomization.yaml b/config/installbundle/release-manifests/autopilot/kustomization.yaml index d4af5f9873..315eb3cd12 100644 --- a/config/installbundle/release-manifests/autopilot/kustomization.yaml +++ b/config/installbundle/release-manifests/autopilot/kustomization.yaml @@ -18,6 +18,6 @@ commonLabels: commonAnnotations: cnrm.cloud.google.com/operator-version: "1.126.0" resources: - - crds.yaml - - rbac.yaml - - manager.yaml + - ../../../../operator/config/rbac + - ../../../../operator/config/crd + - ../../../../operator/config/autopilot-manager diff --git a/config/installbundle/release-manifests/standard/kustomization.yaml b/config/installbundle/release-manifests/standard/kustomization.yaml index d4af5f9873..4e443cf75f 100644 --- a/config/installbundle/release-manifests/standard/kustomization.yaml +++ b/config/installbundle/release-manifests/standard/kustomization.yaml @@ -18,6 +18,6 @@ commonLabels: commonAnnotations: cnrm.cloud.google.com/operator-version: "1.126.0" resources: - - crds.yaml - - rbac.yaml - - manager.yaml + - ../../../../operator/config/rbac + - ../../../../operator/config/crd + - ../../../../operator/config/manager From 6cb6d94c1e0af3374db4f17c21f726966dd2bdda Mon Sep 17 00:00:00 2001 From: Yuwen Ma Date: Mon, 9 Dec 2024 22:05:43 +0000 Subject: [PATCH 2/2] feat:add manual release --- dev/tasks/deploy-release-manual | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 dev/tasks/deploy-release-manual diff --git a/dev/tasks/deploy-release-manual b/dev/tasks/deploy-release-manual new file mode 100755 index 0000000000..76a3bc1c2d --- /dev/null +++ b/dev/tasks/deploy-release-manual @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# Copyright 2022 Google LLC +# +# 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. + +set -o errexit +set -o nounset +set -o pipefail + +# runs the config-connector build across all desired systems and architectures and creates a release tarball +REPO_ROOT="$(git rev-parse --show-toplevel)" +cd ${REPO_ROOT} + + +BUILD_DIR="${REPO_ROOT}/.build" +mkdir -p "${BUILD_DIR}" + + +MANUAL_DIR="${BUILD_DIR}/manual-release" +mkdir -p "${MANUAL_DIR}/operator-system" + +# New process +kustomize build config/installbundle/release-manifests/standard -o ${MANUAL_DIR}/operator-system/configconnector-operator.yaml +echo "Added standard release manifest to ${MANUAL_DIR}/operator-system/configconnector-operator.yaml" + +kustomize build config/installbundle/release-manifests/autopilot -o ${MANUAL_DIR}/operator-system/autopilot-configconnector-operator.yaml +echo "Added autopilot release manifest to ${MANUAL_DIR}/operator-system/autopilot-configconnector-operator.yaml" + +cp -rf operator/config/samples ${MANUAL_DIR}/ + +tar -czvf ${BUILD_DIR}/release-bundle.tar.gz -C ${MANUAL_DIR}/ . + +echo "Generated ${BUILD_DIR}/release-bundle.tar.gz for manual installation "