You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2022/03/08 21:39:35 UTC
[solr-operator] branch main updated: Add operator version & ArgoCD annotations to CRDs (#411)
This is an automated email from the ASF dual-hosted git repository.
houston pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-operator.git
The following commit(s) were added to refs/heads/main by this push:
new 7124bf5 Add operator version & ArgoCD annotations to CRDs (#411)
7124bf5 is described below
commit 7124bf548a5d0f71666421c7dfecc7f6ad054d6d
Author: Jan Høydahl <ja...@users.noreply.github.com>
AuthorDate: Tue Mar 8 22:37:43 2022 +0100
Add operator version & ArgoCD annotations to CRDs (#411)
---
Makefile | 1 +
config/crd/bases/solr.apache.org_solrbackups.yaml | 2 ++
config/crd/bases/solr.apache.org_solrclouds.yaml | 2 ++
.../crd/bases/solr.apache.org_solrprometheusexporters.yaml | 2 ++
config/dependencies/zookeeper_cluster_crd.yaml | 3 +++
.../{add_crds_roles_headers.sh => add_crds_annotations.sh} | 12 +++++++-----
hack/config/add_crds_roles_headers.sh | 2 ++
hack/release/artifacts/create_crds.sh | 7 ++-----
hack/release/version/propagate_version.sh | 2 ++
hack/release/wizard/scriptutil.py | 4 ++--
hack/zk-operator/update-crd.sh | 13 +++++--------
helm/solr-operator/crds/crds.yaml | 6 ++++++
12 files changed, 36 insertions(+), 20 deletions(-)
diff --git a/Makefile b/Makefile
index 376574b..856250a 100644
--- a/Makefile
+++ b/Makefile
@@ -95,6 +95,7 @@ prepare: fmt generate manifests fetch-licenses-list mod-tidy ## Prepare the code
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects
rm -rf generated-check/api
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=solr-operator-role webhook paths="./api/..." paths="./controllers/." output:rbac:artifacts:config=$(or $(TMP_CONFIG_OUTPUT_DIRECTORY),config)/rbac output:crd:artifacts:config=$(or $(TMP_CONFIG_OUTPUT_DIRECTORY),config)/crd/bases
+ CONFIG_DIRECTORY=$(or $(TMP_CONFIG_OUTPUT_DIRECTORY),config) VERSION=$(VERSION) ./hack/config/add_crds_annotations.sh
CONFIG_DIRECTORY=$(or $(TMP_CONFIG_OUTPUT_DIRECTORY),config) HELM_DIRECTORY=$(or $(TMP_HELM_OUTPUT_DIRECTORY),helm) ./hack/config/copy_crds_roles_helm.sh
CONFIG_DIRECTORY=$(or $(TMP_CONFIG_OUTPUT_DIRECTORY),config) ./hack/config/add_crds_roles_headers.sh
diff --git a/config/crd/bases/solr.apache.org_solrbackups.yaml b/config/crd/bases/solr.apache.org_solrbackups.yaml
index 0032d4c..9d849cc 100644
--- a/config/crd/bases/solr.apache.org_solrbackups.yaml
+++ b/config/crd/bases/solr.apache.org_solrbackups.yaml
@@ -19,6 +19,8 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.0
+ operator.solr.apache.org/version: v0.6.0-prerelease
+ argocd.argoproj.io/sync-options: Replace=true
creationTimestamp: null
name: solrbackups.solr.apache.org
spec:
diff --git a/config/crd/bases/solr.apache.org_solrclouds.yaml b/config/crd/bases/solr.apache.org_solrclouds.yaml
index ae86d52..76b4d2a 100644
--- a/config/crd/bases/solr.apache.org_solrclouds.yaml
+++ b/config/crd/bases/solr.apache.org_solrclouds.yaml
@@ -19,6 +19,8 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.0
+ operator.solr.apache.org/version: v0.6.0-prerelease
+ argocd.argoproj.io/sync-options: Replace=true
creationTimestamp: null
name: solrclouds.solr.apache.org
spec:
diff --git a/config/crd/bases/solr.apache.org_solrprometheusexporters.yaml b/config/crd/bases/solr.apache.org_solrprometheusexporters.yaml
index 8e5b6d4..e89b1f0 100644
--- a/config/crd/bases/solr.apache.org_solrprometheusexporters.yaml
+++ b/config/crd/bases/solr.apache.org_solrprometheusexporters.yaml
@@ -19,6 +19,8 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.0
+ operator.solr.apache.org/version: v0.6.0-prerelease
+ argocd.argoproj.io/sync-options: Replace=true
creationTimestamp: null
name: solrprometheusexporters.solr.apache.org
spec:
diff --git a/config/dependencies/zookeeper_cluster_crd.yaml b/config/dependencies/zookeeper_cluster_crd.yaml
index 3dc9cb7..ea6a78d 100644
--- a/config/dependencies/zookeeper_cluster_crd.yaml
+++ b/config/dependencies/zookeeper_cluster_crd.yaml
@@ -13,6 +13,9 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: zookeeperclusters.zookeeper.pravega.io
+ annotations:
+ operator.zookeeper.pravega.io/version: v0.2.13
+ argocd.argoproj.io/sync-options: Replace=true
spec:
group: zookeeper.pravega.io
names:
diff --git a/hack/config/add_crds_roles_headers.sh b/hack/config/add_crds_annotations.sh
similarity index 77%
copy from hack/config/add_crds_roles_headers.sh
copy to hack/config/add_crds_annotations.sh
index 13f31e9..18d3431 100755
--- a/hack/config/add_crds_roles_headers.sh
+++ b/hack/config/add_crds_annotations.sh
@@ -21,15 +21,17 @@ set -o pipefail
# error on unset variables
set -u
-echo "Add headers to CRDs and Role files"
+echo "Add annotations to CRDs"
-files=("${CONFIG_DIRECTORY:-config}"/crd/bases/* "${CONFIG_DIRECTORY:-config}"/rbac/role.yaml)
+rm -f "${CONFIG_DIRECTORY:-config}"/crd/bases/*.tmp
+
+files=("${CONFIG_DIRECTORY:-config}"/crd/bases/*)
# Copy and package CRDs
for file in "${files[@]}"; do
{
- cat hack/headers/header.yaml.txt
- printf "\n"
- cat "${file}"
+ cat "${file}" | sed -e "/^ controller-gen.kubebuilder.io.version.*/a \\
+ operator.solr.apache.org\\/version: ${VERSION}\\
+ argocd.argoproj.io\\/sync-options: Replace=true"
} > "${file}.tmp" && mv "${file}.tmp" "${file}"
done
diff --git a/hack/config/add_crds_roles_headers.sh b/hack/config/add_crds_roles_headers.sh
index 13f31e9..080ea37 100755
--- a/hack/config/add_crds_roles_headers.sh
+++ b/hack/config/add_crds_roles_headers.sh
@@ -23,6 +23,8 @@ set -u
echo "Add headers to CRDs and Role files"
+rm -f "${CONFIG_DIRECTORY:-config}"/crd/bases/*.tmp "${CONFIG_DIRECTORY:-config}"/rbac/role.yaml.tmp
+
files=("${CONFIG_DIRECTORY:-config}"/crd/bases/* "${CONFIG_DIRECTORY:-config}"/rbac/role.yaml)
# Copy and package CRDs
diff --git a/hack/release/artifacts/create_crds.sh b/hack/release/artifacts/create_crds.sh
index 8a78513..894dba3 100755
--- a/hack/release/artifacts/create_crds.sh
+++ b/hack/release/artifacts/create_crds.sh
@@ -85,11 +85,8 @@ for filename in config/crd/bases/*.yaml; do
done
# Fetch the correct dependency Zookeeper CRD, package with other CRDS
-{
- cat hack/headers/zookeeper-operator-header.yaml.txt;
- printf "\n\n---\n"
- curl -sL "https://raw.githubusercontent.com/pravega/zookeeper-operator/v0.2.13/deploy/crds/zookeeper.pravega.io_zookeeperclusters_crd.yaml"
-} > "${ARTIFACTS_DIR}/crds/zookeeperclusters.yaml"
+./hack/zk-operator/update-crd.sh
+cp "config/dependencies/zookeeper_cluster_crd.yaml" "${ARTIFACTS_DIR}/crds/zookeeperclusters.yaml"
# Package all Solr and Dependency CRDs
{
diff --git a/hack/release/version/propagate_version.sh b/hack/release/version/propagate_version.sh
index 7697f63..32aaa67 100755
--- a/hack/release/version/propagate_version.sh
+++ b/hack/release/version/propagate_version.sh
@@ -114,3 +114,5 @@ fi
sed -E "s|(kubectl.+/crds/)[^/<]+|\1${VERSION}|g" | \
sed -E "s|(helm.+--version )[^ <]+|\1${VERSION#v}|g"
} > docs/running-the-operator.md.tmp && mv docs/running-the-operator.md.tmp docs/running-the-operator.md
+
+make manifests
diff --git a/hack/release/wizard/scriptutil.py b/hack/release/wizard/scriptutil.py
index ac39d13..c453dab 100644
--- a/hack/release/wizard/scriptutil.py
+++ b/hack/release/wizard/scriptutil.py
@@ -130,9 +130,9 @@ def find_branch_type():
if branchName == b'main':
return BranchType.unstable
- if re.match(r'release-(\d+)', branchName.decode('UTF-8')):
+ if re.match(r'^release-(\d+)$', branchName.decode('UTF-8')):
return BranchType.stable
- if re.match(r'release-(\d+)\.(\d+)', branchName.decode('UTF-8')):
+ if re.match(r'^release-(\d+)\.(\d+)$', branchName.decode('UTF-8')):
return BranchType.release
raise Exception('Cannot run %s on feature branch' % sys.argv[0].rsplit('/', 1)[-1])
diff --git a/hack/zk-operator/update-crd.sh b/hack/zk-operator/update-crd.sh
index 9ec06df..cbe955a 100755
--- a/hack/zk-operator/update-crd.sh
+++ b/hack/zk-operator/update-crd.sh
@@ -27,12 +27,9 @@ ZK_OP_VERSION="$(cat versions.props | grep -E 'zookeeper-operator' | grep -o 'v[
{
cat hack/headers/zookeeper-operator-header.yaml.txt;
printf "\n\n---\n"
- curl -sL "https://raw.githubusercontent.com/pravega/zookeeper-operator/${ZK_OP_VERSION}/deploy/crds/zookeeper.pravega.io_zookeeperclusters_crd.yaml"
+ curl -sL "https://raw.githubusercontent.com/pravega/zookeeper-operator/${ZK_OP_VERSION}/deploy/crds/zookeeper.pravega.io_zookeeperclusters_crd.yaml" \
+ | sed -e "/^ name: zookeeperclusters.zookeeper.pravega.io$/a \\
+ annotations:\\
+ operator.zookeeper.pravega.io\\/version: ${ZK_OP_VERSION}\\
+ argocd.argoproj.io\\/sync-options: Replace=true"
} > config/dependencies/zookeeper_cluster_crd.yaml
-
-# Fetch the correct dependency Zookeeper CRD, package with other CRDS
-{
- cat hack/headers/zookeeper-operator-header.yaml.txt;
- printf "\n\n---\n"
- curl -sL "https://raw.githubusercontent.com/pravega/zookeeper-operator/${ZK_OP_VERSION}/deploy/crds/zookeeper.pravega.io_zookeeperclusters_crd.yaml"
-} > config/dependencies/zookeeper_cluster_crd.yaml
\ No newline at end of file
diff --git a/helm/solr-operator/crds/crds.yaml b/helm/solr-operator/crds/crds.yaml
index c54d8be..4ba9c51 100644
--- a/helm/solr-operator/crds/crds.yaml
+++ b/helm/solr-operator/crds/crds.yaml
@@ -19,6 +19,8 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.0
+ operator.solr.apache.org/version: v0.6.0-prerelease
+ argocd.argoproj.io/sync-options: Replace=true
creationTimestamp: null
name: solrbackups.solr.apache.org
spec:
@@ -1272,6 +1274,8 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.0
+ operator.solr.apache.org/version: v0.6.0-prerelease
+ argocd.argoproj.io/sync-options: Replace=true
creationTimestamp: null
name: solrclouds.solr.apache.org
spec:
@@ -8332,6 +8336,8 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.5.0
+ operator.solr.apache.org/version: v0.6.0-prerelease
+ argocd.argoproj.io/sync-options: Replace=true
creationTimestamp: null
name: solrprometheusexporters.solr.apache.org
spec: