Skip to content

Commit 915b45a

Browse files
schnatterernihussmann
authored andcommitted
Implement remaining image pull secrets
Ignore Jenkins, SCMM, Registry, ArgoCD because we don't have params to set their images. We have different options for using them in airGapped envs: Cloudogu Ecosystem and Argo CD Operator (WIP) Added setting nginx-image in helm-umbrella example app Add --ingress-nginx-image and upgrade chart to avoid conflict with isControllerTagValid.
1 parent 6bd9c7b commit 915b45a

File tree

18 files changed

+216
-83
lines changed

18 files changed

+216
-83
lines changed

applications/argocd/nginx/helm-jenkins/k8s/values-shared.ftl.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ image:
44
repository: ${nginxImage.repository}
55
tag: ${nginxImage.tag}
66
</#if>
7+
<#if config.registry.createImagePullSecrets?has_content && config.registry.twoRegistries?has_content>
8+
9+
global:
10+
imagePullSecrets:
11+
- proxy-registry
12+
</#if>
713
service:
814
ports:
915
http: 80

applications/argocd/nginx/helm-umbrella/values.ftl.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
nginx:
2+
<#if nginxImage??>
3+
image:
4+
registry: ${nginxImage.registry}
5+
repository: ${nginxImage.repository}
6+
tag: ${nginxImage.tag}
7+
</#if>
8+
<#if config.registry.createImagePullSecrets == true>
9+
10+
global:
11+
imagePullSecrets:
12+
- proxy-registry
13+
</#if>
214
service:
315
ports:
416
http: 80

applications/cluster-resources/ingress-nginx-helm-values.ftl.yaml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1+
<#assign DockerImageParser=statics['com.cloudogu.gitops.utils.DockerImageParser']>
2+
<#if config.registry.createImagePullSecrets?has_content && config.registry.twoRegistries?has_content>
3+
imagePullSecrets:
4+
- name: proxy-registry
5+
6+
</#if>
17
controller:
8+
<#if config.features.ingressNginx.helm.image?has_content>
9+
<#assign imageObject = DockerImageParser.parse(config.features.ingressNginx.helm.image)>
10+
image:
11+
repository: ${imageObject.registryAndRepositoryAsString}
12+
tag: ${imageObject.tag}
13+
# Changing the image will change digest, so don't use the default.
14+
# A digest can also be appended to the tag
15+
digest: null
16+
</#if>
217
annotations:
318
ingressclass.kubernetes.io/is-default-class: "true"
419
watchIngressWithoutClass: true
@@ -14,7 +29,8 @@ controller:
1429
# https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip
1530
externalTrafficPolicy: Local
1631
replicaCount: 2
17-
<#if podResources == true>
32+
<#if config.application.podResources == true>
33+
1834
resources:
1935
# Be generous to our Single Point of failure
2036
limits:
@@ -42,10 +58,10 @@ controller:
4258
# customize access log format to include requested hostname ($host)
4359
# https://github.com/kubernetes/ingress-nginx/blob/controller-v1.2.1/docs/user-guide/nginx-configuration/log-format.md
4460
log-format-upstream: '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$host" $request_length $request_time [$proxy_upstream_name] [$proxy_alternative_upstream_name] $upstream_addr $upstream_response_length $upstream_response_time $upstream_status $req_id'
45-
<#if monitoring.active == true>
61+
<#if config.features.monitoring.active == true>
4662
metrics:
4763
enabled: true
4864
serviceMonitor:
4965
enabled: true
50-
namespace: ${namePrefix}monitoring
66+
namespace: ${config.application.namePrefix}monitoring
5167
</#if>

applications/cluster-resources/mailhog-helm-values.ftl.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ image:
55
repository: ${imageObject.registryAndRepositoryAsString}
66
<#if imageObject.tag?has_content> tag: ${imageObject.tag}</#if>
77
</#if>
8-
98
<#if config.registry.createImagePullSecrets?has_content && config.registry.twoRegistries?has_content>
9+
1010
imagePullSecrets:
1111
- name: proxy-registry
1212
</#if>
13-
1413
service:
1514
type: <#if isRemote>LoadBalancer<#else>NodePort</#if>
1615
port:

applications/cluster-resources/monitoring/prometheus-stack-helm-values.ftl.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,22 @@ crds:
44
enabled: false
55
</#if>
66

7-
<#if namespaceIsolation == true>
7+
<#if namespaceIsolation == true || config.registry.createImagePullSecrets == true>
88
global:
9+
<#if config.registry.createImagePullSecrets == true>
10+
imagePullSecrets:
11+
- name: proxy-registry
12+
</#if>
13+
<#if namespaceIsolation == true>
14+
915
rbac:
1016
# Avoids creation of ClusterRole, which do not need here
1117
create: false
1218
kubeApiServer:
1319
# Don't scrape ApiServer to avoid 403 in prometheus targets due to lacking RBAC in isolated mode
1420
enabled: false
1521
</#if>
22+
</#if>
1623

1724
# Note that many things are disabled here, because we want to start small, especially in airgapped envs where each image
1825
# has to be replicated individually

docs/configuration.schema.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@
198198
"type" : "string",
199199
"description" : "Name of the Helm chart"
200200
},
201+
"image" : {
202+
"type" : "string",
203+
"description" : "The image of the Helm chart to be installed"
204+
},
201205
"repoURL" : {
202206
"type" : "string",
203207
"description" : "Repository url from which the Helm chart should be obtained"
@@ -211,8 +215,8 @@
211215
"description" : "The version of the Helm chart to be installed"
212216
}
213217
},
214-
"description" : "Common Config parameters for the Helm package manager: Name of Chart (chart), URl of Helm-Repository (repoURL) and Chart Version (version). Note: These config is intended to obtain the chart from a different source (e.g. in air-gapped envs), not to use a different version of a helm chart. Using a different helm chart or version to the one used in the GOP version will likely cause errors.",
215-
"additionalProperties" : false
218+
"additionalProperties" : false,
219+
"description" : "Common Config parameters for the Helm package manager: Name of Chart (chart), URl of Helm-Repository (repoURL) and Chart Version (version). Note: These config is intended to obtain the chart from a different source (e.g. in air-gapped envs), not to use a different version of a helm chart. Using a different helm chart or version to the one used in the GOP version will likely cause errors."
216220
}
217221
},
218222
"additionalProperties" : false,
@@ -518,7 +522,7 @@
518522
"properties" : {
519523
"createImagePullSecrets" : {
520524
"type" : "boolean",
521-
"description" : "Create image pull secrets for registry and proxy-registry for all GOP namespaces and helm charts. Use this if your cluster is not auto-provisioned with credentials for your private registries or if you configure individual helm images to be pulled from the proxy-registry that requires authentication."
525+
"description" : "Create image pull secrets for registry and proxy-registry for all GOP namespaces and helm charts. Uses proxy-username, read-only-username or registry-username (in this order). Use this if your cluster is not auto-provisioned with credentials for your private registries or if you configure individual helm images to be pulled from the proxy-registry that requires authentication."
522526
},
523527
"helm" : {
524528
"$ref" : "#/$defs/HelmConfig"

docs/developers.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,21 @@ for operation in "${operations[@]}"; do
464464
curl --fail "http://localhost:30000/api/v2.0/projects/${projectId}/members" -X POST -u admin:Harbor12345 -H 'Content-Type: application/json' --data-raw "{\"role_id\":4,\"member_user\":{\"username\":\"$operation\"}}"
465465
done
466466
467+
# When updating the container image versions note that all images of a chart are listed at artifact hub on the right hand side under "Containers Images"
467468
skopeo copy docker://eclipse-temurin:11-jre-alpine --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/eclipse-temurin:11-jre-alpine
468469
skopeo copy docker://ghcr.io/cloudogu/mailhog:v1.0.1 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/mailhog
469-
skopeo copy docker://ghcr.io/external-secrets/external-secrets:v0.9.16 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/eso
470-
skopeo copy docker://hashicorp/vault:1.14.0 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/vault
470+
skopeo copy docker://ghcr.io/external-secrets/external-secrets:v0.9.16 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/external-secrets
471+
skopeo copy docker://hashicorp/vault:1.14.0 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/vault
472+
skopeo copy docker://bitnami/nginx:1.23.3-debian-11-r8 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/nginx
473+
skopeo copy docker://registry.k8s.io/ingress-nginx/controller:v1.9.6 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/ingress-nginx
474+
skopeo copy docker://quay.io/prometheus-operator/prometheus-operator:v0.73.2 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/prometheus-operator
475+
# Using latest will lead to failure with
476+
# k describe prometheus -n monitoring
477+
# Message: initializing PrometheusRules failed: failed to parse version: Invalid character(s) found in major number "0latest"
478+
skopeo copy docker://quay.io/prometheus/prometheus:v2.51.2 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/prometheus:v2.51.2
479+
skopeo copy docker://quay.io/prometheus-operator/prometheus-config-reloader:v0.73.2 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/prometheus-config-reloader
480+
skopeo copy docker://grafana/grafana:10.4.1 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/grafana
481+
skopeo copy docker://quay.io/kiwigrid/k8s-sidecar:1.27.4 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/k8s-sidecar
471482
```
472483
473484
* Deploy playground:
@@ -490,28 +501,19 @@ docker run --rm -t -u $(id -u) \
490501
--petclinic-image=localhost:30000/proxy/eclipse-temurin:11-jre-alpine \
491502
--mailhog-image=localhost:30000/proxy/mailhog:latest \
492503
--vault-image=localhost:30000/proxy/vault:latest \
493-
--external-secrets-image=localhost:30000/proxy/eso:latest \
494-
--external-secrets-certcontroller-image=localhost:30000/proxy/eso:latest \
495-
--external-secrets-webhook-image=localhost:30000/proxy/eso:latest
496-
504+
--external-secrets-image=localhost:30000/proxy/external-secrets:latest \
505+
--external-secrets-certcontroller-image=localhost:30000/proxy/external-secrets:latest \
506+
--external-secrets-webhook-image=localhost:30000/proxy/external-secrets:latest \
507+
--nginx-image=localhost:30000/proxy/nginx:latest \
508+
--ingress-nginx-image=localhost:30000/proxy/ingress-nginx:latest \
509+
--prometheus-image=localhost:30000/proxy/prometheus:v2.51.2 \
510+
--prometheus-operator-image=localhost:30000/proxy/prometheus-operator:latest \
511+
--prometheus-config-reloader-image=localhost:30000/proxy/prometheus-config-reloader:latest \
512+
--grafana-image=localhost:30000/proxy/grafana:latest \
513+
--grafana-sidecar-image=localhost:30000/proxy/k8s-sidecar:latest
497514
# Or with config file --config-file=/config/gitops-playground.yaml
498515
```
499516
500-
The same using a config file looks like so:
501-
502-
```yaml
503-
registry:
504-
proxyUrl: localhost:30000
505-
proxyUsername: Proxy
506-
proxyPassword: Proxy12345
507-
registryUrl: localhost:30000
508-
registryUsername: Registry
509-
registryPassword: Registry12345
510-
registryPath: Registry
511-
createImagePullSecrets: true
512-
images:
513-
petclinic: localhost:30000/proxy/eclipse-temurin:11-jre-alpine
514-
```
515517
## Testing Network Policies locally
516518
517519
The first increment of our `--netpols` feature is intended to be used on openshift and with an external Cloudogu Ecosystem.

exercises/broken-application/broken-application.ftl.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ spec:
77
selector:
88
matchLabels:
99
app: broken-application
10+
<#if config.registry.createImagePullSecrets?has_content && config.registry.twoRegistries?has_content>
11+
imagePullSecrets:
12+
- name: proxy-registry
13+
</#if>
1014
template:
1115
metadata:
1216
labels:

exercises/nginx-validation/k8s/values-shared.ftl.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ image:
44
repository: ${nginxImage.repository}
55
tag: ${nginxImage.tag}
66
</#if>
7+
<#if config.registry.createImagePullSecrets?has_content && config.registry.twoRegistries?has_content>
8+
global:
9+
imagePullSecrets:
10+
- proxy-registry
11+
</#if>
712
service:
813
ports:
914
http: 80

src/main/groovy/com/cloudogu/gitops/cli/GitopsPlaygroundCli.groovy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ class GitopsPlaygroundCli implements Runnable {
228228
// args Ingress-Class
229229
@Option(names = ['--ingress-nginx'], description = INGRESS_NGINX_ENABLE_DESCRIPTION)
230230
private Boolean ingressNginx
231-
231+
@Option(names = ['--ingress-nginx-image'], description = HELM_CONFIG_IMAGE_DESCRIPTION)
232+
private String ingressNginxImage
232233

233234
@Override
234235
void run() {
@@ -503,6 +504,9 @@ class GitopsPlaygroundCli implements Runnable {
503504
],
504505
ingressNginx: [
505506
active: ingressNginx,
507+
helm : [
508+
image: ingressNginxImage
509+
]
506510
],
507511

508512
]

0 commit comments

Comments
 (0)