Skip to content

Commit

Permalink
Switch to use kustomize
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheng Pan committed Dec 17, 2019
1 parent 0117032 commit 9b89635
Show file tree
Hide file tree
Showing 11 changed files with 262 additions and 224 deletions.
66 changes: 66 additions & 0 deletions deploy/kubernetes/base/controller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: fsx-csi-controller
namespace: kube-system
spec:
replicas: 2
selector:
matchLabels:
app: fsx-csi-controller
template:
metadata:
labels:
app: fsx-csi-controller
spec:
nodeSelector:
beta.kubernetes.io/os: linux
serviceAccount: fsx-csi-controller-sa
priorityClassName: system-cluster-critical
tolerations:
- key: CriticalAddonsOnly
operator: Exists
containers:
- name: fsx-plugin
image: amazon/aws-fsx-csi-driver:latest
args :
- --endpoint=$(CSI_ENDPOINT)
- --logtostderr
- --v=5
env:
- name: CSI_ENDPOINT
value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: aws-secret
key: key_id
optional: true
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: aws-secret
key: access_key
optional: true
volumeMounts:
- name: socket-dir
mountPath: /var/lib/csi/sockets/pluginproxy/
- name: csi-provisioner
image: quay.io/k8scsi/csi-provisioner:v1.3.0
args:
- --timeout=5m
- --csi-address=$(ADDRESS)
- --v=5
- --enable-leader-election
- --leader-election-type=leases
env:
- name: ADDRESS
value: /var/lib/csi/sockets/pluginproxy/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /var/lib/csi/sockets/pluginproxy/
volumes:
- name: socket-dir
emptyDir: {}

8 changes: 8 additions & 0 deletions deploy/kubernetes/base/csidriver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---

apiVersion: storage.k8s.io/v1beta1
kind: CSIDriver
metadata:
name: fsx.csi.aws.com
spec:
attachRequired: false
8 changes: 8 additions & 0 deletions deploy/kubernetes/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: kube-system
resources:
- controller.yaml
- node.yaml
- rbac.yaml
- csidriver.yaml
91 changes: 91 additions & 0 deletions deploy/kubernetes/base/node.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---

kind: DaemonSet
apiVersion: apps/v1
metadata:
name: fsx-csi-node
namespace: kube-system
spec:
selector:
matchLabels:
app: fsx-csi-node
template:
metadata:
labels:
app: fsx-csi-node
spec:
nodeSelector:
beta.kubernetes.io/os: linux
hostNetwork: true
containers:
- name: fsx-plugin
securityContext:
privileged: true
image: amazon/aws-fsx-csi-driver:latest
args:
- --endpoint=$(CSI_ENDPOINT)
- --logtostderr
- --v=5
env:
- name: CSI_ENDPOINT
value: unix:/csi/csi.sock
volumeMounts:
- name: kubelet-dir
mountPath: /var/lib/kubelet
mountPropagation: "Bidirectional"
- name: plugin-dir
mountPath: /csi
ports:
- containerPort: 9810
name: healthz
protocol: TCP
livenessProbe:
failureThreshold: 5
httpGet:
path: /healthz
port: healthz
initialDelaySeconds: 10
timeoutSeconds: 3
periodSeconds: 2
- name: csi-driver-registrar
image: quay.io/k8scsi/csi-node-driver-registrar:v1.1.0
args:
- --csi-address=$(ADDRESS)
- --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)
- --v=5
env:
- name: ADDRESS
value: /csi/csi.sock
- name: DRIVER_REG_SOCK_PATH
value: /var/lib/kubelet/plugins/fsx.csi.aws.com/csi.sock
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- name: plugin-dir
mountPath: /csi
- name: registration-dir
mountPath: /registration
- name: liveness-probe
imagePullPolicy: Always
image: quay.io/k8scsi/livenessprobe:v1.1.0
args:
- --csi-address=/csi/csi.sock
- --health-port=9810
volumeMounts:
- mountPath: /csi
name: plugin-dir
volumes:
- name: kubelet-dir
hostPath:
path: /var/lib/kubelet
type: Directory
- name: registration-dir
hostPath:
path: /var/lib/kubelet/plugins_registry/
type: Directory
- name: plugin-dir
hostPath:
path: /var/lib/kubelet/plugins/fsx.csi.aws.com/
type: DirectoryOrCreate
57 changes: 57 additions & 0 deletions deploy/kubernetes/base/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---

apiVersion: v1
kind: ServiceAccount
metadata:
name: fsx-csi-controller-sa
namespace: kube-system
#Enable if EKS IAM for SA is used
#annotations:
# eks.amazonaws.com/role-arn: arn:aws:iam::586565787010:role/fsx-csi-role

---

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: fsx-csi-external-provisioner-role
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- apiGroups: ["storage.k8s.io"]
resources: ["csinodes"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "watch", "list", "delete", "update", "create"]

---

kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: fsx-csi-external-provisioner-binding
subjects:
- kind: ServiceAccount
name: fsx-csi-controller-sa
namespace: kube-system
roleRef:
kind: ClusterRole
name: fsx-csi-external-provisioner-role
apiGroup: rbac.authorization.k8s.io

---

Loading

0 comments on commit 9b89635

Please sign in to comment.