diff --git a/cinder/templates/bin/_volume-usage-audit.sh.tpl b/cinder/templates/bin/_volume-usage-audit.sh.tpl new file mode 100644 index 0000000000..32b1d41d5f --- /dev/null +++ b/cinder/templates/bin/_volume-usage-audit.sh.tpl @@ -0,0 +1,21 @@ +#!/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 + +exec cinder-volume-usage-audit --send_actions diff --git a/cinder/templates/configmap-bin.yaml b/cinder/templates/configmap-bin.yaml index b653e363eb..eacc70260b 100644 --- a/cinder/templates/configmap-bin.yaml +++ b/cinder/templates/configmap-bin.yaml @@ -47,6 +47,8 @@ data: {{ tuple "bin/_cinder-volume.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} ceph-keyring.sh: |+ {{ tuple "bin/_ceph-keyring.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} + volume-usage-audit.sh: |+ +{{ tuple "bin/_volume-usage-audit.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} {{- if .Values.bootstrap.enabled }} bootstrap.sh: |+ {{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} diff --git a/cinder/templates/cron-job-cinder-volume-usage-audit.yaml b/cinder/templates/cron-job-cinder-volume-usage-audit.yaml new file mode 100644 index 0000000000..debfcd87a7 --- /dev/null +++ b/cinder/templates/cron-job-cinder-volume-usage-audit.yaml @@ -0,0 +1,74 @@ +{{/* +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. +*/}} + +{{- if .Values.manifests.cron_volume_usage_audit }} +{{- if .Capabilities.APIVersions.Has "batch/v2alpha1" }} +{{- $envAll := . }} +{{- $dependencies := .Values.dependencies.volume_usage_audit }} +{{- $mounts_cinder_volume_usage_audit := .Values.pod.mounts.cinder_volume_usage_audit.cinder_volume_usage_audit }} +{{- $mounts_cinder_volume_usage_audit_init := .Values.pod.mounts.cinder_volume_usage_audit.init_container }} +apiVersion: batch/v2alpha1 +kind: CronJob +metadata: + name: cinder-volume-usage-audit +spec: + schedule: {{ .Values.jobs.volume_usage_audit.cron | quote }} + concurrencyPolicy: Forbid + jobTemplate: + metadata: + labels: +{{ tuple $envAll "cinder" "volume-usage-audit" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} + spec: + template: + spec: + initContainers: +{{ tuple $envAll $dependencies $mounts_cinder_volume_usage_audit_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 12 }} + restartPolicy: OnFailure + nodeSelector: + {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} + containers: + - name: cinder-volume-usage-audit + image: {{ .Values.images.volume_usage_audit }} + imagePullPolicy: {{ .Values.images.pull_policy }} +{{ tuple $envAll $envAll.Values.pod.resources.jobs.volume_usage_audit | include "helm-toolkit.snippets.kubernetes_resources" | indent 14 }} + command: + - /tmp/volume-usage-audit.sh + volumeMounts: + - name: etccinder + mountPath: /etc/cinder + - name: cinder-etc + mountPath: /etc/cinder/cinder.conf + subPath: cinder.conf + readOnly: true + - name: cinder-bin + mountPath: /tmp/volume-usage-audit.sh + subPath: volume-usage-audit.sh + readOnly: true + {{ if $mounts_cinder_volume_usage_audit.volumeMounts }}{{ toYaml $mounts_cinder_volume_usage_audit.volumeMounts | indent 14 }}{{ end }} + volumes: + - name: etccinder + emptyDir: {} + - name: cinder-etc + configMap: + name: cinder-etc + defaultMode: 0444 + - name: cinder-bin + configMap: + name: cinder-bin + defaultMode: 0555 + {{ if $mounts_cinder_volume_usage_audit.volumes }}{{ toYaml $mounts_cinder_volume_usage_audit.volumes | indent 10 }}{{ end }} +{{- end }} +{{- end }} diff --git a/cinder/values.yaml b/cinder/values.yaml index 235ad48fe2..8ba7ecd11f 100644 --- a/cinder/values.yaml +++ b/cinder/values.yaml @@ -37,10 +37,15 @@ images: bootstrap: docker.io/kolla/ubuntu-source-heat-engine:3.0.3 scheduler: docker.io/kolla/ubuntu-source-cinder-scheduler:3.0.3 volume: docker.io/kolla/ubuntu-source-cinder-volume:3.0.3 + volume_usage_audit: docker.io/kolla/ubuntu-source-cinder-volume:3.0.3 backup: docker.io/kolla/ubuntu-source-cinder-backup:3.0.3 dep_check: docker.io/kolla/ubuntu-source-kubernetes-entrypoint:4.0.0 pull_policy: "IfNotPresent" +jobs: + volume_usage_audit: + cron: "*/5 * * * *" + pod: user: cinder: @@ -61,6 +66,9 @@ pod: cinder_volume: init_container: null cinder_volume: + cinder_volume_usage_audit: + init_container: null + cinder_volume_usage_audit: cinder_backup: init_container: null cinder_backup: @@ -110,6 +118,13 @@ pod: memory: "1024Mi" cpu: "2000m" jobs: + volume_usage_audit: + requests: + memory: "128Mi" + cpu: "100m" + limits: + memory: "1024Mi" + cpu: "2000m" bootstrap: requests: memory: "128Mi" @@ -390,6 +405,8 @@ conf: memcache_security_strategy: ENCRYPT oslo_concurrency: lock_path: "/var/lib/cinder/tmp" + oslo_messaging_notifications: + driver: messagingv2 backends: # Those options will be written to backends.conf as-is. rbd1: @@ -462,6 +479,16 @@ dependencies: endpoint: internal - service: volume endpoint: internal + volume_usage_audit: + jobs: + - cinder-db-sync + - cinder-ks-user + - cinder-ks-endpoints + services: + - service: identity + endpoint: internal + - service: volume + endpoint: internal scheduler: jobs: - cinder-db-sync @@ -656,6 +683,7 @@ endpoints: manifests: configmap_bin: true configmap_etc: true + cron_volume_usage_audit: true deployment_api: true deployment_backup: true deployment_scheduler: true diff --git a/glance/values.yaml b/glance/values.yaml index c9fd1a8f89..6907dd93fb 100644 --- a/glance/values.yaml +++ b/glance/values.yaml @@ -199,7 +199,9 @@ conf: paste_deploy: flavor: keystone database: - connection: null + max_retries: -1 + oslo_messaging_notifications: + driver: messagingv2 paste_registry: pipeline:glance-registry: pipeline: healthcheck osprofiler unauthenticated-context registryapp @@ -233,7 +235,9 @@ conf: paste_deploy: flavor: keystone database: - connection: null + max_retries: -1 + oslo_messaging_notifications: + driver: messagingv2 swift_store: override: append: diff --git a/heat/values.yaml b/heat/values.yaml index ebc32cfe2b..9f335df691 100644 --- a/heat/values.yaml +++ b/heat/values.yaml @@ -213,6 +213,8 @@ conf: endpoint_type: internalURL clients_keystone: endpoint_type: internalURL + oslo_messaging_notifications: + driver: messagingv2 network: api: diff --git a/neutron/values.yaml b/neutron/values.yaml index c36b68ced8..4f927fc253 100644 --- a/neutron/values.yaml +++ b/neutron/values.yaml @@ -675,8 +675,7 @@ conf: agent: root_helper: sudo /var/lib/kolla/venv/bin/neutron-rootwrap /etc/neutron/rootwrap.conf oslo_messaging_notifications: - driver: - - noop + driver: messagingv2 nova: auth_type: password auth_version: v3 diff --git a/nova/values.yaml b/nova/values.yaml index f2ea8750cf..091ca9dd98 100644 --- a/nova/values.yaml +++ b/nova/values.yaml @@ -619,6 +619,9 @@ conf: allow_resize_to_same_host: true compute_driver: libvirt.LibvirtDriver my_ip: 0.0.0.0 + instance_usage_audit: True + instance_usage_audit_period: hour + notify_on_state_change: vm_and_task_state vnc: novncproxy_host: 0.0.0.0 novncproxy_port: 6080 @@ -668,6 +671,8 @@ conf: backend: oslo_cache.memcache_pool wsgi: api_paste_config: /etc/nova/api-paste.ini + oslo_messaging_notifications: + driver: messagingv2 # Names of secrets used by bootstrap and environmental checks secrets: