Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

wip: adding gnocchi chart #276

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

.PHONY: ceph bootstrap mariadb etcd postgresql keystone memcached rabbitmq helm-toolkit neutron nova cinder heat maas all clean
.PHONY: ceph bootstrap mariadb etcd postgresql keystone memcached rabbitmq helm-toolkit neutron nova cinder heat gnocchi maas all clean

B64_DIRS := helm-toolkit/secrets
B64_EXCLUDE := $(wildcard helm-toolkit/secrets/*.b64)

CHARTS := ceph mariadb etcd postgresql rabbitmq memcached keystone glance horizon neutron nova cinder heat maas
CHARTS := ceph mariadb etcd postgresql rabbitmq memcached keystone glance horizon neutron nova cinder heat gnocchi maas
TOOLKIT_TPL := helm-toolkit/templates/_globals.tpl

all: helm-toolkit ceph bootstrap mariadb etcd postgresql rabbitmq memcached keystone glance horizon neutron nova cinder heat maas
all: helm-toolkit ceph bootstrap mariadb etcd postgresql rabbitmq memcached keystone glance horizon neutron nova cinder heat gnocchi maas

helm-toolkit: build-helm-toolkit

Expand Down Expand Up @@ -51,6 +51,8 @@ nova: build-nova

heat: build-heat

gnocchi: build-gnocchi

maas: build-maas

memcached: build-memcached
Expand Down
21 changes: 21 additions & 0 deletions gnocchi/.helmignore
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions gnocchi/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
description: A Helm chart for Kubernetes
name: gnocchi
version: 0.1.0
18 changes: 18 additions & 0 deletions gnocchi/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2017 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://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://localhost:8879/charts
version: 0.1.0
37 changes: 37 additions & 0 deletions gnocchi/templates/bin/_db-init.sh.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# Copyright 2017 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://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

ansible localhost -vvv \
-m mysql_db -a "login_host='{{ .Values.database.address }}' \
login_port='{{ .Values.database.port }}' \
login_user='{{ .Values.database.root_user }}' \
login_password='{{ .Values.database.root_password }}' \
name='{{ .Values.database.gnocchi_database_name }}'"

ansible localhost -vvv \
-m mysql_user -a "login_host='{{ .Values.database.address }}' \
login_port='{{ .Values.database.port }}' \
login_user='{{ .Values.database.root_user }}' \
login_password='{{ .Values.database.root_password }}' \
name='{{ .Values.database.gnocchi_user }}' \
password='{{ .Values.database.gnocchi_password }}' \
host='%' \
priv='{{ .Values.database.gnocchi_database_name }}.*:ALL' \
append_privs='yes'"

19 changes: 19 additions & 0 deletions gnocchi/templates/bin/_db-sync.sh.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Copyright 2017 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://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

gnocchi-upgrade
25 changes: 25 additions & 0 deletions gnocchi/templates/bin/_start.sh.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# Copyright 2017 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://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

if [ -f /etc/apache2/envvars ]; then
# Loading Apache2 ENV variables
source /etc/apache2/envvars
fi

# Start Apache2
exec apache2 -DFOREGROUND
27 changes: 27 additions & 0 deletions gnocchi/templates/configmap-bin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2017 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://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
kind: ConfigMap
metadata:
name: gnocchi-bin
data:
db-init.sh: |+
{{ tuple "bin/_db-init.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
db-sync.sh: |+
{{ tuple "bin/_db-sync.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}
start.sh: |+
{{ tuple "bin/_start.sh.tpl" . | include "helm-toolkit.template" | indent 4 }}


27 changes: 27 additions & 0 deletions gnocchi/templates/configmap-etc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2017 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://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
kind: ConfigMap
metadata:
name: gnocchi-etc
data:
gnocchi.conf: |+
{{ tuple "etc/_gnocchi.conf.tpl" . | include "helm-toolkit.template" | indent 4 }}
api-paste.ini: |+
{{ tuple "etc/_gnocchi-api-paste.ini.tpl" . | include "helm-toolkit.template" | indent 4 }}
policy.json: |+
{{ tuple "etc/_gnocchi-policy.json.tpl" . | include "helm-toolkit.template" | indent 4 }}
wsgi-gnocchi.conf: |+
{{ tuple "etc/_wsgi-gnocchi.conf.tpl" . | include "helm-toolkit.template" | indent 4 }}
96 changes: 96 additions & 0 deletions gnocchi/templates/deployment-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Copyright 2017 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://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.

{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.api }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: gnocchi-api
spec:
replicas: {{ .Values.replicas.api }}
template:
metadata:
labels:
app: gnocchi-api
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "helm-toolkit.kubernetes_entrypoint_init_container" | indent 10 }}
]'
spec:
nodeSelector:
{{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
containers:
- name: gnocchi-api
image: {{ .Values.images.api }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{- if .Values.resources.enabled }}
resources:
requests:
memory: {{ .Values.resources.gnocchi_api.requests.memory | quote }}
cpu: {{ .Values.resources.gnocchi_api.requests.cpu | quote }}
limits:
memory: {{ .Values.resources.gnocchi_api.limits.memory | quote }}
cpu: {{ .Values.resources.gnocchi_api.limits.cpu | quote }}
{{- end }}
command:
- bash
- /tmp/start.sh
ports:
- containerPort: {{ .Values.network.api.port }}
readinessProbe:
tcpSocket:
port: {{ .Values.network.api.port }}
volumeMounts:
- name: pod-etc-gnocchi
mountPath: /etc/gnocchi
- name: gnocchiconf
mountPath: /etc/gnocchi/gnocchi.conf
subPath: gnocchi.conf
readOnly: true
- name: gnocchipaste
mountPath: /etc/gnocchi/api-paste.ini
subPath: api-paste.ini
readOnly: true
- name: gnocchipolicy
mountPath: /etc/gnocchi/policy.json
subPath: policy.json
readOnly: true
- name: wsgignocchi
mountPath: /etc/apache2/conf-enabled/wsgi-gnocchi.conf
subPath: wsgi-gnocchi.conf
readOnly: true
- name: startsh
mountPath: /tmp/start.sh
subPath: start.sh
readOnly: true
volumes:
- name: pod-etc-gnocchi
emptyDir: {}
- name: gnocchiconf
configMap:
name: gnocchi-etc
- name: gnocchipaste
configMap:
name: gnocchi-etc
- name: gnocchipolicy
configMap:
name: gnocchi-etc
- name: wsgignocchi
configMap:
name: gnocchi-etc
- name: startsh
configMap:
name: gnocchi-bin

31 changes: 31 additions & 0 deletions gnocchi/templates/etc/_gnocchi-api-paste.ini.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Use gnocchi+auth in the pipeline if you want to use keystone authentication
[pipeline:main]
pipeline = gnocchi+noauth

[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
42 changes: 42 additions & 0 deletions gnocchi/templates/etc/_gnocchi-policy.json.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"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"
}
Loading