Add mini-mirror chart

This commit introduces a chart for the mini-mirror [0], a service that
mirrors Debian and Ubuntu repositories. Mini-mirror uses aptly [1] to
download remote repositories listed in a directory structure and NGINX
[2] to serve their generated snapshots.

[0] https://airship-specs.readthedocs.io/en/latest/specs/approved/mini-mirror.html
[1] https://www.aptly.info/
[2] http://hg.nginx.org/nginx/

Depends-On: https://review.openstack.org/629600

Change-Id: I8b5cc42dd1128e3979a3faebea13fcacb0256242
This commit is contained in:
Drew Walters 2018-12-18 16:21:35 +00:00
parent fa705f1aaa
commit 239471b1a8
10 changed files with 443 additions and 0 deletions

24
mini-mirror/Chart.yaml Normal file
View File

@ -0,0 +1,24 @@
# Copyright 2019, AT&T Intellectual Property
#
# 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: v1
description: |
A Helm chart to deploy mini-mirror, a custom repository mirroring service.
name: mini-mirror
version: 0.1.0
sources:
- https://github.com/nginx/nginx
- https://git.openstack.org/openstack/openstack-helm-addons
maintainers:
- name: OpenStack-Helm Authors

View File

@ -0,0 +1,18 @@
# Copyright 2019, AT&T Intellectual Property
#
# 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

@ -0,0 +1,26 @@
#!/bin/bash
{{/*
Copyright 2019, AT&T Intellectual Property
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.
*/}}
set -xe
rm /etc/apt/sources.list
tee /etc/apt/sources.list << EOF
deb [ allow-insecure=yes ] http://${MINI_MIRROR_ENDPOINT} squeeze main
EOF
apt-get update

View File

@ -0,0 +1,27 @@
{{/*
Copyright 2019, AT&T Intellectual Property
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.configmap_bin }}
{{- $envAll := . }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mini-mirror-bin
data:
helm-test.sh: |
{{ tuple "bin/_helm_test.sh.tpl" $envAll | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}

View File

@ -0,0 +1,26 @@
{{/*
Copyright 2019, AT&T Intellectual Property
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.configmap_etc }}
{{- $envAll := . }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mini-mirror-etc
data:
{{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.nginx "key" "nginx.conf") | indent 2 }}
{{- end }}

View File

@ -0,0 +1,60 @@
{{/*
Copyright 2019, AT&T Intellectual Property
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/v1
kind: Deployment
metadata:
name: mini-mirror
annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
labels:
{{ tuple $envAll "mini-mirror" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
spec:
replicas: {{ .Values.pod.replicas.api }}
selector:
matchLabels:
{{ tuple $envAll "mini-mirror" "api" | 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 "mini-mirror" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec:
containers:
- name: mini-mirror-api
{{ tuple $envAll "mini-mirror" | include "helm-toolkit.snippets.image" | indent 10 }}
ports:
- name: http
containerPort: {{ tuple "api" "port" "http" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
{{ if .Values.network.api.node_port.enabled }}
nodePort: {{ .Values.network.api.node_port.port }}
{{ end }}
{{- if .Values.manifests.configmap_etc }}
volumeMounts:
- mountPath: /etc/nginx/conf.d
name: nginx-config
readOnly: true
{{ end }}
volumes:
{{- if .Values.manifests.configmap_etc }}
- name: nginx-config
configMap:
name: mini-mirror-etc
{{ end }}
{{ end }}

View File

@ -0,0 +1,20 @@
{{/*
Copyright 2019, AT&T Intellectual Property
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.job_image_repo_sync .Values.images.local_registry.active }}
{{- $imageRepoSyncJob := dict "envAll" . "serviceName" "mini-mirror" -}}
{{ $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" }}
{{- end }}

View File

@ -0,0 +1,55 @@
{{/*
Copyright 2019, AT&T Intellectual Property
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.helm_test }}
{{- $envAll := . }}
---
apiVersion: v1
kind: Pod
metadata:
name: mini-mirror-test
labels:
{{ tuple $envAll "mini-mirror" "test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
annotations:
"helm.sh/hook": test-success
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
spec:
nodeSelector:
{{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
restartPolicy: Never
containers:
- name: mini-mirror-helm-test
{{ tuple $envAll "helm-test" | include "helm-toolkit.snippets.image" | indent 6 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
command:
- /tmp/helm-test.sh
env:
- name: NO_PROXY
value: 127.0.0.1,.svc.cluster.local
- name: MINI_MIRROR_ENDPOINT
value: {{ tuple "api" "public" $envAll | include "helm-toolkit.endpoints.endpoint_host_lookup" }}
volumeMounts:
- name: mini-mirror-bin
mountPath: /tmp/helm-test.sh
subPath: helm-test.sh
readOnly: true
volumes:
- name: mini-mirror-bin
configMap:
name: mini-mirror-bin
defaultMode: 0555
{{- end }}

View File

@ -0,0 +1,41 @@
{{/*
Copyright 2019, AT&T Intellectual Property
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:
name: {{ tuple "api" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
ports:
- name: http
{{ if .Values.network.api.node_port.enabled }}
nodePort: {{ .Values.network.api.node_port.port }}
{{ end }}
port: {{ .Values.endpoints.api.port.http.public }}
protocol: TCP
targetPort: 80
selector:
{{ tuple $envAll "mini-mirror" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
sessionAffinity: None
{{ if .Values.network.api.node_port.enabled }}
type: NodePort
{{ else }}
type: ClusterIP
{{ end }}
{{ end }}

146
mini-mirror/values.yaml Normal file
View File

@ -0,0 +1,146 @@
# Copyright 2019, AT&T Intellectual Property
#
# 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.
images:
tags:
dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
helm-test: docker.io/ubuntu:18.04
image_repo_sync: docker.io/docker:17.07.0
mini-mirror: docker.io/openstackhelm/mini-mirror:latest-ubuntu
pull_policy: "IfNotPresent"
local_registry:
active: false
exclude:
- dep_check
- image_repo_sync
labels:
job:
node_selector_key: openstack-control-plane
node_selector_value: enabled
server:
node_selector_key: openstack-control-plane
node_selector_value: enabled
test:
node_selector_key: openstack-control-plane
node_selector_value: enabled
dependencies:
dynamic:
common:
local_image_registry:
jobs:
- mini-mirror-image-repo-sync
services:
- endpoint: node
service: local_image_registry
static:
image_repo_sync:
services:
- endpoint: internal
service: local_image_registry
pod:
affinity:
anti:
type:
default: preferredDuringSchedulingIgnoredDuringExecution
topologyKey:
default: kubernetes.io/hostname
replicas:
api: 2
lifecycle:
upgrades:
deployments:
revision_history: 3
pod_replacement_strategy: RollingUpdate
rolling_update:
max_unavailable: 1
max_surge: 3
disruption_budget:
api:
min_available: 0
resources:
enabled: false
api:
limits:
memory: "1024Mi"
cpu: "2000m"
requests:
memory: "128Mi"
cpu: "100m"
jobs:
image_repo_sync:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "1024Mi"
cpu: "2000m"
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
api:
name: api
hosts:
default: mini-mirror-api
public: mini-mirror
host_fqdn_override:
default: null
path:
default: /
scheme:
default: http
port:
http:
default: 8888
public: 80
network:
api:
external_policy_local: false
node_port:
enabled: false
port: 8888
manifests:
configmap_bin: true
configmap_etc: true
deployment_mini_mirror: true
helm_test: true
job_image_repo_sync: true
service_mini_mirror: true
conf:
nginx: |
server {
root /srv;
server_name nginx;
location / {
autoindex on;
}
}