Skip to content

Commit 3ccd3fe

Browse files
fcanovaileonardoce
authored andcommitted
chore: review
Signed-off-by: Francesco Canovai <[email protected]>
1 parent 788eaf6 commit 3ccd3fe

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

internal/cnpgi/operator/lifecycle.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,15 @@ func InjectPluginSidecarPodSpec(
336336
if spec.Containers[i].Name == mainContainerName {
337337
volumeMounts = spec.Containers[i].VolumeMounts
338338
mainContainerFound = true
339-
} else if spec.Containers[i].Name == sidecar.Name {
339+
}
340+
}
341+
342+
if !mainContainerFound {
343+
return errors.New("main container not found")
344+
}
345+
346+
for i := range spec.InitContainers {
347+
if spec.InitContainers[i].Name == sidecar.Name {
340348
sidecarContainerFound = true
341349
}
342350
}
@@ -346,10 +354,6 @@ func InjectPluginSidecarPodSpec(
346354
return nil
347355
}
348356

349-
if !mainContainerFound {
350-
return errors.New("main container not found")
351-
}
352-
353357
// Do not modify the passed sidecar definition
354358
if injectMainContainerVolumes {
355359
sidecar.VolumeMounts = append(sidecar.VolumeMounts, volumeMounts...)

scripts/run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ MYTMPDIR="$(mktemp -d)"
1313
trap 'rm -rf -- "$MYTMPDIR"' EXIT
1414

1515
current_context=$(kubectl config view --raw -o json | jq -r '."current-context"' | sed "s/kind-//")
16-
operator_image=$(KIND_CLUSTER_NAME="$current_context" KO_DOCKER_REPO=kind.local ko build -BP ./cmd/operator)
17-
instance_image=$(KIND_CLUSTER_NAME="$current_context" KO_DOCKER_REPO=kind.local KO_DEFAULTBASEIMAGE="ghcr.io/cloudnative-pg/postgresql:17.0" ko build -BP ./cmd/instance)
16+
operator_image=$(KIND_CLUSTER_NAME="$current_context" KO_DOCKER_REPO=kind.local ko build -BP ./cmd/manager)
17+
instance_image=$(KIND_CLUSTER_NAME="$current_context" KO_DOCKER_REPO=kind.local KO_DEFAULTBASEIMAGE="ghcr.io/cloudnative-pg/postgresql:17.0" ko build -BP ./cmd/manager)
1818

1919
# Now we deploy the plugin inside the `cnpg-system` workspace
2020
(

0 commit comments

Comments
 (0)