Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jbessaguet committed Jan 28, 2017
1 parent 259a105 commit b18fd44
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 0 deletions.
12 changes: 12 additions & 0 deletions claim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: nfs
annotations:
volume.beta.kubernetes.io/storage-class: "test-nfs"
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Mi
7 changes: 7 additions & 0 deletions class.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
name: test-nfs
annotations:
storageclass.beta.kubernetes.io/is-default-class: "true"
provisioner: test/nfs
70 changes: 70 additions & 0 deletions deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
kind: Service
apiVersion: v1
metadata:
name: nfs-provisioner
labels:
app: nfs-provisioner
spec:
ports:
- name: nfs
port: 2049
- name: mountd
port: 20048
- name: rpcbind
port: 111
- name: rpcbind-udp
port: 111
protocol: UDP
selector:
app: nfs-provisioner
---
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: nfs-provisioner
spec:
replicas: 1
template:
metadata:
labels:
app: nfs-provisioner
spec:
containers:
- name: nfs-provisioner
image: quay.io/kubernetes_incubator/nfs-provisioner:v1.0.3
ports:
- name: nfs
containerPort: 2049
- name: mountd
containerPort: 20048
- name: rpcbind
containerPort: 111
- name: rpcbind-udp
containerPort: 111
protocol: UDP
securityContext:
capabilities:
add:
- DAC_READ_SEARCH
args:
- "-provisioner=test/nfs"
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: SERVICE_NAME
value: nfs-provisioner
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: export-volume
mountPath: /export
serviceAccountName: nfs-provisioner
volumes:
- name: export-volume
hostPath:
path: /srv
20 changes: 20 additions & 0 deletions openshift-clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
kind: ClusterRole
apiVersion: v1
metadata:
name: nfs-provisioner-runner
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: ["watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["services", "endpoints"]
verbs: ["get"]
34 changes: 34 additions & 0 deletions openshift-scc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
allowHostDirVolumePlugin: true
allowHostIPC: false
allowHostNetwork: false
allowHostPID: false
allowHostPorts: false
allowPrivilegedContainer: false
allowedCapabilities:
- DAC_READ_SEARCH
apiVersion: v1
defaultAddCapabilities: null
fsGroup:
type: MustRunAs
kind: SecurityContextConstraints
metadata:
annotations: null
name: nfs-provisioner
priority: null
readOnlyRootFilesystem: false
requiredDropCapabilities:
- KILL
- MKNOD
- SYS_CHROOT
runAsUser:
type: RunAsAny
seLinuxContext:
type: MustRunAs
supplementalGroups:
type: RunAsAny
volumes:
- configMap
- downwardAPI
- emptyDir
- persistentVolumeClaim
- secret
11 changes: 11 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# https://github.com/kubernetes-incubator/nfs-provisioner/blob/master/docs/deployment.md

oc create -f serviceaccount.yaml
oc create -f openshift-scc.yaml
oc create -f openshift-clusterrole.yaml
oadm policy add-scc-to-user nfs-provisioner system:serviceaccount:default:nfs-provisioner
oadm policy add-cluster-role-to-user nfs-provisioner-runner system:serviceaccount:default:nfs-provisioner
oc create -f deployment.yaml
oc create -f class.yaml
# oc create -f claim.yaml
4 changes: 4 additions & 0 deletions serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: nfs-provisioner

0 comments on commit b18fd44

Please sign in to comment.