Enable StarlingX helm charts for stx-openstack app

Use an application RPM to build and collect application artifacts.

This follows the same mechanism that is used to build the openstack-helm
and openstack-helm-infra charts. The custom StarlingX charts are built
and the application specific armada manifests are included in the RPM.

This application RPM will be used to produce some of the required build
artifacts (custom helm tarballs + armada manifests) but is not intended
to be installed on the system. These artifacts are extracted later for
proper application packaging with additional required metadata.

Changes also include:
 - Update the README describing the new layouts for applications.
 - Move the nova-api-proxy chart from the common area to be included as
   a chart specific to the stx-openstack app.

Change-Id: I1140760d56035249324519be93bb913e18f394d9
Story: 2004005
Task: 27801
Depends-On: I57c5ec5f3565e9e585f0935af745e495699aa28c
Signed-off-by: Robert Church <robert.church@windriver.com>
This commit is contained in:
Robert Church 2018-11-06 11:22:33 -05:00
parent 301e310b67
commit 3c953ae67e
18 changed files with 1915 additions and 0 deletions

View File

@ -0,0 +1,2 @@
SRC_DIR="stx-openstack-helm"
TIS_PATCH_VER=1

View File

@ -0,0 +1,54 @@
%global helm_folder /usr/lib/helm
%global armada_folder /usr/lib/armada
%global toolkit_version 0.1.0
%global helmchart_version 0.1.0
Summary: StarlingX Openstack Application Helm charts
Name: stx-openstack-helm
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: unknown
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: helm
BuildRequires: openstack-helm-infra
Requires: openstack-helm-infra
%description
StarlingX Openstack Application Helm charts
%prep
%setup
%build
# initialize helm and stage the toolkit
helm init --client-only
# Host a server for the charts
cp %{helm_folder}/helm-toolkit-%{toolkit_version}.tgz .
helm serve --repo-path . &
helm repo rm local
helm repo add local http://localhost:8879/charts
# Make the charts. These produce a tgz file
make nova-api-proxy
# remove helm-toolkit. This will be packaged with openstack-helm-infra
rm ./helm-toolkit-%{toolkit_version}.tgz
%install
# helm_folder is created by openstack-helm-infra
install -d -m 755 ${RPM_BUILD_ROOT}%{helm_folder}
install -p -D -m 755 *.tgz ${RPM_BUILD_ROOT}%{helm_folder}
install -d -m 755 ${RPM_BUILD_ROOT}%{armada_folder}
install -p -D -m 755 manifests/*.yaml ${RPM_BUILD_ROOT}%{armada_folder}
%files
#helm_folder is owned by openstack-helm-infra
%defattr(-,root,root,-)
%{helm_folder}/*
%{armada_folder}/*

View File

@ -0,0 +1,43 @@
#
# Copyright 2017 The Openstack-Helm Authors.
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# It's necessary to set this because some environments don't link sh -> bash.
SHELL := /bin/bash
TASK := build
EXCLUDES := helm-toolkit doc tests tools logs tmp
CHARTS := helm-toolkit $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.)))
.PHONY: $(EXCLUDES) $(CHARTS)
all: $(CHARTS)
$(CHARTS):
@if [ -d $@ ]; then \
echo; \
echo "===== Processing [$@] chart ====="; \
make $(TASK)-$@; \
fi
init-%:
if [ -f $*/Makefile ]; then make -C $*; fi
if [ -f $*/requirements.yaml ]; then helm dep up $*; fi
lint-%: init-%
if [ -d $* ]; then helm lint $*; fi
build-%: lint-%
if [ -d $* ]; then helm package $*; fi
clean:
@echo "Clean all build artifacts"
rm -f */templates/_partials.tpl */templates/_globals.tpl
rm -f *tgz */charts/*tgz */requirements.lock
rm -rf */charts */tmpcharts
%:
@:

View File

@ -0,0 +1,5 @@
This directory contains all StarlingX charts that need to be built for this
application. Some charts are common across applications. These common charts
reside in the stx-config/kubernetes/helm-charts directory. To include these in
this application update the build_srpm.data file and use the COPY_LIST_TO_TAR
mechanism to populate these commom charts.

View File

@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: StarlingX-Helm nova-api-proxy
name: nova-api-proxy
version: 0.1.0

View File

@ -0,0 +1,10 @@
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
dependencies:
- name: helm-toolkit
repository: http://localhost:8879/charts
version: 0.1.0

View File

@ -0,0 +1,13 @@
#!/bin/bash
{{/*
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
set -ex
nova-api-proxy --config-file=/etc/proxy/nova-api-proxy.conf

View File

@ -0,0 +1,19 @@
{{/*
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.configmap_bin }}
{{- $envAll := . }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nova-api-proxy-bin
data:
nova-api-proxy.sh: |
{{ tuple "bin/_nova-api-proxy.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}

View File

@ -0,0 +1,55 @@
{{/*
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- define "nova_proxy.configmap.etc" }}
{{- $envAll := index . 1 }}
{{- with $envAll }}
{{- if empty .Values.conf.nova_api_proxy.keystone_authtoken.auth_uri -}}
{{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | set .Values.conf.nova_api_proxy.keystone_authtoken "auth_uri" -}}
{{- end -}}
{{- if empty .Values.conf.nova_api_proxy.keystone_authtoken.auth_url -}}
{{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | set .Values.conf.nova_api_proxy.keystone_authtoken "auth_url" -}}
{{- end -}}
{{- if empty .Values.conf.nova_api_proxy.keystone_authtoken.region_name -}}
{{- $_ := set .Values.conf.nova_api_proxy.keystone_authtoken "region_name" .Values.endpoints.identity.auth.nova.region_name -}}
{{- end -}}
{{- if empty .Values.conf.nova_api_proxy.keystone_authtoken.project_name -}}
{{- $_ := set .Values.conf.nova_api_proxy.keystone_authtoken "project_name" .Values.endpoints.identity.auth.nova.project_name -}}
{{- end -}}
{{- if empty .Values.conf.nova_api_proxy.keystone_authtoken.project_domain_name -}}
{{- $_ := set .Values.conf.nova_api_proxy.keystone_authtoken "project_domain_name" .Values.endpoints.identity.auth.nova.project_domain_name -}}
{{- end -}}
{{- if empty .Values.conf.nova_api_proxy.keystone_authtoken.user_domain_name -}}
{{- $_ := set .Values.conf.nova_api_proxy.keystone_authtoken "user_domain_name" .Values.endpoints.identity.auth.nova.user_domain_name -}}
{{- end -}}
{{- if empty .Values.conf.nova_api_proxy.keystone_authtoken.username -}}
{{- $_ := set .Values.conf.nova_api_proxy.keystone_authtoken "username" .Values.endpoints.identity.auth.nova.username -}}
{{- end -}}
{{- if empty .Values.conf.nova_api_proxy.keystone_authtoken.password -}}
{{- $_ := set .Values.conf.nova_api_proxy.keystone_authtoken "password" .Values.endpoints.identity.auth.nova.password -}}
{{- end -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: nova-api-proxy-etc
data:
nova-api-proxy.conf: |
{{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.nova_api_proxy | indent 4 }}
api-proxy-paste.ini: |
{{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.paste | indent 4 }}
logging.conf: |
{{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.logging | indent 4 }}
{{- end }}
{{- end }}
{{- if .Values.manifests.configmap_etc }}
{{- list "nova-proxy-etc" . | include "nova_proxy.configmap.etc" }}
{{- end }}

View File

@ -0,0 +1,88 @@
{{/*
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.deployment_api_proxy }}
{{- $envAll := . }}
{{- $mounts_nova_api_proxy := .Values.pod.mounts.nova_api_proxy.nova_api_proxy }}
{{- $mounts_nova_api_proxy_init := .Values.pod.mounts.nova_api_proxy.init_container }}
{{- $serviceAccountName := "nova-api-proxy" }}
{{ tuple $envAll "proxy" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nova-api-proxy
labels:
{{ tuple $envAll "nova" "api-proxy" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
spec:
replicas: {{ .Values.pod.replicas.proxy }}
selector:
matchLabels:
{{ tuple $envAll "nova" "api-proxy" | 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 "nova" "api-proxy" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
annotations:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
spec:
serviceAccountName: {{ $serviceAccountName }}
affinity:
{{ tuple $envAll "nova" "api-proxy" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
nodeSelector:
{{ .Values.labels.api_proxy.node_selector_key }}: {{ .Values.labels.api_proxy.node_selector_value }}
terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.api_proxy.timeout | default "30" }}
initContainers:
{{ tuple $envAll "api" $mounts_nova_api_proxy_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: nova-api-proxy
{{ tuple $envAll "nova_api_proxy" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.api_proxy | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
securityContext:
runAsUser: {{ .Values.pod.user.nova_api_proxy.uid }}
command:
- /tmp/nova-api-proxy.sh
ports:
- name: n-api
containerPort: {{ tuple "compute" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
readinessProbe:
tcpSocket:
port: {{ tuple "compute" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
volumeMounts:
- name: nova-api-proxy-bin
mountPath: /tmp/nova-api-proxy.sh
subPath: nova-api-proxy.sh
readOnly: true
- name: nova-api-proxy-etc
mountPath: /etc/proxy/nova-api-proxy.conf
subPath: nova-api-proxy.conf
readOnly: true
- name: nova-api-proxy-etc
mountPath: /etc/proxy/logging.conf
subPath: logging.conf
readOnly: true
- name: nova-api-proxy-etc
mountPath: /etc/proxy/api-proxy-paste.ini
subPath: api-proxy-paste.ini
readOnly: true
{{ if $mounts_nova_api_proxy.volumeMounts }}{{ toYaml $mounts_nova_api_proxy.volumeMounts | indent 12 }}{{ end }}
volumes:
- name: nova-api-proxy-bin
configMap:
name: nova-api-proxy-bin
defaultMode: 0777
- name: nova-api-proxy-etc
configMap:
name: nova-api-proxy-etc
defaultMode: 0777
{{ if $mounts_nova_api_proxy.volumes}}{{ toYaml $mounts_nova_api_proxy.volumes | indent 8 }}{{ end }}
{{- end }}

View File

@ -0,0 +1,13 @@
{{/*
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if and .Values.manifests.job_image_repo_sync .Values.images.local_registry.active }}
{{- $imageRepoSyncJob := dict "envAll" . "serviceName" "nova-api-proxy" -}}
{{ $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" }}
{{- end }}

View File

@ -0,0 +1,12 @@
{{/*
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if and .Values.manifests.ingress .Values.network.api_proxy.ingress.public }}
{{- $ingressOpts := dict "envAll" . "backendServiceType" "compute" "backendPort" "n-api-proxy" -}}
{{ $ingressOpts | include "helm-toolkit.manifests.ingress" }}
{{- end }}

View File

@ -0,0 +1,12 @@
{{/*
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.job_ks_endpoints }}
{{- $ksServiceJob := dict "envAll" . "serviceName" "nova" "serviceTypes" ( tuple "compute" ) -}}
{{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_endpoints" }}
{{- end }}

View File

@ -0,0 +1,11 @@
{{/*
#
#Copyright (c) 2018 Wind River Systems, Inc.
#
#SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.secret_ingress_tls }}
{{ include "helm-toolkit.manifests.secret_ingress_tls" ( dict "envAll" . "backendService" "osapi" "backendServiceType" "compute" ) }}
{{- end }}

View File

@ -0,0 +1,22 @@
{{/*
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.secret_keystone }}
{{- $envAll := . }}
{{- range $key1, $userClass := tuple "admin" "nova" "test" }}
{{- $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,31 @@
{{/*
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
*/}}
{{- if .Values.manifests.service_api }}
{{- $envAll := . }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ tuple "nova" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: n-api-proxy
port: {{ tuple "compute" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
{{ if .Values.network.api.node_port.enabled }}
nodePort: {{ .Values.network.api.node_port.port }}
{{ end }}
selector:
{{ tuple $envAll "nova" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
{{ if .Values.network.api.node_port.enabled }}
type: NodePort
{{ if .Values.network.api.external_policy_local }}
externalTrafficPolicy: Local
{{ end }}
{{ end }}
{{- end }}

View File

@ -0,0 +1,306 @@
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# Default values for nova-api-proxy.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
labels:
api_proxy:
node_selector_key: openstack-control-plane
node_selector_value: enabled
job:
node_selector_key: openstack-control-plane
node_selector_value: enabled
images:
tags:
nova_api_proxy: 128.224.186.231:9001/abailey/stx-nova-api-proxy:latest
ks_endpoints: docker.io/openstackhelm/heat:pike
dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
pullPolicy: IfNotPresent
local_registry:
active: false
exclude:
- dep_check
- image_repo_sync
network:
api_proxy:
ingress:
public: true
classes:
namespace: "nginx"
cluster: "nginx-cluster"
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
external_policy_local: false
node_port:
enabled: false
port: 8774
conf:
nova_api_proxy:
DEFAULT:
log_config_append: /etc/proxy/logging.conf
api_paste_config: api-proxy-paste.ini
auth_strategy: keystone
debug: False
use_syslog: False
show_request_body: False
pool_size: 256
osapi_proxy_listen: 0.0.0.0
osapi_proxy_listen_port: 8774
osapi_compute_listen: nova-api.openstack.svc.cluster.local
osapi_compute_listen_port: 8774
nfvi_compute_listen_port: 30003
nfvi_compute_listen: 0.0.0.0
keystone_authtoken:
auth_type: password
auth_version: v3
paste:
pipeline:nova-api-proxy:
pipeline: version authtoken acceptor proxyapp
filter:debug_header:
paste.filter_factory: nova_api_proxy.apps.acceptor:DebugHeaders.factory
filter:version:
paste.filter_factory: nova_api_proxy.apps.acceptor:VersionAcceptor.factory
filter:authtoken:
paste.filter_factory: keystonemiddleware.auth_token:filter_factory
filter:acceptor:
paste.filter_factory: nova_api_proxy.apps.acceptor:Acceptor.factory
app:proxyapp:
paste.app_factory: nova_api_proxy.apps.proxy:Proxy.factory
logging:
loggers:
keys:
- root
- nova_api_proxy
- keystonemiddleware
handlers:
keys:
- stdout
- stderr
- "null"
formatters:
keys:
- context
- default
logger_root:
level: WARNING
handlers: null
logger_nova_api_proxy:
level: INFO
handlers:
- stdout
qualname: nova_api_proxy
logger_keystonemiddleware:
level: INFO
handlers:
- stdout
qualname: keystonemiddleware
logger_amqp:
level: WARNING
handlers: stderr
qualname: amqp
logger_amqplib:
level: WARNING
handlers: stderr
qualname: amqplib
logger_eventletwsgi:
level: WARNING
handlers: stderr
qualname: eventlet.wsgi.server
logger_sqlalchemy:
level: WARNING
handlers: stderr
qualname: sqlalchemy
logger_boto:
level: WARNING
handlers: stderr
qualname: boto
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:
dynamic:
common:
local_image_registry:
jobs:
- image-repo-sync
services:
- endpoint: node
service: local_image_registry
static:
ks_endpoints:
jobs:
- nova-ks-service
services:
- endpoint: internal
service: identity
endpoints:
cluster_domain_suffix: cluster.local
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
nova:
role: admin
region_name: RegionOne
username: nova
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:
admin:
default: 35357
api:
default: 80
compute:
name: nova
hosts:
default: nova-api-proxy
public: nova-api-proxy
host_fqdn_override:
default: null
# NOTE(portdirect): this chart supports TLS for fqdn over-ridden public
# endpoints using the following format:
# public:
# host: null
# tls:
# crt: null
# key: null
path:
default: "/v2.1/%(tenant_id)s"
scheme:
default: 'http'
port:
api:
default: 8774
public: 80
pod:
user:
nova_api_proxy:
uid: 42424
affinity:
anti:
type:
default: preferredDuringSchedulingIgnoredDuringExecution
topologyKey:
default: kubernetes.io/hostname
mounts:
nova_api_proxy:
init_container: null
nova_api_proxy:
replicas:
proxy: 1
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:
api_proxy:
min_available: 0
termination_grace_period:
api_proxy:
timeout: 30
resources:
enabled: false
api_proxy:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "1024Mi"
cpu: "2000m"
jobs:
ks_endpoints:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "1024Mi"
cpu: "2000m"
secrets:
identity:
admin: nova-keystone-admin
nova: nova-keystone-user
manifests:
configmap_bin: true
configmap_etc: true
deployment_api_proxy: true
ingress_api: true
job_ks_endpoints: false
resources: {}
nodeSelector: {}
tolerations: []
affinity: {}

File diff suppressed because it is too large Load Diff