Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Keycloak): add support for custom image and image pull secrets #422

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions deploy/crd/keycloaks.glasskube.eu-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ spec:
x-kubernetes-int-or-string: true
type: object
type: object
image:
type: string
imagePullSecrets:
items:
properties:
name:
type: string
type: object
type: array
version:
pattern: \d+\.\d+\.\d+
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ internal val Keycloak.genericResourceName get() = "${Keycloak.APP_NAME}-${metada
internal val Keycloak.backupBucketName get() = "$genericResourceName-backup"
internal val Keycloak.ingressTlsCertName get() = "$genericResourceName-tls"
internal val Keycloak.discoveryServiceName get() = "$genericResourceName-discovery"
internal val Keycloak.appImage get() = "quay.io/keycloak/${Keycloak.APP_NAME}:${spec.version}"
internal val Keycloak.appImage get() = spec.image ?: "quay.io/keycloak/${Keycloak.APP_NAME}:${spec.version}"
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import eu.glasskube.operator.validation.Patterns.SEMVER
import io.fabric8.generator.annotation.Nullable
import io.fabric8.generator.annotation.Pattern
import io.fabric8.generator.annotation.Required
import io.fabric8.kubernetes.api.model.LocalObjectReference
import io.fabric8.kubernetes.api.model.Quantity
import io.fabric8.kubernetes.api.model.ResourceRequirements

Expand All @@ -16,6 +17,8 @@ data class KeycloakSpec(
val host: String,
val management: ManagementSpec = ManagementSpec(),
val resources: ResourceRequirements = defaultResourceRequirements,
val image: String?,
val imagePullSecrets: List<LocalObjectReference>?,
@field:Pattern(SEMVER)
val version: String = "21.1.2",
@field:Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import eu.glasskube.operator.apps.keycloak.discoveryServiceName
import eu.glasskube.operator.apps.keycloak.genericResourceName
import eu.glasskube.operator.apps.keycloak.resourceLabelSelector
import eu.glasskube.operator.apps.keycloak.resourceLabels
import io.fabric8.kubernetes.api.model.LocalObjectReference
import io.fabric8.kubernetes.api.model.apps.Deployment
import io.javaoperatorsdk.operator.api.reconciler.Context
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource
Expand Down Expand Up @@ -67,7 +68,7 @@ class KeycloakDeployment : CRUDKubernetesDependentResource<Deployment, Keycloak>
"KC_HOSTNAME_STRICT_BACKCHANNEL" to "false",
"KC_HTTP_ENABLED" to "true",
"KC_HTTP_PORT" to "8080",
"KC_PROXY" to "passthrough",
"KC_PROXY" to "edge",
"KEYCLOAK_ADMIN" to "root",
"KEYCLOAK_ADMIN_PASSWORD" to "glasskube-operator",
"jgroups.dns.query" to primary.discoveryServiceName
Expand Down Expand Up @@ -101,6 +102,7 @@ class KeycloakDeployment : CRUDKubernetesDependentResource<Deployment, Keycloak>
}
}
)
imagePullSecrets = primary.spec.imagePullSecrets?.map { LocalObjectReference(it.name) }
}
}
}
Expand Down