Skip to content

Commit 71f924d

Browse files
Add GKE Autopilot allowlist for CSI driver (#1776)
Co-authored-by: jatin.singh <[email protected]>
1 parent 5d4ea60 commit 71f924d

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

scenarios/gcp/gke/cluster.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ import (
1919
//go:embed workloadallowlist.yaml
2020
var autopilotAllowListYAML string
2121

22+
//go:embed workloadcsiallowlist.yaml
23+
var workloadCSIAllowListYAML string
24+
2225
type Params struct {
2326
autopilot bool
2427
}
@@ -65,7 +68,7 @@ func NewGKECluster(env gcp.Environment, opts ...Option) (*kubeComp.Cluster, erro
6568
// Apply allowlist if autopilot is enabled
6669
if params.autopilot {
6770
_, err = yaml.NewConfigGroup(env.Ctx(), env.Namer.ResourceName("autopilot-allowlist"), &yaml.ConfigGroupArgs{
68-
YAML: []string{autopilotAllowListYAML},
71+
YAML: []string{autopilotAllowListYAML, workloadCSIAllowListYAML},
6972
}, pulumi.Provider(gkeKubeProvider), env.WithProviders(config.ProviderGCP))
7073
if err != nil {
7174
return err
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
apiVersion: auto.gke.io/v1
2+
kind: WorkloadAllowlist
3+
metadata:
4+
annotations:
5+
autopilot.gke.io/no-connect: "true"
6+
name: datadog-datadog-csi-driver-daemonset-exemption-v1.0.1
7+
exemptions:
8+
- autogke-no-write-mode-hostpath
9+
- autogke-no-host-port
10+
- autogke-default-linux-capabilities
11+
- autogke-disallow-privilege
12+
matchingCriteria:
13+
containers:
14+
- env:
15+
- name: NODE_ID
16+
envFrom:
17+
- secretRef:
18+
name: ^datadog-.*
19+
image: ^.*$
20+
name: csi-node-driver
21+
securityContext:
22+
privileged: true # privileged security context is needed to perform volume mounts on other pods.
23+
args:
24+
- --apm-host-socket-path=/var/run/datadog/apm.socket
25+
- --dsd-host-socket-path=/var/run/datadog/dsd.socket
26+
volumeMounts:
27+
- name: plugin-dir # stores the socket on which CSI node server service is exposed. It is created by the node server and needs to be writeable.
28+
mountPath: /csi
29+
- name: apm-socket
30+
mountPath: /var/run/datadog
31+
readOnly: true
32+
- mountPath: /var/lib/kubelet/pods # write mode is required to perform a volume mount. csi driver has to create a subdirectory under /var/lib/kubelet/pods/<pod-uid>/volumes/kubernetes.io~csi/datadog/mount.
33+
name: mountpoint-dir
34+
- name: csi-node-driver-registrar
35+
image: ^.*$
36+
args:
37+
- "--csi-address=$(ADDRESS)"
38+
- "--kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)"
39+
env:
40+
- name: ADDRESS
41+
- name: DRIVER_REG_SOCK_PATH
42+
volumeMounts:
43+
- name: plugin-dir
44+
mountPath: /csi
45+
readOnly: true
46+
- name: registration-dir
47+
mountPath: /registration # registration-dir needs to be writeable to store the registration information and register the driver with kubelet.
48+
volumes:
49+
- name: plugin-dir
50+
hostPath:
51+
path: /var/lib/kubelet/plugins/datadog.csi/driver
52+
- name: registration-dir
53+
hostPath:
54+
path: /var/lib/kubelet/plugins_registry
55+
- hostPath:
56+
path: /var/lib/kubelet/pods
57+
name: mountpoint-dir
58+
- hostPath:
59+
path: /var/run/datadog
60+
name: apm-socket
61+
- hostPath:
62+
path: /var/run/datadog
63+
name: dsd-socket

0 commit comments

Comments
 (0)