Merge "Add libvirtd_exporter"
This commit is contained in:
commit
bb67cfc27d
@ -15,4 +15,4 @@ configMap:
|
||||
configDir: /etc/heat
|
||||
magnum:
|
||||
configDir: /etc/magnum
|
||||
chronyd: {}
|
||||
chronyd: {}
|
||||
|
@ -19,4 +19,4 @@ data:
|
||||
api-cfn: "h-api-cfn.vexxhost.com"
|
||||
magnum:
|
||||
configDir: /etc/magnum
|
||||
chronyd: {}
|
||||
chronyd: {}
|
||||
|
34
openstack_operator/libvirtd_exporter.py
Normal file
34
openstack_operator/libvirtd_exporter.py
Normal file
@ -0,0 +1,34 @@
|
||||
# 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.
|
||||
|
||||
"""libvirtd-exporter Operator
|
||||
|
||||
This module maintains the operator for libvirtd-exporter,
|
||||
it takes care of creating the appropriate daemonset
|
||||
"""
|
||||
|
||||
|
||||
from openstack_operator import utils
|
||||
|
||||
|
||||
def create_or_resume(spec, **_):
|
||||
"""Create and re-sync a libvirtd-exporter instance
|
||||
|
||||
This function is called when a new resource is created but also when we
|
||||
start the service up for the first time.
|
||||
"""
|
||||
|
||||
utils.create_or_update('libvirtd_exporter/daemonset.yml.j2',
|
||||
spec=spec)
|
||||
utils.create_or_update('libvirtd_exporter/podmonitor.yml.j2')
|
@ -28,6 +28,7 @@ from openstack_operator import glance
|
||||
from openstack_operator import heat
|
||||
from openstack_operator import horizon
|
||||
from openstack_operator import keystone
|
||||
from openstack_operator import libvirtd_exporter
|
||||
from openstack_operator import magnum
|
||||
from openstack_operator import utils
|
||||
|
||||
@ -67,7 +68,17 @@ def deploy(name, namespace, new, **_):
|
||||
glance.create_or_resume("glance", config["glance"])
|
||||
if "magnum" in config:
|
||||
magnum.create_or_resume("magnum", config["magnum"])
|
||||
if "chronyd" in config:
|
||||
chronyd.create_or_resume(config["chronyd"])
|
||||
if "ceilometer" in config:
|
||||
ceilometer.create_or_resume(config["ceilometer"])
|
||||
|
||||
if "chronyd" in config:
|
||||
spec = config["chronyd"]
|
||||
else:
|
||||
spec = {}
|
||||
chronyd.create_or_resume(spec)
|
||||
|
||||
if "libvirtd-exporter" in config:
|
||||
spec = config["libvirtd-exporter"]
|
||||
else:
|
||||
spec = {}
|
||||
libvirtd_exporter.create_or_resume(spec)
|
||||
|
@ -0,0 +1,65 @@
|
||||
---
|
||||
# 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: DaemonSet
|
||||
metadata:
|
||||
name: libvirtd-exporter
|
||||
namespace: openstack
|
||||
labels:
|
||||
{{ labels("libvirtd-exporter", "libvirtd-exporter") | indent(4) }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{ labels("libvirtd-exporter", "libvirtd-exporter") | indent(6) }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{ labels("libvirtd-exporter", "libvirtd-exporter") | indent(8) }}
|
||||
spec:
|
||||
containers:
|
||||
- name: main
|
||||
image: vexxhost/libvirtd-exporter:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- name: metrics
|
||||
protocol: TCP
|
||||
containerPort: 9474
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: metrics
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: metrics
|
||||
resources:
|
||||
limits:
|
||||
cpu: 500m
|
||||
ephemeral-storage: 100M
|
||||
memory: 256M
|
||||
requests:
|
||||
cpu: 250m
|
||||
ephemeral-storage: 100M
|
||||
memory: 128M
|
||||
volumeMounts:
|
||||
- mountPath: /var/run/libvirt
|
||||
name: sock
|
||||
volumes:
|
||||
- name: sock
|
||||
hostPath:
|
||||
path: /var/run/libvirt
|
||||
nodeSelector:
|
||||
node-role.openstack.org: "compute"
|
@ -0,0 +1,29 @@
|
||||
---
|
||||
# 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: monitoring.coreos.com/v1
|
||||
kind: PodMonitor
|
||||
metadata:
|
||||
name: libvirtd-exporter
|
||||
namespace: openstack
|
||||
labels:
|
||||
{{ labels("libvirtd-exporter", "libvirtd-exporter") | indent(4) }}
|
||||
spec:
|
||||
podMetricsEndpoints:
|
||||
- path: /metrics
|
||||
port: metrics
|
||||
selector:
|
||||
matchLabels:
|
||||
{{ labels("libvirtd-exporter", "libvirtd-exporter") | indent(6) }}
|
@ -47,8 +47,11 @@ class KubernetesObjectTestCase(testtools.TestCase):
|
||||
with open(config_path) as config_fd:
|
||||
sample = yaml.load(config_fd, Loader=yaml.FullLoader)
|
||||
name = sample['metadata']['name']
|
||||
spec = utils.to_dict(
|
||||
sample['data']['operator-config.yaml'])[cls.RELEASE_TYPE]
|
||||
config = utils.to_dict(sample['data']['operator-config.yaml'])
|
||||
if cls.RELEASE_TYPE in config:
|
||||
spec = config[cls.RELEASE_TYPE]
|
||||
else:
|
||||
spec = {}
|
||||
cls.object = utils.render_template(cls.TEMPLATE_FILE,
|
||||
name=cls.RELEASE_TYPE,
|
||||
spec=spec,
|
||||
|
Loading…
Reference in New Issue
Block a user