Skip to content

Commit

Permalink
Set terminationGracePeriod for oneagent pods (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismuellner committed Feb 28, 2022
1 parent 0da5deb commit cb9e12d
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/controllers/dynakube/oneagent/daemonset/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
dynatracev1beta1 "github.com/Dynatrace/dynatrace-operator/src/api/v1beta1"
"github.com/Dynatrace/dynatrace-operator/src/deploymentmetadata"
"github.com/Dynatrace/dynatrace-operator/src/kubeobjects"
"github.com/Dynatrace/dynatrace-operator/src/kubeobjects/address_of"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
Expand All @@ -24,6 +25,8 @@ const (
annotationVersion = dynatracev1beta1.InternalFlagPrefix + "version"

defaultUnprivilegedServiceAccountName = "dynatrace-dynakube-oneagent-unprivileged"
// normal oneagent shutdown scenario with some extra time
defaultTerminationGracePeriod = 80

hostRootVolumeName = "host-root"
hostRootVolumeMount = "/mnt/root"
Expand Down Expand Up @@ -223,17 +226,18 @@ func (dsInfo *builderInfo) podSpec() corev1.PodSpec {
SecurityContext: dsInfo.unprivilegedSecurityContext(),
VolumeMounts: volumeMounts,
}},
ImagePullSecrets: imagePullSecrets,
HostNetwork: true,
HostPID: true,
HostIPC: false,
NodeSelector: dsInfo.hostInjectSpec.NodeSelector,
PriorityClassName: dsInfo.hostInjectSpec.PriorityClassName,
ServiceAccountName: defaultUnprivilegedServiceAccountName,
Tolerations: dsInfo.hostInjectSpec.Tolerations,
DNSPolicy: dnsPolicy,
Volumes: volumes,
Affinity: affinity,
ImagePullSecrets: imagePullSecrets,
HostNetwork: true,
HostPID: true,
HostIPC: false,
NodeSelector: dsInfo.hostInjectSpec.NodeSelector,
PriorityClassName: dsInfo.hostInjectSpec.PriorityClassName,
ServiceAccountName: defaultUnprivilegedServiceAccountName,
Tolerations: dsInfo.hostInjectSpec.Tolerations,
DNSPolicy: dnsPolicy,
Volumes: volumes,
Affinity: affinity,
TerminationGracePeriodSeconds: address_of.Int64(defaultTerminationGracePeriod),
}
}

Expand Down

0 comments on commit cb9e12d

Please sign in to comment.