Skip to content

Commit 42a5bef

Browse files
authored
Adapt Makefile to exclude CSI and add v1beta1 changes to CSV (Dynatrace#633)
* Adapt Makefile to exclude CSI and add v1beta1 changes to CSV * Change according to Review
1 parent 47f91cd commit 42a5bef

File tree

7 files changed

+536
-151
lines changed

7 files changed

+536
-151
lines changed

Makefile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,13 @@ manifests: controller-gen kustomize
169169
$(KUSTOMIZE) build config/crd | cat - config/deploy/openshift/openshift.yaml > temp
170170
mv temp config/deploy/openshift/openshift.yaml
171171

172+
ifeq ($(OUT), olm)
173+
cat config/deploy/kubernetes/kubernetes.yaml > config/deploy/kubernetes/kubernetes-$(OUT).yaml
174+
cat config/deploy/openshift/openshift.yaml > config/deploy/openshift/openshift-$(OUT).yaml
175+
else
172176
cat config/deploy/kubernetes/kubernetes.yaml config/deploy/kubernetes/kubernetes-csi.yaml > config/deploy/kubernetes/kubernetes-$(OUT).yaml
173177
cat config/deploy/openshift/openshift.yaml config/deploy/openshift/openshift-csi.yaml > config/deploy/openshift/openshift-$(OUT).yaml
174-
178+
endif
175179
make reset-kustomization-files
176180

177181
reset-kustomization-files: kustomize
@@ -245,14 +249,14 @@ endif
245249
SERVICE_ACCOUNTS=--extra-service-accounts dynatrace-dynakube-oneagent
246250
SERVICE_ACCOUNTS+=--extra-service-accounts dynatrace-dynakube-oneagent-unprivileged
247251
SERVICE_ACCOUNTS+=--extra-service-accounts dynatrace-kubernetes-monitoring
248-
SERVICE_ACCOUNTS+=--extra-service-accounts dynatrace-activegate
249252

250253
# Generate bundle manifests and metadata, then validate generated files.
251-
.PHONY: bundle
252-
bundle: export OLM=true
253-
bundle: export OUT=olm
254-
bundle: manifests kustomize
255-
operator-sdk generate kustomize manifests -q
254+
.PHONY: bundle bundle-olm
255+
# to avoid necessity of calling make bundle with OUT=olm
256+
bundle:
257+
make bundle-olm OLM=true OUT=olm
258+
bundle-olm: manifests kustomize
259+
operator-sdk generate kustomize manifests -q --apis-dir ./src/api/
256260
cd config/deploy/$(PLATFORM) && $(KUSTOMIZE) edit set image "quay.io/dynatrace/dynatrace-operator:snapshot"=$(OLM_IMAGE)
257261
$(KUSTOMIZE) build config/olm/$(PLATFORM) | operator-sdk generate bundle --overwrite --version $(VERSION) $(SERVICE_ACCOUNTS) $(BUNDLE_METADATA_OPTS)
258262
make OUT=all reset-kustomization-files
@@ -295,7 +299,7 @@ bundle-build:
295299
docker build -f ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile -t $(BUNDLE_IMG) ./config/olm/$(PLATFORM)/
296300

297301
setup-pre-commit:
298-
$(info WARNING Make sure that golangci-lint is installed, for more info see https://golangci-lint.run/usage/install/")
302+
$(info WARNING "Make sure that golangci-lint is installed, for more info see https://golangci-lint.run/usage/install/")
299303
GO111MODULE=off go get github.com/daixiang0/gci
300304
GO111MODULE=off go get golang.org/x/tools/cmd/goimports
301305
cp ./.github/pre-commit ./.git/hooks/pre-commit

PROJECT

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ domain: com
22
layout:
33
- go.kubebuilder.io/v3
44
plugins:
5-
go.sdk.operatorframework.io/v3: {}
5+
manifests.sdk.operatorframework.io/v2: {}
6+
scorecard.sdk.operatorframework.io/v2: {}
67
projectName: dynatrace-operator
78
repo: github.com/Dynatrace/dynatrace-operator
89
resources:
910
- api:
1011
crdVersion: v1
1112
namespaced: true
1213
group: dynatrace
14+
domain: com
1315
kind: DynaKube
1416
path: github.com/Dynatrace/dynatrace-operator/src/api/v1alpha1
1517
version: v1alpha1
@@ -20,9 +22,11 @@ resources:
2022
crdVersion: v1
2123
namespaced: true
2224
group: dynatrace
25+
domain: com
2326
kind: DynaKube
2427
path: github.com/Dynatrace/dynatrace-operator/src/api/v1beta1
2528
version: v1beta1
29+
controller: true
2630
webhooks:
2731
conversion: true
2832
webhookVersion: v1

config/helm/chart/default/templates/Common/operator/clusterrole-operator.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,15 @@ rules:
8989
verbs:
9090
- get
9191
- update
92+
{{- if eq (default false .Values.olm) true}}
93+
- apiGroups:
94+
- security.openshift.io
95+
resourceNames:
96+
- host
97+
- privileged
98+
resources:
99+
- securitycontextconstraints
100+
verbs:
101+
- use
102+
{{ end }}
92103
{{ end }}

config/helm/chart/default/templates/Common/webhook/clusterrole-webhook.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,15 @@ rules:
8383
- deploymentconfigs
8484
verbs:
8585
- get
86+
{{- if eq (default false .Values.olm) true}}
87+
- apiGroups:
88+
- security.openshift.io
89+
resourceNames:
90+
- host
91+
- privileged
92+
resources:
93+
- securitycontextconstraints
94+
verbs:
95+
- use
96+
{{ end }}
8697
{{ end }}

0 commit comments

Comments
 (0)