Skip to content

Commit

Permalink
Merge "Support for local storage"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Jan 9, 2020
2 parents a43ae25 + 2ac08b5 commit c2ece6a
Show file tree
Hide file tree
Showing 19 changed files with 354 additions and 0 deletions.
20 changes: 20 additions & 0 deletions elasticsearch/values_overrides/local-storage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
pod:
replicas:
data: 1
storage:
data:
requests:
storage: 1Gi
storage_class: local-storage
master:
requests:
storage: 1Gi
storage_class: local-storage
manifests:
cron_curator: false
cron_verify_repositories: false
job_snapshot_repository: false
job_elasticsearch_templates: false
job_s3_user: false
job_s3_bucket: false
helm_tests: false
20 changes: 20 additions & 0 deletions local-storage/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2020 The Openstack-Helm Authors.
#
# 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:https://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.

apiVersion: v1
description: OpenStack-Helm Local Storage
name: local-storage
version: 0.1.0
maintainers:
- name: OpenStack-Helm Authors
18 changes: 18 additions & 0 deletions local-storage/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2020 The Openstack-Helm Authors.
#
# 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:https://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.

dependencies:
- name: helm-toolkit
repository: http:https://localhost:8879/charts
version: 0.1.0
44 changes: 44 additions & 0 deletions local-storage/templates/persistent-volumes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{/*
Copyright 2020 The Openstack-Helm Authors.

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:https://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.manifests.persistent_volumes }}
{{- $envAll := . }}
{{- range .Values.conf.persistent_volumes }}
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ .name }}
labels:
{{ tuple $envAll "local-storage" $envAll.Release.Name | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
spec:
capacity:
storage: {{ .storage_capacity }}
accessModes: {{ .access_modes }}
persistentVolumeReclaimPolicy: {{ .reclaim_policy }}
storageClassName: {{ $envAll.Release.Name }}
local:
path: {{ .local_path }}
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: {{ $envAll.Values.labels.node_affinity.node_selector_key }}
operator: In
values:
- {{ $envAll.Values.labels.node_affinity.node_selector_value }}
{{- end }}
{{- end }}
28 changes: 28 additions & 0 deletions local-storage/templates/storage-class.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{/*
Copyright 2020 The Openstack-Helm Authors.

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:https://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.manifests.storage_class }}
{{- $envAll := . }}
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{ .Release.Name }}
labels:
{{ tuple $envAll "local-storage" $envAll.Release.Name | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
{{- end }}
41 changes: 41 additions & 0 deletions local-storage/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2020 The Openstack-Helm Authors.
#
# 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:https://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.

labels:
node_affinity:
node_selector_key: openstack-control-plane
node_selector_value: enabled

conf:
persistent_volumes:
# For each mount path, one PV should be created.
# If there are two mount paths for local storage are available on two nodes,
# then two PVs details should be defined. Example:
# - name: local-pv-1 (name of the Persistent Volume 1)
# reclaimpolicy: Retain (Reclaim Policy for the PV local-pv-1)
# storage_capacity: "100Gi" (Storage capacity of the PV local-pv-1)
# access_modes: [ "ReadWriteOnce" ] (Access mode for the PV local-pv-1)
# local_path: /mnt/disk/vol1 (Mount path of the local disk, local-pv-1 will be created on)
# - name: local-pv-2 (name of the Persistent Volume 2)
# reclaimpolicy: Retain (Reclaim Policy for the PV local-pv-2)
# storage_capacity: "100Gi" (Storage capacity of the PV local-pv-2)
# access_modes: [ "ReadWriteOnce" ] (Access mode for the PV local-pv-2)
# local_path: /mnt/disk/vol2 (Mount path of the local disk, local-pv-2 will be created on)
# Similarly if three nodes each have disk mount path /var/lib/kubernetes
# which will be acting as local storage for each node, then Persistentvolumes
# should be updated with three entries.

manifests:
storage_class: true
persistent_volumes: true
35 changes: 35 additions & 0 deletions local-storage/values_overrides/local-storage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
conf:
persistent_volumes:
- name: local-persistent-volume-0
reclaim_policy: Delete
storage_capacity: "1Gi"
access_modes: [ "ReadWriteOnce" ]
local_path: /srv/local-volume-0
- name: local-persistent-volume-1
reclaim_policy: Delete
storage_capacity: "1Gi"
access_modes: [ "ReadWriteOnce" ]
local_path: /srv/local-volume-1
- name: local-persistent-volume-2
reclaim_policy: Delete
storage_capacity: "1Gi"
access_modes: [ "ReadWriteOnce" ]
local_path: /srv/local-volume-2
- name: local-persistent-volume-3
reclaim_policy: Delete
storage_capacity: "1Gi"
access_modes: [ "ReadWriteOnce" ]
local_path: /srv/local-volume-3
- name: local-persistent-volume-4
reclaim_policy: Delete
storage_capacity: "1Gi"
access_modes: [ "ReadWriteOnce" ]
local_path: /srv/local-volume-4
- name: local-persistent-volume-5
reclaim_policy: Delete
storage_capacity: "1Gi"
access_modes: [ "ReadWriteOnce" ]
local_path: /srv/local-volume-5
manifests:
storage_class: true
persistent_volumes: true
9 changes: 9 additions & 0 deletions mariadb/values_overrides/local-storage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pod:
replicas:
server: 1
volume:
size: 1Gi
class_name: local-storage
monitoring:
prometheus:
enabled: false
7 changes: 7 additions & 0 deletions prometheus/values_overrides/local-storage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pod:
replicas:
prometheus: 1
storage:
requests:
storage: 1Gi
storage_class: local-storage
1 change: 1 addition & 0 deletions tools/deployment/osh-infra-local-storage/005-deploy-k8s.sh
1 change: 1 addition & 0 deletions tools/deployment/osh-infra-local-storage/010-ingress.sh
43 changes: 43 additions & 0 deletions tools/deployment/osh-infra-local-storage/020-local-storage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# Copyright 2020 The Openstack-Helm Authors.
#
# 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:https://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.

set -xe

for i in {0..5}; do
sudo mkdir /srv/local-volume-$i;
done

#NOTE: Lint and package chart
make local-storage

#NOTE: Deploy command
: ${OSH_INFRA_EXTRA_HELM_ARGS:=""}
: ${OSH_INFRA_EXTRA_HELM_ARGS_LOCAL_STORAGE:="$(./tools/deployment/common/get-values-overrides.sh local-storage)"}

helm upgrade --install local-storage ./local-storage \
--namespace=osh-infra \
${OSH_INFRA_EXTRA_HELM_ARGS} \
${OSH_INFRA_EXTRA_HELM_ARGS_LOCAL_STORAGE}

#NOTE: Wait for deploy
./tools/deployment/common/wait-for-pods.sh osh-infra

#NOTE: Validate Deployment info
helm status local-storage

# Simple object validation
kubectl describe sc local-storage
kubectl get pv
1 change: 1 addition & 0 deletions tools/deployment/osh-infra-local-storage/030-mariadb.sh
37 changes: 37 additions & 0 deletions tools/deployment/osh-infra-local-storage/040-prometheus.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# Copyright 2020 The Openstack-Helm Authors.
#
# 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:https://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.

set -xe

#NOTE: Lint and package chart
make prometheus

#NOTE: Deploy command
: ${OSH_INFRA_EXTRA_HELM_ARGS:=""}
: ${OSH_INFRA_EXTRA_HELM_ARGS_PROMETHEUS:="$(./tools/deployment/common/get-values-overrides.sh prometheus)"}

helm upgrade --install prometheus ./prometheus \
--namespace=osh-infra \
${OSH_INFRA_EXTRA_HELM_ARGS} \
${OSH_INFRA_EXTRA_HELM_ARGS_PROMETHEUS}

#NOTE: Wait for deploy
./tools/deployment/common/wait-for-pods.sh osh-infra

#NOTE: Validate Deployment info
helm status prometheus

helm test prometheus
20 changes: 20 additions & 0 deletions tools/deployment/osh-infra-local-storage/060-volume-info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Copyright 2020 The Openstack-Helm Authors.
#
# 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:https://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.

set -xe

# Verifying persistent volumes
kubectl get pv
25 changes: 25 additions & 0 deletions zuul.d/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -468,3 +468,28 @@
- ./tools/deployment/podsecuritypolicy/005-deploy-k8s.sh
- ./tools/deployment/podsecuritypolicy/006-config-k8s-psp.sh
- ./tools/deployment/podsecuritypolicy/007-podsecuritypolicy.sh

- job:
name: openstack-helm-infra-local-storage
parent: openstack-helm-infra-functional
timeout: 7200
pre-run:
- playbooks/osh-infra-upgrade-host.yaml
run: playbooks/osh-infra-gate-runner.yaml
post-run: playbooks/osh-infra-collect-logs.yaml
nodeset: openstack-helm-single-node
vars:
osh_params:
openstack_release: stein
container_distro_name: ubuntu
container_distro_version: bionic
feature_gates: local-storage
gate_scripts:
- ./tools/deployment/osh-infra-local-storage/000-install-packages.sh
- ./tools/deployment/osh-infra-local-storage/005-deploy-k8s.sh
- ./tools/deployment/osh-infra-local-storage/010-ingress.sh
- ./tools/deployment/osh-infra-local-storage/020-local-storage.sh
- ./tools/deployment/osh-infra-local-storage/030-mariadb.sh
- ./tools/deployment/osh-infra-local-storage/040-prometheus.sh
- ./tools/deployment/osh-infra-local-storage/050-elasticsearch.sh
- ./tools/deployment/osh-infra-local-storage/060-volume-info.sh
2 changes: 2 additions & 0 deletions zuul.d/project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
voting: false
- openstack-helm-infra-apparmor:
voting: false
- openstack-helm-infra-local-storage:
voting: false
gate:
jobs:
- openstack-helm-lint
Expand Down

0 comments on commit c2ece6a

Please sign in to comment.