-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2736 from justinsb/propose_version
chore: create a script for updating the version
- Loading branch information
Showing
25 changed files
with
628 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2024 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. | ||
|
||
# Update the manifests etc in the repository to reflect a new tagged release. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
REPO_ROOT="$(git rev-parse --show-toplevel)" | ||
cd ${REPO_ROOT} | ||
|
||
BUILD_DIR="${REPO_ROOT}/.build" | ||
mkdir -p "${BUILD_DIR}" | ||
|
||
WORKDIR="${BUILD_DIR}/workdir" | ||
rm -rf "${WORKDIR}" | ||
mkdir -p "${WORKDIR}" | ||
|
||
|
||
BIN_DIR="${BUILD_DIR}/bin" | ||
mkdir -p "${BIN_DIR}" | ||
|
||
GOBIN=${BIN_DIR}/ go install sigs.k8s.io/kustomize/kustomize/[email protected] | ||
export PATH=${BIN_DIR}/:$PATH | ||
|
||
if [[ -z "${VERSION:-}" ]]; then | ||
echo "VERSION must be set" | ||
exit 1 | ||
fi | ||
|
||
# Update our version marker file (used for user agent etc) | ||
cat <<EOF > version/VERSION | ||
${VERSION} | ||
EOF | ||
|
||
# Update the version label in our kustomization files | ||
sed -i -e "[email protected]/operator-version:.*@cnrm.cloud.google.com/operator-version: \"${VERSION}\"@g" \ | ||
operator/config/autopilot/kustomization.yaml \ | ||
operator/config/default/kustomization.yaml \ | ||
config/installbundle/release-manifests/standard/kustomization.yaml \ | ||
config/installbundle/release-manifests/autopilot/kustomization.yaml | ||
|
||
# Update the default version in the "default" operator channel | ||
cat <<EOF > operator/channels/stable | ||
manifests: | ||
- version: ${VERSION} | ||
EOF | ||
|
||
# Update the default version in the "autopilot" operator channel | ||
cat <<EOF > operator/autopilot-channels/stable | ||
manifests: | ||
- version: ${VERSION} | ||
EOF | ||
|
||
|
||
# Build the release bundle | ||
VERSION=${VERSION} dev/tasks/build-release-bundle | ||
cp dist/release-bundle.tar.gz ${WORKDIR}/ | ||
cd ${WORKDIR} | ||
tar xzf release-bundle.tar.gz | ||
|
||
|
||
# Update the operator manifests in the channels / autopilot-channels directory | ||
|
||
for channeldir in channels autopilot-channels; do | ||
mkdir -p ${REPO_ROOT}/operator/config/${channeldir}/release-bundle | ||
cd ${REPO_ROOT}/operator/config/${channeldir}/release-bundle | ||
tar xzf ${WORKDIR}/release-bundle.tar.gz | ||
|
||
cd ${REPO_ROOT}/operator/config/${channeldir} | ||
|
||
mkdir -p ${REPO_ROOT}/operator/${channeldir}/packages/configconnector/${VERSION}/cluster/gcp-identity | ||
kustomize build --load-restrictor=LoadRestrictionsNone cluster-gcp-identity > ${REPO_ROOT}/operator/${channeldir}/packages/configconnector/${VERSION}/cluster/gcp-identity/0-cnrm-system.yaml | ||
|
||
mkdir -p ${REPO_ROOT}/operator/${channeldir}/packages/configconnector/${VERSION}/cluster/workload-identity | ||
kustomize build --load-restrictor=LoadRestrictionsNone cluster-workload-identity > ${REPO_ROOT}/operator/${channeldir}/packages/configconnector/${VERSION}/cluster/workload-identity/0-cnrm-system.yaml | ||
|
||
mkdir -p ${REPO_ROOT}/operator/${channeldir}/packages/configconnector/${VERSION}/namespaced | ||
kustomize build --load-restrictor=LoadRestrictionsNone namespaced-main > ${REPO_ROOT}/operator/${channeldir}/packages/configconnector/${VERSION}/namespaced/0-cnrm-system.yaml | ||
kustomize build --load-restrictor=LoadRestrictionsNone namespaced-per-namespace-components > ${REPO_ROOT}/operator/${channeldir}/packages/configconnector/${VERSION}/namespaced/per-namespace-components.yaml | ||
|
||
kustomize build --load-restrictor=LoadRestrictionsNone crds > ${REPO_ROOT}/operator/${channeldir}/packages/configconnector/${VERSION}/crds.yaml | ||
|
||
rm -rf ${REPO_ROOT}/operator/config/${channeldir}/release-bundle | ||
done | ||
|
||
# Swap container registry | ||
# TODO: This is only needed for release bundles that we didn't build with our scripts here (i.e. only needed for release bundles built with the legacy process) | ||
for channeldir in channels autopilot-channels; do | ||
find ${REPO_ROOT}/operator/${channeldir}/packages -type f -name "*.yaml" | xargs sed -i -e "[email protected]/cnrm-eap/@gcr.io/gke-release/cnrm/@g" | ||
done | ||
|
||
# Generate operator/config/gke-addon/image_configmap.yaml | ||
make -C ${REPO_ROOT}/operator manifests |
25 changes: 25 additions & 0 deletions
25
operator/config/autopilot-channels/cluster-gcp-identity/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 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. | ||
|
||
resources: | ||
- ../release-bundle/install-bundle-autopilot-gcp-identity/0-cnrm-system.yaml | ||
|
||
patchesJson6902: | ||
- target: | ||
group: apps | ||
version: v1 | ||
kind: Deployment | ||
name: cnrm-resource-stats-recorder | ||
namespace: cnrm-system | ||
path: recorder_remove_hostport_patch.yaml |
16 changes: 16 additions & 0 deletions
16
operator/config/autopilot-channels/cluster-gcp-identity/recorder_remove_hostport_patch.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 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. | ||
|
||
- op: remove | ||
path: /spec/template/spec/containers/0/ports/0/hostPort |
25 changes: 25 additions & 0 deletions
25
operator/config/autopilot-channels/cluster-workload-identity/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 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. | ||
|
||
resources: | ||
- ../release-bundle/install-bundle-autopilot-workload-identity/0-cnrm-system.yaml | ||
|
||
patchesJson6902: | ||
- target: | ||
group: apps | ||
version: v1 | ||
kind: Deployment | ||
name: cnrm-resource-stats-recorder | ||
namespace: cnrm-system | ||
path: recorder_remove_hostport_patch.yaml |
16 changes: 16 additions & 0 deletions
16
...r/config/autopilot-channels/cluster-workload-identity/recorder_remove_hostport_patch.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 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. | ||
|
||
- op: remove | ||
path: /spec/template/spec/containers/0/ports/0/hostPort |
16 changes: 16 additions & 0 deletions
16
operator/config/autopilot-channels/crds/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 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. | ||
|
||
resources: | ||
- ../release-bundle/install-bundle-namespaced/crds.yaml |
25 changes: 25 additions & 0 deletions
25
operator/config/autopilot-channels/namespaced-main/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 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. | ||
|
||
resources: | ||
- ../release-bundle/install-bundle-autopilot-namespaced/0-cnrm-system.yaml | ||
|
||
patchesJson6902: | ||
- target: | ||
group: apps | ||
version: v1 | ||
kind: Deployment | ||
name: cnrm-resource-stats-recorder | ||
namespace: cnrm-system | ||
path: recorder_remove_hostport_patch.yaml |
16 changes: 16 additions & 0 deletions
16
operator/config/autopilot-channels/namespaced-main/recorder_remove_hostport_patch.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 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. | ||
|
||
- op: remove | ||
path: /spec/template/spec/containers/0/ports/0/hostPort |
21 changes: 21 additions & 0 deletions
21
operator/config/autopilot-channels/namespaced-per-namespace-components/finalizer_patch.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# 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. | ||
|
||
# When a KCC managed namespace is deleted the RoleBindings in the namespace are deleted. As a result the KCC controllers | ||
# are unable to clean up the KCC resources in the namespace. This finalizer prevents the RoleBinding deletion from | ||
# occurring. The operator can then wait for the KCC controllers to delete all resources before removing this finalizer. | ||
- op: add | ||
path: /metadata/finalizers | ||
value: | ||
- configconnector.cnrm.cloud.google.com/finalizer |
35 changes: 35 additions & 0 deletions
35
operator/config/autopilot-channels/namespaced-per-namespace-components/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# 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. | ||
|
||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
resources: | ||
- ../release-bundle/install-bundle-autopilot-namespaced/per-namespace-components.yaml | ||
|
||
patchesJson6902: | ||
- target: | ||
group: rbac.authorization.k8s.io | ||
version: v1 | ||
kind: RoleBinding | ||
namespace: \$\{NAMESPACE\?\} | ||
name: cnrm-admin-binding-\$\{NAMESPACE\?\} | ||
path: finalizer_patch.yaml | ||
- target: | ||
group: rbac.authorization.k8s.io | ||
version: v1 | ||
kind: RoleBinding | ||
namespace: \$\{NAMESPACE\?\} | ||
name: cnrm-manager-ns-binding-\$\{NAMESPACE\?\} | ||
path: finalizer_patch.yaml |
16 changes: 16 additions & 0 deletions
16
operator/config/channels/cluster-gcp-identity/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 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. | ||
|
||
resources: | ||
- ../release-bundle/install-bundle-gcp-identity/0-cnrm-system.yaml |
Oops, something went wrong.