Skip to content

Commit

Permalink
add support for confidential pods
Browse files Browse the repository at this point in the history
  • Loading branch information
arc9693 committed Sep 24, 2024
1 parent 98c2cc8 commit 6166a27
Show file tree
Hide file tree
Showing 45 changed files with 3,300 additions and 69 deletions.
Binary file modified charts/latest/azurefile-csi-driver-v0.0.0.tgz
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,56 @@ roleRef:
name: csi-{{ .Values.rbac.name }}-node-secret-role
apiGroup: rbac.authorization.k8s.io
{{ end }}
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-{{ .Values.rbac.name }}-node-pod-role
labels:
{{- include "azurefile.labels" . | nindent 4 }}
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-{{ .Values.rbac.name }}-node-pod-binding
labels:
{{- include "azurefile.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccount.node }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: csi-{{ .Values.rbac.name }}-node-pod-role
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: csi-{{ .Values.rbac.name }}-node-rc-role
labels:
{{- include "azurefile.labels" . | nindent 4 }}
rules:
- apiGroups: ["node.k8s.io"]
resources: ["runtimeclasses"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: csi-{{ .Values.rbac.name }}-node-rc-binding
labels:
{{- include "azurefile.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccount.node }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: csi-{{ .Values.rbac.name }}-node-rc-role
apiGroup: rbac.authorization.k8s.io
---
6 changes: 6 additions & 0 deletions deploy/csi-azurefile-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ spec:
- name: CSI_ENDPOINT
value: unix:///csi/csi.sock
volumeMounts:
- mountPath: /run/kata-containers/shared/direct-volumes
name: kata-direct-volumes
- mountPath: /csi
name: socket-dir
- mountPath: /root/.azcopy
Expand All @@ -186,3 +188,7 @@ spec:
hostPath:
path: /etc/kubernetes/
type: DirectoryOrCreate
- name: kata-direct-volumes
hostPath:
path: /run/kata-containers/shared/direct-volumes/
type: DirectoryOrCreate
6 changes: 6 additions & 0 deletions deploy/csi-azurefile-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ spec:
name: azure-cred
- mountPath: /dev
name: device-dir
- mountPath: /run/kata-containers/shared/direct-volumes
name: kata-direct-volumes
resources:
limits:
memory: 400Mi
Expand Down Expand Up @@ -165,4 +167,8 @@ spec:
path: /dev
type: Directory
name: device-dir
- name: kata-direct-volumes
hostPath:
path: /run/kata-containers/shared/direct-volumes/
type: DirectoryOrCreate
---
53 changes: 53 additions & 0 deletions deploy/example-cc/cc-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-azurefile
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
storageClassName: azurefile-csi
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx
name: cc-deployment-azurefile
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
name: cc-deployment-azurefile
spec:
runtimeClassName: kata-cc
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: cc-deployment-azurefile
image: mcr.microsoft.com/oss/nginx/nginx:1.19.5
command:
- "/bin/bash"
- "-c"
- set -euo pipefail; while true; do echo $(date) >> /mnt/azurefile/kata-cc.txt; sleep 1; done
volumeMounts:
- name: cc-azurefile
mountPath: "/mnt/azurefile"
readOnly: false
volumes:
- name: cc-azurefile
persistentVolumeClaim:
claimName: pvc-azurefile
strategy:
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
type: RollingUpdate
24 changes: 24 additions & 0 deletions deploy/example-cc/cc-nginx-pod-azurefile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
kind: Pod
apiVersion: v1
metadata:
name: cc-nginx-azurefile
spec:
runtimeClassName: kata-cc
nodeSelector:
"kubernetes.io/os": linux
containers:
- image: mcr.microsoft.com/oss/nginx/nginx:1.19.5
name: nginx-azurefile
command:
- "/bin/bash"
- "-c"
- set -euo pipefail; while true; do echo $(date) >> /mnt/azurefile/kata-cc.txt; sleep 1; done
volumeMounts:
- name: persistent-storage
mountPath: "/mnt/azurefile"
readOnly: false
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: pvc-azurefile
44 changes: 44 additions & 0 deletions deploy/example-cc/cc-statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: cc-statefulset-azurefile
labels:
app: nginx
spec:
podManagementPolicy: Parallel # default is OrderedReady
serviceName: cc-statefulset-azurefile
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
runtimeClassName: kata-cc
nodeSelector:
"kubernetes.io/os": linux
containers:
- name: cc-statefulset-azurefile
image: mcr.microsoft.com/oss/nginx/nginx:1.19.5
command:
- "/bin/bash"
- "-c"
- set -euo pipefail; while true; do echo $(date) >> /mnt/azurefile/kata-cc.txt; sleep 1; done
volumeMounts:
- name: persistent-storage
mountPath: /mnt/azurefile
readOnly: false
updateStrategy:
type: RollingUpdate
selector:
matchLabels:
app: nginx
volumeClaimTemplates:
- metadata:
name: persistent-storage
spec:
storageClassName: azurefile-csi
accessModes: ["ReadWriteMany"]
resources:
requests:
storage: 100Gi
72 changes: 72 additions & 0 deletions deploy/example-cc/shared-pvc-across-runtimes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
kind: Pod
apiVersion: v1
metadata:
name: nginx-azurefile
spec:
nodeSelector:
"kubernetes.io/os": linux
containers:
- image: mcr.microsoft.com/oss/nginx/nginx:1.19.5
name: nginx-azurefile
command:
- "/bin/bash"
- "-c"
- set -euo pipefail; while true; do echo $(date) >> /mnt/azurefile/runc.txt; sleep 1; done
volumeMounts:
- name: persistent-storage
mountPath: "/mnt/azurefile"
readOnly: false
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: pvc-azurefile
---
kind: Pod
apiVersion: v1
metadata:
name: kata-nginx-azurefile
spec:
runtimeClassName: kata
nodeSelector:
"kubernetes.io/os": linux
containers:
- image: mcr.microsoft.com/oss/nginx/nginx:1.19.5
name: nginx-azurefile
command:
- "/bin/bash"
- "-c"
- set -euo pipefail; while true; do echo $(date) >> /mnt/azurefile/kata.txt; sleep 1; done
volumeMounts:
- name: persistent-storage
mountPath: "/mnt/azurefile"
readOnly: false
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: pvc-azurefile
---
kind: Pod
apiVersion: v1
metadata:
name: kata-cc-nginx-azurefile
spec:
runtimeClassName: kata-cc
nodeSelector:
"kubernetes.io/os": linux
containers:
- image: mcr.microsoft.com/oss/nginx/nginx:1.19.5
name: nginx-azurefile
command:
- "/bin/bash"
- "-c"
- set -euo pipefail; while true; do echo $(date) >> /mnt/azurefile/kata-cc.txt; sleep 1; done
volumeMounts:
- name: persistent-storage
mountPath: "/mnt/azurefile"
readOnly: false
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: pvc-azurefile
---
23 changes: 23 additions & 0 deletions deploy/rbac-csi-azurefile-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,26 @@ roleRef:
kind: ClusterRole
name: csi-azurefile-controller-secret-role
apiGroup: rbac.authorization.k8s.io
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-azurefile-controller-pod-role
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-azurefile-controller-pod-binding
subjects:
- kind: ServiceAccount
name: csi-azurefile-controller-sa
namespace: kube-system
roleRef:
kind: ClusterRole
name: csi-azurefile-controller-pod-role
apiGroup: rbac.authorization.k8s.io
---
45 changes: 45 additions & 0 deletions deploy/rbac-csi-azurefile-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,48 @@ roleRef:
kind: ClusterRole
name: csi-azurefile-node-secret-role
apiGroup: rbac.authorization.k8s.io
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-azurefile-node-pod-role
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-azurefile-node-pod-binding
subjects:
- kind: ServiceAccount
name: csi-azurefile-node-sa
namespace: kube-system
roleRef:
kind: ClusterRole
name: csi-azurefile-node-pod-role
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: csi-azurefile-node-rc-role
rules:
- apiGroups: ["node.k8s.io"]
resources: ["runtimeclasses"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: csi-azurefile-node-rc-binding
subjects:
- kind: ServiceAccount
name: csi-azurefile-node-sa
namespace: kube-system
roleRef:
kind: ClusterRole
name: csi-azurefile-node-rc-role
apiGroup: rbac.authorization.k8s.io
---
Loading

0 comments on commit 6166a27

Please sign in to comment.