| # Copyright (c) 2022 VEXXHOST, Inc. |
| # |
| # 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. |
| |
| - name: Deploy service |
| kubernetes.core.k8s: |
| state: present |
| definition: |
| - apiVersion: apps/v1 |
| kind: Deployment |
| metadata: |
| name: openstack-exporter |
| namespace: openstack |
| labels: |
| application: openstack-exporter |
| spec: |
| replicas: 1 |
| selector: |
| matchLabels: |
| application: openstack-exporter |
| template: |
| metadata: |
| labels: |
| application: openstack-exporter |
| spec: |
| nodeSelector: |
| openstack-control-plane: enabled |
| initContainers: |
| - name: build-config |
| image: quay.io/vexxhost/openstack-runtime-focal:latest |
| command: ["bash", "-ec"] |
| args: |
| - | |
| cat <<EOF > /etc/openstack/clouds.yaml |
| --- |
| clouds: |
| default: |
| auth: |
| auth_url: "$(OS_AUTH_URL)" |
| project_domain_name: "$(OS_PROJECT_DOMAIN_NAME)" |
| project_name: "$(OS_PROJECT_NAME)" |
| user_domain_name: "$(OS_USER_DOMAIN_NAME)" |
| username: "$(OS_USERNAME)" |
| password: "$(OS_PASSWORD)" |
| region_name: "$(OS_REGION_NAME)" |
| interface: "$(OS_INTERFACE)" |
| identity_api_version: 3 |
| identity_interface: "$(OS_INTERFACE)" |
| EOF |
| envFrom: |
| - secretRef: |
| name: keystone-keystone-admin |
| volumeMounts: |
| - name: openstack-config |
| mountPath: /etc/openstack |
| containers: |
| - name: openstack-exporter |
| image: "{{ atmosphere_images['prometheus_openstack_exporter'] | vexxhost.atmosphere.docker_image('ref') }}" |
| args: |
| - --endpoint-type |
| - internal |
| - default |
| - --collect-metric-time |
| - --disable-service.identity |
| - --disable-service.image |
| - --disable-metric=cinder-limits_volume_max_gb |
| - --disable-metric=cinder-limits_volume_used_gb |
| - --disable-metric=cinder-volumes |
| - --disable-metric=cinder-volume_status |
| - --disable-metric=neutron-floating_ips |
| - --disable-metric=neutron-networks |
| - --disable-metric=neutron-security_groups |
| - --disable-metric=neutron-subnets |
| - --disable-metric=neutron-routers |
| - --disable-metric=nova-flavors |
| - --disable-metric=nova-availability_zones |
| - --disable-metric=nova-security_groups |
| - --disable-metric=nova-limits_vcpus_max |
| - --disable-metric=nova-limits_vcpus_used |
| - --disable-metric=nova-limits_memory_max |
| - --disable-metric=nova-limits_memory_used |
| ports: |
| - name: metrics |
| containerPort: 9180 |
| volumeMounts: |
| - name: openstack-config |
| mountPath: /etc/openstack |
| readinessProbe: |
| failureThreshold: 3 |
| httpGet: |
| path: / |
| port: 9180 |
| scheme: HTTP |
| livenessProbe: |
| failureThreshold: 3 |
| httpGet: |
| path: / |
| port: 9180 |
| scheme: HTTP |
| periodSeconds: 10 |
| successThreshold: 1 |
| timeoutSeconds: 1 |
| volumes: |
| - name: openstack-config |
| emptyDir: {} |
| |
| - apiVersion: v1 |
| kind: Service |
| metadata: |
| name: openstack-exporter |
| namespace: openstack |
| labels: |
| application: openstack-exporter |
| spec: |
| clusterIP: None |
| ports: |
| - name: metrics |
| port: 9180 |
| targetPort: metrics |
| selector: |
| application: openstack-exporter |