Merge select content originating from repo 'openstack-armada-app'

Story: 2006166
Task: 35687
Change-Id: Id9f1ed3242115b9ca0e0090ba8b8c632cfff843c
Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
Scott Little 2019-09-04 10:17:08 -04:00
commit eda8c1d27b
21 changed files with 768 additions and 0 deletions

View File

@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: StarlingX Fault Rest API Service
name: fm-rest-api
version: 0.1.0

View File

@ -0,0 +1,8 @@
#
# SPDX-License-Identifier: Apache-2.0
#
dependencies:
- name: helm-toolkit
repository: http://localhost:8879/charts
version: 0.1.0

View File

@ -0,0 +1,38 @@
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "fm-rest-api.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "fm-rest-api.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "fm-rest-api.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

View File

@ -0,0 +1,11 @@
#!/bin/bash
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
set -ex
dropdb -h 127.0.0.1 -Uroot fm

View File

@ -0,0 +1,11 @@
#!/bin/bash
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
set -ex
fm-dbsync --config-file /etc/fm/fm.conf

View File

@ -0,0 +1,14 @@
#!/bin/bash
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
set -ex
export SQL_CONNECTION=$(awk -F '=' '/sql_connection/{print $2}' /etc/fm/fm.conf)
echo $SQL_CONNECTION > /var/log/sql_connection
python /usr/local/bin/fm_db_sync_event_suppression.py $SQL_CONNECTION
python /var/lib/openstack/bin/fm-api --config-file /etc/fm/fm.conf

View File

@ -0,0 +1,27 @@
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
apiVersion: v1
kind: ConfigMap
metadata:
name: fm-bin
data:
fm-rest-api.sh: |
{{ tuple "bin/_fm-rest-api.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
db-sync.sh: |
{{ tuple "bin/_db-sync.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
db-init.py: |
{{- include "helm-toolkit.scripts.db_init" . | indent 4 }}
db-drop.sh: |
{{ tuple "bin/_db-drop.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
db-drop.py: |
{{- include "helm-toolkit.scripts.db_drop" . | indent 4 }}
ks-service.sh: |
{{- include "helm-toolkit.scripts.keystone_service" . | indent 4 }}
ks-endpoints.sh: |
{{- include "helm-toolkit.scripts.keystone_endpoints" . | indent 4 }}
ks-user.sh: |
{{- include "helm-toolkit.scripts.keystone_user" . | indent 4 }}

View File

@ -0,0 +1,46 @@
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if empty .Values.conf.fm.database.connection -}}
{{- $_ := tuple "oslo_db" "internal" "fm" "mysql" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup"| set .Values.conf.fm.database "connection" -}}
{{- end -}}
{{- if empty .Values.conf.fm.DEFAULT.sql_connection -}}
{{- $_ := tuple "oslo_db" "internal" "fm" "mysql" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup"| set .Values.conf.fm.DEFAULT "sql_connection" -}}
{{- end -}}
{{- if empty .Values.conf.fm.keystone_authtoken.auth_uri -}}
{{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.fm.keystone_authtoken "auth_uri" -}}
{{- end -}}
{{- if empty .Values.conf.fm.keystone_authtoken.auth_url -}}
{{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.fm.keystone_authtoken "auth_url" -}}
{{- end -}}
{{- if empty .Values.conf.fm.keystone_authtoken.region_name -}}
{{- $_ := set .Values.conf.fm.keystone_authtoken "region_name" .Values.endpoints.identity.auth.fm.region_name -}}
{{- end -}}
{{- if empty .Values.conf.fm.keystone_authtoken.project_name -}}
{{- $_ := set .Values.conf.fm.keystone_authtoken "project_name" .Values.endpoints.identity.auth.fm.project_name -}}
{{- end -}}
{{- if empty .Values.conf.fm.keystone_authtoken.project_domain_name -}}
{{- $_ := set .Values.conf.fm.keystone_authtoken "project_domain_name" .Values.endpoints.identity.auth.fm.project_domain_name -}}
{{- end -}}
{{- if empty .Values.conf.fm.keystone_authtoken.user_domain_name -}}
{{- $_ := set .Values.conf.fm.keystone_authtoken "user_domain_name" .Values.endpoints.identity.auth.fm.user_domain_name -}}
{{- end -}}
{{- if empty .Values.conf.fm.keystone_authtoken.username -}}
{{- $_ := set .Values.conf.fm.keystone_authtoken "username" .Values.endpoints.identity.auth.fm.username -}}
{{- end -}}
{{- if empty .Values.conf.fm.keystone_authtoken.password -}}
{{- $_ := set .Values.conf.fm.keystone_authtoken "password" .Values.endpoints.identity.auth.fm.password -}}
{{- end -}}
apiVersion: v1
kind: Secret
metadata:
name: fm-etc
type: Opaque
data:
api-paste.ini: {{ include "helm-toolkit.utils.to_ini" .Values.conf.paste | b64enc }}
fm.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.fm | b64enc }}
logging.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.logging | b64enc }}

View File

@ -0,0 +1,89 @@
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.deployment_fm_rest_api }}
{{- $envAll := . }}
{{- $mounts_fm_rest_api := .Values.pod.mounts.fm_rest_api.fm_rest_api }}
{{- $mounts_fm_rest_api_init := .Values.pod.mounts.fm_rest_api.init_container }}
{{- $serviceAccountName := "fm" }}
{{ tuple $envAll "fmapi" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: fm-rest-api
labels:
{{ tuple $envAll "fm" "fmapi" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
spec:
replicas: {{ .Values.pod.replicas.api }}
selector:
matchLabels:
{{ tuple $envAll "fm" "fmapi" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }}
template:
metadata:
labels:
{{ tuple $envAll "fm" "fmapi" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec:
serviceAccountName: {{ $serviceAccountName }}
initContainers:
{{ tuple $envAll "fmapi" $mounts_fm_rest_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: fm-rest-api
volumeMounts:
- name: fm-bin
mountPath: /tmp/fm-rest-api.sh
subPath: fm-rest-api.sh
readOnly: true
- name: fm-etc
mountPath: /etc/fm/api-paste.ini
subPath: api-paste.ini
readOnly: true
- name: fm-etc
mountPath: /etc/fm/fm.conf
subPath: fm.conf
readOnly: true
- name: fm-etc
mountPath: /etc/fm/logging.conf
subPath: logging.conf
readOnly: true
- name: fm-etc-event
mountPath: /etc/fm/events.yaml
readOnly: true
command:
- /tmp/fm-rest-api.sh
image: "{{ .Values.images.tags.fm_rest_api }}"
imagePullPolicy: {{ .Values.images.pullPolicy }}
ports:
- name: http
containerPort: 18003
protocol: TCP
resources:
{{ toYaml .Values.resources | indent 12 }}
nodeSelector:
{{ .Values.labels.fm_api.node_selector_key }}: {{ .Values.labels.fm_api.node_selector_value }}
affinity:
{{ tuple $envAll "fm" "fmapi" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
volumes:
- name: fm-etc
secret:
secretName: fm-etc
defaultMode: 0644
- name: fm-bin
configMap:
name: fm-bin
defaultMode: 0755
- name: fm-etc-event
hostPath:
path: /etc/fm/events.yaml
type: File
{{- end }}

View File

@ -0,0 +1,10 @@
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if and .Values.manifests.ingress .Values.network.faultmanagement.ingress.public }}
{{- $ingressOpts := dict "envAll" . "backendService" "faultmanagement" "backendServiceType" "faultmanagement" "backendPort" "fm-port" -}}
{{ $ingressOpts | include "helm-toolkit.manifests.ingress" }}
{{- end }}

View File

@ -0,0 +1,10 @@
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.job_db_drop }}
{{- $dbDropJob := dict "envAll" . "serviceName" "fm" -}}
{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }}
{{- end }}

View File

@ -0,0 +1,10 @@
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.job_db_init }}
{{- $dbInitJob := dict "envAll" . "serviceName" "fm" -}}
{{ $dbInitJob | include "helm-toolkit.manifests.job_db_init_mysql" }}
{{- end }}

View File

@ -0,0 +1,10 @@
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.job_db_sync }}
{{- $dbSyncJob := dict "envAll" . "serviceName" "fm" -}}
{{ $dbSyncJob | include "helm-toolkit.manifests.job_db_sync" }}
{{- end }}

View File

@ -0,0 +1,10 @@
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.job_ks_endpoints }}
{{- $ksServiceJob := dict "envAll" . "serviceName" "fm" "serviceTypes" ( tuple "faultmanagement" ) -}}
{{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_endpoints" }}
{{- end }}

View File

@ -0,0 +1,10 @@
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.job_ks_service }}
{{- $ksServiceJob := dict "envAll" . "serviceName" "fm" "serviceTypes" ( tuple "faultmanagement" ) -}}
{{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_service" }}
{{- end }}

View File

@ -0,0 +1,10 @@
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.job_ks_user }}
{{- $ksUserJob := dict "envAll" . "serviceName" "fm" -}}
{{ $ksUserJob | include "helm-toolkit.manifests.job_ks_user" }}
{{- end }}

View File

@ -0,0 +1,20 @@
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.secret_db }}
{{- $envAll := . }}
{{- range $key1, $userClass := tuple "admin" "fm" }}
{{- $secretName := index $envAll.Values.secrets.oslo_db $userClass }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ $secretName }}
type: Opaque
data:
DB_CONNECTION: {{ tuple "oslo_db" "internal" $userClass "mysql" $envAll | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | b64enc -}}
{{- end }}
{{- end }}

View File

@ -0,0 +1,20 @@
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.secret_keystone }}
{{- $envAll := . }}
{{- range $key1, $userClass := tuple "admin" "fm" }}
{{- $secretName := index $envAll.Values.secrets.identity $userClass }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ $secretName }}
type: Opaque
data:
{{- tuple $userClass "internal" $envAll | include "helm-toolkit.snippets.keystone_secret_openrc" | indent 2 -}}
{{- end }}
{{- end }}

View File

@ -0,0 +1,21 @@
{{/*
Copyright 2017 The Openstack-Helm Authors.
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.
*/}}
{{- if and .Values.manifests.service_ingress .Values.network.faultmanagement.ingress.public }}
{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "faultmanagement" -}}
{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }}
{{- end }}

View File

@ -0,0 +1,29 @@
{{/*
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.service_fm }}
{{- $envAll := . }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "faultmanagement" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: fm-port
port: {{ .Values.network.faultmanagement.port }}
{{ if .Values.network.faultmanagement.node_port.enabled }}
nodePort: {{ .Values.network.faultmanagement.node_port.port }}
{{ end }}
selector:
{{ tuple $envAll "fm" "fmapi" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
{{ if .Values.network.faultmanagement.node_port.enabled }}
type: NodePort
{{ if .Values.network.faultmanagement.external_policy_local }}
externalTrafficPolicy: Local
{{ end }}
{{ end }}
{{- end }}

View File

@ -0,0 +1,359 @@
#
# SPDX-License-Identifier: Apache-2.0
#
# Default values for fm-rest-api.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
labels:
fm_api:
node_selector_key: openstack-control-plane
node_selector_value: enabled
job:
node_selector_key: openstack-control-plane
node_selector_value: enabled
images:
tags:
fm_rest_api: docker.io/starlingx/stx-fm-rest-api:master-centos-stable-latest
ks_user: docker.io/starlingx/stx-heat:master-centos-stable-latest
ks_service: docker.io/starlingx/stx-heat:master-centos-stable-latest
ks_endpoints: docker.io/starlingx/stx-heat:master-centos-stable-latest
fm_db_sync: docker.io/starlingx/stx-fm-rest-api:master-centos-stable-latest
db_init: docker.io/starlingx/stx-heat:master-centos-stable-latest
db_drop: docker.io/starlingx/stx-heat:master-centos-stable-latest
dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
pullPolicy: IfNotPresent
local_registry:
active: false
nameOverride: ""
fullnameOverride: ""
network:
faultmanagement:
ingress:
public: true
classes:
namespace: "nginx"
cluster: "nginx-cluster"
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
port: 18003
node_port:
enabled: false
port: 30083
external_policy_local: false
ingress:
enabled: false
annotations: {}
paths: []
hosts:
- fm-rest-api
tls: []
conf:
paste:
app:api_v1:
paste.app_factory: fm.api.app:app_factory
filter:authtoken:
acl_public_routes: /, /v1
paste.filter_factory: fm.api.middleware.auth_token:AuthTokenMiddleware.factory
filter:request_id:
paste.filter_factory: oslo_middleware:RequestId.factory
pipeline:fm-api:
pipeline: request_id authtoken api_v1
fm:
DEFAULT:
log_config_append: /etc/fm/logging.conf
trap_destinations:
region_name: RegionOne
event_log_max_size: 4000
database:
idle_timeout: 60
max_pool_size: 1
max_overflow: 20
oslo_middleware:
enable_proxy_headers_parsing: True
keystone_authtoken:
auth_type: password
auth_version: v3
sysinv:
catalog_info: platform:sysinv:internalURL
os_region_name: RegionOne
api:
api_paste_config: /etc/fm/api-paste.ini
api_workers: 2
bind_port: 18003
logging:
loggers:
keys:
- root
- fm
handlers:
keys:
- stdout
- stderr
- "null"
formatters:
keys:
- context
- default
logger_root:
level: WARNING
handlers: 'null'
logger_fm:
level: INFO
handlers:
- stdout
qualname: fm
logger_eventletwsgi:
level: WARNING
handlers: stderr
qualname: eventlet.wsgi.server
logger_sqlalchemy:
level: WARNING
handlers: stderr
qualname: sqlalchemy
handler_null:
class: logging.NullHandler
formatter: default
args: ()
handler_stdout:
class: StreamHandler
args: (sys.stdout,)
formatter: context
handler_stderr:
class: StreamHandler
args: (sys.stderr,)
formatter: context
formatter_context:
class: oslo_log.formatters.ContextFormatter
formatter_default:
format: "%(message)s"
dependencies:
static:
fmapi:
jobs:
- fm-ks-user
- fm-ks-service
- fm-ks-endpoints
- fm-db-sync
services:
- endpoint: internal
service: identity
- endpoint: internal
service: oslo_db
ks_endpoints:
jobs:
- fm-ks-user
- fm-ks-service
services:
- endpoint: internal
service: identity
db_drop:
services:
- endpoint: internal
service: oslo_db
db_init:
services:
- endpoint: internal
service: oslo_db
db_sync:
jobs:
- fm-db-init
services:
- endpoint: internal
service: oslo_db
ks_service:
services:
- endpoint: internal
service: identity
ks_user:
services:
- endpoint: internal
service: identity
manifests:
configmap_bin: true
configmap_etc: true
deployment_fm_rest_api: true
ingress: true
job_ks_endpoints: true
job_db_init: true
job_db_sync: true
job_db_drop: false
job_ks_user: true
job_ks_service: true
secret_db: true
secret_ingress_tls: false
secret_keystone: true
service_fm: true
service_ingress: true
endpoints:
cluster_domain_suffix: cluster.local
oslo_db:
auth:
admin:
username: root
password: password
fm:
username: fm
password: password
hosts:
default: mariadb
host_fqdn_override:
default: null
path: /fm
scheme: mysql+pymysql
port:
mysql:
default: 3306
local_image_registry:
name: docker-registry
namespace: docker-registry
hosts:
default: localhost
internal: docker-registry
node: localhost
host_fqdn_override:
default: null
port:
registry:
node: 5000
identity:
name: keystone
auth:
admin:
region_name: RegionOne
username: admin
password: password
project_name: admin
user_domain_name: default
project_domain_name: default
fm:
role: admin
region_name: RegionOne
username: fm
password: password
project_name: service
user_domain_name: service
project_domain_name: service
hosts:
default: keystone-api
public: keystone
host_fqdn_override:
default: null
path:
default: /v3
scheme:
default: http
port:
api:
default: 80
internal: 5000
faultmanagement:
name: fm
hosts:
default: fm-rest-api
public: fm
host_fqdn_override:
default: null
path:
default: null
scheme:
default: 'http'
port:
api:
default: 18003
public: 80
pod:
user:
fm_rest_api:
uid: 42424
affinity:
anti:
type:
default: preferredDuringSchedulingIgnoredDuringExecution
topologyKey:
default: kubernetes.io/hostname
mounts:
fm_rest_api:
init_container: null
fm_rest_api:
replicas:
api: 2
lifecycle:
upgrades:
deployments:
revision_history: 3
pod_replacement_strategy: RollingUpdate
rolling_update:
max_unavailable: 1
max_surge: 3
daemonsets:
pod_replacement_strategy: RollingUpdate
compute:
enabled: true
min_ready_seconds: 0
max_unavailable: 1
disruption_budget:
fm:
min_available: 0
termination_grace_period:
fm:
timeout: 30
resources:
jobs:
ks_endpoints:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "1024Mi"
cpu: "2000m"
db_init:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "1024Mi"
cpu: "2000m"
db_sync:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "1024Mi"
cpu: "2000m"
db_drop:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "1024Mi"
cpu: "2000m"
secrets:
identity:
admin: fm-keystone-admin
fm: fm-keystone-user
oslo_db:
admin: fm-db-admin
fm: fm-db-user
tls:
faultmanagement:
fm_api:
public: fm-rest-api-tls-public
resources: {}
nodeSelector: {}
tolerations: []
affinity: {}