From c94174c9bed40976e566bbcd8296687652252bf4 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Tue, 15 Jan 2019 14:44:15 -0500 Subject: [PATCH] Provide a writable location for flexvolume plugins Fix tests and add a note about how to update testdata --- pkg/controller/template/test_data/README.md | 7 +++++++ .../-etc-kubernetes-kubelet-plugins-volume-exec-.dummy | 6 ++++++ .../-etc-kubernetes-kubelet-plugins-volume-exec-.dummy | 6 ++++++ .../-etc-kubernetes-kubelet-plugins-volume-exec-.dummy | 6 ++++++ .../-etc-kubernetes-kubelet-plugins-volume-exec-.dummy | 6 ++++++ .../master/01-master-kubelet/aws/units/kubelet.service | 1 + .../master/01-master-kubelet/libvirt/units/kubelet.service | 1 + .../master/01-master-kubelet/none/units/kubelet.service | 1 + .../-etc-kubernetes-kubelet-plugins-volume-exec-.dummy | 6 ++++++ .../-etc-kubernetes-kubelet-plugins-volume-exec-.dummy | 6 ++++++ .../-etc-kubernetes-kubelet-plugins-volume-exec-.dummy | 6 ++++++ .../-etc-kubernetes-kubelet-plugins-volume-exec-.dummy | 6 ++++++ .../worker/01-worker-kubelet/aws/units/kubelet.service | 1 + .../worker/01-worker-kubelet/libvirt/units/kubelet.service | 1 + .../worker/01-worker-kubelet/none/units/kubelet.service | 1 + templates/master/00-master/_base/files/volume-plugins.yaml | 5 +++++ .../master/01-master-kubelet/_base/units/kubelet.yaml | 1 + templates/worker/00-worker/_base/files/volume-plugins.yaml | 5 +++++ .../worker/01-worker-kubelet/_base/units/kubelet.yaml | 1 + 19 files changed, 73 insertions(+) create mode 100644 pkg/controller/template/test_data/README.md create mode 100644 pkg/controller/template/test_data/templates/master/00-master/aws/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy create mode 100644 pkg/controller/template/test_data/templates/master/00-master/libvirt/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy create mode 100644 pkg/controller/template/test_data/templates/master/00-master/none/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy create mode 100644 pkg/controller/template/test_data/templates/master/00-master/openstack/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy create mode 100644 pkg/controller/template/test_data/templates/worker/00-worker/aws/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy create mode 100644 pkg/controller/template/test_data/templates/worker/00-worker/libvirt/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy create mode 100644 pkg/controller/template/test_data/templates/worker/00-worker/none/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy create mode 100644 pkg/controller/template/test_data/templates/worker/00-worker/openstack/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy create mode 100644 templates/master/00-master/_base/files/volume-plugins.yaml create mode 100644 templates/worker/00-worker/_base/files/volume-plugins.yaml diff --git a/pkg/controller/template/test_data/README.md b/pkg/controller/template/test_data/README.md new file mode 100644 index 0000000000..c3e25c0adc --- /dev/null +++ b/pkg/controller/template/test_data/README.md @@ -0,0 +1,7 @@ +## Updating test data after making changes to original + +test data templates can be updated via: + +``` +go test ./pkg/controller/template/... -u +``` diff --git a/pkg/controller/template/test_data/templates/master/00-master/aws/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy b/pkg/controller/template/test_data/templates/master/00-master/aws/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy new file mode 100644 index 0000000000..745cb9e5d9 --- /dev/null +++ b/pkg/controller/template/test_data/templates/master/00-master/aws/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy @@ -0,0 +1,6 @@ +contents: + source: data:, + verification: {} +filesystem: root +mode: 493 +path: /etc/kubernetes/kubelet-plugins/volume/exec/.dummy diff --git a/pkg/controller/template/test_data/templates/master/00-master/libvirt/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy b/pkg/controller/template/test_data/templates/master/00-master/libvirt/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy new file mode 100644 index 0000000000..745cb9e5d9 --- /dev/null +++ b/pkg/controller/template/test_data/templates/master/00-master/libvirt/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy @@ -0,0 +1,6 @@ +contents: + source: data:, + verification: {} +filesystem: root +mode: 493 +path: /etc/kubernetes/kubelet-plugins/volume/exec/.dummy diff --git a/pkg/controller/template/test_data/templates/master/00-master/none/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy b/pkg/controller/template/test_data/templates/master/00-master/none/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy new file mode 100644 index 0000000000..745cb9e5d9 --- /dev/null +++ b/pkg/controller/template/test_data/templates/master/00-master/none/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy @@ -0,0 +1,6 @@ +contents: + source: data:, + verification: {} +filesystem: root +mode: 493 +path: /etc/kubernetes/kubelet-plugins/volume/exec/.dummy diff --git a/pkg/controller/template/test_data/templates/master/00-master/openstack/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy b/pkg/controller/template/test_data/templates/master/00-master/openstack/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy new file mode 100644 index 0000000000..745cb9e5d9 --- /dev/null +++ b/pkg/controller/template/test_data/templates/master/00-master/openstack/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy @@ -0,0 +1,6 @@ +contents: + source: data:, + verification: {} +filesystem: root +mode: 493 +path: /etc/kubernetes/kubelet-plugins/volume/exec/.dummy diff --git a/pkg/controller/template/test_data/templates/master/01-master-kubelet/aws/units/kubelet.service b/pkg/controller/template/test_data/templates/master/01-master-kubelet/aws/units/kubelet.service index 7a55cafb88..08e1131c81 100644 --- a/pkg/controller/template/test_data/templates/master/01-master-kubelet/aws/units/kubelet.service +++ b/pkg/controller/template/test_data/templates/master/01-master-kubelet/aws/units/kubelet.service @@ -22,6 +22,7 @@ contents: | --minimum-container-ttl-duration=6m0s \ --client-ca-file=/etc/kubernetes/ca.crt \ --cloud-provider=aws \ + --volume-plugin-dir=/etc/kubernetes/kubelet-plugins/volume/exec \ \ --anonymous-auth=false \ --register-with-taints=node-role.kubernetes.io/master=:NoSchedule \ diff --git a/pkg/controller/template/test_data/templates/master/01-master-kubelet/libvirt/units/kubelet.service b/pkg/controller/template/test_data/templates/master/01-master-kubelet/libvirt/units/kubelet.service index 45abd5d904..3526dc2efe 100644 --- a/pkg/controller/template/test_data/templates/master/01-master-kubelet/libvirt/units/kubelet.service +++ b/pkg/controller/template/test_data/templates/master/01-master-kubelet/libvirt/units/kubelet.service @@ -22,6 +22,7 @@ contents: | --minimum-container-ttl-duration=6m0s \ --client-ca-file=/etc/kubernetes/ca.crt \ --cloud-provider= \ + --volume-plugin-dir=/etc/kubernetes/kubelet-plugins/volume/exec \ \ --anonymous-auth=false \ --register-with-taints=node-role.kubernetes.io/master=:NoSchedule \ diff --git a/pkg/controller/template/test_data/templates/master/01-master-kubelet/none/units/kubelet.service b/pkg/controller/template/test_data/templates/master/01-master-kubelet/none/units/kubelet.service index 45abd5d904..3526dc2efe 100644 --- a/pkg/controller/template/test_data/templates/master/01-master-kubelet/none/units/kubelet.service +++ b/pkg/controller/template/test_data/templates/master/01-master-kubelet/none/units/kubelet.service @@ -22,6 +22,7 @@ contents: | --minimum-container-ttl-duration=6m0s \ --client-ca-file=/etc/kubernetes/ca.crt \ --cloud-provider= \ + --volume-plugin-dir=/etc/kubernetes/kubelet-plugins/volume/exec \ \ --anonymous-auth=false \ --register-with-taints=node-role.kubernetes.io/master=:NoSchedule \ diff --git a/pkg/controller/template/test_data/templates/worker/00-worker/aws/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy b/pkg/controller/template/test_data/templates/worker/00-worker/aws/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy new file mode 100644 index 0000000000..745cb9e5d9 --- /dev/null +++ b/pkg/controller/template/test_data/templates/worker/00-worker/aws/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy @@ -0,0 +1,6 @@ +contents: + source: data:, + verification: {} +filesystem: root +mode: 493 +path: /etc/kubernetes/kubelet-plugins/volume/exec/.dummy diff --git a/pkg/controller/template/test_data/templates/worker/00-worker/libvirt/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy b/pkg/controller/template/test_data/templates/worker/00-worker/libvirt/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy new file mode 100644 index 0000000000..745cb9e5d9 --- /dev/null +++ b/pkg/controller/template/test_data/templates/worker/00-worker/libvirt/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy @@ -0,0 +1,6 @@ +contents: + source: data:, + verification: {} +filesystem: root +mode: 493 +path: /etc/kubernetes/kubelet-plugins/volume/exec/.dummy diff --git a/pkg/controller/template/test_data/templates/worker/00-worker/none/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy b/pkg/controller/template/test_data/templates/worker/00-worker/none/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy new file mode 100644 index 0000000000..745cb9e5d9 --- /dev/null +++ b/pkg/controller/template/test_data/templates/worker/00-worker/none/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy @@ -0,0 +1,6 @@ +contents: + source: data:, + verification: {} +filesystem: root +mode: 493 +path: /etc/kubernetes/kubelet-plugins/volume/exec/.dummy diff --git a/pkg/controller/template/test_data/templates/worker/00-worker/openstack/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy b/pkg/controller/template/test_data/templates/worker/00-worker/openstack/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy new file mode 100644 index 0000000000..745cb9e5d9 --- /dev/null +++ b/pkg/controller/template/test_data/templates/worker/00-worker/openstack/files/-etc-kubernetes-kubelet-plugins-volume-exec-.dummy @@ -0,0 +1,6 @@ +contents: + source: data:, + verification: {} +filesystem: root +mode: 493 +path: /etc/kubernetes/kubelet-plugins/volume/exec/.dummy diff --git a/pkg/controller/template/test_data/templates/worker/01-worker-kubelet/aws/units/kubelet.service b/pkg/controller/template/test_data/templates/worker/01-worker-kubelet/aws/units/kubelet.service index fd23ed6931..bb2904077d 100644 --- a/pkg/controller/template/test_data/templates/worker/01-worker-kubelet/aws/units/kubelet.service +++ b/pkg/controller/template/test_data/templates/worker/01-worker-kubelet/aws/units/kubelet.service @@ -19,6 +19,7 @@ contents: | --allow-privileged \ --node-labels=node-role.kubernetes.io/worker \ --minimum-container-ttl-duration=6m0s \ + --volume-plugin-dir=/etc/kubernetes/kubelet-plugins/volume/exec \ --client-ca-file=/etc/kubernetes/ca.crt \ --cloud-provider=aws \ \ diff --git a/pkg/controller/template/test_data/templates/worker/01-worker-kubelet/libvirt/units/kubelet.service b/pkg/controller/template/test_data/templates/worker/01-worker-kubelet/libvirt/units/kubelet.service index 9f5bd33f73..b0240b0b4e 100644 --- a/pkg/controller/template/test_data/templates/worker/01-worker-kubelet/libvirt/units/kubelet.service +++ b/pkg/controller/template/test_data/templates/worker/01-worker-kubelet/libvirt/units/kubelet.service @@ -19,6 +19,7 @@ contents: | --allow-privileged \ --node-labels=node-role.kubernetes.io/worker \ --minimum-container-ttl-duration=6m0s \ + --volume-plugin-dir=/etc/kubernetes/kubelet-plugins/volume/exec \ --client-ca-file=/etc/kubernetes/ca.crt \ --cloud-provider= \ \ diff --git a/pkg/controller/template/test_data/templates/worker/01-worker-kubelet/none/units/kubelet.service b/pkg/controller/template/test_data/templates/worker/01-worker-kubelet/none/units/kubelet.service index 9f5bd33f73..b0240b0b4e 100644 --- a/pkg/controller/template/test_data/templates/worker/01-worker-kubelet/none/units/kubelet.service +++ b/pkg/controller/template/test_data/templates/worker/01-worker-kubelet/none/units/kubelet.service @@ -19,6 +19,7 @@ contents: | --allow-privileged \ --node-labels=node-role.kubernetes.io/worker \ --minimum-container-ttl-duration=6m0s \ + --volume-plugin-dir=/etc/kubernetes/kubelet-plugins/volume/exec \ --client-ca-file=/etc/kubernetes/ca.crt \ --cloud-provider= \ \ diff --git a/templates/master/00-master/_base/files/volume-plugins.yaml b/templates/master/00-master/_base/files/volume-plugins.yaml new file mode 100644 index 0000000000..d73d1ea1bb --- /dev/null +++ b/templates/master/00-master/_base/files/volume-plugins.yaml @@ -0,0 +1,5 @@ +filesystem: "root" +mode: 0755 +path: "/etc/kubernetes/kubelet-plugins/volume/exec/.dummy" +contents: + inline: | diff --git a/templates/master/01-master-kubelet/_base/units/kubelet.yaml b/templates/master/01-master-kubelet/_base/units/kubelet.yaml index 83eab51ae4..d50e855d4f 100644 --- a/templates/master/01-master-kubelet/_base/units/kubelet.yaml +++ b/templates/master/01-master-kubelet/_base/units/kubelet.yaml @@ -24,6 +24,7 @@ contents: | --minimum-container-ttl-duration=6m0s \ --client-ca-file=/etc/kubernetes/ca.crt \ --cloud-provider={{cloudProvider .}} \ + --volume-plugin-dir=/etc/kubernetes/kubelet-plugins/volume/exec \ {{.CloudProviderConfig -}} \ --anonymous-auth=false \ --register-with-taints=node-role.kubernetes.io/master=:NoSchedule \ diff --git a/templates/worker/00-worker/_base/files/volume-plugins.yaml b/templates/worker/00-worker/_base/files/volume-plugins.yaml new file mode 100644 index 0000000000..d73d1ea1bb --- /dev/null +++ b/templates/worker/00-worker/_base/files/volume-plugins.yaml @@ -0,0 +1,5 @@ +filesystem: "root" +mode: 0755 +path: "/etc/kubernetes/kubelet-plugins/volume/exec/.dummy" +contents: + inline: | diff --git a/templates/worker/01-worker-kubelet/_base/units/kubelet.yaml b/templates/worker/01-worker-kubelet/_base/units/kubelet.yaml index 3383699f40..393d399c99 100644 --- a/templates/worker/01-worker-kubelet/_base/units/kubelet.yaml +++ b/templates/worker/01-worker-kubelet/_base/units/kubelet.yaml @@ -21,6 +21,7 @@ contents: | --allow-privileged \ --node-labels=node-role.kubernetes.io/worker \ --minimum-container-ttl-duration=6m0s \ + --volume-plugin-dir=/etc/kubernetes/kubelet-plugins/volume/exec \ --client-ca-file=/etc/kubernetes/ca.crt \ --cloud-provider={{cloudProvider .}} \ {{.CloudProviderConfig -}} \