diff --git a/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/build_srpm.data b/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/build_srpm.data index 3fcf9d76ba..035fddebd5 100644 --- a/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/build_srpm.data +++ b/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/build_srpm.data @@ -1,3 +1,4 @@ SRC_DIR="stx-openstack-helm" -COPY_LIST_TO_TAR="$PKG_BASE/../../../helm-charts/garbd" +COPY_LIST_TO_TAR="$PKG_BASE/../../../helm-charts/garbd \ + $PKG_BASE/../../../helm-charts/clients" TIS_PATCH_VER=14 diff --git a/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/stx-openstack-helm.spec b/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/stx-openstack-helm.spec index f85b26c886..6c9ec559cf 100644 --- a/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/stx-openstack-helm.spec +++ b/kubernetes/applications/stx-openstack/stx-openstack-helm/centos/stx-openstack-helm.spec @@ -60,6 +60,7 @@ make nova-api-proxy make garbd make keystone-api-proxy make fm-rest-api +make clients # terminate helm server (the last backgrounded task) kill %1 diff --git a/kubernetes/helm-charts/clients/Chart.yaml b/kubernetes/helm-charts/clients/Chart.yaml new file mode 100644 index 0000000000..62b12258e1 --- /dev/null +++ b/kubernetes/helm-charts/clients/Chart.yaml @@ -0,0 +1,10 @@ +# +# Copyright (c) 2019 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +apiVersion: v1 +description: openstack clients chart +name: clients +version: 0.1.0 diff --git a/kubernetes/helm-charts/clients/requirements.yaml b/kubernetes/helm-charts/clients/requirements.yaml new file mode 100644 index 0000000000..0c7cc4a76f --- /dev/null +++ b/kubernetes/helm-charts/clients/requirements.yaml @@ -0,0 +1,9 @@ +# +# Copyright (c) 2019 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +dependencies: + - name: helm-toolkit + repository: http://localhost:8879/charts + version: 0.1.0 diff --git a/kubernetes/helm-charts/clients/templates/configmap-etc.yaml b/kubernetes/helm-charts/clients/templates/configmap-etc.yaml new file mode 100644 index 0000000000..82e70cf4b6 --- /dev/null +++ b/kubernetes/helm-charts/clients/templates/configmap-etc.yaml @@ -0,0 +1,35 @@ +{{/* +# +# Copyright (c) 2019 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +*/}} + +{{- if .Values.global.configmap_etc }} +{{- $envAll := . }} + +{{- if empty .Values.endpoints.identity.auth.auth_url -}} +{{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.endpoints.identity.auth "auth_url" -}} +{{- end -}} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + creationTimestamp: 2019-04-18T19:14:38Z + name: config-{{- .Values.global.name }} +data: + clouds.yaml: | + clouds: +{{ .Values.global.cloud_name | toYaml | trim | indent 6 }}: + region_name: {{ .Values.endpoints.identity.auth.admin.region_name }} + identity_api_version: 3 + endpoint_type: internalURL + auth: + username: {{ .Values.endpoints.identity.auth.admin.username | quote }} + password: {{ .Values.endpoints.identity.auth.admin.password | quote }} + project_name: {{ .Values.endpoints.identity.auth.admin.project_name | quote }} + project_domain_name: {{ .Values.endpoints.identity.auth.admin.project_domain_name | quote }} + user_domain_name: {{ .Values.endpoints.identity.auth.admin.user_domain_name | quote }} + auth_url: {{ .Values.endpoints.identity.auth.auth_url | quote }} +{{- end }} diff --git a/kubernetes/helm-charts/clients/templates/deployment.yaml b/kubernetes/helm-charts/clients/templates/deployment.yaml new file mode 100644 index 0000000000..6ced2d5c83 --- /dev/null +++ b/kubernetes/helm-charts/clients/templates/deployment.yaml @@ -0,0 +1,59 @@ +{{/* +# +# Copyright (c) 2019 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +*/}} + +{{- if eq .Values.global.deployAs "Deployment" }} +{{- $mount := "/etc/openstack" }} +{{- $envAll := . }} +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ .Values.global.name }} +spec: + replicas: {{ .Values.global.replicas }} + strategy: + type: Recreate + template: + metadata: + labels: + app: {{ .Values.global.name }} + spec: + {{- if .Values.global.rbac }} + serviceAccountName: {{ .Values.rbac.serviceAccount }} + {{- end }} + affinity: +{{ tuple $envAll "openstack" "clients" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} + volumes: + - name: config-volume-{{- .Values.global.name }} + configMap: + name: config-{{- .Values.global.name }} + {{- if .Values.volume.enabled }} + - name: staging-{{ .Values.global.name }} + persistentVolumeClaim: + claimName: pvc-{{ .Values.global.name }} + {{- end }} + containers: + - name: {{ .Values.global.name }} + image: {{ .Values.images.tags.openstackclients | quote }} + env: + - name: OS_CLOUD + value: {{ .Values.global.cloud_name }} + {{- if .Values.global.keep_running }} + command: ["/bin/bash"] + args: ["-c", "trap : TERM INT; sleep infinity & wait"] + {{- end }} + volumeMounts: + - name: config-volume-{{- .Values.global.name }} + mountPath: {{ $mount }} + {{- if .Values.volume.enabled }} + - name: staging-{{ .Values.global.name }} + mountPath: {{ .Values.volume.mount_path }} + {{- end }} + nodeSelector: + {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} +{{- end }} diff --git a/kubernetes/helm-charts/clients/templates/pvc.yaml b/kubernetes/helm-charts/clients/templates/pvc.yaml new file mode 100644 index 0000000000..58249398a7 --- /dev/null +++ b/kubernetes/helm-charts/clients/templates/pvc.yaml @@ -0,0 +1,21 @@ +{{/* +# +# Copyright (c) 2019 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +*/}} + +{{- if and .Values.volume.enabled (eq .Values.global.deployAs "Deployment") }} +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: pvc-{{- .Values.global.name }} +spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: {{ .Values.volume.size }} + storageClassName: {{ .Values.volume.class_name }} +{{- end }} diff --git a/kubernetes/helm-charts/clients/templates/serviceaccount.yaml b/kubernetes/helm-charts/clients/templates/serviceaccount.yaml new file mode 100644 index 0000000000..e3aa46a7fb --- /dev/null +++ b/kubernetes/helm-charts/clients/templates/serviceaccount.yaml @@ -0,0 +1,16 @@ +{{/* +# +# Copyright (c) 2019 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +*/}} + +{{- if .Values.global.rbac }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.rbac.serviceAccount }} +imagePullSecrets: + - name: default-registry-key +{{- end }} diff --git a/kubernetes/helm-charts/clients/templates/statefulset.yaml b/kubernetes/helm-charts/clients/templates/statefulset.yaml new file mode 100644 index 0000000000..2edd7e6810 --- /dev/null +++ b/kubernetes/helm-charts/clients/templates/statefulset.yaml @@ -0,0 +1,68 @@ +{{/* +# +# Copyright (c) 2019 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +*/}} + +{{- if eq .Values.global.deployAs "StatefulSet" }} +{{- $mount := "/etc/openstack" }} +{{- $envAll := . }} +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Values.global.name }} +spec: + replicas: {{ .Values.global.replicas }} + serviceName: {{ .Values.global.name }} + podManagementPolicy: "Parallel" + selector: + matchLabels: + app: {{ .Values.global.name }} + template: + metadata: + labels: + app: {{ .Values.global.name }} + spec: + {{- if .Values.global.rbac }} + serviceAccountName: {{ .Values.rbac.serviceAccount }} + {{- end }} + affinity: +{{ tuple $envAll "openstack" "clients" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} + volumes: + - name: config-volume-{{- .Values.global.name }} + configMap: + name: config-{{- .Values.global.name }} + containers: + - name: {{ .Values.global.name }} + image: {{ .Values.images.tags.openstackclients | quote }} + env: + - name: OS_CLOUD + value: {{ .Values.global.cloud_name }} + {{- if .Values.global.keep_running }} + command: ["/bin/bash"] + args: ["-c", "trap : TERM INT; sleep infinity & wait"] + {{- end }} + volumeMounts: + - name: config-volume-{{- .Values.global.name }} + mountPath: {{ $mount }} + {{- if .Values.volume.enabled }} + - name: staging-{{ .Values.global.name }} + mountPath: {{ .Values.volume.mount_path }} + {{- end }} + nodeSelector: + {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} + {{- if .Values.volume.enabled }} + volumeClaimTemplates: + - metadata: + name: staging-{{ .Values.global.name }} + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: {{ .Values.volume.size }} + storageClassName: {{ .Values.volume.class_name }} + {{- end }} +{{- end }} diff --git a/kubernetes/helm-charts/clients/values.yaml b/kubernetes/helm-charts/clients/values.yaml new file mode 100644 index 0000000000..dbe026634d --- /dev/null +++ b/kubernetes/helm-charts/clients/values.yaml @@ -0,0 +1,61 @@ +# +# Copyright (c) 2019 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +endpoints: + cluster_domain_suffix: cluster.local + identity: + name: keystone + namespace: openstack + auth: + auth_url: null + admin: + region_name: RegionOne + username: admin + password: password + project_name: admin + user_domain_name: default + project_domain_name: default + hosts: + default: keystone-api + public: keystone + host_fqdn_override: + default: null + path: + default: /v3 + scheme: + default: http + port: + api: + default: 80 + internal: 5000 +pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname +labels: + node_selector_key: openstack-control-plane + node_selector_value: enabled +global: + deployAs: Deployment + configmap_etc: true + replicas: 1 + name: "openstack-clients" + cloud_name: cloud + keep_running: false + rbac: true +volume: + enabled: true + class_name: general + size: 5Gi + mount_path: "/scratch" +rbac: + serviceAccount: clients +images: + tags: + openstackclients: docker.io/starlingx/stx-openstackclients:master-centos-stable-latest