Mini-mirror chart htk integration

Change-Id: I31a1363a9fcfdb30b49e56d953199253f2baaed4
This commit is contained in:
Andrey Volkov 2018-10-30 11:40:33 -07:00
parent 56172a8b1c
commit bd2074a792
8 changed files with 178 additions and 26 deletions

View File

@ -52,7 +52,7 @@ test-containers: clean build
.PHONY: test-charts
test-charts: helm-lint charts
$(HELM) delete mini-mirror || true
$(HELM) delete --purge mini-mirror || true
$(HELM) install --debug -n mini-mirror mini-mirror-*.tgz
.PHONY: clean
@ -101,5 +101,11 @@ helm-lint:
# Create tgz of the chart
.PHONY: charts
charts:
rm -f mini-mirror-*.tgz
$(HELM) dep up $(CHART)
$(HELM) package $(CHART)
.PHONY: htk-install
tests-install:
rm -rf build
tools/helm_tk.sh $(HELM)

View File

@ -0,0 +1,19 @@
# Copyright 2017 The Openstack-Helm Authors.
# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
#
# 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.
dependencies:
- name: helm-toolkit
repository: http://localhost:8879/charts
version: 0.1.0

View File

@ -1,7 +1,26 @@
# Copyright 2017 The Openstack-Helm Authors.
# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
#
# 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 .Values.manifests.deployment_mini_mirror }}
{{- $envAll := . }}
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ include "mini-mirror.fullname" . }}
annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
labels:
app.kubernetes.io/name: {{ include "mini-mirror.name" . }}
helm.sh/chart: {{ include "mini-mirror.chart" . }}
@ -9,6 +28,7 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "mini-mirror.name" . }}
@ -18,11 +38,13 @@ spec:
labels:
app.kubernetes.io/name: {{ include "mini-mirror.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ tuple $envAll "mini-mirror" "mini-mirror" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{ tuple $envAll $envAll.Values.pod.resources.mini_mirror | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
ports:
- name: http
containerPort: 80
@ -35,8 +57,6 @@ spec:
httpGet:
path: /
port: http
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
@ -49,3 +69,4 @@ spec:
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- end }}

View File

@ -1,4 +1,21 @@
{{- if .Values.ingress.enabled -}}
{{/*
Copyright 2017 The Openstack-Helm Authors.
Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
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 .Values.manifests.ingress_mini_mirror }}
{{- $fullName := include "mini-mirror.fullname" . -}}
{{- $ingressPath := .Values.ingress.path -}}
apiVersion: extensions/v1beta1
@ -33,6 +50,6 @@ spec:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: http
servicePort: mm-port
{{- end }}
{{- end }}

View File

@ -1,3 +1,23 @@
{{/*
Copyright 2017 The Openstack-Helm Authors.
Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
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 .Values.manifests.service_mini_mirror }}
{{- $envAll := . }}
---
apiVersion: v1
kind: Service
metadata:
@ -11,9 +31,10 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
targetPort: 80
protocol: TCP
name: http
name: mm-port
selector:
app.kubernetes.io/name: {{ include "mini-mirror.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

View File

@ -19,30 +19,39 @@ service:
ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
path: /
hosts:
- cluster.local
tls: []
# - secretName: chart-example-tls
# hosts:
# - cluster.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
nodeSelector:
node_selector_key: ucp-control-plane
node_selector_value: enabled
tolerations: []
affinity: {}
pod:
lifecycle:
upgrades:
deployments:
revision_history: 3
pod_replacement_strategy: RollingUpdate
rolling_update:
max_unavailable: 1
max_surge: 3
resources:
enabled: false
mini_mirror:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
manifests:
deployment_mini_mirror: true
service_mini_mirror: true
ingress_mini_mirror: true

View File

@ -15,6 +15,6 @@
- hosts: primary
tasks:
- name: Build and Run Container
command: sudo make test
command: sudo make test-install test
args:
chdir: "{{ zuul_osh_relative_path | default(zuul.project.src_dir) }}"

59
tools/helm_tk.sh Executable file
View File

@ -0,0 +1,59 @@
#!/bin/bash
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# 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.
#
# Script to setup helm-toolkit and helm dep up the shipyard chart
#
HELM=$1
HTK_REPO=${HTK_REPO:-"https://github.com/openstack/openstack-helm-infra"}
HTK_PATH=${HTK_PATH:-""}
if [[ ! -z $(echo $http_proxy) ]]
then
export no_proxy=$no_proxy,127.0.0.1
fi
set -x
function helm_serve {
if [[ -d "$HOME/.helm" ]]; then
echo ".helm directory found"
else
${HELM} init --client-only
fi
if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then
${HELM} serve & > /dev/null
while [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; do
sleep 1
echo "Waiting for Helm Repository"
done
else
echo "Helm serve already running"
fi
if ${HELM} repo list | grep -q "^stable" ; then
${HELM} repo remove stable
fi
${HELM} repo add local http://localhost:8879/charts
}
mkdir -p build
pushd build
git clone --depth 1 $HTK_REPO || true
pushd ${HTK_REPO##*/}/$HTK_PATH
git pull
make helm-toolkit
helm_serve