Skip to content

Commit 7afe766

Browse files
committed
Add imagepullsecret to airflow and envoy-gateway
1 parent 2b4cb27 commit 7afe766

File tree

6 files changed

+96
-4
lines changed

6 files changed

+96
-4
lines changed

modules/apache-airflow/main.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,25 @@ spec:
7979
namespace: ${var.namespace}
8080
YAML
8181
}
82+
83+
resource "kubernetes_secret" "docker-cfg" {
84+
metadata {
85+
name = "docker-cfg"
86+
namespace = var.namespace
87+
}
88+
89+
type = "kubernetes.io/dockerconfigjson"
90+
91+
data = {
92+
".dockerconfigjson" = jsonencode({
93+
auths = {
94+
"${var.docker_server}" = {
95+
"username" = var.docker_username,
96+
"password" = var.docker_access_token,
97+
"email" = var.docker_email
98+
"auth" = base64encode("${var.docker_username}:${var.docker_access_token}")
99+
}
100+
}
101+
})
102+
}
103+
}

modules/apache-airflow/templates/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2354,7 +2354,7 @@ redis:
23542354
# Auth secret for a private registry
23552355
# This is used if pulling airflow images from a private registry
23562356
registry:
2357-
secretName: ~
2357+
secretName: docker-cfg
23582358

23592359
# Example:
23602360
# connection:

modules/apache-airflow/variables.tf

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,27 @@ variable "git_revision" {
1919
variable "namespace" {
2020
description = "The namespace to deploy into"
2121
type = string
22-
}
22+
}
23+
24+
variable "docker_server" {
25+
description = "The docker registry URL"
26+
default = "https://index.docker.io/v1/"
27+
type = string
28+
}
29+
30+
variable "docker_username" {
31+
description = "Username to log into docker for authenticated pulls"
32+
default = "dpesagebionetworks"
33+
type = string
34+
}
35+
36+
variable "docker_access_token" {
37+
description = "The access token to use for docker authenticated pulls. Created via by setting 'TF_VAR_docker_access_token' within spacelift as an environment variable"
38+
type = string
39+
}
40+
41+
variable "docker_email" {
42+
description = "The email for the docker account"
43+
default = "[email protected]"
44+
type = string
45+
}

modules/envoy-gateway/main.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,25 @@ spec:
6868
namespace: ${var.namespace}
6969
YAML
7070
}
71+
72+
resource "kubernetes_secret" "docker-cfg" {
73+
metadata {
74+
name = "docker-cfg"
75+
namespace = var.namespace
76+
}
77+
78+
type = "kubernetes.io/dockerconfigjson"
79+
80+
data = {
81+
".dockerconfigjson" = jsonencode({
82+
auths = {
83+
"${var.docker_server}" = {
84+
"username" = var.docker_username,
85+
"password" = var.docker_access_token,
86+
"email" = var.docker_email
87+
"auth" = base64encode("${var.docker_username}:${var.docker_access_token}")
88+
}
89+
}
90+
})
91+
}
92+
}

modules/envoy-gateway/templates/values.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ global:
99
# Default behavior: latest images will be Always else IfNotPresent.
1010
pullPolicy: IfNotPresent
1111
# List of secrets in the same namespace of the component that can be used to pull images from private repositories.
12-
pullSecrets: []
12+
pullSecrets:
13+
- "docker-cfg"
1314
ratelimit:
1415
# This is the full image name including the hub, repo, and tag.
1516
image: "docker.io/envoyproxy/ratelimit:master"
1617
# Specify image pull policy if default behavior isn't desired.
1718
# Default behavior: latest images will be Always else IfNotPresent.
1819
pullPolicy: IfNotPresent
1920
# List of secrets in the same namespace of the component that can be used to pull images from private repositories.
20-
pullSecrets: []
21+
pullSecrets:
22+
- "docker-cfg"
2123
podDisruptionBudget:
2224
minAvailable: 0
2325
# maxUnavailable: 1

modules/envoy-gateway/variables.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,26 @@ variable "ssl_hostname" {
3535
description = "The hostname to use for the SSL certificate"
3636
type = string
3737
}
38+
39+
variable "docker_server" {
40+
description = "The docker registry URL"
41+
default = "https://index.docker.io/v1/"
42+
type = string
43+
}
44+
45+
variable "docker_username" {
46+
description = "Username to log into docker for authenticated pulls"
47+
default = "dpesagebionetworks"
48+
type = string
49+
}
50+
51+
variable "docker_access_token" {
52+
description = "The access token to use for docker authenticated pulls. Created via by setting 'TF_VAR_docker_access_token' within spacelift as an environment variable"
53+
type = string
54+
}
55+
56+
variable "docker_email" {
57+
description = "The email for the docker account"
58+
default = "[email protected]"
59+
type = string
60+
}

0 commit comments

Comments
 (0)