From 69e4decfc9445f88e8d74eb2156ef549175f3020 Mon Sep 17 00:00:00 2001 From: Balazs Szekeres Date: Mon, 28 Oct 2019 10:00:15 +0100 Subject: [PATCH] Infra chart changes. Refactored values.yaml. Removed unused code. Added Dynamic-local-pv-executor. Change-Id: I8fdc05cdf5d433f9f57e0f44cff39b999445c784 Signed-off-by: Balazs Szekeres --- SPECS/infra-charts.spec | 2 +- infra-charts/templates/danm-webhook-ds.yaml | 6 ++ .../templates/dynamic-local-pv-executor.yaml | 83 ++++++++++++++++++++++ .../templates/dynamic-local-pv-provisioner.yaml | 33 +++------ infra-charts/templates/prometheus-pvc.yaml | 3 + .../storage-local-static-provisioner-service.yaml | 33 --------- .../storage-local-static-provisioner.yaml | 33 +++++---- infra-charts/values.yaml.j2 | 3 +- 8 files changed, 121 insertions(+), 75 deletions(-) create mode 100644 infra-charts/templates/dynamic-local-pv-executor.yaml delete mode 100644 infra-charts/templates/storage-local-static-provisioner-service.yaml diff --git a/SPECS/infra-charts.spec b/SPECS/infra-charts.spec index 364a52c..778a744 100644 --- a/SPECS/infra-charts.spec +++ b/SPECS/infra-charts.spec @@ -15,7 +15,7 @@ %define COMPONENT infra-charts %define RPM_NAME caas-%{COMPONENT} %define RPM_MAJOR_VERSION 1.0.0 -%define RPM_MINOR_VERSION 43 +%define RPM_MINOR_VERSION 44 Name: %{RPM_NAME} Version: %{RPM_MAJOR_VERSION} diff --git a/infra-charts/templates/danm-webhook-ds.yaml b/infra-charts/templates/danm-webhook-ds.yaml index 72cac41..64d63f4 100644 --- a/infra-charts/templates/danm-webhook-ds.yaml +++ b/infra-charts/templates/danm-webhook-ds.yaml @@ -44,9 +44,15 @@ spec: - name: webhook-certs mountPath: /etc/webhook/certs readOnly: true + - name: time-mount + mountPath: /etc/localtime + readOnly: true volumes: # TODO: make it a secret - name: webhook-certs hostPath: path: /etc/kubernetes/ssl/ + - name: time-mount + hostPath: + path: /etc/localtime {{ end }} diff --git a/infra-charts/templates/dynamic-local-pv-executor.yaml b/infra-charts/templates/dynamic-local-pv-executor.yaml new file mode 100644 index 0000000..da91fa5 --- /dev/null +++ b/infra-charts/templates/dynamic-local-pv-executor.yaml @@ -0,0 +1,83 @@ +{{/* +Copyright 2019 Nokia + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} +{{ if .Values.localstorage.required }} +--- +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: dynamic-local-pv-executor + namespace: kube-system + label: + {{ .Values.kubernetes_component_label }}: {{ .Values.localstorage.dynamiclocalpvprovisioner.name }} +spec: + selector: + matchLabels: + {{ .Values.kubernetes_component_label }}: {{ .Values.localstorage.dynamiclocalpvprovisioner.name }} + template: + metadata: + labels: + {{ .Values.kubernetes_component_label }}: {{ .Values.localstorage.dynamiclocalpvprovisioner.name }} + spec: + containers: + - name: {{ .Values.localstorage.dynamiclocalpvprovisioner.name }} + image: {{ .Values.localstorage.dynamiclocalpvprovisioner.image_name }} + imagePullPolicy: IfNotPresent + command: [ "/executor", "--storagepath={{ .Values.localstorage.local_storage_dir }}" ] + volumeMounts: + - name: mapper + mountPath: /dev/mapper/nova-caas_app + - name: sig-storage-mount + mountPath: {{ .Values.localstorage.local_storage_dir }} + mountPropagation: Bidirectional + - name: fstab + mountPath: /rootfs/fstab + - name: projects + mountPath: /etc/projects + - name: projid + mountPath: /etc/projid + - name: time-mount + mountPath: /etc/localtime + readOnly: true + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + securityContext: + privileged: true + volumes: + - name: mapper + hostPath: + path: /dev/mapper/nova-caas_app + - name: sig-storage-mount + hostPath: + path: {{ .Values.localstorage.local_storage_dir }} + - name: fstab + hostPath: + path: /etc/fstab + - name: projects + hostPath: + path: /etc/projects + type: FileOrCreate + - name: projid + hostPath: + path: /etc/projid + type: FileOrCreate + - name: time-mount + hostPath: + path: /etc/localtime + serviceAccountName: dynamic-pv +{{ end }} diff --git a/infra-charts/templates/dynamic-local-pv-provisioner.yaml b/infra-charts/templates/dynamic-local-pv-provisioner.yaml index dbac399..5772255 100644 --- a/infra-charts/templates/dynamic-local-pv-provisioner.yaml +++ b/infra-charts/templates/dynamic-local-pv-provisioner.yaml @@ -35,36 +35,21 @@ spec: - name: {{ .Values.localstorage.dynamiclocalpvprovisioner.name }} image: {{ .Values.localstorage.dynamiclocalpvprovisioner.image_name }} imagePullPolicy: IfNotPresent - command: [ "/executor", "--storagepath=/mnt/sig_storage" ] - volumeMounts: - - name: mapper - mountPath: /dev/mapper/nova-caas_app - - name: sig-storage-mount - mountPath: /mnt/sig_storage - mountPropagation: Bidirectional - - name: fstab - mountPath: /rootfs/fstab + command: [ "/provisioner" ] env: - name: NODE_NAME valueFrom: fieldRef: fieldPath: spec.nodeName - securityContext: - privileged: true - capabilities: - add: - - SYS_ADMIN + volumeMounts: + - name: time-mount + mountPath: /etc/localtime + readOnly: true volumes: - - name: mapper - hostPath: - path: /dev/mapper/nova-caas_app - - name: sig-storage-mount - hostPath: - path: {{ .Values.localstorage.dynamiclocalpvprovisioner.local_storage_dir }} - - name: fstab - hostPath: - path: /etc/fstab + - name: time-mount + hostPath: + path: /etc/localtime nodeSelector: - nodename: caas_master1 + nodetype: caas_master serviceAccountName: dynamic-pv {{ end }} diff --git a/infra-charts/templates/prometheus-pvc.yaml b/infra-charts/templates/prometheus-pvc.yaml index 809ddb7..bcd954c 100644 --- a/infra-charts/templates/prometheus-pvc.yaml +++ b/infra-charts/templates/prometheus-pvc.yaml @@ -3,6 +3,9 @@ apiVersion: v1 metadata: name: prometheus-pvc namespace: kube-system + annotations: + nodeselector: + nodetype=caas_master spec: accessModes: - ReadWriteOnce diff --git a/infra-charts/templates/storage-local-static-provisioner-service.yaml b/infra-charts/templates/storage-local-static-provisioner-service.yaml deleted file mode 100644 index d68aa64..0000000 --- a/infra-charts/templates/storage-local-static-provisioner-service.yaml +++ /dev/null @@ -1,33 +0,0 @@ -{{/* -Copyright 2019 Nokia - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/}} -{{ if .Values.localstorage.required }} ---- -apiVersion: v1 -kind: Service -metadata: - name: local-volume-provisioner - namespace: kube-system - labels: - app: local-volume-provisioner -spec: - type: ClusterIP - selector: - app: local-volume-provisioner - ports: - - name: metrics - port: 8080 - protocol: TCP -{{ end }} diff --git a/infra-charts/templates/storage-local-static-provisioner.yaml b/infra-charts/templates/storage-local-static-provisioner.yaml index 2fcce74..c29cbcf 100644 --- a/infra-charts/templates/storage-local-static-provisioner.yaml +++ b/infra-charts/templates/storage-local-static-provisioner.yaml @@ -18,34 +18,31 @@ limitations under the License. apiVersion: v1 kind: ConfigMap metadata: - name: local-provisioner-config + name: storage-local-static-provisioner-config namespace: kube-system data: storageClassMap: | local-volume: - hostDir: {{ .Values.localstorage.storagelocalstaticprovisioner.local_storage_dir }} - mountDir: {{ .Values.localstorage.storagelocalstaticprovisioner.local_storage_dir }} - blockCleanerCommand: - - "/scripts/shred.sh" - - "2" + hostDir: {{ .Values.localstorage.local_storage_dir }} + mountDir: {{ .Values.localstorage.local_storage_dir }} volumeMode: Filesystem fsType: xfs --- apiVersion: apps/v1 kind: DaemonSet metadata: - name: local-volume-provisioner + name: storage-local-static-provisioner namespace: kube-system labels: - app: local-volume-provisioner + app: storage-local-static-provisioner spec: selector: matchLabels: - app: local-volume-provisioner + app: storage-local-static-provisioner template: metadata: labels: - app: local-volume-provisioner + app: storage-local-static-provisioner spec: serviceAccountName: local-storage-admin containers: @@ -59,17 +56,23 @@ spec: fieldPath: spec.nodeName volumeMounts: - mountPath: /etc/provisioner/config - name: provisioner-config + name: storage-local-static-provisioner-config readOnly: true - - mountPath: {{ .Values.localstorage.storagelocalstaticprovisioner.local_storage_dir }} + - mountPath: {{ .Values.localstorage.local_storage_dir }} name: local-volume mountPropagation: "HostToContainer" + - name: time-mount + mountPath: /etc/localtime + readOnly: true volumes: - - name: provisioner-config + - name: storage-local-static-provisioner-config configMap: - name: local-provisioner-config + name: storage-local-static-provisioner-config - name: local-volume hostPath: - path: {{ .Values.localstorage.storagelocalstaticprovisioner.local_storage_dir }} + path: {{ .Values.localstorage.local_storage_dir }} + - name: time-mount + hostPath: + path: /etc/localtime {{ end }} diff --git a/infra-charts/values.yaml.j2 b/infra-charts/values.yaml.j2 index 1f9e65e..f433790 100644 --- a/infra-charts/values.yaml.j2 +++ b/infra-charts/values.yaml.j2 @@ -119,11 +119,10 @@ localstorage: required: false {% else %} required: true + local_storage_dir: "{{ caas.local_storage_path }}" storagelocalstaticprovisioner: - local_storage_dir: "{{ caas.local_storage_path }}" image_name: {{ container_image_names | select('search', '/storage_local_static_provisioner') | list | last }} dynamiclocalpvprovisioner: - local_storage_dir: "{{ caas.local_storage_path }}" image_name: {{ container_image_names | select('search', '/dynamic_local_pv_provisioner') | list | last }} name: "pv-provisioner" {% endif %} -- 2.16.6