Skip to content

Commit

Permalink
Update deprecated api versions (#216)
Browse files Browse the repository at this point in the history
* Remove deprecated api versions
  • Loading branch information
DTMad committed Aug 11, 2021
1 parent ac12bea commit f4fa150
Show file tree
Hide file tree
Showing 36 changed files with 3,149 additions and 402 deletions.
64 changes: 55 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
SHELL = bash

# Current Operator version
VERSION ?= 0.0.1
# Default bundle image tag
BUNDLE_IMG ?= controller-bundle:$(VERSION)
# Default platform for bundle
PLATFORM="kubernetes"
PLATFORM=kubernetes
# Options for 'bundle-build'
ifneq ($(origin CHANNELS), undefined)
BUNDLE_CHANNELS := --channels=$(CHANNELS)
Expand All @@ -18,12 +20,13 @@ ifeq ($(origin IMG),undefined)
ifeq ($(shell git branch --show-current),master)
IMG=quay.io/dynatrace/dynatrace-operator:snapshot
else
IMG=quay.io/dynatrace/dynatrace-operator:snapshot-$(shell git branch --show-current | sed "s\#[^a-zA-Z0-9_-]\#-\#g")
IMG=quay.io/dynatrace/dynatrace-operator:snapshot-$(shell git branch --show-current | sed "s/[^a-zA-Z0-9_-]/-/g")
endif
endif

# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false,crdVersions=v1"
CRD_OPTIONS_OCP311 ?= "crd:trivialVersions=true,preserveUnknownFields=false,crdVersions=v1beta1"

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -85,10 +88,28 @@ deploy-ocp: manifests kustomize
cd config/deploy && $(KUSTOMIZE) edit set image "quay.io/dynatrace/dynatrace-operator:snapshot"=${IMG}
$(KUSTOMIZE) build config/deploy | oc apply -f -

deploy-ocp3.11: manifests-ocp311 kustomize
oc get project dynatrace || oc adm new-project --node-selector="" dynatrace
rm -f config/deploy/kustomization.yaml
mkdir -p config/deploy
cd config/deploy && $(KUSTOMIZE) create
cd config/deploy && $(KUSTOMIZE) edit add base ../openshift3.11
cd config/deploy && $(KUSTOMIZE) edit set image "quay.io/dynatrace/dynatrace-operator:snapshot"=${IMG}
$(KUSTOMIZE) build config/deploy | oc apply -f -

deploy-local:
./build/deploy_local.sh

deploy-local-easy: export TAG=snapshot-$(shell git branch --show-current | sed "s/[^a-zA-Z0-9_-]/-/g")
deploy-local-easy:
./build/deploy_local.sh

# Generate manifests e.g. CRD, RBAC etc.
manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) paths="./..." output:crd:artifacts:config=config/crd/bases
python3 ./hack/customize_crds.py
$(CONTROLLER_GEN) $(CRD_OPTIONS) paths="./..." output:crd:artifacts:config=config/crd/default/bases

manifests-ocp311: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS_OCP311) paths="./..." output:crd:artifacts:config=config/crd/ocp311/bases

# Run go fmt against code
fmt:
Expand Down Expand Up @@ -142,17 +163,42 @@ else
KUSTOMIZE=$(shell which kustomize)
endif

SERVICE_ACCOUNTS=--extra-service-accounts dynatrace-dynakube-oneagent
SERVICE_ACCOUNTS+=--extra-service-accounts dynatrace-dynakube-oneagent-unprivileged
SERVICE_ACCOUNTS+=--extra-service-accounts dynatrace-kubernetes-monitoring
SERVICE_ACCOUNTS+=--extra-service-accounts dynatrace-routing

# Generate bundle manifests and metadata, then validate generated files.
.PHONY: bundle
bundle: manifests kustomize
operator-sdk generate kustomize manifests -q
cd config/olm && $(KUSTOMIZE) edit set image "quay.io/dynatrace/dynatrace-operator:snapshot"=$(IMG)
$(KUSTOMIZE) build config/olm | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
cd config/olm/$(PLATFORM) && $(KUSTOMIZE) edit set image "quay.io/dynatrace/dynatrace-operator:snapshot"="$(IMG)"
$(KUSTOMIZE) build config/olm/$(PLATFORM) | operator-sdk generate bundle --overwrite --version $(VERSION) $(SERVICE_ACCOUNTS) $(BUNDLE_METADATA_OPTS)
operator-sdk bundle validate ./bundle
rm -rf ./config/olm/$(PLATFORM)/$(VERSION)
mkdir -p ./config/olm/$(PLATFORM)/$(VERSION)
mv ./bundle ./config/olm/$(PLATFORM)/$(VERSION)
mv ./bundle.Dockerfile ./config/olm/$(PLATFORM)/$(VERSION)
mv ./bundle/* ./config/olm/$(PLATFORM)/$(VERSION)
mv ./config/olm/$(PLATFORM)/$(VERSION)/manifests/dynatrace-operator.clusterserviceversion.yaml ./config/olm/$(PLATFORM)/$(VERSION)/manifests/dynatrace-operator.v$(VERSION).clusterserviceversion.yaml
mv ./bundle.Dockerfile ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile
grep -v '/tests/scorecard/' ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile > ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile.output
mv ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile.output ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile
sed 's/bundle/$(VERSION)/' ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile > ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile.output
mv ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile.output ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile
awk '/operators.operatorframework.io.metrics.project_layout/ { print; print " operators.operatorframework.io.bundle.channel.default.v1: alpha"; next }1' ./config/olm/$(PLATFORM)/$(VERSION)/metadata/annotations.yaml > ./config/olm/$(PLATFORM)/$(VERSION)/metadata/annotations.yaml.output
mv ./config/olm/$(PLATFORM)/$(VERSION)/metadata/annotations.yaml.output ./config/olm/$(PLATFORM)/$(VERSION)/metadata/annotations.yaml
awk '/operators.operatorframework.io.$(VERSION).mediatype.v1/ { print "LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha"; print; next }1' ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile > ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile.output
mv ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile.output ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile
echo 'LABEL com.redhat.openshift.versions="v4.5,v4.6,v4.7"' >> ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile
echo 'LABEL com.redhat.delivery.operator.bundle=true' >> ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile
echo 'LABEL com.redhat.delivery.backport=true' >> ./config/olm/$(PLATFORM)/bundle-$(VERSION).Dockerfile
ifeq ($(PLATFORM), openshift)
sed 's/\bkubectl\b/oc/g' ./config/olm/$(PLATFORM)/$(VERSION)/manifests/dynatrace-operator.v$(VERSION).clusterserviceversion.yaml > ./config/olm/$(PLATFORM)/$(VERSION)/manifests/dynatrace-operator.v$(VERSION).clusterserviceversion.yaml.output
mv ./config/olm/$(PLATFORM)/$(VERSION)/manifests/dynatrace-operator.v$(VERSION).clusterserviceversion.yaml.output ./config/olm/$(PLATFORM)/$(VERSION)/manifests/dynatrace-operator.v$(VERSION).clusterserviceversion.yaml
endif

.PHONY: bundle-minimal
bundle-minimal: bundle
find ./config/olm/${PLATFORM}/${VERSION}/manifests/ ! \( -name "dynatrace-operator.v${VERSION}.clusterserviceversion.yaml" -o -name "dynatrace.com_dynakubes.yaml" \) -type f -exec rm {} +

# Build the bundle image.
.PHONY: bundle-build
Expand Down
6 changes: 3 additions & 3 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
domain: com
layout: go.kubebuilder.io/v2
layout: go.kubebuilder.io/v3
projectName: dynatrace-operator
repo: github.com/Dynatrace/dynatrace-operator
resources:
- group: dynatrace
kind: DynaKube
version: v1alpha1
version: 3-alpha
version: "3"
plugins:
go.sdk.operatorframework.io/v2-alpha: {}
go.sdk.operatorframework.io/v3: {}
3 changes: 0 additions & 3 deletions api/v1alpha1/dynakube_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,10 @@ type FullStackSpec struct {

// Optional: Arguments to the OneAgent installer
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="OneAgent installer arguments",order=21,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:advanced","urn:alm:descriptor:com.tectonic.ui:hidden"}
// +listType=set
Args []string `json:"args,omitempty"`

// Optional: List of environment variables to set for the installer
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="OneAgent environment variable installer arguments",order=22,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:advanced","urn:alm:descriptor:com.tectonic.ui:hidden"}
// +listType=set
Env []corev1.EnvVar `json:"env,omitempty"`

// Optional: If specified, indicates the pod's priority. Name must be defined by creating a PriorityClass object with that
Expand Down Expand Up @@ -227,7 +225,6 @@ type CapabilityProperties struct {

// Optional: List of environment variables to set for the ActiveGate
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Environment variables",order=39,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:advanced","urn:alm:descriptor:com.tectonic.ui:hidden"}
// +listType=set
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Environment variables"
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:advanced,urn:alm:descriptor:com.tectonic.ui:text"
Expand Down
6 changes: 6 additions & 0 deletions config/common/kubernetes-monitoring/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- clusterrole-kubernetes-monitoring.yaml
- clusterrolebinding-kubernetes-monitoring.yaml
- serviceaccount-kubernetes-monitoring.yaml
17 changes: 0 additions & 17 deletions config/common/kustomization.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions config/common/oneagent/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- serviceaccount-oneagent-unprivileged.yaml
- serviceaccount-oneagent.yaml
9 changes: 9 additions & 0 deletions config/common/operator/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- clusterrole-operator.yaml
- clusterrolebinding-operator.yaml
- deployment-operator.yaml
- role-operator.yaml
- rolebinding-operator.yaml
- serviceaccount-operator.yaml
4 changes: 4 additions & 0 deletions config/common/routing/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- serviceaccount-routing.yaml
33 changes: 0 additions & 33 deletions config/common/webhook/clusterrole-webhook.yaml

This file was deleted.

140 changes: 0 additions & 140 deletions config/common/webhook/deployment-webhook.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions config/common/webhook/mutatingwebhookconfiguration.yaml

This file was deleted.

Loading

0 comments on commit f4fa150

Please sign in to comment.