Skip to content

Commit 7899703

Browse files
authored
fix(operator): Bump operator-sdk version
fix(operator): Bump operator-sdk version
2 parents a472822 + 1898bec commit 7899703

38 files changed

+419
-565
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM quay.io/operator-framework/helm-operator:v1.25.2
2+
FROM quay.io/operator-framework/helm-operator:v1.32.0
33

44
ENV HOME=/opt/helm
55
COPY watches.yaml ${HOME}/watches.yaml

Dockerfile-ARM64

Lines changed: 0 additions & 7 deletions
This file was deleted.

Makefile

Lines changed: 69 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
# To re-generate a bundle for another specific version without changing the standard setup, you can:
44
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
55
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
6-
VERSION ?= 0.0.6
6+
VERSION ?= 0.0.1
77

88
# CHANNELS define the bundle channels used in the bundle.
9-
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "preview,fast,stable")
9+
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
1010
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
11-
# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=preview,fast,stable)
12-
# - use environment variables to overwrite this value (e.g export CHANNELS="preview,fast,stable")
11+
# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable)
12+
# - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable")
1313
ifneq ($(origin CHANNELS), undefined)
1414
BUNDLE_CHANNELS := --channels=$(CHANNELS)
1515
endif
@@ -35,9 +35,25 @@ IMAGE_TAG_BASE ?= kubealex.com/k8s-mediaserver-operator
3535
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
3636
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)
3737

38+
# BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command
39+
BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
40+
41+
# USE_IMAGE_DIGESTS defines if images are resolved via tags or digests
42+
# You can enable this value if you would like to use SHA Based Digests
43+
# To enable set flag to true
44+
USE_IMAGE_DIGESTS ?= false
45+
ifeq ($(USE_IMAGE_DIGESTS), true)
46+
BUNDLE_GEN_FLAGS += --use-image-digests
47+
endif
48+
49+
# Set the Operator SDK version to use. By default, what is installed on the system is used.
50+
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
51+
OPERATOR_SDK_VERSION ?= v1.32.0
52+
3853
# Image URL to use all building/pushing image targets
3954
IMG ?= controller:latest
4055

56+
.PHONY: all
4157
all: docker-build
4258

4359
##@ General
@@ -53,37 +69,62 @@ all: docker-build
5369
# More info on the awk command:
5470
# http://linuxcommand.org/lc3_adv_awk.php
5571

72+
.PHONY: help
5673
help: ## Display this help.
5774
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
5875

5976
##@ Build
6077

78+
.PHONY: run
6179
run: helm-operator ## Run against the configured Kubernetes cluster in ~/.kube/config
6280
$(HELM_OPERATOR) run
6381

82+
.PHONY: docker-build
6483
docker-build: ## Build docker image with the manager.
6584
docker build -t ${IMG} .
6685

86+
.PHONY: docker-push
6787
docker-push: ## Push docker image with the manager.
6888
docker push ${IMG}
6989

90+
# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
91+
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
92+
# - able to use docker buildx . More info: https://docs.docker.com/build/buildx/
93+
# - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/
94+
# - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=<myregistry/image:<tag>> than the export will fail)
95+
# To properly provided solutions that supports more than one platform you should use this option.
96+
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
97+
.PHONY: docker-buildx
98+
docker-buildx: test ## Build and push docker image for the manager for cross-platform support
99+
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
100+
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
101+
- docker buildx create --name project-v3-builder
102+
docker buildx use project-v3-builder
103+
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
104+
- docker buildx rm project-v3-builder
105+
rm Dockerfile.cross
106+
70107
##@ Deployment
71108

109+
.PHONY: install
72110
install: kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
73111
$(KUSTOMIZE) build config/crd | kubectl apply -f -
74112

113+
.PHONY: uninstall
75114
uninstall: kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
76115
$(KUSTOMIZE) build config/crd | kubectl delete -f -
77116

117+
.PHONY: deploy
78118
deploy: kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
79119
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
80120
$(KUSTOMIZE) build config/default | kubectl apply -f -
81121

122+
.PHONY: undeploy
82123
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
83124
$(KUSTOMIZE) build config/default | kubectl delete -f -
84125

85126
OS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
86-
ARCH := $(shell uname -m | sed 's/x86_64/amd64/')
127+
ARCH := $(shell uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
87128

88129
.PHONY: kustomize
89130
KUSTOMIZE = $(shell pwd)/bin/kustomize
@@ -93,7 +134,7 @@ ifeq (,$(shell which kustomize 2>/dev/null))
93134
@{ \
94135
set -e ;\
95136
mkdir -p $(dir $(KUSTOMIZE)) ;\
96-
curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v3.5.4/kustomize_v3.5.4_$(OS)_$(ARCH).tar.gz | \
137+
curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v4.5.7/kustomize_v4.5.7_$(OS)_$(ARCH).tar.gz | \
97138
tar xzf - -C bin/ ;\
98139
}
99140
else
@@ -109,20 +150,36 @@ ifeq (,$(shell which helm-operator 2>/dev/null))
109150
@{ \
110151
set -e ;\
111152
mkdir -p $(dir $(HELM_OPERATOR)) ;\
112-
curl -sSLo $(HELM_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.8.0/helm-operator_$(OS)_$(ARCH) ;\
153+
curl -sSLo $(HELM_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.32.0/helm-operator_$(OS)_$(ARCH) ;\
113154
chmod +x $(HELM_OPERATOR) ;\
114155
}
115156
else
116157
HELM_OPERATOR = $(shell which helm-operator)
117158
endif
118159
endif
119160

161+
.PHONY: operator-sdk
162+
OPERATOR_SDK ?= ./bin/operator-sdk
163+
operator-sdk: ## Download operator-sdk locally if necessary.
164+
ifeq (,$(wildcard $(OPERATOR_SDK)))
165+
ifeq (, $(shell which operator-sdk 2>/dev/null))
166+
@{ \
167+
set -e ;\
168+
mkdir -p $(dir $(OPERATOR_SDK)) ;\
169+
curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_$(OS)_$(ARCH) ;\
170+
chmod +x $(OPERATOR_SDK) ;\
171+
}
172+
else
173+
OPERATOR_SDK = $(shell which operator-sdk)
174+
endif
175+
endif
176+
120177
.PHONY: bundle
121-
bundle: kustomize ## Generate bundle manifests and metadata, then validate generated files.
122-
operator-sdk generate kustomize manifests -q
178+
bundle: kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files.
179+
$(OPERATOR_SDK) generate kustomize manifests -q
123180
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
124-
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
125-
operator-sdk bundle validate ./bundle
181+
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
182+
$(OPERATOR_SDK) bundle validate ./bundle
126183

127184
.PHONY: bundle-build
128185
bundle-build: ## Build the bundle image.
@@ -140,7 +197,7 @@ ifeq (,$(shell which opm 2>/dev/null))
140197
@{ \
141198
set -e ;\
142199
mkdir -p $(dir $(OPM)) ;\
143-
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.15.1/$(OS)-$(ARCH)-opm ;\
200+
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.0/$(OS)-$(ARCH)-opm ;\
144201
chmod +x $(OPM) ;\
145202
}
146203
else

PROJECT

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Code generated by tool. DO NOT EDIT.
2+
# This file is used to track the info used to scaffold your project
3+
# and allow the plugins properly work.
4+
# More info: https://book.kubebuilder.io/reference/project-config.html
15
domain: kubealex.com
26
layout:
37
- helm.sdk.operatorframework.io/v1
@@ -13,4 +17,4 @@ resources:
1317
group: charts
1418
kind: K8SMediaserver
1519
version: v1
16-
version: "3"
20+
version: "3"

config/default/kustomization.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,4 @@ patchesStrategicMerge:
2727
# endpoint w/o any authn/z, please comment the following line.
2828
- manager_auth_proxy_patch.yaml
2929

30-
# Mount the controller config file for loading manager configurations
31-
# through a ComponentConfig type
32-
#- manager_config_patch.yaml
30+

config/default/manager_auth_proxy_patch.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,30 @@ metadata:
88
spec:
99
template:
1010
spec:
11+
affinity:
12+
nodeAffinity:
13+
requiredDuringSchedulingIgnoredDuringExecution:
14+
nodeSelectorTerms:
15+
- matchExpressions:
16+
- key: kubernetes.io/arch
17+
operator: In
18+
values:
19+
- amd64
20+
- arm64
21+
- ppc64le
22+
- s390x
23+
- key: kubernetes.io/os
24+
operator: In
25+
values:
26+
- linux
1127
containers:
1228
- name: kube-rbac-proxy
1329
securityContext:
1430
allowPrivilegeEscalation: false
1531
capabilities:
1632
drop:
1733
- "ALL"
18-
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.13.0
34+
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.13.1
1935
args:
2036
- "--secure-listen-address=0.0.0.0:8443"
2137
- "--upstream=http://127.0.0.1:8080/"

config/default/manager_config_patch.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,3 @@ spec:
88
spec:
99
containers:
1010
- name: manager
11-
args:
12-
- "--config=controller_manager_config.yaml"
13-
volumeMounts:
14-
- name: manager-config
15-
mountPath: /controller_manager_config.yaml
16-
subPath: controller_manager_config.yaml
17-
volumes:
18-
- name: manager-config
19-
configMap:
20-
name: manager-config

config/manager/controller_manager_config.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

config/manager/kustomization.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
11
resources:
22
- manager.yaml
3-
4-
generatorOptions:
5-
disableNameSuffixHash: true
6-
7-
configMapGenerator:
8-
- name: manager-config
9-
files:
10-
- controller_manager_config.yaml

config/manager/manager.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ kind: Namespace
33
metadata:
44
labels:
55
control-plane: controller-manager
6+
app.kubernetes.io/name: namespace
7+
app.kubernetes.io/instance: system
8+
app.kubernetes.io/component: manager
9+
app.kubernetes.io/created-by: k8s-mediaserver-operator
10+
app.kubernetes.io/part-of: k8s-mediaserver-operator
11+
app.kubernetes.io/managed-by: kustomize
612
name: system
713
---
814
apiVersion: apps/v1
@@ -12,6 +18,12 @@ metadata:
1218
namespace: system
1319
labels:
1420
control-plane: controller-manager
21+
app.kubernetes.io/name: deployment
22+
app.kubernetes.io/instance: controller-manager
23+
app.kubernetes.io/component: manager
24+
app.kubernetes.io/created-by: k8s-mediaserver-operator
25+
app.kubernetes.io/part-of: k8s-mediaserver-operator
26+
app.kubernetes.io/managed-by: kustomize
1527
spec:
1628
selector:
1729
matchLabels:
@@ -24,6 +36,26 @@ spec:
2436
labels:
2537
control-plane: controller-manager
2638
spec:
39+
# TODO(user): Uncomment the following code to configure the nodeAffinity expression
40+
# according to the platforms which are supported by your solution.
41+
# It is considered best practice to support multiple architectures. You can
42+
# build your manager image using the makefile target docker-buildx.
43+
# affinity:
44+
# nodeAffinity:
45+
# requiredDuringSchedulingIgnoredDuringExecution:
46+
# nodeSelectorTerms:
47+
# - matchExpressions:
48+
# - key: kubernetes.io/arch
49+
# operator: In
50+
# values:
51+
# - amd64
52+
# - arm64
53+
# - ppc64le
54+
# - s390x
55+
# - key: kubernetes.io/os
56+
# operator: In
57+
# values:
58+
# - linux
2759
securityContext:
2860
runAsNonRoot: true
2961
# TODO(user): For common cases that do not require escalating privileges

0 commit comments

Comments
 (0)