This guide will show you how you can manually migrate from apiVersion: dynatrace.com/v1beta1 to apiVersion: dynatrace.com/v1beta5 of the DynaKube.
Introduced in: Dynatrace Operator version 0.3.0
Deprecated in: Dynatrace Operator version 1.6.0
Last supported in: Dynatrace Operator version 1.6.2
Introduced in: Dynatrace Operator version 1.6.0
When migrating your DynaKube, remember to update the apiVersion field as well as any other fields that have changed
DynaKube CRD v1beta1 apiVersion will be removed in a future release. We recommend that you prepare for this ahead of time. User action will be required when upgrading from Dynatrace Operator version 1.1.0 and earlier.
Query the current storage version of the DynaKube CRD:
kubectl get customresourcedefinitions dynakubes.dynatrace.com -o jsonpath='{.spec.versions[?(@.storage==true)].name}'
Query the stored versions of the DynaKube CRD:
kubectl get customresourcedefinitions dynakubes.dynatrace.com -o jsonpath='{.status.storedVersions}'
If the stored versions list contains versions that will be removed with the CRD update, user intervention is required.
Make sure that the old apiVersion is no longer referenced by any manifest. This includes resources that load manifests from external sources, like Helm releases or ArgoCD applications. When using GitOps, always check the source that manifests are synced from, because diffing may take conversion into account.
To ensure that the Kubernetes storage backend no longer contains outdated DynaKube objects, we recommend updating them in place.
for item in $(kubectl get dynakubes.dynatrace.com -A -o jsonpath='{range .items[*]}{.metadata.namespace}{"/"}{.metadata.name}{"\n"}{end}'); donamespace=${item%/*}name=${item#*/}kubectl get dynakubes.dynatrace.com -n $namespace $name -o yaml | kubectl replace -f -done
Do not use the command kubectl apply, because it only writes data when changes are detected.
Once the old apiVersion is no longer referenced, it is safe to update the CRD status.
kubectl patch customresourcedefinitions dynakubes.dynatrace.com --subresource status --type merge -p '{"status":{"storedVersions":["<current storage version>"]}}'
metadataEnrichment sectionThe feature flag for enabling metadata enrichment (feature.dynatrace.com/metadata-enrichment: true/false) was moved to a dedicated field:
apiVersion: dynatrace.com/v1beta4kind: DynaKubemetadata:name: examplenamespace: dynatracespec:metadataEnrichment:enabled: true # replaces feature.dynatrace.com/metadata-enrichment: true#...
dynatraceApiRequestThreshold fieldThe feature flag for controlling how often Dynatrace Operator can ping the Dynatrace API (feature.dynatrace.com/dynatrace-api-request-threshold: <number>) was moved to a dedicated field:
apiVersion: dynatrace.com/v1beta4kind: DynaKubemetadata:name: examplenamespace: dynatracespec:dynatraceApiRequestThreshold: 10 # replaces feature.dynatrace.com/dynatrace-api-request-threshold: "10"#...
secCompProfile field for OneAgentThe feature flag that controls which seccomp profile the OneAgent DaemonSet uses (feature.dynatrace.com/oneagent-seccomp-profile:example) has been moved to a dedicated field:
apiVersion: dynatrace.com/v1beta4kind: DynaKubemetadata:name: examplenamespace: dynatracespec:oneAgent:hostMonitoring:secCompProfile: example # replaces feature.dynatrace.com/oneagent-seccomp-profile: "example"#...
The feature flag that controlled how many mount attempts the CSI driver would make before stopping (feature.dynatrace.com/max-csi-mount-attempts: 5) has been replaced with a timeout-based feature flag. This was done due to the difficulty of determining how many attempts equal a given timeout.
feature.dynatrace.com/max-csi-mount-timeout: "8m" # replaces feature.dynatrace.com/max-csi-mount-attempts: "10"
spec.namespaceSelectorThe spec.namespaceSelector field was moved to each feature subsection that it affects.
apiVersion: dynatrace.com/v1beta4kind: DynaKubemetadata:name: examplenamespace: dynatracespec:oneAgent:cloudNativeFullstack:namespaceSelector: ... # replaces spec.namespaceSelector# ...
autoUpdateThe spec.oneAgent.<mode>.autoUpdate: true/false field is deprecated in v1beta5, so it shouldn't be used.
We recommend the following:
If you want autoUpdate: true, do not set image, codeModulesImage, or version.
apiVersion: dynatrace.com/v1beta5kind: DynaKubemetadata:name: examplenamespace: dynatracespec:oneAgent:cloudNativeFullstack: {} # same as autoUpdate: true# ...
If you want autoUpdate: false, set image, codeModulesImage or version
apiVersion: dynatrace.com/v1beta5kind: DynaKubemetadata:name: examplenamespace: dynatracespec:oneAgent:cloudNativeFullstack:image: ... # same effect as autoUpdate: falsecodeModulesImage: # same effect as autoUpdate: false# ...---apiVersion: dynatrace.com/v1beta5kind: DynaKubemetadata:name: examplenamespace: dynatracespec:oneAgent:cloudNativeFullstack:version: ... # replaces autoUpdate: false# ...
spec.applicationMonitoring.useCSIDriverThe spec.applicationMonitoring.useCSIDriver: true/false field has been removed.
The CSI driver is now used when installed as part of the Dynatrace Operator installation.
spec.kubernetesMonitoringThe deprecated field spec.kubernetesMonitoring was removed in favor of using the current spec.activeGate section. This example shows you before and after:
Before
apiVersion: dynatrace.com/v1beta1kind: DynaKubemetadata:name: examplenamespace: dynatracespec:kubernetesMonitoring:enabled: truereplicas: ...image: ...group: ...customProperties: ...resources: ...nodeSelector: ...tolerations: ...labels: ...env: ...#...
After
apiVersion: dynatrace.com/v1beta4kind: DynaKubemetadata:name: examplenamespace: dynatracespec:activeGate:capabilities:- kubernetes-monitoring #<-- explicitly enable Kubernetes monitoringreplicas: ...image: ...group: ...customProperties: ...resources: ...nodeSelector: ...tolerations: ...labels: ...env: ...#...
spec.routingThe deprecated field spec.routing was removed in favor of using the current spec.activeGate section. This example shows you before and after:
Before
apiVersion: dynatrace.com/v1beta1kind: DynaKubemetadata:name: examplenamespace: dynatracespec:routing:enabled: truereplicas: ...image: ...group: ...customProperties: ...resources: ...nodeSelector: ...tolerations: ...labels: ...env: ...#...
After
apiVersion: dynatrace.com/v1beta4kind: DynaKubemetadata:name: examplenamespace: dynatracespec:activeGate:capabilities:- routing #<-- explicitly enable routingreplicas: ...image: ...group: ...customProperties: ...resources: ...nodeSelector: ...tolerations: ...labels: ...env: ...#...