diff --git a/Makefile b/Makefile index 6eec10e28e..b96ea7e2b4 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,8 @@ all: test local-build # Image URL to use all building/pushing image targets REPO ?= scylladb/scylla-operator -TAG ?= $(shell git describe --tags --always --abbrev=0) +TAG ?= $(shell ./version.sh) IMG ?= $(REPO):$(TAG) -NIGHTLY_IMG ?= $(REPO):nightly # Produce CRDs that work back to Kubernetes 1.11 (no version conversion) CRD_OPTIONS ?= "crd:trivialVersions=true" @@ -47,11 +46,12 @@ cert-manager: # Deploy controller in the configured Kubernetes cluster in ~/.kube/config deploy: manifests cert-manager - cd config/operator/operator && kustomize edit set image controller=${IMG} - kustomize build config/operator/default | kubectl apply -f - + kubectl apply -f examples/common/operator.yaml # Generate manifests e.g. CRD, RBAC etc. manifests: + cd config/operator/operator && kustomize edit set image controller=${IMG} + controller-gen $(CRD_OPTIONS) paths="$(PKG)" output:crd:dir=config/operator/crd/bases \ rbac:roleName=manager-role output:rbac:artifacts:config=config/operator/rbac \ webhook output:webhook:artifacts:config=config/operator/webhook @@ -96,4 +96,4 @@ release: nightly: goreleaser --snapshot --rm-dist --config=.goreleaser-nightly.yml - docker push ${NIGHTLY_IMG} + docker push ${IMG} diff --git a/config/operator/operator/kustomization.yaml b/config/operator/operator/kustomization.yaml index 464bf95734..9f82258a84 100644 --- a/config/operator/operator/kustomization.yaml +++ b/config/operator/operator/kustomization.yaml @@ -5,4 +5,4 @@ kind: Kustomization images: - name: controller newName: scylladb/scylla-operator - newTag: v0.3.0 + newTag: nightly diff --git a/examples/common/operator.yaml b/examples/common/operator.yaml index edf8cc3106..c99091b8b4 100644 --- a/examples/common/operator.yaml +++ b/examples/common/operator.yaml @@ -1832,7 +1832,7 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - image: scylladb/scylla-operator:v0.3.0 + image: scylladb/scylla-operator:nightly imagePullPolicy: IfNotPresent name: manager ports: diff --git a/version.sh b/version.sh new file mode 100755 index 0000000000..7f5f6374be --- /dev/null +++ b/version.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# +# This file is open source software, licensed to you under the terms +# of the Apache License, Version 2.0 (the "License"). See the NOTICE file +# distributed with this work for additional information regarding copyright +# ownership. 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 -euo pipefail + +BRANCH=$(git rev-parse --abbrev-ref HEAD) +if [[ "$BRANCH" != "master" ]]; then + echo $(git describe --tags --always --abbrev=0) + exit 0 +fi + +echo 'nightly' \ No newline at end of file