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

fix(k8s): correctly set image pull secret on sync pod #6533

Merged
merged 2 commits into from
Oct 15, 2024
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
1 change: 1 addition & 0 deletions core/src/plugins/kubernetes/container/deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export async function createWorkloadManifest({
production,
}: CreateDeploymentParams): Promise<KubernetesWorkload> {
const spec = action.getSpec()

const mode = action.mode()

let configuredReplicas = spec.replicas || DEFAULT_MINIMUM_REPLICAS
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/kubernetes/kubernetes-type/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ async function configureSpecialModesForManifests({
log,
})
} else if (mode === "sync" && spec.sync && !isEmpty(spec.sync)) {
// The "sync-mode" annotation is set in `configureDevMode`.
// The "sync-mode" annotation is already set.
return configureSyncMode({
ctx,
log,
Expand Down
7 changes: 5 additions & 2 deletions core/src/plugins/kubernetes/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export async function configureSyncMode({
spec,
}: {
ctx: PluginContext
log: Log
log: ActionLog
provider: KubernetesProvider
action: Resolved<SyncableRuntimeAction>
defaultTarget: KubernetesTargetResourceSpec | undefined
Expand Down Expand Up @@ -461,10 +461,12 @@ export async function configureSyncMode({
if (!podSpec.initContainers) {
podSpec.initContainers = []
}

if (!podSpec.imagePullSecrets) {
podSpec.imagePullSecrets = []
}
const k8sSyncUtilImageName = getK8sSyncUtilImageName()

if (!podSpec.initContainers.find((c) => c.image === k8sSyncUtilImageName)) {
const initContainer: V1Container = {
name: k8sSyncUtilContainerName,
Expand All @@ -479,7 +481,8 @@ export async function configureSyncMode({
volumeMounts: [gardenVolumeMount],
}
podSpec.initContainers.push(initContainer)
podSpec.imagePullSecrets.push(...provider.config.imagePullSecrets)

podSpec.imagePullSecrets.push(...provider.config.imagePullSecrets.map((s) => ({ name: s.name })))
}

if (!targetContainer.volumeMounts) {
Expand Down
Loading