Added ceilometer-agent-notification
Change-Id: I0e05f59a48ff9639fa8cf209665ebea39b72907c
This commit is contained in:
parent
e053ab162f
commit
7ab44ee132
31
openstack_operator/ceilometer.py
Normal file
31
openstack_operator/ceilometer.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# Copyright 2020 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.
|
||||||
|
|
||||||
|
"""Ceilometer
|
||||||
|
|
||||||
|
The following modules maintains all the operations for deploying Ceilometer
|
||||||
|
alongside Atmosphere.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from openstack_operator import utils
|
||||||
|
|
||||||
|
|
||||||
|
def create_or_resume(spec):
|
||||||
|
"""Create or start-up Ceilometer."""
|
||||||
|
|
||||||
|
config_hash = utils.generate_hash(spec)
|
||||||
|
|
||||||
|
utils.create_or_update('ceilometer/secret.yml.j2', spec=spec)
|
||||||
|
utils.create_or_update('ceilometer/deployment-agent-notification.yml.j2',
|
||||||
|
spec=spec, config_hash=config_hash)
|
@ -22,6 +22,7 @@ the appropriate deployments, an instance of Keystone, Heat and Horizon
|
|||||||
import os
|
import os
|
||||||
import kopf
|
import kopf
|
||||||
|
|
||||||
|
from openstack_operator import ceilometer
|
||||||
from openstack_operator import chronyd
|
from openstack_operator import chronyd
|
||||||
from openstack_operator import heat
|
from openstack_operator import heat
|
||||||
from openstack_operator import horizon
|
from openstack_operator import horizon
|
||||||
@ -61,3 +62,5 @@ def deploy(name, namespace, new, **_):
|
|||||||
heat.create_or_resume("heat", config["heat"])
|
heat.create_or_resume("heat", config["heat"])
|
||||||
if "chronyd" in config:
|
if "chronyd" in config:
|
||||||
chronyd.create_or_resume(config["chronyd"])
|
chronyd.create_or_resume(config["chronyd"])
|
||||||
|
if "ceilometer" in config:
|
||||||
|
ceilometer.create_or_resume(config["ceilometer"])
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2020 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.
|
||||||
|
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
namespace: openstack
|
||||||
|
name: ceilometer-agent-notification
|
||||||
|
labels:
|
||||||
|
{{ labels("ceilometer", "ceilometer") | indent(4) }}
|
||||||
|
spec:
|
||||||
|
replicas: 3
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{ labels("ceilometer", "ceilometer") | indent(6) }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
checksum/config: "{{ config_hash }}"
|
||||||
|
labels:
|
||||||
|
{{ labels("ceilometer", "ceilometer") | indent(8) }}
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: ceilometer-notification-agent
|
||||||
|
image: vexxhost/ceilometer-agent-notification:latest
|
||||||
|
volumeMounts:
|
||||||
|
- name: ceilometer-config
|
||||||
|
mountPath: /etc/ceilometer
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 1000m
|
||||||
|
ephemeral-storage: 1G
|
||||||
|
memory: 256M
|
||||||
|
requests:
|
||||||
|
cpu: 500m
|
||||||
|
ephemeral-storage: 1G
|
||||||
|
memory: 128M
|
||||||
|
- name: atmosphere-ingress
|
||||||
|
image: jmalloc/echo-server
|
||||||
|
env:
|
||||||
|
- name: LOG_HTTP_BODY
|
||||||
|
value: 'true'
|
||||||
|
volumes:
|
||||||
|
- name: ceilometer-config
|
||||||
|
secret:
|
||||||
|
secretName: ceilometer-config
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 65534
|
||||||
|
runAsGroup: 65534
|
||||||
|
fsGroup: 65534
|
||||||
|
{% if 'nodeSelector' in spec %}
|
||||||
|
nodeSelector:
|
||||||
|
{{ spec.nodeSelector | to_yaml | indent(8) }}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'tolerations' in spec %}
|
||||||
|
tolerations:
|
||||||
|
{{ spec.tolerations | to_yaml | indent(8) }}
|
||||||
|
{% endif %}
|
45
openstack_operator/templates/ceilometer/secret.yml.j2
Normal file
45
openstack_operator/templates/ceilometer/secret.yml.j2
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2020 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.
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
namespace: openstack
|
||||||
|
name: ceilometer-config
|
||||||
|
stringData:
|
||||||
|
ceilometer.conf: |
|
||||||
|
[DEFAULT]
|
||||||
|
transport_url = fake:/
|
||||||
|
[notification]
|
||||||
|
ack_on_event_error = false
|
||||||
|
{% for transport in spec.get('transports', []) %}
|
||||||
|
messaging_urls = {{ transport }}
|
||||||
|
{% endfor %}
|
||||||
|
pipeline.yaml: |
|
||||||
|
---
|
||||||
|
sources: []
|
||||||
|
sinks: []
|
||||||
|
event_pipeline.yaml: |
|
||||||
|
---
|
||||||
|
sources:
|
||||||
|
- name: all
|
||||||
|
events:
|
||||||
|
- "*"
|
||||||
|
sinks:
|
||||||
|
- atmosphere
|
||||||
|
sinks:
|
||||||
|
- name: atmosphere
|
||||||
|
publishers:
|
||||||
|
- http://localhost:8080/v1/events
|
Loading…
x
Reference in New Issue
Block a user