Skip to content

Commit 6e45f6a

Browse files
authored
Add imagepullsecrets component with example (#19)
* Add imagepullsecrets component with example * move example to demo
1 parent 80bd0c5 commit 6e45f6a

File tree

6 files changed

+87
-1
lines changed

6 files changed

+87
-1
lines changed

.buildkite/verify-overlays.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eu
44
pushd "$(dirname "${BASH_SOURCE[0]}")"/..
55

66
OVERLAYS=()
7-
mapfile -t OVERLAYS < <(find examples -maxdepth 1 -type d ! -name '.*' ! -name 'monitoring' ! -name 'ingress-controller' ! -name 'examples' -printf '%f\n')
7+
mapfile -t OVERLAYS < <(find examples -maxdepth 1 -type d ! -name '.*' ! -name 'demo' ! -name 'monitoring' ! -name 'ingress-controller' ! -name 'examples' -printf '%f\n')
88

99
for O in "${OVERLAYS[@]}"; do
1010
echo "<<<< GENERATING ${O} OVERLAY >>>>>"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: kustomize.config.k8s.io/v1alpha1
2+
kind: Component
3+
patches:
4+
- patch: |-
5+
- op: add
6+
path: /spec/template/spec/imagePullSecrets
7+
value:
8+
name: IMAGE_PULL_SECRET_NAME
9+
target:
10+
group: apps
11+
kind: StatefulSet|Deployment|DaemonSet
12+
version: v1
13+
replacements:
14+
- source:
15+
fieldPath: data.IMAGE_PULL_SECRET_NAME
16+
kind: ConfigMap
17+
name: sourcegraph-kustomize-build-config
18+
targets:
19+
- fieldPaths:
20+
- spec.template.spec.imagePullSecrets.name
21+
select:
22+
group: apps
23+
kind: Deployment
24+
- fieldPaths:
25+
- spec.template.spec.imagePullSecrets.name
26+
select:
27+
group: apps
28+
kind: StatefulSet
29+
- fieldPaths:
30+
- spec.template.spec.imagePullSecrets.name
31+
select:
32+
group: apps
33+
kind: DaemonSet
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
################################################################################################
2+
# [BUILD CONFIGURATIONS]
3+
# Some components read the configuration values in this file during the Kustomize build-process
4+
#
5+
# HOW TO USE:
6+
# Enter the configuration values as instructed by components used in your kustomization.yaml
7+
# Always refer to the component’s documentation or comments before updating
8+
################################################################################################
9+
apiVersion: v1
10+
kind: ConfigMap
11+
metadata:
12+
annotations:
13+
description: Some components read the configuration values from the "data" field below during the build process. You only need to update this file if you are using components that require specific CONFIG_KEYS. If no components in your overlay require extra configuration, no update is necessary.
14+
labels:
15+
deploy: sourcegraph
16+
name: sourcegraph-kustomize-build-config
17+
data:
18+
# example:
19+
EXAMPLE_CONFIG_KEY: example
20+
#-------- Update config options below ---------#
21+
# AWS_MANAGED_CERT_ARN: __placeholder__
22+
# GKE_MANAGED_CERT_NAME: __placeholder__
23+
# HOST_DOMAIN: __placeholder__
24+
# NEW_REDIS_CACHE_ENDPOINT: __placeholder__
25+
# NEW_REDIS_STORE_ENDPOINT: __placeholder__
26+
PRIVATE_REGISTRY: my-private-registry.io
27+
IMAGE_PULL_SECRET_NAME: secret-registry-key
28+
# SSD_NODE_PATH: __placeholder__
29+
# STORAGECLASS_NAME: __placeholder__
30+
# STORAGECLASS_PROVISIONER: __placeholder__
31+
# STORAGECLASS_PARAM_TYPE: __placeholder__
32+
# TLS_HOST: __placeholder__
33+
# TLS_INGRESS_CLASS_NAME: __placeholder__
34+
# TLS_CLUSTER_ISSUER: __placeholder__
35+
# TLS_SECRET_NAME: __placeholder__
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
namespace: ns-sourcegraph
4+
# Run all services with default values
5+
resources:
6+
# [REQUIRED: BUILD CONFIG] Update this file when using components that have "CONFIG KEYS"
7+
- buildConfig.yaml # -- Update the CONFIG Key values in buildConfig.yaml when instructed
8+
- ../../base/sourcegraph
9+
- ../../base/monitoring
10+
components:
11+
- ../../components/resources/namespace
12+
- ../../components/monitoring/tracing
13+
- ../../components/enable/private-registry
14+
- ../../components/resources/imagepullsecrets

instances/template/buildConfig.template.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ data:
2424
# NEW_REDIS_CACHE_ENDPOINT: __placeholder__
2525
# NEW_REDIS_STORE_ENDPOINT: __placeholder__
2626
# PRIVATE_REGISTRY: __placeholder__
27+
# PRIVATE_REGISTRY_SECRET_KEY: __placeholder__
2728
# SSD_NODE_PATH: __placeholder__
2829
# STORAGECLASS_NAME: __placeholder__
2930
# STORAGECLASS_PROVISIONER: __placeholder__

instances/template/kustomization.template.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ components:
159159
# - ../../components/enable/private-registry # -- Update images name to private registry name
160160
# CONFIG KEYS: PRIVATE_REGISTRY
161161
#
162+
# - ../../components/resources/imagepullsecrets # -- Add imagePullSecrets field to all resources
163+
# CONFIG KEYS: IMAGE_PULL_SECRET_NAME
164+
#
162165
# ------------------------------------------------------------------------
163166
# Permission Configurations
164167
# IMPORTANT: Keep the components below as the LAST components

0 commit comments

Comments
 (0)