Add senlin-health-manager

Change-Id: Iee8edcef95f724a4293ddb6baeeba39f37499278
This commit is contained in:
okozachenko 2020-09-03 17:43:37 +03:00
parent a14d61b385
commit ecb3780b96
6 changed files with 116 additions and 1 deletions

View File

@ -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

View File

@ -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"]

View File

@ -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())

View File

@ -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)

View File

@ -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 %}

View File

@ -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