diff --git a/cluster/addons/registry/registry-pv.yaml.in b/cluster/addons/registry/registry-pv.yaml.in new file mode 100644 index 00000000000..b6fd2b35295 --- /dev/null +++ b/cluster/addons/registry/registry-pv.yaml.in @@ -0,0 +1,16 @@ +kind: PersistentVolume +apiVersion: v1 +metadata: + name: kube-system-kube-registry-pv + labels: + kubernetes.io/cluster-service: "true" +spec: +{% if pillar.get('cluster_registry_disk_type', '') == 'gce' %} + capacity: + storage: {{ pillar['cluster_registry_disk_size'] }} + accessModes: + - ReadWriteOnce + gcePersistentDisk: + pdName: "{{ pillar['cluster_registry_disk_name'] }}" + fsType: "ext4" +{% endif %} diff --git a/cluster/addons/registry/registry-pvc.yaml.in b/cluster/addons/registry/registry-pvc.yaml.in new file mode 100644 index 00000000000..92bfc69864c --- /dev/null +++ b/cluster/addons/registry/registry-pvc.yaml.in @@ -0,0 +1,13 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: kube-registry-pvc + namespace: kube-system + labels: + kubernetes.io/cluster-service: "true" +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ pillar['cluster_registry_disk_size'] }} diff --git a/cluster/addons/registry/registry-rc.yaml.in b/cluster/addons/registry/registry-rc.yaml similarity index 74% rename from cluster/addons/registry/registry-rc.yaml.in rename to cluster/addons/registry/registry-rc.yaml index 0af47a36ebe..9ac12c56755 100644 --- a/cluster/addons/registry/registry-rc.yaml.in +++ b/cluster/addons/registry/registry-rc.yaml @@ -41,13 +41,5 @@ spec: # TODO: use a persistent volume claim volumes: - name: image-store - {%- if pillar.get('cluster_registry_disk', '') != '' -%} - {%- for disk in pillar['cluster_registry_disk'].keys() %} - {{ disk }}: - {%- for k, v in pillar['cluster_registry_disk'][disk].items() %} - {{k}}: {{v}} - {%- endfor -%} - {%- endfor -%} - {%- else %} - emptyDir: {} - {%- endif -%} + persistentVolumeClaim: + claimName: kube-registry-pvc diff --git a/cluster/gce/config-default.sh b/cluster/gce/config-default.sh index bc37499bd1b..7e62500c6c5 100755 --- a/cluster/gce/config-default.sh +++ b/cluster/gce/config-default.sh @@ -81,7 +81,7 @@ DNS_REPLICAS=1 ENABLE_CLUSTER_REGISTRY="${KUBE_ENABLE_CLUSTER_REGISTRY:-true}" CLUSTER_REGISTRY_DISK="${CLUSTER_REGISTRY_PD:-${INSTANCE_PREFIX}-kube-system-kube-registry}" CLUSTER_REGISTRY_DISK_SIZE="${CLUSTER_REGISTRY_DISK_SIZE:-200GB}" -CLUSTER_REGISTRY_DISK_TYPE="${CLUSTER_REGISTRY_DISK_TYPE:-pd-standard}" +CLUSTER_REGISTRY_DISK_TYPE_GCE="${CLUSTER_REGISTRY_DISK_TYPE_GCE:-pd-standard}" # Optional: Install Kubernetes UI ENABLE_CLUSTER_UI="${KUBE_ENABLE_CLUSTER_UI:-true}" diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index 1c14e67b61b..9c09a42c89c 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -86,7 +86,7 @@ DNS_REPLICAS=1 ENABLE_CLUSTER_REGISTRY="${KUBE_ENABLE_CLUSTER_REGISTRY:-true}" CLUSTER_REGISTRY_DISK="${CLUSTER_REGISTRY_DISK:-${INSTANCE_PREFIX}-kube-system-kube-registry}" CLUSTER_REGISTRY_DISK_SIZE="${CLUSTER_REGISTRY_DISK_SIZE:-200GB}" -CLUSTER_REGISTRY_DISK_TYPE="${CLUSTER_REGISTRY_DISK_TYPE:-pd-standard}" +CLUSTER_REGISTRY_DISK_TYPE_GCE="${CLUSTER_REGISTRY_DISK_TYPE_GCE:-pd-standard}" # Optional: Install Kubernetes UI ENABLE_CLUSTER_UI="${KUBE_ENABLE_CLUSTER_UI:-true}" diff --git a/cluster/gce/configure-vm.sh b/cluster/gce/configure-vm.sh index 3043e2cda23..bfed226d4cf 100644 --- a/cluster/gce/configure-vm.sh +++ b/cluster/gce/configure-vm.sh @@ -307,10 +307,9 @@ EOF # TODO: Replace this with a persistent volume (and create it). if [[ "${ENABLE_CLUSTER_REGISTRY}" == true && -n "${CLUSTER_REGISTRY_DISK}" ]]; then cat <>/srv/salt-overlay/pillar/cluster-params.sls -cluster_registry_disk: - gcePersistentDisk: - pdName: ${CLUSTER_REGISTRY_DISK} - fsType: ext4 +cluster_registry_disk_type: gce +cluster_registry_disk_size: ${CLUSTER_REGISTRY_DISK_SIZE//GB/Gi} +cluster_registry_disk_name: ${CLUSTER_REGISTRY_DISK} EOF fi } diff --git a/cluster/gce/debian/helper.sh b/cluster/gce/debian/helper.sh index e224d57caf1..ad717bc1066 100755 --- a/cluster/gce/debian/helper.sh +++ b/cluster/gce/debian/helper.sh @@ -43,6 +43,7 @@ ELASTICSEARCH_LOGGING_REPLICAS: $(yaml-quote ${ELASTICSEARCH_LOGGING_REPLICAS:-} ENABLE_CLUSTER_DNS: $(yaml-quote ${ENABLE_CLUSTER_DNS:-false}) ENABLE_CLUSTER_REGISTRY: $(yaml-quote ${ENABLE_CLUSTER_REGISTRY:-false}) CLUSTER_REGISTRY_DISK: $(yaml-quote ${CLUSTER_REGISTRY_DISK}) +CLUSTER_REGISTRY_DISK_SIZE: $(yaml-quote ${CLUSTER_REGISTRY_DISK_SIZE}) DNS_REPLICAS: $(yaml-quote ${DNS_REPLICAS:-}) DNS_SERVER_IP: $(yaml-quote ${DNS_SERVER_IP:-}) DNS_DOMAIN: $(yaml-quote ${DNS_DOMAIN:-}) diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index a6cedd10431..d8ff6494acc 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -648,7 +648,7 @@ function kube-up { gcloud compute disks create "${CLUSTER_REGISTRY_DISK}" \ --project "${PROJECT}" \ --zone "${ZONE}" \ - --type "${CLUSTER_REGISTRY_DISK_TYPE}" \ + --type "${CLUSTER_REGISTRY_DISK_TYPE_GCE}" \ --size "${CLUSTER_REGISTRY_DISK_SIZE}" & fi diff --git a/cluster/saltbase/salt/kube-addons/init.sls b/cluster/saltbase/salt/kube-addons/init.sls index df9c3c739d9..b9d4e93f53b 100644 --- a/cluster/saltbase/salt/kube-addons/init.sls +++ b/cluster/saltbase/salt/kube-addons/init.sls @@ -92,7 +92,24 @@ addon-dir-create: /etc/kubernetes/addons/registry/registry-rc.yaml: file.managed: - - source: salt://kube-addons/registry/registry-rc.yaml.in + - source: salt://kube-addons/registry/registry-rc.yaml + - user: root + - group: root + - file_mode: 644 + - makedirs: True + +/etc/kubernetes/addons/registry/registry-pv.yaml: + file.managed: + - source: salt://kube-addons/registry/registry-pv.yaml.in + - template: jinja + - user: root + - group: root + - file_mode: 644 + - makedirs: True + +/etc/kubernetes/addons/registry/registry-pvc.yaml: + file.managed: + - source: salt://kube-addons/registry/registry-pvc.yaml.in - template: jinja - user: root - group: root diff --git a/cluster/saltbase/salt/kube-addons/kube-addon-update.sh b/cluster/saltbase/salt/kube-addons/kube-addon-update.sh index c04815ff210..0caa4c0a8b8 100755 --- a/cluster/saltbase/salt/kube-addons/kube-addon-update.sh +++ b/cluster/saltbase/salt/kube-addons/kube-addon-update.sh @@ -470,12 +470,14 @@ function update-addons() { # be careful, reconcile-objects uses global variables reconcile-objects ${addon_path} ReplicationController "-" & - # We don't expect service names to be versioned, so - # we match entire name, ignoring version suffix. + # We don't expect names to be versioned for the following kinds, so + # we match the entire name, ignoring version suffix. # That's why we pass an empty string as the version separator. - # If the service description differs on disk, the service should be recreated. + # If the description differs on disk, the object should be recreated. # This is not implemented in this version. reconcile-objects ${addon_path} Service "" & + reconcile-objects ${addon_path} PersistentVolume "" & + reconcile-objects ${addon_path} PersistentVolumeClaim "" & wait-for-jobs if [[ $? -eq 0 ]]; then