Skip to content

Commit 62acd83

Browse files
authored
Add OEL image support to Ory Kratos and Hydra modules (#186)
* Add OEL image support to Ory Kratos and Hydra modules * Remove image_registry variable: Ory Helm chart ignores it, use full path in image_repository
1 parent 1a44a72 commit 62acd83

File tree

4 files changed

+64
-4
lines changed

4 files changed

+64
-4
lines changed

kubernetes/modules/ory-hydra/main.tf

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ locals {
2424
secrets_system = var.secrets_system != null ? var.secrets_system : random_password.secrets_system[0].result
2525
secrets_cookie = var.secrets_cookie != null ? var.secrets_cookie : random_password.secrets_cookie[0].result
2626

27+
image_config = var.image_repository != null || var.image_tag != null ? {
28+
image = merge(
29+
var.image_repository != null ? { repository = var.image_repository } : {},
30+
var.image_tag != null ? { tag = var.image_tag } : {},
31+
)
32+
} : {}
33+
34+
image_pull_secrets_config = length(var.image_pull_secrets) > 0 ? {
35+
imagePullSecrets = [for name in var.image_pull_secrets : { name = name }]
36+
} : {}
37+
2738
urls_config = merge(
2839
{
2940
self = {
@@ -35,7 +46,7 @@ locals {
3546
var.logout_url != null ? { logout = var.logout_url } : {},
3647
)
3748

38-
default_helm_values = {
49+
default_helm_values = merge({
3950
replicaCount = var.replica_count
4051

4152
secret = {
@@ -115,7 +126,7 @@ locals {
115126
port = 4445
116127
}
117128
}
118-
}
129+
}, local.image_config, local.image_pull_secrets_config)
119130
}
120131

121132
resource "helm_release" "hydra" {

kubernetes/modules/ory-hydra/variables.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,25 @@ variable "maester_enabled" {
164164
nullable = false
165165
}
166166

167+
variable "image_repository" {
168+
description = "Override the Docker image repository for Hydra. Must include the full registry path as the Ory Helm chart ignores image.registry. Example: europe-docker.pkg.dev/ory-artifacts/ory-enterprise/hydra-oel"
169+
type = string
170+
default = null
171+
}
172+
173+
variable "image_tag" {
174+
description = "Override the Docker image tag for Hydra. If not set, the chart default will be used."
175+
type = string
176+
default = null
177+
}
178+
179+
variable "image_pull_secrets" {
180+
description = "List of Kubernetes secret names for pulling images from private registries. Required for OEL deployments."
181+
type = list(string)
182+
default = []
183+
nullable = false
184+
}
185+
167186
variable "helm_values" {
168187
description = "Additional values to pass to the Helm chart. These will be deep-merged with the module's default values, with these values taking precedence."
169188
type = any

kubernetes/modules/ory-kratos/main.tf

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ locals {
3535
identitySchemas = var.identity_schemas
3636
} : {}
3737

38+
image_config = var.image_repository != null || var.image_tag != null ? {
39+
image = merge(
40+
var.image_repository != null ? { repository = var.image_repository } : {},
41+
var.image_tag != null ? { tag = var.image_tag } : {},
42+
)
43+
} : {}
44+
45+
image_pull_secrets_config = length(var.image_pull_secrets) > 0 ? {
46+
imagePullSecrets = [for name in var.image_pull_secrets : { name = name }]
47+
} : {}
48+
3849
smtp_config = var.smtp_connection_uri != null ? {
3950
courier = {
4051
smtp = merge(
@@ -45,7 +56,7 @@ locals {
4556
}
4657
} : {}
4758

48-
default_helm_values = {
59+
default_helm_values = merge({
4960
replicaCount = var.replica_count
5061

5162
secret = {
@@ -130,7 +141,7 @@ locals {
130141
port = 4434
131142
}
132143
}
133-
}
144+
}, local.image_config, local.image_pull_secrets_config)
134145
}
135146

136147
resource "helm_release" "kratos" {

kubernetes/modules/ory-kratos/variables.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,25 @@ variable "smtp_from_name" {
172172
default = null
173173
}
174174

175+
variable "image_repository" {
176+
description = "Override the Docker image repository for Kratos. Must include the full registry path as the Ory Helm chart ignores image.registry. Example: europe-docker.pkg.dev/ory-artifacts/ory-enterprise-kratos/kratos-oel"
177+
type = string
178+
default = null
179+
}
180+
181+
variable "image_tag" {
182+
description = "Override the Docker image tag for Kratos. If not set, the chart default will be used."
183+
type = string
184+
default = null
185+
}
186+
187+
variable "image_pull_secrets" {
188+
description = "List of Kubernetes secret names for pulling images from private registries. Required for OEL deployments."
189+
type = list(string)
190+
default = []
191+
nullable = false
192+
}
193+
175194
variable "helm_values" {
176195
description = "Additional values to pass to the Helm chart. These will be deep-merged with the module's default values, with these values taking precedence."
177196
type = any

0 commit comments

Comments
 (0)