Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change example deployment scheme in multi-node cluster #14

Merged
merged 1 commit into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ rolebinding.rbac.authorization.k8s.io/csi-attacher-role-cfg created
deploying hostpath components
service/csi-hostpath-attacher created
statefulset.apps/csi-hostpath-attacher created
daemonset.apps/csi-hostpathplugin created
statefulset.apps/csi-hostpathplugin created
service/csi-hostpath-provisioner created
statefulset.apps/csi-hostpath-provisioner created
```
Expand All @@ -50,7 +50,7 @@ $ kubectl get pods
NAME READY STATUS RESTARTS AGE
csi-hostpath-attacher-0 1/1 Running 0 5m47s
csi-hostpath-provisioner-0 1/1 Running 0 5m47s
csi-hostpathplugin-lzzlc 2/2 Running 0 5m45s
csi-hostpathplugin-0 2/2 Running 0 5m45s
```

From the root directory, deploy the application pods including a storage class, a PVC, and a pod which mounts a volume using the Hostpath driver found in directory `./examples`:
Expand Down
10 changes: 10 additions & 0 deletions deploy/hostpath/csi-hostpath-attacher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ spec:
labels:
app: csi-hostpath-attacher
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- csi-hostpathplugin
topologyKey: kubernetes.io/hostname
serviceAccountName: csi-attacher
containers:
- name: csi-attacher
Expand Down
25 changes: 24 additions & 1 deletion deploy/hostpath/csi-hostpath-plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
kind: DaemonSet
# Service defined here, plus serviceName below in StatefulSet,
# are needed only because of condition explained in
# https://github.com/kubernetes/kubernetes/issues/69608

kind: Service
apiVersion: v1
metadata:
name: csi-hostpathplugin
labels:
app: csi-hostpathplugin
spec:
selector:
app: csi-hostpathplugin
ports:
- name: dummy
port: 12345
---
kind: StatefulSet
apiVersion: apps/v1
metadata:
name: csi-hostpathplugin
spec:
serviceName: "csi-hostpathplugin"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it is a bit dumb in this particular usage of StatefulSet, but until someone from SIG-App declares that leaving out the Service is okay (see kubernetes/kubernetes#69608) we should have a fake Service with that name defined in this .yaml file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's still no csi-hostpathplugin service, is it? Please add it to this file and link to that issue in the explanation why we have the useless Service.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added Service with comment, force-pushed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add replicas: 1 to be clear.

# One replica only:
# Host path driver only works when everything runs
# on a single node. We achieve that by starting it once and then
# co-locate all other pods via inter-pod affinity
replicas: 1
selector:
matchLabels:
app: csi-hostpathplugin
Expand Down
10 changes: 10 additions & 0 deletions deploy/hostpath/csi-hostpath-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ spec:
labels:
app: csi-hostpath-provisioner
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- csi-hostpathplugin
topologyKey: kubernetes.io/hostname
serviceAccountName: csi-provisioner
containers:
- name: csi-provisioner
Expand Down
12 changes: 11 additions & 1 deletion examples/csi-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ apiVersion: v1
metadata:
name: my-csi-app
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- csi-hostpathplugin
topologyKey: kubernetes.io/hostname
containers:
- name: my-frontend
image: busybox
Expand All @@ -13,4 +23,4 @@ spec:
volumes:
- name: my-csi-volume
persistentVolumeClaim:
claimName: csi-pvc # defined in csi-pvs.yaml
claimName: csi-pvc # defined in csi-pvs.yaml