diff --git a/devstack/lib/senlin b/devstack/lib/senlin index 72f8cb99..5abe3d88 100644 --- a/devstack/lib/senlin +++ b/devstack/lib/senlin @@ -155,7 +155,8 @@ function start_senlin { kubernetes_rollout_restart daemonset/senlin-conductor kubernetes_rollout_status daemonset/senlin-conductor - run_process sl-health-manager "$SENLIN_BIN_DIR/senlin-health-manager --config-file=$SENLIN_CONF" + kubernetes_rollout_restart daemonset/senlin-health-manager + kubernetes_rollout_status daemonset/senlin-health-manager kubernetes_rollout_restart daemonset/senlin-api kubernetes_rollout_status daemonset/senlin-api diff --git a/images/senlin/Dockerfile b/images/senlin/Dockerfile index 94a51f9f..44c36d6c 100644 --- a/images/senlin/Dockerfile +++ b/images/senlin/Dockerfile @@ -29,3 +29,7 @@ CMD ["/usr/local/bin/senlin-conductor"] FROM senlin-base AS senlin-engine COPY senlin-engine /usr/local/bin/senlin-engine CMD ["/usr/local/bin/senlin-engine"] + +FROM senlin-base AS senlin-health-manager +COPY senlin-health-manager /usr/local/bin/senlin-health-manager +CMD ["/usr/local/bin/senlin-health-manager"] diff --git a/images/senlin/senlin-health-manager b/images/senlin/senlin-health-manager new file mode 100644 index 00000000..2c71e381 --- /dev/null +++ b/images/senlin/senlin-health-manager @@ -0,0 +1,34 @@ +#!/usr/local/bin/python +# Copyright (c) 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. + +import pkg_resources +import re +import sys + +import sentry_sdk +from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration + +from senlin.cmd.health_manager import main + +VERSION = pkg_resources.get_distribution("senlin").version + +sentry_sdk.init( + release="senlin@%s" % VERSION, + integrations=[SqlalchemyIntegration()] +) + +sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) +sys.exit(main()) \ No newline at end of file diff --git a/openstack_operator/senlin.py b/openstack_operator/senlin.py index 77a072fa..418a7fbe 100644 --- a/openstack_operator/senlin.py +++ b/openstack_operator/senlin.py @@ -46,6 +46,10 @@ def create_or_resume(name, spec, **_): utils.create_or_update('senlin/engine/daemonset.yml.j2', name=name, spec=spec) + # senlin health-manager + utils.create_or_update('senlin/health-manager/daemonset.yml.j2', + name=name, spec=spec) + if "ingress" in spec: utils.create_or_update('senlin/api/ingress.yml.j2', name=name, spec=spec) diff --git a/openstack_operator/templates/senlin/health-manager/daemonset.yml.j2 b/openstack_operator/templates/senlin/health-manager/daemonset.yml.j2 new file mode 100644 index 00000000..befa4e0a --- /dev/null +++ b/openstack_operator/templates/senlin/health-manager/daemonset.yml.j2 @@ -0,0 +1,69 @@ +--- +# 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: senlin-health-manager + namespace: openstack + labels: + {{ labels("senlin", component="health-manager") | indent(4) }} +spec: + updateStrategy: + rollingUpdate: + maxUnavailable: 1 + type: RollingUpdate + selector: + matchLabels: + {{ labels("senlin", component="health-manager") | indent(6) }} + template: + metadata: + labels: + {{ labels("senlin", component="health-manager") | indent(8) }} + spec: + automountServiceAccountToken: false + containers: + - name: senlin + image: vexxhost/senlin-health-manager:latest + imagePullPolicy: Always + env: + {% if 'sentryDSN' in spec %} + - name: SENTRY_DSN + value: {{ spec.sentryDSN }} + {% endif %} + securityContext: + runAsUser: 1001 + volumeMounts: + - name: config + mountPath: /etc/senlin + - name: uwsgi-config + mountPath: /etc/uwsgi + volumes: + - name: config + secret: + secretName: senlin-config + - name: uwsgi-config + configMap: + defaultMode: 420 + name: uwsgi-default + nodeSelector: + node-role.kubernetes.io/master: "" + tolerations: + - key: node-role.kubernetes.io/master + effect: NoSchedule +{% if 'hostAliases' in spec %} + hostAliases: + {{ spec.hostAliases | to_yaml | indent(8) }} +{% endif %} diff --git a/zuul.d/senlin-jobs.yaml b/zuul.d/senlin-jobs.yaml index fbc5bfb1..43ab08a6 100644 --- a/zuul.d/senlin-jobs.yaml +++ b/zuul.d/senlin-jobs.yaml @@ -20,6 +20,9 @@ - context: images/senlin repository: vexxhost/senlin-engine target: senlin-engine + - context: images/senlin + repository: vexxhost/senlin-health-manager + target: senlin-health-manager dependencies: - openstack-operator:images:build:openstack-operator files: &id003