Browse Source

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
Drew Walters 4 months ago
parent
commit
239471b1a8

+ 24
- 0
mini-mirror/Chart.yaml View File

@@ -0,0 +1,24 @@
1
+# Copyright 2019, AT&T Intellectual Property
2
+#
3
+# Licensed under the Apache License, Version 2.0 (the "License");
4
+# you may not use this file except in compliance with the License.
5
+# You may obtain a copy of the License at
6
+#
7
+#     http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+# Unless required by applicable law or agreed to in writing, software
10
+# distributed under the License is distributed on an "AS IS" BASIS,
11
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+# See the License for the specific language governing permissions and
13
+# limitations under the License.
14
+
15
+apiVersion: v1
16
+description: |
17
+  A Helm chart to deploy mini-mirror, a custom repository mirroring service.
18
+name: mini-mirror
19
+version: 0.1.0
20
+sources:
21
+  - https://github.com/nginx/nginx
22
+  - https://git.openstack.org/openstack/openstack-helm-addons
23
+maintainers:
24
+  - name: OpenStack-Helm Authors

+ 18
- 0
mini-mirror/requirements.yaml View File

@@ -0,0 +1,18 @@
1
+# Copyright 2019, AT&T Intellectual Property
2
+#
3
+# Licensed under the Apache License, Version 2.0 (the "License");
4
+# you may not use this file except in compliance with the License.
5
+# You may obtain a copy of the License at
6
+#
7
+#     http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+# Unless required by applicable law or agreed to in writing, software
10
+# distributed under the License is distributed on an "AS IS" BASIS,
11
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+# See the License for the specific language governing permissions and
13
+# limitations under the License.
14
+
15
+dependencies:
16
+  - name: helm-toolkit
17
+    repository: http://localhost:8879/charts
18
+    version: 0.1.0

+ 26
- 0
mini-mirror/templates/bin/_helm_test.sh.tpl View File

@@ -0,0 +1,26 @@
1
+#!/bin/bash
2
+
3
+{{/*
4
+Copyright 2019, AT&T Intellectual Property
5
+
6
+Licensed under the Apache License, Version 2.0 (the "License");
7
+you may not use this file except in compliance with the License.
8
+You may obtain a copy of the License at
9
+
10
+   http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+Unless required by applicable law or agreed to in writing, software
13
+distributed under the License is distributed on an "AS IS" BASIS,
14
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+See the License for the specific language governing permissions and
16
+limitations under the License.
17
+*/}}
18
+
19
+set -xe
20
+
21
+rm /etc/apt/sources.list
22
+tee /etc/apt/sources.list << EOF
23
+deb [ allow-insecure=yes ] http://${MINI_MIRROR_ENDPOINT} squeeze main
24
+EOF
25
+
26
+apt-get update

+ 27
- 0
mini-mirror/templates/configmap-bin.yaml View File

@@ -0,0 +1,27 @@
1
+{{/*
2
+Copyright 2019, AT&T Intellectual Property
3
+
4
+Licensed under the Apache License, Version 2.0 (the "License");
5
+you may not use this file except in compliance with the License.
6
+You may obtain a copy of the License at
7
+
8
+   http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+Unless required by applicable law or agreed to in writing, software
11
+distributed under the License is distributed on an "AS IS" BASIS,
12
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+See the License for the specific language governing permissions and
14
+limitations under the License.
15
+*/}}
16
+
17
+{{- if .Values.manifests.configmap_bin }}
18
+{{- $envAll := . }}
19
+---
20
+apiVersion: v1
21
+kind: ConfigMap
22
+metadata:
23
+  name: mini-mirror-bin
24
+data:
25
+  helm-test.sh: |
26
+{{ tuple "bin/_helm_test.sh.tpl" $envAll | include "helm-toolkit.utils.template" | indent 4 }}
27
+{{- end }}

+ 26
- 0
mini-mirror/templates/configmap-etc.yaml View File

@@ -0,0 +1,26 @@
1
+{{/*
2
+Copyright 2019, AT&T Intellectual Property
3
+
4
+Licensed under the Apache License, Version 2.0 (the "License");
5
+you may not use this file except in compliance with the License.
6
+You may obtain a copy of the License at
7
+
8
+   http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+Unless required by applicable law or agreed to in writing, software
11
+distributed under the License is distributed on an "AS IS" BASIS,
12
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+See the License for the specific language governing permissions and
14
+limitations under the License.
15
+*/}}
16
+
17
+{{- if .Values.manifests.configmap_etc }}
18
+{{- $envAll := . }}
19
+---
20
+apiVersion: v1
21
+kind: ConfigMap
22
+metadata:
23
+  name: mini-mirror-etc
24
+data:
25
+{{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.nginx "key" "nginx.conf") | indent 2 }}
26
+{{- end }}

+ 60
- 0
mini-mirror/templates/deployment-mini-mirror.yaml View File

@@ -0,0 +1,60 @@
1
+{{/*
2
+Copyright 2019, AT&T Intellectual Property
3
+
4
+Licensed under the Apache License, Version 2.0 (the "License");
5
+you may not use this file except in compliance with the License.
6
+You may obtain a copy of the License at
7
+
8
+   http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+Unless required by applicable law or agreed to in writing, software
11
+distributed under the License is distributed on an "AS IS" BASIS,
12
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+See the License for the specific language governing permissions and
14
+limitations under the License.
15
+*/}}
16
+
17
+{{- if .Values.manifests.deployment_mini_mirror }}
18
+{{- $envAll := . }}
19
+---
20
+apiVersion: apps/v1
21
+kind: Deployment
22
+metadata:
23
+  name: mini-mirror
24
+  annotations:
25
+    {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
26
+  labels:
27
+{{ tuple $envAll "mini-mirror" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
28
+spec:
29
+  replicas: {{ .Values.pod.replicas.api }}
30
+  selector:
31
+    matchLabels:
32
+{{ tuple $envAll "mini-mirror" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
33
+{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }}
34
+  template:
35
+    metadata:
36
+      labels:
37
+{{ tuple $envAll "mini-mirror" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
38
+    spec:
39
+      containers:
40
+        - name: mini-mirror-api
41
+{{ tuple $envAll "mini-mirror" | include "helm-toolkit.snippets.image" | indent 10 }}
42
+          ports:
43
+            - name: http
44
+              containerPort: {{ tuple "api" "port" "http" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
45
+{{ if .Values.network.api.node_port.enabled }}
46
+              nodePort: {{ .Values.network.api.node_port.port }}
47
+{{ end }}
48
+{{- if .Values.manifests.configmap_etc }}
49
+          volumeMounts:
50
+            - mountPath: /etc/nginx/conf.d
51
+              name: nginx-config
52
+              readOnly: true
53
+{{ end }}
54
+      volumes:
55
+{{- if .Values.manifests.configmap_etc }}
56
+        - name: nginx-config
57
+          configMap:
58
+            name: mini-mirror-etc
59
+{{ end }}
60
+{{ end }}

+ 20
- 0
mini-mirror/templates/job-image-repo-sync.yaml View File

@@ -0,0 +1,20 @@
1
+{{/*
2
+Copyright 2019, AT&T Intellectual Property
3
+
4
+Licensed under the Apache License, Version 2.0 (the "License");
5
+you may not use this file except in compliance with the License.
6
+You may obtain a copy of the License at
7
+
8
+   http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+Unless required by applicable law or agreed to in writing, software
11
+distributed under the License is distributed on an "AS IS" BASIS,
12
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+See the License for the specific language governing permissions and
14
+limitations under the License.
15
+*/}}
16
+
17
+{{- if and .Values.manifests.job_image_repo_sync .Values.images.local_registry.active }}
18
+{{- $imageRepoSyncJob := dict "envAll" . "serviceName" "mini-mirror" -}}
19
+{{ $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" }}
20
+{{- end }}

+ 55
- 0
mini-mirror/templates/pod-helm-test.yaml View File

@@ -0,0 +1,55 @@
1
+{{/*
2
+Copyright 2019, AT&T Intellectual Property
3
+
4
+Licensed under the Apache License, Version 2.0 (the "License");
5
+you may not use this file except in compliance with the License.
6
+You may obtain a copy of the License at
7
+
8
+   http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+Unless required by applicable law or agreed to in writing, software
11
+distributed under the License is distributed on an "AS IS" BASIS,
12
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+See the License for the specific language governing permissions and
14
+limitations under the License.
15
+*/}}
16
+
17
+{{- if .Values.manifests.helm_test }}
18
+{{- $envAll := . }}
19
+---
20
+apiVersion: v1
21
+kind: Pod
22
+metadata:
23
+  name: mini-mirror-test
24
+  labels:
25
+{{ tuple $envAll "mini-mirror" "test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
26
+  annotations:
27
+    "helm.sh/hook": test-success
28
+    {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
29
+spec:
30
+  nodeSelector:
31
+    {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
32
+  restartPolicy: Never
33
+  containers:
34
+    - name: mini-mirror-helm-test
35
+{{ tuple $envAll "helm-test" | include "helm-toolkit.snippets.image" | indent 6 }}
36
+{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
37
+      command:
38
+        - /tmp/helm-test.sh
39
+      env:
40
+        - name: NO_PROXY
41
+          value: 127.0.0.1,.svc.cluster.local
42
+        - name: MINI_MIRROR_ENDPOINT
43
+          value: {{ tuple "api" "public" $envAll | include "helm-toolkit.endpoints.endpoint_host_lookup" }}
44
+      volumeMounts:
45
+        - name: mini-mirror-bin
46
+          mountPath: /tmp/helm-test.sh
47
+          subPath: helm-test.sh
48
+          readOnly: true
49
+  volumes:
50
+    - name: mini-mirror-bin
51
+      configMap:
52
+        name: mini-mirror-bin
53
+        defaultMode: 0555
54
+{{- end }}
55
+

+ 41
- 0
mini-mirror/templates/service-mini-mirror.yaml View File

@@ -0,0 +1,41 @@
1
+{{/*
2
+Copyright 2019, AT&T Intellectual Property
3
+
4
+Licensed under the Apache License, Version 2.0 (the "License");
5
+you may not use this file except in compliance with the License.
6
+You may obtain a copy of the License at
7
+
8
+   http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+Unless required by applicable law or agreed to in writing, software
11
+distributed under the License is distributed on an "AS IS" BASIS,
12
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+See the License for the specific language governing permissions and
14
+limitations under the License.
15
+*/}}
16
+
17
+{{- if .Values.manifests.service_mini_mirror }}
18
+{{- $envAll := . }}
19
+---
20
+apiVersion: v1
21
+kind: Service
22
+metadata:
23
+  name: {{ tuple "api" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
24
+spec:
25
+  ports:
26
+  - name: http
27
+{{ if .Values.network.api.node_port.enabled }}
28
+    nodePort: {{ .Values.network.api.node_port.port }}
29
+{{ end }}
30
+    port: {{ .Values.endpoints.api.port.http.public }}
31
+    protocol: TCP
32
+    targetPort: 80
33
+  selector:
34
+{{ tuple $envAll "mini-mirror" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
35
+  sessionAffinity: None
36
+{{ if .Values.network.api.node_port.enabled }}
37
+  type: NodePort
38
+{{ else }}
39
+  type: ClusterIP
40
+{{ end }}
41
+{{ end }}

+ 146
- 0
mini-mirror/values.yaml View File

@@ -0,0 +1,146 @@
1
+# Copyright 2019, AT&T Intellectual Property
2
+#
3
+# Licensed under the Apache License, Version 2.0 (the "License");
4
+# you may not use this file except in compliance with the License.
5
+# You may obtain a copy of the License at
6
+#
7
+#     http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+# Unless required by applicable law or agreed to in writing, software
10
+# distributed under the License is distributed on an "AS IS" BASIS,
11
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+# See the License for the specific language governing permissions and
13
+# limitations under the License.
14
+
15
+images:
16
+  tags:
17
+    dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
18
+    helm-test: docker.io/ubuntu:18.04
19
+    image_repo_sync: docker.io/docker:17.07.0
20
+    mini-mirror: docker.io/openstackhelm/mini-mirror:latest-ubuntu
21
+  pull_policy: "IfNotPresent"
22
+  local_registry:
23
+    active: false
24
+    exclude:
25
+      - dep_check
26
+      - image_repo_sync
27
+
28
+labels:
29
+  job:
30
+    node_selector_key: openstack-control-plane
31
+    node_selector_value: enabled
32
+  server:
33
+    node_selector_key: openstack-control-plane
34
+    node_selector_value: enabled
35
+  test:
36
+    node_selector_key: openstack-control-plane
37
+    node_selector_value: enabled
38
+
39
+dependencies:
40
+  dynamic:
41
+    common:
42
+      local_image_registry:
43
+        jobs:
44
+          - mini-mirror-image-repo-sync
45
+        services:
46
+          - endpoint: node
47
+            service: local_image_registry
48
+  static:
49
+    image_repo_sync:
50
+      services:
51
+        - endpoint: internal
52
+          service: local_image_registry
53
+
54
+pod:
55
+  affinity:
56
+    anti:
57
+      type:
58
+        default: preferredDuringSchedulingIgnoredDuringExecution
59
+      topologyKey:
60
+        default: kubernetes.io/hostname
61
+  replicas:
62
+    api: 2
63
+  lifecycle:
64
+    upgrades:
65
+      deployments:
66
+        revision_history: 3
67
+        pod_replacement_strategy: RollingUpdate
68
+        rolling_update:
69
+          max_unavailable: 1
70
+          max_surge: 3
71
+    disruption_budget:
72
+      api:
73
+        min_available: 0
74
+  resources:
75
+    enabled: false
76
+    api:
77
+      limits:
78
+        memory: "1024Mi"
79
+        cpu: "2000m"
80
+      requests:
81
+        memory: "128Mi"
82
+        cpu: "100m"
83
+    jobs:
84
+      image_repo_sync:
85
+        requests:
86
+          memory: "128Mi"
87
+          cpu: "100m"
88
+        limits:
89
+          memory: "1024Mi"
90
+          cpu: "2000m"
91
+
92
+endpoints:
93
+  cluster_domain_suffix: cluster.local
94
+  local_image_registry:
95
+    name: docker-registry
96
+    namespace: docker-registry
97
+    hosts:
98
+      default: localhost
99
+      internal: docker-registry
100
+      node: localhost
101
+    host_fqdn_override:
102
+      default: null
103
+    port:
104
+      registry:
105
+        node: 5000
106
+  api:
107
+    name: api
108
+    hosts:
109
+      default: mini-mirror-api
110
+      public: mini-mirror
111
+    host_fqdn_override:
112
+      default: null
113
+    path:
114
+      default: /
115
+    scheme:
116
+      default: http
117
+    port:
118
+      http:
119
+        default: 8888
120
+        public: 80
121
+
122
+network:
123
+  api:
124
+    external_policy_local: false
125
+    node_port:
126
+      enabled: false
127
+      port: 8888
128
+
129
+manifests:
130
+  configmap_bin: true
131
+  configmap_etc: true
132
+  deployment_mini_mirror: true
133
+  helm_test: true
134
+  job_image_repo_sync: true
135
+  service_mini_mirror: true
136
+
137
+conf:
138
+  nginx: |
139
+    server {
140
+      root /srv;
141
+      server_name nginx;
142
+
143
+      location / {
144
+        autoindex on;
145
+      }
146
+    }

Loading…
Cancel
Save