diff --git a/openstack_operator/ceilometer.py b/openstack_operator/ceilometer.py index 4c3561b3..1b381acc 100644 --- a/openstack_operator/ceilometer.py +++ b/openstack_operator/ceilometer.py @@ -29,3 +29,4 @@ def create_or_resume(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) + utils.create_or_update('ceilometer/horizontalpodautoscaler.yml.j2') diff --git a/openstack_operator/templates/ceilometer/deployment-agent-notification.yml.j2 b/openstack_operator/templates/ceilometer/deployment-agent-notification.yml.j2 index b485e6c9..79a6adf3 100644 --- a/openstack_operator/templates/ceilometer/deployment-agent-notification.yml.j2 +++ b/openstack_operator/templates/ceilometer/deployment-agent-notification.yml.j2 @@ -21,7 +21,7 @@ metadata: labels: {{ labels("ceilometer", "ceilometer") | indent(4) }} spec: - replicas: 3 + replicas: 1 selector: matchLabels: {{ labels("ceilometer", "ceilometer") | indent(6) }} diff --git a/openstack_operator/templates/ceilometer/horizontalpodautoscaler.yml.j2 b/openstack_operator/templates/ceilometer/horizontalpodautoscaler.yml.j2 new file mode 100644 index 00000000..bb7eeb51 --- /dev/null +++ b/openstack_operator/templates/ceilometer/horizontalpodautoscaler.yml.j2 @@ -0,0 +1,30 @@ +--- +# 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: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: ceilometer + namespace: openstack + labels: + {{ labels("ceilometer", "ceilometer") | indent(4) }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: ceilometer-agent-notification + minReplicas: 1 + maxReplicas: 10 + targetCPUUtilizationPercentage: 90