Skip to content

Commit

Permalink
Update deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirvivien committed Jan 16, 2019
1 parent 660c357 commit 8169bdc
Show file tree
Hide file tree
Showing 13 changed files with 90 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ test:
go vet github.com/kubernetes-csi/csi-driver-host-path/pkg/...
hostpath:
if [ ! -d ./vendor ]; then dep ensure -vendor-only; fi
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X github.com/kubernetes-csi/csi-driver-host-path/pkg/hostpath.vendorVersion=$(REV) -extldflags "-static"' -o _output/hostpathplugin ./app
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-X github.com/kubernetes-csi/csi-driver-host-path/pkg/hostpath.vendorVersion=$(REV) -extldflags "-static"' -o _output/hostpathplugin ./cmd/hostpathplugin
hostpath-container: hostpath
docker build -t $(IMAGE_TAG) -f ./app/Dockerfile .
docker build -t $(IMAGE_TAG) -f ./cmd/Dockerfile .
push: hostpath-container
docker push $(IMAGE_TAG)
clean:
Expand Down
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions deploy/deploy-hostpath.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# This script captures the steps required to successfully
# deploy the hostpath plugin driver. This should be considered
# authoritative and all updates for this process should be
# done here and referenced elsewhere.

# The script assumes that kubectl is available on the OS path
# where it is executed.

K8S_RELEASE=${K8S_RELEASE:-"release-1.13"}
PROVISIONER_RELEASE=${PROVISIONER_RELEASE:-"release-1.0"}
ATTACHER_RELEASE=${ATTACHER_RELEASE:-"release-1.0"}
SKIP_CRD_INSTALL=${SKIP_CRD_INSTALL:-"true"}
BASE_DIR=$(dirname "$0")

# apply CSIDriver and CSINodeInfo API objects
if [ "${SKIP_CRD_INSTALL}" != "true" ] ; then
kubectl apply -f https://raw.githubusercontent.com/kubernetes/csi-api/${K8S_RELEASE}/pkg/crd/manifests/csidriver.yaml --validate=false
kubectl apply -f https://raw.githubusercontent.com/kubernetes/csi-api/${K8S_RELEASE}/pkg/crd/manifests/csinodeinfo.yaml --validate=false
fi

# rbac rules
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-provisioner/${PROVISIONER_RELEASE}/deploy/kubernetes/rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-attacher/${ATTACHER_RELEASE}/deploy/kubernetes/rbac.yaml

# deploy hostpath plugin and registrar sidecar
kubectl apply -f ${BASE_DIR}/hostpath
6 changes: 0 additions & 6 deletions deploy/hostpath/README.md

This file was deleted.

5 changes: 3 additions & 2 deletions deploy/hostpath/csi-hostpath-attacher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,18 @@ spec:
serviceAccountName: csi-attacher
containers:
- name: csi-attacher
image: gcr.io/gke-release/csi-attacher:v1.0.0-gke.0
image: quay.io/k8scsi/csi-attacher:v1.0.1
imagePullPolicy: Always
args:
- --v=5
- --csi-address=$(ADDRESS)
env:
- name: ADDRESS
value: /csi/csi.sock
imagePullPolicy: Always
volumeMounts:
- mountPath: /csi
name: socket-dir

volumes:
- hostPath:
path: /var/lib/kubelet/plugins/csi-hostpath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ spec:
labels:
app: csi-hostpathplugin
spec:
serviceAccountName: csi-driver-registrar
serviceAccountName: csi-node-sa
hostNetwork: true
containers:
- name: driver-registrar
image: gcr.io/gke-release/csi-driver-registrar:v1.0.1-gke.0
- name: node-driver-registrar
image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.1
imagePullPolicy: Always
lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "rm -rf /registration/csi-hostpath /registration/csi-hostpath-reg.sock"]
args:
- --v=5
- --csi-address=/csi/csi.sock
Expand All @@ -26,14 +31,14 @@ spec:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
imagePullPolicy: Always
volumeMounts:
- mountPath: /csi
name: socket-dir
- mountPath: /registration
name: registration-dir

- name: hostpath
image: quay.io/k8scsi/hostpathplugin:v1.0.0
image: quay.io/k8scsi/hostpathplugin:v1.0.1
args:
- "--v=5"
- "--endpoint=$(CSI_ENDPOINT)"
Expand Down
2 changes: 1 addition & 1 deletion deploy/hostpath/csi-hostpath-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
serviceAccountName: csi-provisioner
containers:
- name: csi-provisioner
image: gcr.io/gke-release/csi-provisioner:v1.0.0-gke.0
image: quay.io/k8scsi/csi-provisioner:v1.0.1
args:
- "--provisioner=csi-hostpath"
- "--csi-address=$(ADDRESS)"
Expand Down
46 changes: 46 additions & 0 deletions deploy/hostpath/csi-hostpath-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: csi-node-sa

---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-node-sa
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "update"]
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get", "list"]
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["create","get","update"]
- apiGroups: ["storage.k8s.io"]
resources: ["volumeattachments"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["csi.storage.k8s.io"]
resources: ["csidrivers"]
verbs: ["create", "get", "list", "watch", "update"]
- apiGroups: ["csi.storage.k8s.io"]
resources: ["csinodeinfos"]
verbs: ["create", "get", "list", "watch", "update"]

---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-node-sa
subjects:
- kind: ServiceAccount
name: csi-nodeplugin
namespace: default
roleRef:
kind: ClusterRole
name: csi-node-sa
apiGroup: rbac.authorization.k8s.io
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 8169bdc

Please sign in to comment.