Skip to content

Commit 1d1cc99

Browse files
committed
Update operator-sdk to v1.20.1
1 parent d7918a0 commit 1d1cc99

8 files changed

Lines changed: 69 additions & 11 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ commands:
5454
- run:
5555
name: Install operator-sdk
5656
command: |
57-
export OPERATOR_SDK_RELEASE_VERSION=v1.11.0
57+
export OPERATOR_SDK_RELEASE_VERSION=v1.20.1
5858
curl -JL https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_RELEASE_VERSION}/operator-sdk_linux_amd64 -o operator-sdk
5959
chmod +x operator-sdk && sudo cp operator-sdk /usr/local/bin/operator-sdk && rm operator-sdk
6060

Makefile

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ ARCH = $(shell go env GOARCH)
2929
# Image URL to use all building/pushing image targets
3030
IMG ?= quay.io/3scale/3scale-operator:master
3131

32-
CRD_OPTIONS ?= "crd:crdVersions=v1"
33-
3432
GO ?= go
3533
KUBECTL ?= kubectl
3634
DOCKER ?= docker
@@ -64,14 +62,17 @@ PROMETHEUS_RULES_TARGETS = $(foreach pr,$(PROMETHEUS_RULES),$(PROJECT_PATH)/doc/
6462
PROMETHEUS_RULES_DEPS = $(shell find $(PROJECT_PATH)/pkg/3scale/amp/component -name '*.go')
6563
PROMETHEUS_RULES_NAMESPACE ?= "__NAMESPACE__"
6664

65+
.PHONY: all
6766
all: manager
6867

6968
# Run all tests
69+
.PHONY: test
7070
test: test-unit test-e2e test-crds test-manifests-version
7171

7272
# Run unit tests
7373
TEST_UNIT_PKGS = $(shell $(GO) list ./... | grep -E 'github.com/3scale/3scale-operator/pkg|github.com/3scale/3scale-operator/apis|github.com/3scale/3scale-operator/test/unitcontrollers|github.com/3scale/3scale-operator/controllers/capabilities')
7474
TEST_UNIT_COVERPKGS = $(shell $(GO) list ./... | grep -v github.com/3scale/3scale-operator/test | tr "\n" ",") # Exclude test directories as coverpkg does not accept only-tests packages
75+
.PHONY: test-unit
7576
test-unit: clean-cov generate fmt vet manifests
7677
mkdir -p "$(PROJECT_PATH)/_output"
7778
$(GO) test -v $(TEST_UNIT_PKGS) -covermode=count -coverprofile $(PROJECT_PATH)/_output/unit.cov -coverpkg=$(TEST_UNIT_COVERPKGS)
@@ -80,18 +81,21 @@ $(PROJECT_PATH)/_output/unit.cov: test-unit
8081

8182
# Run CRD tests
8283
TEST_CRD_PKGS = $(shell $(GO) list ./... | grep 'github.com/3scale/3scale-operator/test/crds')
84+
.PHONY: test-crds
8385
test-crds: generate fmt vet manifests
8486
$(GO) test -v $(TEST_CRD_PKGS)
8587

8688
TEST_MANIFESTS_VERSION_PKGS = $(shell $(GO) list ./... | grep 'github.com/3scale/3scale-operator/test/manifests-version')
8789
## test-manifests-version: Run manifest version checks
90+
.PHONY: test-manifests-version
8891
test-manifests-version:
8992
$(GO) test -v $(TEST_MANIFESTS_VERSION_PKGS)
9093

9194
# Run e2e tests
9295
TEST_E2E_PKGS_APPS = $(shell $(GO) list ./... | grep 'github.com/3scale/3scale-operator/controllers/apps')
9396
TEST_E2E_PKGS_CAPABILITIES = $(shell $(GO) list ./... | grep 'github.com/3scale/3scale-operator/controllers/capabilities')
9497
ENVTEST_ASSETS_DIR=$(PROJECT_PATH)/testbin
98+
.PHONY: test-e2e
9599
test-e2e: generate fmt vet manifests
96100
mkdir -p ${ENVTEST_ASSETS_DIR}
97101
test -f $(ENVTEST_ASSETS_DIR)/setup-envtest.sh || curl -sSLo $(ENVTEST_ASSETS_DIR)/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.8.0/hack/setup-envtest.sh
@@ -100,10 +104,12 @@ test-e2e: generate fmt vet manifests
100104

101105

102106
# Build manager binary
107+
.PHONY: manager
103108
manager: generate fmt vet
104109
$(GO) build -o bin/manager main.go
105110

106111
# Run against the configured Kubernetes cluster in ~/.kube/config
112+
.PHONY: run
107113
run: export WATCH_NAMESPACE=$(LOCAL_RUN_NAMESPACE)
108114
run: export THREESCALE_DEBUG=1
109115
run: export PREFLIGHT_CHECKS_BYPASS=true
@@ -172,7 +178,7 @@ kustomize: $(KUSTOMIZE)
172178
OPERATOR_SDK = $(PROJECT_PATH)/bin/operator-sdk
173179
# Note: release file patterns changed after v1.2.0
174180
# More info https://sdk.operatorframework.io/docs/installation/
175-
OPERATOR_SDK_VERSION=v1.11.0
181+
OPERATOR_SDK_VERSION=v1.20.1
176182
$(OPERATOR_SDK):
177183
curl -sSL https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_$(OS)_$(ARCH) -o $(OPERATOR_SDK)
178184
chmod +x $(OPERATOR_SDK)
@@ -187,28 +193,44 @@ $(GO_BINDATA):
187193
.PHONY: go-bindata
188194
go-bindata: $(GO_BINDATA)
189195

196+
##@ Deployment
197+
198+
ifndef ignore-not-found
199+
ignore-not-found = false
200+
endif
201+
190202
# Install CRDs into a cluster
203+
.PHONY: install
191204
install: manifests $(KUSTOMIZE)
192205
$(KUSTOMIZE) build config/crd | $(KUBECTL) create -f - || $(KUSTOMIZE) build config/crd | $(KUBECTL) replace -f -
193206

194207
# Uninstall CRDs from a cluster
208+
.PHONY: uninstall
195209
uninstall: manifests $(KUSTOMIZE)
196-
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete -f -
210+
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
197211

198212
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
213+
.PHONY: deploy
199214
deploy: manifests $(KUSTOMIZE)
200215
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
201216
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
202217

218+
.PHONY: undeploy
219+
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
220+
$(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
221+
203222
# Generate manifests e.g. CRD, RBAC etc.
223+
.PHONY: manifests
204224
manifests: $(CONTROLLER_GEN)
205-
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
225+
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
206226

207227
# Run go fmt against code
228+
.PHONY: fmt
208229
fmt:
209230
$(GO) fmt ./...
210231

211232
# Run go vet against code
233+
.PHONY: vet
212234
vet:
213235
$(GO) vet ./...
214236

@@ -326,6 +348,7 @@ catalog-build: opm
326348
catalog-push: ## Push the catalog image.
327349
$(MAKE) docker-push IMG=$(CATALOG_IMG)
328350

351+
.PHONY: download
329352
download:
330353
@echo Download go.mod dependencies
331354
@$(GO) mod download
@@ -339,6 +362,7 @@ endif
339362
license_finder report --decisions-file=$(DEPENDENCY_DECISION_FILE) --quiet --format=xml > licenses.xml
340363

341364
## licenses-check: Check license compliance of dependencies
365+
.PHONY: licenses-check
342366
licenses-check:
343367
ifndef LICENSEFINDERBINARY
344368
$(error "license-finder is not available please install: gem install license_finder --version 5.7.1")

bundle.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
66
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
77
LABEL operators.operatorframework.io.bundle.package.v1=3scale-operator
88
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
9-
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.10.0+git
9+
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.19.0+git
1010
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
1111
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
1212

bundle/manifests/3scale-operator.clusterserviceversion.yaml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ metadata:
245245
operators.openshift.io/infrastructure-features: '["Disconnected"]'
246246
operators.openshift.io/valid-subscription: '["Red Hat Integration", "Red Hat 3scale
247247
API Management"]'
248-
operators.operatorframework.io/builder: operator-sdk-v1.10.0+git
248+
operators.operatorframework.io/builder: operator-sdk-v1.19.0+git
249249
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
250250
repository: https://github.com/3scale/3scale-operator
251251
rht_backend_redis_requirements: 7.0.0
@@ -516,7 +516,10 @@ spec:
516516
- watch
517517
serviceAccountName: 3scale-operator
518518
deployments:
519-
- name: threescale-operator-controller-manager-v2
519+
- label:
520+
app: 3scale-api-management
521+
control-plane: controller-manager
522+
name: threescale-operator-controller-manager-v2
520523
spec:
521524
replicas: 1
522525
selector:
@@ -526,6 +529,8 @@ spec:
526529
strategy: {}
527530
template:
528531
metadata:
532+
annotations:
533+
kubectl.kubernetes.io/default-container: manager
529534
labels:
530535
app: 3scale-api-management
531536
com.company: Red_Hat
@@ -1164,4 +1169,21 @@ spec:
11641169
maturity: stable
11651170
provider:
11661171
name: Red Hat
1172+
relatedImages:
1173+
- image: quay.io/3scale/apisonator:latest
1174+
name: backend
1175+
- image: quay.io/3scale/apicast:latest
1176+
name: apicast
1177+
- image: quay.io/3scale/porta:latest
1178+
name: system
1179+
- image: quay.io/3scale/zync:latest
1180+
name: zync
1181+
- image: mirror.gcr.io/library/memcached:1.5
1182+
name: system-memcached
1183+
- image: quay.io/sclorg/postgresql-13-c8s
1184+
name: zync-postgresql
1185+
- image: quay.io/openshift/origin-cli:4.7
1186+
name: oc-cli
1187+
- image: quay.io/3scale/searchd:latest
1188+
name: system-searchd
11671189
version: 0.0.1

bundle/manifests/capabilities.3scale.net_backends.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ spec:
136136
SystemName identifies uniquely the backend within the account provider
137137
Default value will be sanitized Name
138138
type: string
139+
x-kubernetes-validations:
140+
- message: SystemName is immutable
141+
rule: self == oldSelf
139142
required:
140143
- name
141144
- privateBaseURL

bundle/metadata/annotations.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ annotations:
55
operators.operatorframework.io.bundle.metadata.v1: metadata/
66
operators.operatorframework.io.bundle.package.v1: 3scale-operator
77
operators.operatorframework.io.bundle.channels.v1: alpha
8-
operators.operatorframework.io.metrics.builder: operator-sdk-v1.10.0+git
8+
operators.operatorframework.io.metrics.builder: operator-sdk-v1.19.0+git
99
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
1010
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3
1111

config/default/manager_auth_proxy_patch.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,18 @@ spec:
1515
- "--secure-listen-address=0.0.0.0:8443"
1616
- "--upstream=http://127.0.0.1:8080/"
1717
- "--logtostderr=true"
18-
- "--v=10"
18+
- "--v=0"
1919
ports:
2020
- containerPort: 8443
2121
protocol: TCP
2222
name: https
23+
resources:
24+
limits:
25+
cpu: 500m
26+
memory: 128Mi
27+
requests:
28+
cpu: 5m
29+
memory: 64Mi
2330
- name: manager
2431
args:
2532
- "--health-probe-bind-address=:8081"

config/manager/manager.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ spec:
1919
replicas: 1
2020
template:
2121
metadata:
22+
annotations:
23+
kubectl.kubernetes.io/default-container: manager
2224
labels:
2325
control-plane: controller-manager
2426
com.company: Red_Hat

0 commit comments

Comments
 (0)