Skip to content

Commit 18c1759

Browse files
schnatterernihussmann
authored andcommitted
createImagePullSecrets also from other reg creds
This improves UX because we can also create image pull secrets when running with only one registry
1 parent 915b45a commit 18c1759

File tree

18 files changed

+63
-33
lines changed

18 files changed

+63
-33
lines changed

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ node('high-cpu') {
9797
.inside("-e KUBECONFIG=${env.WORKSPACE}/.kube/config " +
9898
" --network=host --entrypoint=''") {
9999
sh "/app/apply-ng --yes --trace --internal-registry-port=${registryPort} " +
100-
"--argocd --monitoring --vault=dev --ingress-nginx --mailhog"
100+
"--argocd --monitoring --vault=dev --ingress-nginx --mailhog --base-url=http://localhost"
101101
}
102102
}
103103
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ image:
44
repository: ${nginxImage.repository}
55
tag: ${nginxImage.tag}
66
</#if>
7-
<#if config.registry.createImagePullSecrets?has_content && config.registry.twoRegistries?has_content>
7+
<#if config.registry.createImagePullSecrets == true>
88

99
global:
1010
imagePullSecrets:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<#assign DockerImageParser=statics['com.cloudogu.gitops.utils.DockerImageParser']>
2-
<#if config.registry.createImagePullSecrets?has_content && config.registry.twoRegistries?has_content>
2+
<#if config.registry.createImagePullSecrets == true>
33
imagePullSecrets:
44
- name: proxy-registry
55

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ image:
55
repository: ${imageObject.registryAndRepositoryAsString}
66
<#if imageObject.tag?has_content> tag: ${imageObject.tag}</#if>
77
</#if>
8-
<#if config.registry.createImagePullSecrets?has_content && config.registry.twoRegistries?has_content>
8+
<#if config.registry.createImagePullSecrets == true>
99

1010
imagePullSecrets:
1111
- name: proxy-registry

applications/cluster-resources/secrets/external-secrets/values.ftl.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ resources:
2929
memory: 40Mi
3030
cpu: 50m
3131
</#if>
32-
<#if config.registry.createImagePullSecrets?has_content && config.registry.twoRegistries?has_content>
32+
<#if config.registry.createImagePullSecrets == true>
3333
imagePullSecrets:
3434
- name: proxy-registry
3535
</#if>
@@ -45,7 +45,7 @@ certController:
4545
image:
4646
repository: ${certControllerimageObject.registryAndRepositoryAsString}
4747
tag: ${certControllerimageObject.tag}
48-
<#if config.registry.createImagePullSecrets?has_content && config.registry.twoRegistries?has_content>
48+
<#if config.registry.createImagePullSecrets == true>
4949
imagePullSecrets:
5050
- name: proxy-registry
5151
</#if>
@@ -56,7 +56,7 @@ webhook:
5656
image:
5757
repository: ${webhookImageObject.registryAndRepositoryAsString}
5858
tag: ${webhookImageObject.tag}
59-
<#if config.registry.createImagePullSecrets?has_content && config.registry.twoRegistries?has_content>
59+
<#if config.registry.createImagePullSecrets == true>
6060
imagePullSecrets:
6161
- name: proxy-registry
6262
</#if>

applications/cluster-resources/secrets/vault/values.ftl.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ui:
1010
</#if>
1111
injector:
1212
enabled: false
13-
<#if config.registry.createImagePullSecrets?has_content && config.registry.twoRegistries?has_content>
13+
<#if config.registry.createImagePullSecrets == true>
1414
global:
1515
imagePullSecrets:
1616
- name: proxy-registry
@@ -26,11 +26,11 @@ server:
2626
repository: ${imageObject.registryAndRepositoryAsString}
2727
tag: ${imageObject.tag}
2828
</#if>
29-
<#if url?has_content>
29+
<#if host?has_content>
3030
ingress:
3131
enabled: true
3232
hosts:
33-
- host: ${url.host}
33+
- host: ${host}
3434
</#if>
3535

3636
<#if config.application.podResources == true>

docs/developers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ skopeo copy docker://quay.io/kiwigrid/k8s-sidecar:1.27.4 --dest-creds Proxy:Prox
487487
docker run --rm -t -u $(id -u) \
488488
-v ~/.config/k3d/kubeconfig-gitops-playground.yaml:/home/.kube/config \
489489
--net=host \
490-
gitops-playground:dev \
490+
gitops-playground:dev -x \
491491
--yes --argocd --ingress-nginx --base-url=http://localhost \
492492
--vault=dev --monitoring --mailhog \
493493
--create-image-pull-secrets \

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ spec:
77
selector:
88
matchLabels:
99
app: broken-application
10-
<#if config.registry.createImagePullSecrets?has_content && config.registry.twoRegistries?has_content>
10+
<#if config.registry.createImagePullSecrets == true>
1111
imagePullSecrets:
1212
- name: proxy-registry
1313
</#if>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ image:
44
repository: ${nginxImage.repository}
55
tag: ${nginxImage.tag}
66
</#if>
7-
<#if config.registry.createImagePullSecrets?has_content && config.registry.twoRegistries?has_content>
7+
<#if config.registry.createImagePullSecrets == true>
88
global:
99
imagePullSecrets:
1010
- proxy-registry

src/main/groovy/com/cloudogu/gitops/FeatureWithImage.groovy

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ trait FeatureWithImage {
1212
final Logger log = LoggerFactory.getLogger(this.class)
1313

1414
void createImagePullSecret() {
15-
if (config.registry['createImagePullSecrets'] && config.registry['twoRegistries']) {
15+
if (config.registry['createImagePullSecrets']) {
1616
log.trace("Creating image pull secret 'proxy-registry' in namespace ${namespace}" as String)
17+
String url = config.registry['proxyUrl'] ?: config.registry['url']
18+
String user = config.registry['proxyUsername'] ?: config.registry['readOnlyUsername'] ?: config.registry['username']
19+
String password = config.registry['proxyPassword'] ?: config.registry['readOnlyPassword'] ?: config.registry['password']
20+
1721
k8sClient.createNamespace(namespace)
18-
k8sClient.createImagePullSecret('proxy-registry', namespace, config.registry['proxyUrl'] as String,
19-
config.registry['proxyUsername'] as String,
20-
config.registry['proxyPassword'] as String)
22+
k8sClient.createImagePullSecret('proxy-registry', namespace, url, user, password)
2123
}
2224
}
2325

0 commit comments

Comments
 (0)