From 15358cebc43bfcfbd5109418f5128ce759282002 Mon Sep 17 00:00:00 2001 From: Karl Kloppenborg Date: Fri, 13 Jan 2023 02:58:19 +0000 Subject: [PATCH] Revert "Remove gnocchi chart" This reverts commit 4dafe7e254d4d27079907579a37b5e379896d98d. Commit has been reverted after conversation between Gage Hugo and Karl Kloppenborg. It has been decided to add this back in as it breaks ceilometer support Karl Kloppenborg has offered to incubate the helm chart. Change-Id: Ife6a47c7ed43075912a836b3b9c2e87fc2d13055 --- gnocchi/.helmignore | 21 + gnocchi/Chart.yaml | 26 + gnocchi/requirements.yaml | 18 + gnocchi/templates/bin/_bootstrap.sh.tpl | 18 + .../templates/bin/_ceph-admin-keyring.sh.tpl | 29 + gnocchi/templates/bin/_ceph-keyring.sh.tpl | 30 + gnocchi/templates/bin/_clean-secrets.sh.tpl | 22 + gnocchi/templates/bin/_db-init.sh.tpl | 89 +++ gnocchi/templates/bin/_db-sync.sh.tpl | 19 + gnocchi/templates/bin/_gnocchi-api.sh.tpl | 32 + gnocchi/templates/bin/_gnocchi-metricd.sh.tpl | 19 + .../bin/_gnocchi-resources-cleaner.sh.tpl | 20 + gnocchi/templates/bin/_gnocchi-statsd.sh.tpl | 19 + gnocchi/templates/bin/_gnocchi-test.sh.tpl | 66 ++ gnocchi/templates/bin/_storage-init.sh.tpl | 62 ++ gnocchi/templates/configmap-bin.yaml | 63 ++ gnocchi/templates/configmap-etc.yaml | 101 +++ .../templates/cron-job-resources-cleaner.yaml | 106 +++ gnocchi/templates/daemonset-metricd.yaml | 125 ++++ gnocchi/templates/daemonset-statsd.yaml | 131 ++++ gnocchi/templates/deployment-api.yaml | 150 ++++ gnocchi/templates/ingress-api.yaml | 18 + gnocchi/templates/job-bootstrap.yaml | 21 + gnocchi/templates/job-clean.yaml | 98 +++ gnocchi/templates/job-db-drop.yaml | 21 + gnocchi/templates/job-db-init-indexer.yaml | 85 +++ gnocchi/templates/job-db-init.yaml | 21 + gnocchi/templates/job-db-sync.yaml | 103 +++ gnocchi/templates/job-image-repo-sync.yaml | 21 + gnocchi/templates/job-ks-endpoints.yaml | 21 + gnocchi/templates/job-ks-service.yaml | 21 + gnocchi/templates/job-ks-user.yaml | 21 + gnocchi/templates/job-storage-init.yaml | 141 ++++ gnocchi/templates/pdb-api.yaml | 27 + gnocchi/templates/pod-gnocchi-test.yaml | 86 +++ gnocchi/templates/secret-db-indexer.yaml | 28 + gnocchi/templates/secret-db.yaml | 28 + gnocchi/templates/secret-ingress-tls.yaml | 19 + gnocchi/templates/secret-keystone.yaml | 33 + gnocchi/templates/service-api.yaml | 37 + gnocchi/templates/service-ingress-api.yaml | 18 + gnocchi/templates/service-statsd.yaml | 34 + gnocchi/values.yaml | 657 ++++++++++++++++++ releasenotes/config.yaml | 1 + releasenotes/notes/gnocchi.yaml | 9 + 45 files changed, 2735 insertions(+) create mode 100644 gnocchi/.helmignore create mode 100644 gnocchi/Chart.yaml create mode 100644 gnocchi/requirements.yaml create mode 100644 gnocchi/templates/bin/_bootstrap.sh.tpl create mode 100644 gnocchi/templates/bin/_ceph-admin-keyring.sh.tpl create mode 100644 gnocchi/templates/bin/_ceph-keyring.sh.tpl create mode 100644 gnocchi/templates/bin/_clean-secrets.sh.tpl create mode 100644 gnocchi/templates/bin/_db-init.sh.tpl create mode 100644 gnocchi/templates/bin/_db-sync.sh.tpl create mode 100644 gnocchi/templates/bin/_gnocchi-api.sh.tpl create mode 100644 gnocchi/templates/bin/_gnocchi-metricd.sh.tpl create mode 100644 gnocchi/templates/bin/_gnocchi-resources-cleaner.sh.tpl create mode 100644 gnocchi/templates/bin/_gnocchi-statsd.sh.tpl create mode 100644 gnocchi/templates/bin/_gnocchi-test.sh.tpl create mode 100644 gnocchi/templates/bin/_storage-init.sh.tpl create mode 100644 gnocchi/templates/configmap-bin.yaml create mode 100644 gnocchi/templates/configmap-etc.yaml create mode 100644 gnocchi/templates/cron-job-resources-cleaner.yaml create mode 100644 gnocchi/templates/daemonset-metricd.yaml create mode 100644 gnocchi/templates/daemonset-statsd.yaml create mode 100644 gnocchi/templates/deployment-api.yaml create mode 100644 gnocchi/templates/ingress-api.yaml create mode 100644 gnocchi/templates/job-bootstrap.yaml create mode 100644 gnocchi/templates/job-clean.yaml create mode 100644 gnocchi/templates/job-db-drop.yaml create mode 100644 gnocchi/templates/job-db-init-indexer.yaml create mode 100644 gnocchi/templates/job-db-init.yaml create mode 100644 gnocchi/templates/job-db-sync.yaml create mode 100644 gnocchi/templates/job-image-repo-sync.yaml create mode 100644 gnocchi/templates/job-ks-endpoints.yaml create mode 100644 gnocchi/templates/job-ks-service.yaml create mode 100644 gnocchi/templates/job-ks-user.yaml create mode 100644 gnocchi/templates/job-storage-init.yaml create mode 100644 gnocchi/templates/pdb-api.yaml create mode 100644 gnocchi/templates/pod-gnocchi-test.yaml create mode 100644 gnocchi/templates/secret-db-indexer.yaml create mode 100644 gnocchi/templates/secret-db.yaml create mode 100644 gnocchi/templates/secret-ingress-tls.yaml create mode 100644 gnocchi/templates/secret-keystone.yaml create mode 100644 gnocchi/templates/service-api.yaml create mode 100644 gnocchi/templates/service-ingress-api.yaml create mode 100644 gnocchi/templates/service-statsd.yaml create mode 100644 gnocchi/values.yaml create mode 100644 releasenotes/notes/gnocchi.yaml diff --git a/gnocchi/.helmignore b/gnocchi/.helmignore new file mode 100644 index 000000000..f0c131944 --- /dev/null +++ b/gnocchi/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/gnocchi/Chart.yaml b/gnocchi/Chart.yaml new file mode 100644 index 000000000..f9909e2c3 --- /dev/null +++ b/gnocchi/Chart.yaml @@ -0,0 +1,26 @@ +# 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. + +--- +apiVersion: v1 +appVersion: v3.0.3 +description: OpenStack-Helm Gnocchi +name: gnocchi +version: 0.1.5 +home: https://gnocchi.xyz/ +icon: https://gnocchi.xyz/_static/gnocchi-logo.png +sources: + - https://github.com/gnocchixyz/gnocchi + - https://opendev.org/openstack/openstack-helm +maintainers: + - name: OpenStack-Helm Authors +... diff --git a/gnocchi/requirements.yaml b/gnocchi/requirements.yaml new file mode 100644 index 000000000..84f0affae --- /dev/null +++ b/gnocchi/requirements.yaml @@ -0,0 +1,18 @@ +# 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. + +--- +dependencies: + - name: helm-toolkit + repository: file://../helm-toolkit + version: ">= 0.1.0" +... diff --git a/gnocchi/templates/bin/_bootstrap.sh.tpl b/gnocchi/templates/bin/_bootstrap.sh.tpl new file mode 100644 index 000000000..6452d0a07 --- /dev/null +++ b/gnocchi/templates/bin/_bootstrap.sh.tpl @@ -0,0 +1,18 @@ +#!/bin/bash + +{{/* +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. +*/}} + +set -ex +{{ .Values.bootstrap.script | default "echo 'Not Enabled'" }} diff --git a/gnocchi/templates/bin/_ceph-admin-keyring.sh.tpl b/gnocchi/templates/bin/_ceph-admin-keyring.sh.tpl new file mode 100644 index 000000000..f19bf03e0 --- /dev/null +++ b/gnocchi/templates/bin/_ceph-admin-keyring.sh.tpl @@ -0,0 +1,29 @@ +#!/bin/bash + +{{/* +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. +*/}} + +set -ex +export HOME=/tmp + +cat < /etc/ceph/ceph.client.admin.keyring +[client.admin] +{{- if .Values.conf.ceph.admin_keyring }} + key = {{ .Values.conf.ceph.admin_keyring }} +{{- else }} + key = $(cat /tmp/client-keyring) +{{- end }} +EOF + +exit 0 diff --git a/gnocchi/templates/bin/_ceph-keyring.sh.tpl b/gnocchi/templates/bin/_ceph-keyring.sh.tpl new file mode 100644 index 000000000..db5f25fe4 --- /dev/null +++ b/gnocchi/templates/bin/_ceph-keyring.sh.tpl @@ -0,0 +1,30 @@ +#!/bin/bash + +{{/* +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. +*/}} + +set -ex +export HOME=/tmp + +cat < /etc/ceph/ceph.client.{{ .Values.conf.gnocchi.storage.ceph_username }}.keyring + +[client.{{ .Values.conf.gnocchi.storage.ceph_username }}] +{{- if .Values.conf.gnocchi.storage.provided_keyring }} + key = {{ .Values.conf.gnocchi.storage.provided_keyring }} +{{- else }} + key = $(cat /tmp/client-keyring) +{{- end }} +EOF + +exit 0 diff --git a/gnocchi/templates/bin/_clean-secrets.sh.tpl b/gnocchi/templates/bin/_clean-secrets.sh.tpl new file mode 100644 index 000000000..31b7177cf --- /dev/null +++ b/gnocchi/templates/bin/_clean-secrets.sh.tpl @@ -0,0 +1,22 @@ +#!/bin/bash + +{{/* +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. +*/}} + +set -ex + +exec kubectl delete secret \ + --namespace ${NAMESPACE} \ + --ignore-not-found=true \ + ${RBD_POOL_SECRET} diff --git a/gnocchi/templates/bin/_db-init.sh.tpl b/gnocchi/templates/bin/_db-init.sh.tpl new file mode 100644 index 000000000..b95d4a214 --- /dev/null +++ b/gnocchi/templates/bin/_db-init.sh.tpl @@ -0,0 +1,89 @@ +#!/bin/bash + +{{/* +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. +*/}} + +set -ex +export HOME=/tmp + +pgsql_superuser_cmd () { + DB_COMMAND="$1" + if [[ ! -z $2 ]]; then + EXPORT PGDATABASE=$2 + fi + if [[ ! -z "${ROOT_DB_PASS}" ]]; then + export PGPASSWORD="${ROOT_DB_PASS}" + fi + psql \ + -h ${DB_FQDN} \ + -p ${DB_PORT} \ + -U ${ROOT_DB_USER} \ + --command="${DB_COMMAND}" + unset PGPASSWORD +} + +if [[ ! -v ROOT_DB_CONNECTION ]]; then + echo "environment variable ROOT_DB_CONNECTION not set" + exit 1 +else + echo "Got DB root connection" +fi + +if [[ -v OPENSTACK_CONFIG_FILE ]]; then + if [[ ! -v OPENSTACK_CONFIG_DB_SECTION ]]; then + echo "Environment variable OPENSTACK_CONFIG_DB_SECTION not set" + exit 1 + elif [[ ! -v OPENSTACK_CONFIG_DB_KEY ]]; then + echo "Environment variable OPENSTACK_CONFIG_DB_KEY not set" + exit 1 + fi + + echo "Using ${OPENSTACK_CONFIG_FILE} as db config source" + echo "Trying to load db config from ${OPENSTACK_CONFIG_DB_SECTION}:${OPENSTACK_CONFIG_DB_KEY}" + + DB_CONN=$(awk -v key=$OPENSTACK_CONFIG_DB_KEY "/^\[${OPENSTACK_CONFIG_DB_SECTION}\]/{f=1} f==1&&/^$OPENSTACK_CONFIG_DB_KEY/{print \$3;exit}" "${OPENSTACK_CONFIG_FILE}") + + echo "Found DB connection: $DB_CONN" +elif [[ -v DB_CONNECTION ]]; then + DB_CONN=${DB_CONNECTION} + echo "Got config from DB_CONNECTION env var" +else + echo "Could not get dbconfig" + exit 1 +fi + +ROOT_DB_PROTO="$(echo $ROOT_DB_CONNECTION | grep '//' | sed -e's,^\(.*://\).*,\1,g')" +ROOT_DB_URL="$(echo $ROOT_DB_CONNECTION | sed -e s,$ROOT_DB_PROTO,,g)" +ROOT_DB_USER="$(echo $ROOT_DB_URL | grep @ | cut -d@ -f1 | cut -d: -f1)" +ROOT_DB_PASS="$(echo $ROOT_DB_URL | grep @ | cut -d@ -f1 | cut -d: -f2)" + +DB_FQDN="$(echo $ROOT_DB_URL | sed -e s,$ROOT_DB_USER:$ROOT_DB_PASS@,,g | cut -d/ -f1 | cut -d: -f1)" +DB_PORT="$(echo $ROOT_DB_URL | sed -e s,$ROOT_DB_USER:$ROOT_DB_PASS@,,g | cut -d/ -f1 | cut -d: -f2)" +DB_NAME="$(echo $ROOT_DB_URL | sed -e s,$ROOT_DB_USER:$ROOT_DB_PASS@,,g | cut -d/ -f2 | cut -d? -f1)" + +DB_PROTO="$(echo $DB_CONN | grep '//' | sed -e's,^\(.*://\).*,\1,g')" +DB_URL="$(echo $DB_CONN | sed -e s,$DB_PROTO,,g)" +DB_USER="$( echo $DB_URL | grep @ | cut -d@ -f1 | cut -d: -f1)" +DB_PASS="$( echo $DB_URL | grep @ | cut -d@ -f1 | cut -d: -f2)" + +#create db +pgsql_superuser_cmd "SELECT 1 FROM pg_database WHERE datname = '$DB_NAME'" | grep -q 1 || pgsql_superuser_cmd "CREATE DATABASE $DB_NAME" + +#create db user +pgsql_superuser_cmd "SELECT * FROM pg_roles WHERE rolname = '$DB_USER';" | tail -n +3 | head -n -2 | grep -q 1 || \ + pgsql_superuser_cmd "CREATE ROLE ${DB_USER} LOGIN PASSWORD '$DB_PASS';" && pgsql_superuser_cmd "ALTER USER ${DB_USER} WITH SUPERUSER" + +#give permissions to user +pgsql_superuser_cmd "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME to $DB_USER;" + diff --git a/gnocchi/templates/bin/_db-sync.sh.tpl b/gnocchi/templates/bin/_db-sync.sh.tpl new file mode 100644 index 000000000..87698f339 --- /dev/null +++ b/gnocchi/templates/bin/_db-sync.sh.tpl @@ -0,0 +1,19 @@ +#!/bin/bash + +{{/* +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. +*/}} + +set -ex + +exec gnocchi-upgrade diff --git a/gnocchi/templates/bin/_gnocchi-api.sh.tpl b/gnocchi/templates/bin/_gnocchi-api.sh.tpl new file mode 100644 index 000000000..446fc68b0 --- /dev/null +++ b/gnocchi/templates/bin/_gnocchi-api.sh.tpl @@ -0,0 +1,32 @@ +#!/bin/bash + +{{/* +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. +*/}} + +set -ex +COMMAND="${@:-start}" + +function start () { + if [ -f /etc/apache2/envvars ]; then + # Loading Apache2 ENV variables + source /etc/apache2/envvars + fi + exec apache2 -DFOREGROUND +} + +function stop () { + kill -TERM 1 +} + +$COMMAND diff --git a/gnocchi/templates/bin/_gnocchi-metricd.sh.tpl b/gnocchi/templates/bin/_gnocchi-metricd.sh.tpl new file mode 100644 index 000000000..71c318d15 --- /dev/null +++ b/gnocchi/templates/bin/_gnocchi-metricd.sh.tpl @@ -0,0 +1,19 @@ +#!/bin/bash + +{{/* +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. +*/}} + +set -x +exec gnocchi-metricd \ + --config-file /etc/gnocchi/gnocchi.conf diff --git a/gnocchi/templates/bin/_gnocchi-resources-cleaner.sh.tpl b/gnocchi/templates/bin/_gnocchi-resources-cleaner.sh.tpl new file mode 100644 index 000000000..df03d5ed0 --- /dev/null +++ b/gnocchi/templates/bin/_gnocchi-resources-cleaner.sh.tpl @@ -0,0 +1,20 @@ +{{/* +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. +*/}} + +set -ex + +echo "Purging the deleted resources with its associated metrics which have lived more than ${DELETED_RESOURCES_TTL}" +gnocchi resource batch delete "ended_at < '-${DELETED_RESOURCES_TTL}'" + +exit 0 diff --git a/gnocchi/templates/bin/_gnocchi-statsd.sh.tpl b/gnocchi/templates/bin/_gnocchi-statsd.sh.tpl new file mode 100644 index 000000000..e962e5756 --- /dev/null +++ b/gnocchi/templates/bin/_gnocchi-statsd.sh.tpl @@ -0,0 +1,19 @@ +#!/bin/bash + +{{/* +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. +*/}} + +set -x +exec gnocchi-statsd \ + --config-file /etc/gnocchi/gnocchi.conf diff --git a/gnocchi/templates/bin/_gnocchi-test.sh.tpl b/gnocchi/templates/bin/_gnocchi-test.sh.tpl new file mode 100644 index 000000000..403548540 --- /dev/null +++ b/gnocchi/templates/bin/_gnocchi-test.sh.tpl @@ -0,0 +1,66 @@ +#!/bin/bash + +{{/* +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. +*/}} + +set -ex +export HOME=/tmp + +echo "Test: list archive policies" +gnocchi archive-policy list + +echo "Test: create metric" +gnocchi metric create --archive-policy-name low +METRIC_UUID=$(gnocchi metric list -c id -f value | head -1) +sleep 5 + +echo "Test: show metric" +gnocchi metric show ${METRIC_UUID} + +sleep 5 + +echo "Test: add measures" +gnocchi measures add -m 2017-06-27T12:00:00@31 \ + -m 2017-06-27T12:03:27@20 \ + -m 2017-06-27T12:06:51@41 \ + ${METRIC_UUID} + +sleep 15 + +echo "Test: show measures" +gnocchi measures show ${METRIC_UUID} +gnocchi measures show --aggregation min ${METRIC_UUID} + +echo "Test: delete metric" +gnocchi metric delete ${METRIC_UUID} + +RESOURCE_UUID={{ uuidv4 }} + +echo "Test: create resource type" +gnocchi resource-type create --attribute name:string --attribute host:string test + +echo "Test: list resource types" +gnocchi resource-type list + +echo "Test: create resource" +gnocchi resource create --attribute name:test --attribute host:testnode1 --create-metric cpu:medium --create-metric memory:low --type test ${RESOURCE_UUID} + +echo "Test: show resource history" +gnocchi resource history --format json --details ${RESOURCE_UUID} +echo "Test: delete resource" +gnocchi resource delete ${RESOURCE_UUID} +echo "Test: delete resource type" +gnocchi resource-type delete test + +exit 0 diff --git a/gnocchi/templates/bin/_storage-init.sh.tpl b/gnocchi/templates/bin/_storage-init.sh.tpl new file mode 100644 index 000000000..beb76d6f4 --- /dev/null +++ b/gnocchi/templates/bin/_storage-init.sh.tpl @@ -0,0 +1,62 @@ +#!/bin/bash + +{{/* +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. +*/}} + +set -x +SECRET=$(mktemp --suffix .yaml) +KEYRING=$(mktemp --suffix .keyring) +function cleanup { + rm -f ${SECRET} ${KEYRING} +} +trap cleanup EXIT + +set -ex +ceph -s +function ensure_pool () { + ceph osd pool stats $1 || ceph osd pool create $1 $2 + local test_version=$(ceph tell osd.* version | egrep -c "nautilus|mimic|luminous" | xargs echo) + if [[ ${test_version} -gt 0 ]]; then + ceph osd pool application enable $1 $3 + fi +} +ensure_pool ${RBD_POOL_NAME} ${RBD_POOL_CHUNK_SIZE} "gnocchi-metrics" + +if USERINFO=$(ceph auth get client.${RBD_POOL_USER}); then + echo "Cephx user client.${RBD_POOL_USER} already exist." + echo "Update its cephx caps" + ceph auth caps client.${RBD_POOL_USER} \ + mon "profile r" \ + osd "profile rwx pool=${RBD_POOL_NAME}" \ + mgr "allow r" + ceph auth get client.${RBD_POOL_USER} -o ${KEYRING} +else + ceph auth get-or-create client.${RBD_POOL_USER} \ + mon "profile r" \ + osd "profile rwx pool=${RBD_POOL_NAME}" \ + mgr "allow r" \ + -o ${KEYRING} +fi + +ENCODED_KEYRING=$(sed -n 's/^[[:blank:]]*key[[:blank:]]\+=[[:blank:]]\(.*\)/\1/p' ${KEYRING} | base64 -w0) +cat > ${SECRET} < + WSGIDaemonProcess gnocchi processes=1 threads=2 user=gnocchi group=gnocchi display-name=%{GROUP} + WSGIProcessGroup gnocchi + WSGIScriptAlias / "/var/lib/kolla/venv/lib/python2.7/site-packages/gnocchi/rest/app.wsgi" + WSGIApplicationGroup %{GLOBAL} + + ErrorLog /dev/stderr + SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded + CustomLog /dev/stdout combined env=!forwarded + CustomLog /dev/stdout proxy env=forwarded + + + Require all granted + + + ceph: + monitors: [] + admin_keyring: null + override: + append: + paste: + pipeline:main: + pipeline: gnocchi+auth + composite:gnocchi+noauth: + use: egg:Paste#urlmap + /: gnocchiversions + /v1: gnocchiv1+noauth + composite:gnocchi+auth: + use: egg:Paste#urlmap + /: gnocchiversions + /v1: gnocchiv1+auth + pipeline:gnocchiv1+noauth: + pipeline: gnocchiv1 + pipeline:gnocchiv1+auth: + pipeline: keystone_authtoken gnocchiv1 + app:gnocchiversions: + paste.app_factory: gnocchi.rest.app:app_factory + root: gnocchi.rest.VersionsController + app:gnocchiv1: + paste.app_factory: gnocchi.rest.app:app_factory + root: gnocchi.rest.V1Controller + filter:keystone_authtoken: + paste.filter_factory: keystonemiddleware.auth_token:filter_factory + oslo_config_project: gnocchi + policy: + admin_or_creator: 'role:admin or project_id:%(created_by_project_id)s' + resource_owner: 'project_id:%(project_id)s' + metric_owner: 'project_id:%(resource.project_id)s' + get status: 'role:admin' + create resource: '' + get resource: 'rule:admin_or_creator or rule:resource_owner' + update resource: 'rule:admin_or_creator' + delete resource: 'rule:admin_or_creator' + delete resources: 'rule:admin_or_creator' + list resource: 'rule:admin_or_creator or rule:resource_owner' + search resource: 'rule:admin_or_creator or rule:resource_owner' + create resource type: 'role:admin' + delete resource type: 'role:admin' + update resource type: 'role:admin' + list resource type: '' + get resource type: '' + get archive policy: '' + list archive policy: '' + create archive policy: 'role:admin' + update archive policy: 'role:admin' + delete archive policy: 'role:admin' + create archive policy rule: 'role:admin' + get archive policy rule: '' + list archive policy rule: '' + delete archive policy rule: 'role:admin' + create metric: '' + delete metric: 'rule:admin_or_creator' + get metric: 'rule:admin_or_creator or rule:metric_owner' + search metric: 'rule:admin_or_creator or rule:metric_owner' + list metric: '' + list all metric: 'role:admin' + get measures: 'rule:admin_or_creator or rule:metric_owner' + post measures: 'rule:admin_or_creator' + gnocchi: + DEFAULT: + debug: false + token: + provider: uuid + api: + auth_mode: keystone + # NOTE(portdirect): the bind port should not be defined, and is manipulated + # via the endpoints section. + port: null + statsd: + # NOTE(portdirect): the bind port should not be defined, and is manipulated + # via the endpoints section. + port: null + metricd: + workers: 1 + database: + max_retries: -1 + storage: + driver: ceph + ceph_pool: gnocchi.metrics + ceph_username: gnocchi + ceph_keyring: /etc/ceph/ceph.client.gnocchi.keyring + ceph_conffile: /etc/ceph/ceph.conf + file_basepath: /var/lib/gnocchi + provided_keyring: null + indexer: + driver: postgresql + keystone_authtoken: + auth_type: password + auth_version: v3 + memcache_security_strategy: ENCRYPT + +ceph_client: + configmap: ceph-etc + user_secret_name: pvc-ceph-client-key + +secrets: + identity: + admin: gnocchi-keystone-admin + gnocchi: gnocchi-keystone-user + oslo_db: + admin: gnocchi-db-admin + gnocchi: gnocchi-db-user + oslo_db_indexer: + admin: gnocchi-db-indexer-admin + gnocchi: gnocchi-db-indexer-user + rbd: gnocchi-rbd-keyring + tls: + metric: + api: + public: gnocchi-tls-public + +bootstrap: + enabled: false + ks_user: gnocchi + script: | + openstack token issue + +# typically overridden by environmental +# values, but should include all endpoints +# required by this chart +endpoints: + cluster_domain_suffix: cluster.local + local_image_registry: + name: docker-registry + namespace: docker-registry + hosts: + default: localhost + internal: docker-registry + node: localhost + host_fqdn_override: + default: null + port: + registry: + node: 5000 + identity: + name: keystone + auth: + admin: + username: "admin" + user_domain_name: "default" + password: "password" + project_name: "admin" + project_domain_name: "default" + region_name: "RegionOne" + os_auth_type: "password" + os_tenant_name: "admin" + gnocchi: + username: "gnocchi" + role: "admin" + password: "password" + project_name: "service" + region_name: "RegionOne" + os_auth_type: "password" + os_tenant_name: "service" + user_domain_name: service + project_domain_name: service + hosts: + default: keystone + internal: keystone-api + host_fqdn_override: + default: null + path: + default: /v3 + scheme: + default: 'http' + port: + api: + default: 80 + internal: 5000 + metric: + name: gnocchi + hosts: + default: gnocchi-api + public: gnocchi + host_fqdn_override: + default: null + # NOTE: this chart supports TLS for fqdn over-ridden public + # endpoints using the following format: + # public: + # host: null + # tls: + # crt: null + # key: null + path: + default: null + scheme: + default: 'http' + port: + api: + default: 8041 + public: 80 + metric_statsd: + name: gnocchi-statsd + hosts: + default: gnocchi-statsd + host_fqdn_override: + default: null + path: + default: null + scheme: + default: null + port: + statsd: + default: 8125 + oslo_db_postgresql: + auth: + admin: + username: postgres + password: password + gnocchi: + username: gnocchi + password: password + hosts: + default: postgresql + host_fqdn_override: + default: null + path: /gnocchi + scheme: postgresql + port: + postgresql: + default: 5432 + oslo_db: + auth: + admin: + username: root + password: password + gnocchi: + username: gnocchi + password: password + hosts: + default: mariadb + host_fqdn_override: + default: null + path: /gnocchi + scheme: mysql+pymysql + port: + mysql: + default: 3306 + oslo_cache: + auth: + # NOTE(portdirect): this is used to define the value for keystone + # authtoken cache encryption key, if not set it will be populated + # automatically with a random value, but to take advantage of + # this feature all services should be set to use the same key, + # and memcache service. + memcache_secret_key: null + hosts: + default: memcached + host_fqdn_override: + default: null + port: + memcache: + default: 11211 + +manifests: + configmap_bin: true + configmap_etc: true + cron_job_resources_cleaner: true + daemonset_metricd: true + daemonset_statsd: true + deployment_api: true + ingress_api: true + job_bootstrap: true + job_clean: true + job_db_drop: false + job_db_init_indexer: true + job_db_init: true + job_image_repo_sync: true + secret_db_indexer: true + job_db_sync: true + job_ks_endpoints: true + job_ks_service: true + job_ks_user: true + job_storage_init: true + pdb_api: true + pod_gnocchi_test: true + secret_db: true + secret_keystone: true + secret_ingress_tls: true + service_api: true + service_ingress_api: true + service_statsd: true +... diff --git a/releasenotes/config.yaml b/releasenotes/config.yaml index a02b24dbc..98f214ab5 100644 --- a/releasenotes/config.yaml +++ b/releasenotes/config.yaml @@ -20,6 +20,7 @@ sections: - [flannel, flannel Chart] - [fluentbit, fluentbit Chart] - [fluentd, fluentd Chart] + - [gnocchi, gnocchi Chart] - [grafana, grafana Chart] - [helm-toolkit, helm-toolkit Chart] - [ingress, ingress Chart] diff --git a/releasenotes/notes/gnocchi.yaml b/releasenotes/notes/gnocchi.yaml new file mode 100644 index 000000000..1d2afd02e --- /dev/null +++ b/releasenotes/notes/gnocchi.yaml @@ -0,0 +1,9 @@ +--- +gnocchi: + - 0.1.0 Initial Chart + - 0.1.1 Change helm-toolkit dependency version to ">= 0.1.0" + - 0.1.2 Use full image ref for docker official images + - 0.1.3 Helm 3 - Fix Job labels + - 0.1.4 Update htk requirements + - 0.1.5 Enable taint toleration for Openstack services jobs +...