From 3ac67534d67c30aa665cfb017b5c48043e81a057 Mon Sep 17 00:00:00 2001 From: Tudor Golubenco Date: Thu, 4 Sep 2025 12:04:11 -0700 Subject: [PATCH 1/4] feat: make startup probe configurable for the sidecar Signed-off-by: Tudor Golubenco --- Makefile | 2 +- internal/cnpgi/operator/config/config.go | 63 +++++++++++++++++++++++ internal/cnpgi/operator/lifecycle.go | 18 ++++++- internal/cnpgi/operator/lifecycle_test.go | 47 +++++++++++++++++ 4 files changed, 127 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a351bd34..c09bf2d6 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,7 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes .PHONY: build build: manifests generate fmt vet ## Build manager binary. - go build -o bin/manager cmd/main.go + go build -o bin/manager cmd/manager/main.go .PHONY: run run: manifests generate fmt vet ## Run a controller from your host. diff --git a/internal/cnpgi/operator/config/config.go b/internal/cnpgi/operator/config/config.go index f040aee9..53a8e67e 100644 --- a/internal/cnpgi/operator/config/config.go +++ b/internal/cnpgi/operator/config/config.go @@ -1,6 +1,7 @@ package config import ( + "strconv" "strings" cnpgv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1" @@ -57,6 +58,29 @@ type PluginConfiguration struct { ReplicaSourceBarmanObjectName string ReplicaSourceServerName string + + // Probe configuration + StartupProbeConfig *ProbeConfig +} + +// ProbeConfig holds configuration for Kubernetes probes +type ProbeConfig struct { + InitialDelaySeconds int32 + TimeoutSeconds int32 + PeriodSeconds int32 + FailureThreshold int32 + SuccessThreshold int32 +} + +// DefaultProbeConfig returns the default probe configuration +func DefaultProbeConfig() *ProbeConfig { + return &ProbeConfig{ + InitialDelaySeconds: 0, + TimeoutSeconds: 10, + PeriodSeconds: 10, + FailureThreshold: 10, + SuccessThreshold: 1, + } } // GetBarmanObjectKey gets the namespaced name of the barman object @@ -166,11 +190,50 @@ func NewFromCluster(cluster *cnpgv1.Cluster) *PluginConfiguration { // used for wal_restore in the designed primary of a replica cluster ReplicaSourceServerName: replicaSourceServerName, ReplicaSourceBarmanObjectName: replicaSourceBarmanObjectName, + // probe configuration + StartupProbeConfig: parseProbeConfig(helper.Parameters), } return result } +// parseProbeConfig parses probe configuration from plugin parameters +func parseProbeConfig(parameters map[string]string) *ProbeConfig { + config := DefaultProbeConfig() + + if val, ok := parameters["startupProbe.initialDelaySeconds"]; ok { + if parsed, err := strconv.ParseInt(val, 10, 32); err == nil { + config.InitialDelaySeconds = int32(parsed) + } + } + + if val, ok := parameters["startupProbe.timeoutSeconds"]; ok { + if parsed, err := strconv.ParseInt(val, 10, 32); err == nil { + config.TimeoutSeconds = int32(parsed) + } + } + + if val, ok := parameters["startupProbe.periodSeconds"]; ok { + if parsed, err := strconv.ParseInt(val, 10, 32); err == nil { + config.PeriodSeconds = int32(parsed) + } + } + + if val, ok := parameters["startupProbe.failureThreshold"]; ok { + if parsed, err := strconv.ParseInt(val, 10, 32); err == nil { + config.FailureThreshold = int32(parsed) + } + } + + if val, ok := parameters["startupProbe.successThreshold"]; ok { + if parsed, err := strconv.ParseInt(val, 10, 32); err == nil { + config.SuccessThreshold = int32(parsed) + } + } + + return config +} + func getRecoveryParameters(cluster *cnpgv1.Cluster) map[string]string { recoveryPluginConfiguration := getRecoverySourcePlugin(cluster) if recoveryPluginConfiguration == nil { diff --git a/internal/cnpgi/operator/lifecycle.go b/internal/cnpgi/operator/lifecycle.go index d5c99185..143d746d 100644 --- a/internal/cnpgi/operator/lifecycle.go +++ b/internal/cnpgi/operator/lifecycle.go @@ -129,6 +129,7 @@ func (impl LifecycleImplementation) reconcileJob( env: env, certificates: certificates, resources: resources, + probeConfig: pluginConfiguration.StartupProbeConfig, }) } @@ -136,6 +137,7 @@ type sidecarConfiguration struct { env []corev1.EnvVar certificates []corev1.VolumeProjection resources corev1.ResourceRequirements + probeConfig *config.ProbeConfig } func reconcileJob( @@ -221,6 +223,7 @@ func (impl LifecycleImplementation) reconcilePod( env: env, certificates: certificates, resources: resources, + probeConfig: pluginConfiguration.StartupProbeConfig, }) } @@ -304,8 +307,6 @@ func reconcilePodSpec( envs = append(envs, config.env...) baseProbe := &corev1.Probe{ - FailureThreshold: 10, - TimeoutSeconds: 10, ProbeHandler: corev1.ProbeHandler{ Exec: &corev1.ExecAction{ Command: []string{"/manager", "healthcheck", "unix"}, @@ -313,6 +314,19 @@ func reconcilePodSpec( }, } + // Apply configurable probe settings if available + if config.probeConfig != nil { + baseProbe.InitialDelaySeconds = config.probeConfig.InitialDelaySeconds + baseProbe.TimeoutSeconds = config.probeConfig.TimeoutSeconds + baseProbe.PeriodSeconds = config.probeConfig.PeriodSeconds + baseProbe.FailureThreshold = config.probeConfig.FailureThreshold + baseProbe.SuccessThreshold = config.probeConfig.SuccessThreshold + } else { + // Fallback to default values + baseProbe.FailureThreshold = 10 + baseProbe.TimeoutSeconds = 10 + } + // fixed values sidecarTemplate.Name = "plugin-barman-cloud" sidecarTemplate.Image = viper.GetString("sidecar-image") diff --git a/internal/cnpgi/operator/lifecycle_test.go b/internal/cnpgi/operator/lifecycle_test.go index c3235ded..24139b7c 100644 --- a/internal/cnpgi/operator/lifecycle_test.go +++ b/internal/cnpgi/operator/lifecycle_test.go @@ -172,6 +172,53 @@ var _ = Describe("LifecycleImplementation", func() { }) Describe("reconcilePod", func() { + It("returns a patch for a valid pod with probe configuration", func(ctx SpecContext) { + // Configure plugin with custom probe settings + pluginConfiguration.StartupProbeConfig = &config.ProbeConfig{ + InitialDelaySeconds: 1, + TimeoutSeconds: 15, + PeriodSeconds: 2, + FailureThreshold: 5, + SuccessThreshold: 1, + } + + pod := &corev1.Pod{ + TypeMeta: podTypeMeta, + ObjectMeta: metav1.ObjectMeta{ + Name: "test-pod", + }, + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ + { + Name: "postgres", + }, + }, + }, + } + + podJSON, err := json.Marshal(pod) + Expect(err).NotTo(HaveOccurred()) + + request := &lifecycle.OperatorLifecycleRequest{ + ObjectDefinition: podJSON, + } + + response, err := reconcilePod(ctx, cluster, request, pluginConfiguration, sidecarConfiguration{ + probeConfig: pluginConfiguration.StartupProbeConfig, + }) + Expect(err).NotTo(HaveOccurred()) + Expect(response).NotTo(BeNil()) + Expect(response.JsonPatch).NotTo(BeEmpty()) + + // Verify the patch contains the expected probe configuration + Expect(string(response.JsonPatch)).To(ContainSubstring("startupProbe")) + Expect(string(response.JsonPatch)).To(ContainSubstring("\"initialDelaySeconds\":1")) + Expect(string(response.JsonPatch)).To(ContainSubstring("\"timeoutSeconds\":15")) + Expect(string(response.JsonPatch)).To(ContainSubstring("\"periodSeconds\":2")) + Expect(string(response.JsonPatch)).To(ContainSubstring("\"failureThreshold\":5")) + Expect(string(response.JsonPatch)).To(ContainSubstring("\"successThreshold\":1")) + }) + It("returns a patch for a valid pod", func(ctx SpecContext) { pod := &corev1.Pod{ TypeMeta: podTypeMeta, From ab6b7a684ce5d87ed9597740fb04e6eb0a748617 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 1 Sep 2025 08:28:44 +0200 Subject: [PATCH 2/4] fix(deps): update module github.com/onsi/ginkgo/v2 to v2.25.1 (#495) | datasource | package | from | to | | ---------- | ------------------------- | ------- | ------- | | go | github.com/onsi/ginkgo/v2 | v2.25.0 | v2.25.1 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Signed-off-by: Tudor Golubenco --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2bc1f759..1fac78a0 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/cloudnative-pg/cnpg-i v0.3.0 github.com/cloudnative-pg/cnpg-i-machinery v0.4.0 github.com/cloudnative-pg/machinery v0.3.1 - github.com/onsi/ginkgo/v2 v2.25.0 + github.com/onsi/ginkgo/v2 v2.25.1 github.com/onsi/gomega v1.38.0 github.com/spf13/cobra v1.9.1 github.com/spf13/viper v1.20.1 diff --git a/go.sum b/go.sum index 078e9a6d..79ff5702 100644 --- a/go.sum +++ b/go.sum @@ -129,8 +129,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/onsi/ginkgo/v2 v2.25.0 h1:LJu94oDZUdgnw+GD0Sk/iwG9c5Fnr1vLgMb4FUUwWxE= -github.com/onsi/ginkgo/v2 v2.25.0/go.mod h1:ppTWQ1dh9KM/F1XgpeRqelR+zHVwV81DGRSDnFxK7Sk= +github.com/onsi/ginkgo/v2 v2.25.1 h1:Fwp6crTREKM+oA6Cz4MsO8RhKQzs2/gOIVOUscMAfZY= +github.com/onsi/ginkgo/v2 v2.25.1/go.mod h1:ppTWQ1dh9KM/F1XgpeRqelR+zHVwV81DGRSDnFxK7Sk= github.com/onsi/gomega v1.38.0 h1:c/WX+w8SLAinvuKKQFh77WEucCnPk4j2OTUr7lt7BeY= github.com/onsi/gomega v1.38.0/go.mod h1:OcXcwId0b9QsE7Y49u+BTrL4IdKOBOKnD6VQNTJEB6o= github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= From 8c2e72a7a6d5d4d494af30d19811653b424a9970 Mon Sep 17 00:00:00 2001 From: Tudor Golubenco Date: Sun, 14 Sep 2025 09:56:10 -0700 Subject: [PATCH 3/4] Move the startup probe configuration for the sidecar in the ObjectStore config Signed-off-by: Tudor Golubenco --- api/v1/objectstore_types.go | 33 ++++++++++ api/v1/zz_generated.deepcopy.go | 20 ++++++ .../barmancloud.cnpg.io_objectstores.yaml | 36 +++++++++++ hack/examples/minio-store.yaml | 6 ++ internal/cnpgi/operator/config/config.go | 63 ------------------- internal/cnpgi/operator/lifecycle.go | 30 ++++++--- internal/cnpgi/operator/lifecycle_probes.go | 59 +++++++++++++++++ internal/cnpgi/operator/lifecycle_test.go | 7 ++- 8 files changed, 179 insertions(+), 75 deletions(-) create mode 100644 internal/cnpgi/operator/lifecycle_probes.go diff --git a/api/v1/objectstore_types.go b/api/v1/objectstore_types.go index 0db706ae..171eb611 100644 --- a/api/v1/objectstore_types.go +++ b/api/v1/objectstore_types.go @@ -22,6 +22,35 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +// ProbeConfig holds configuration for probe timing and thresholds +// This is a subset of the corev1.Probe type, with only the fields that we want to expose as configuration. +type ProbeConfig struct { + // InitialDelaySeconds is the number of seconds after the container has started before startup probes are initiated. + // +kubebuilder:default:=0 + // +optional + InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"` + + // TimeoutSeconds is the number of seconds after which the probe times out. + // +kubebuilder:default:=10 + // +optional + TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"` + + // PeriodSeconds is how often (in seconds) to perform the probe. + // +kubebuilder:default:=10 + // +optional + PeriodSeconds int32 `json:"periodSeconds,omitempty"` + + // SuccessThreshold is the minimum consecutive successes for the probe to be considered successful. + // +kubebuilder:default:=1 + // +optional + SuccessThreshold int32 `json:"successThreshold,omitempty"` + + // FailureThreshold is the minimum consecutive failures for the probe to be considered failed. + // +kubebuilder:default:=10 + // +optional + FailureThreshold int32 `json:"failureThreshold,omitempty"` +} + // InstanceSidecarConfiguration defines the configuration for the sidecar that runs in the instance pods. type InstanceSidecarConfiguration struct { // The environment to be explicitly passed to the sidecar @@ -37,6 +66,10 @@ type InstanceSidecarConfiguration struct { // Resources define cpu/memory requests and limits for the sidecar that runs in the instance pods. // +optional Resources corev1.ResourceRequirements `json:"resources,omitempty"` + + // StartupProbe defines the configuration for the startup probe of the sidecar container. + // +optional + StartupProbe *ProbeConfig `json:"startupProbe,omitempty"` } // ObjectStoreSpec defines the desired state of ObjectStore. diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 1f92d88d..031dcbbc 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -36,6 +36,11 @@ func (in *InstanceSidecarConfiguration) DeepCopyInto(out *InstanceSidecarConfigu } } in.Resources.DeepCopyInto(&out.Resources) + if in.StartupProbe != nil { + in, out := &in.StartupProbe, &out.StartupProbe + *out = new(ProbeConfig) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSidecarConfiguration. @@ -146,6 +151,21 @@ func (in *ObjectStoreStatus) DeepCopy() *ObjectStoreStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProbeConfig) DeepCopyInto(out *ProbeConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProbeConfig. +func (in *ProbeConfig) DeepCopy() *ProbeConfig { + if in == nil { + return nil + } + out := new(ProbeConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RecoveryWindow) DeepCopyInto(out *RecoveryWindow) { *out = *in diff --git a/config/crd/bases/barmancloud.cnpg.io_objectstores.yaml b/config/crd/bases/barmancloud.cnpg.io_objectstores.yaml index be1348d1..c4a9c1f8 100644 --- a/config/crd/bases/barmancloud.cnpg.io_objectstores.yaml +++ b/config/crd/bases/barmancloud.cnpg.io_objectstores.yaml @@ -577,6 +577,42 @@ spec: The retentionCheckInterval defines the frequency at which the system checks and enforces retention policies. type: integer + startupProbe: + description: StartupProbe defines the configuration for the startup + probe of the sidecar container. + properties: + failureThreshold: + default: 10 + description: FailureThreshold is the minimum consecutive failures + for the probe to be considered failed. + format: int32 + type: integer + initialDelaySeconds: + default: 0 + description: InitialDelaySeconds is the number of seconds + after the container has started before startup probes are + initiated. + format: int32 + type: integer + periodSeconds: + default: 10 + description: PeriodSeconds is how often (in seconds) to perform + the probe. + format: int32 + type: integer + successThreshold: + default: 1 + description: SuccessThreshold is the minimum consecutive successes + for the probe to be considered successful. + format: int32 + type: integer + timeoutSeconds: + default: 10 + description: TimeoutSeconds is the number of seconds after + which the probe times out. + format: int32 + type: integer + type: object type: object retentionPolicy: description: |- diff --git a/hack/examples/minio-store.yaml b/hack/examples/minio-store.yaml index de47ea7a..b36fb240 100644 --- a/hack/examples/minio-store.yaml +++ b/hack/examples/minio-store.yaml @@ -13,6 +13,12 @@ spec: limits: memory: "512Mi" cpu: "500m" + startupProbe: + initialDelaySeconds: 1 + timeoutSeconds: 10 + periodSeconds: 1 + failureThreshold: 10 + successThreshold: 1 configuration: endpointCA: name: minio-server-tls diff --git a/internal/cnpgi/operator/config/config.go b/internal/cnpgi/operator/config/config.go index 53a8e67e..f040aee9 100644 --- a/internal/cnpgi/operator/config/config.go +++ b/internal/cnpgi/operator/config/config.go @@ -1,7 +1,6 @@ package config import ( - "strconv" "strings" cnpgv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1" @@ -58,29 +57,6 @@ type PluginConfiguration struct { ReplicaSourceBarmanObjectName string ReplicaSourceServerName string - - // Probe configuration - StartupProbeConfig *ProbeConfig -} - -// ProbeConfig holds configuration for Kubernetes probes -type ProbeConfig struct { - InitialDelaySeconds int32 - TimeoutSeconds int32 - PeriodSeconds int32 - FailureThreshold int32 - SuccessThreshold int32 -} - -// DefaultProbeConfig returns the default probe configuration -func DefaultProbeConfig() *ProbeConfig { - return &ProbeConfig{ - InitialDelaySeconds: 0, - TimeoutSeconds: 10, - PeriodSeconds: 10, - FailureThreshold: 10, - SuccessThreshold: 1, - } } // GetBarmanObjectKey gets the namespaced name of the barman object @@ -190,50 +166,11 @@ func NewFromCluster(cluster *cnpgv1.Cluster) *PluginConfiguration { // used for wal_restore in the designed primary of a replica cluster ReplicaSourceServerName: replicaSourceServerName, ReplicaSourceBarmanObjectName: replicaSourceBarmanObjectName, - // probe configuration - StartupProbeConfig: parseProbeConfig(helper.Parameters), } return result } -// parseProbeConfig parses probe configuration from plugin parameters -func parseProbeConfig(parameters map[string]string) *ProbeConfig { - config := DefaultProbeConfig() - - if val, ok := parameters["startupProbe.initialDelaySeconds"]; ok { - if parsed, err := strconv.ParseInt(val, 10, 32); err == nil { - config.InitialDelaySeconds = int32(parsed) - } - } - - if val, ok := parameters["startupProbe.timeoutSeconds"]; ok { - if parsed, err := strconv.ParseInt(val, 10, 32); err == nil { - config.TimeoutSeconds = int32(parsed) - } - } - - if val, ok := parameters["startupProbe.periodSeconds"]; ok { - if parsed, err := strconv.ParseInt(val, 10, 32); err == nil { - config.PeriodSeconds = int32(parsed) - } - } - - if val, ok := parameters["startupProbe.failureThreshold"]; ok { - if parsed, err := strconv.ParseInt(val, 10, 32); err == nil { - config.FailureThreshold = int32(parsed) - } - } - - if val, ok := parameters["startupProbe.successThreshold"]; ok { - if parsed, err := strconv.ParseInt(val, 10, 32); err == nil { - config.SuccessThreshold = int32(parsed) - } - } - - return config -} - func getRecoveryParameters(cluster *cnpgv1.Cluster) map[string]string { recoveryPluginConfiguration := getRecoverySourcePlugin(cluster) if recoveryPluginConfiguration == nil { diff --git a/internal/cnpgi/operator/lifecycle.go b/internal/cnpgi/operator/lifecycle.go index 143d746d..3e5299be 100644 --- a/internal/cnpgi/operator/lifecycle.go +++ b/internal/cnpgi/operator/lifecycle.go @@ -17,6 +17,7 @@ import ( "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" + barmancloudv1 "github.com/cloudnative-pg/plugin-barman-cloud/api/v1" "github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/metadata" "github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/operator/config" ) @@ -125,11 +126,16 @@ func (impl LifecycleImplementation) reconcileJob( return nil, err } + startupProbe, err := impl.collectSidecarStartupProbeForRecoveryJob(ctx, pluginConfiguration) + if err != nil { + return nil, err + } + return reconcileJob(ctx, cluster, request, sidecarConfiguration{ env: env, certificates: certificates, resources: resources, - probeConfig: pluginConfiguration.StartupProbeConfig, + startupProbe: startupProbe, }) } @@ -137,7 +143,7 @@ type sidecarConfiguration struct { env []corev1.EnvVar certificates []corev1.VolumeProjection resources corev1.ResourceRequirements - probeConfig *config.ProbeConfig + startupProbe *barmancloudv1.ProbeConfig } func reconcileJob( @@ -219,11 +225,16 @@ func (impl LifecycleImplementation) reconcilePod( return nil, err } + startupProbe, err := impl.collectSidecarStartupProbeForInstancePod(ctx, pluginConfiguration) + if err != nil { + return nil, err + } + return reconcilePod(ctx, cluster, request, pluginConfiguration, sidecarConfiguration{ env: env, certificates: certificates, resources: resources, - probeConfig: pluginConfiguration.StartupProbeConfig, + startupProbe: startupProbe, }) } @@ -315,12 +326,13 @@ func reconcilePodSpec( } // Apply configurable probe settings if available - if config.probeConfig != nil { - baseProbe.InitialDelaySeconds = config.probeConfig.InitialDelaySeconds - baseProbe.TimeoutSeconds = config.probeConfig.TimeoutSeconds - baseProbe.PeriodSeconds = config.probeConfig.PeriodSeconds - baseProbe.FailureThreshold = config.probeConfig.FailureThreshold - baseProbe.SuccessThreshold = config.probeConfig.SuccessThreshold + if config.startupProbe != nil { + // Copy timing and threshold settings from user configuration + baseProbe.InitialDelaySeconds = config.startupProbe.InitialDelaySeconds + baseProbe.TimeoutSeconds = config.startupProbe.TimeoutSeconds + baseProbe.PeriodSeconds = config.startupProbe.PeriodSeconds + baseProbe.FailureThreshold = config.startupProbe.FailureThreshold + baseProbe.SuccessThreshold = config.startupProbe.SuccessThreshold } else { // Fallback to default values baseProbe.FailureThreshold = 10 diff --git a/internal/cnpgi/operator/lifecycle_probes.go b/internal/cnpgi/operator/lifecycle_probes.go new file mode 100644 index 00000000..4bee0df9 --- /dev/null +++ b/internal/cnpgi/operator/lifecycle_probes.go @@ -0,0 +1,59 @@ +package operator + +import ( + "context" + + barmancloudv1 "github.com/cloudnative-pg/plugin-barman-cloud/api/v1" + "github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/operator/config" +) + +func (impl LifecycleImplementation) collectSidecarStartupProbeForRecoveryJob( + ctx context.Context, + configuration *config.PluginConfiguration, +) (*barmancloudv1.ProbeConfig, error) { + if len(configuration.RecoveryBarmanObjectName) > 0 { + var barmanObjectStore barmancloudv1.ObjectStore + if err := impl.Client.Get(ctx, configuration.GetRecoveryBarmanObjectKey(), &barmanObjectStore); err != nil { + return nil, err + } + + return barmanObjectStore.Spec.InstanceSidecarConfiguration.StartupProbe, nil + } + + return nil, nil +} + +func (impl LifecycleImplementation) collectSidecarStartupProbeForInstancePod( + ctx context.Context, + configuration *config.PluginConfiguration, +) (*barmancloudv1.ProbeConfig, error) { + if len(configuration.BarmanObjectName) > 0 { + // On a replica cluster that also archives, the designated primary + // will use both the replica source object store and the object store + // of the cluster. + // In this case, we use the cluster object store for configuring + // the startup probe of the sidecar container. + + var barmanObjectStore barmancloudv1.ObjectStore + if err := impl.Client.Get(ctx, configuration.GetBarmanObjectKey(), &barmanObjectStore); err != nil { + return nil, err + } + + return barmanObjectStore.Spec.InstanceSidecarConfiguration.StartupProbe, nil + } + + if len(configuration.RecoveryBarmanObjectName) > 0 { + // On a replica cluster that doesn't archive, the designated primary + // uses only the replica source object store. + // In this case, we use the replica source object store for configuring + // the startup probe of the sidecar container. + var barmanObjectStore barmancloudv1.ObjectStore + if err := impl.Client.Get(ctx, configuration.GetRecoveryBarmanObjectKey(), &barmanObjectStore); err != nil { + return nil, err + } + + return barmanObjectStore.Spec.InstanceSidecarConfiguration.StartupProbe, nil + } + + return nil, nil +} diff --git a/internal/cnpgi/operator/lifecycle_test.go b/internal/cnpgi/operator/lifecycle_test.go index 24139b7c..36532010 100644 --- a/internal/cnpgi/operator/lifecycle_test.go +++ b/internal/cnpgi/operator/lifecycle_test.go @@ -10,6 +10,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + barmancloudv1 "github.com/cloudnative-pg/plugin-barman-cloud/api/v1" "github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/operator/config" . "github.com/onsi/ginkgo/v2" @@ -173,8 +174,8 @@ var _ = Describe("LifecycleImplementation", func() { Describe("reconcilePod", func() { It("returns a patch for a valid pod with probe configuration", func(ctx SpecContext) { - // Configure plugin with custom probe settings - pluginConfiguration.StartupProbeConfig = &config.ProbeConfig{ + // Configure sidecar with custom probe settings + startupProbeConfig := &barmancloudv1.ProbeConfig{ InitialDelaySeconds: 1, TimeoutSeconds: 15, PeriodSeconds: 2, @@ -204,7 +205,7 @@ var _ = Describe("LifecycleImplementation", func() { } response, err := reconcilePod(ctx, cluster, request, pluginConfiguration, sidecarConfiguration{ - probeConfig: pluginConfiguration.StartupProbeConfig, + startupProbe: startupProbeConfig, }) Expect(err).NotTo(HaveOccurred()) Expect(response).NotTo(BeNil()) From ce7d8e9fbe787ddf83d5377e155cde3629914d35 Mon Sep 17 00:00:00 2001 From: Tudor Golubenco Date: Sun, 14 Sep 2025 10:22:33 -0700 Subject: [PATCH 4/4] Make also the liveness and readyness probes configurable Signed-off-by: Tudor Golubenco --- api/v1/objectstore_types.go | 8 ++ api/v1/zz_generated.deepcopy.go | 10 ++ .../barmancloud.cnpg.io_objectstores.yaml | 74 ++++++++++- hack/examples/minio-store.yaml | 12 ++ internal/cnpgi/operator/lifecycle.go | 120 ++++++++++++++---- internal/cnpgi/operator/lifecycle_probes.go | 78 +++++++++++- internal/cnpgi/operator/lifecycle_test.go | 66 ++++++++++ manifest.yaml | 108 ++++++++++++++++ 8 files changed, 442 insertions(+), 34 deletions(-) diff --git a/api/v1/objectstore_types.go b/api/v1/objectstore_types.go index 171eb611..e89e7c1e 100644 --- a/api/v1/objectstore_types.go +++ b/api/v1/objectstore_types.go @@ -70,6 +70,14 @@ type InstanceSidecarConfiguration struct { // StartupProbe defines the configuration for the startup probe of the sidecar container. // +optional StartupProbe *ProbeConfig `json:"startupProbe,omitempty"` + + // LivenessProbe defines the configuration for the liveness probe of the sidecar container. + // +optional + LivenessProbe *ProbeConfig `json:"livenessProbe,omitempty"` + + // ReadinessProbe defines the configuration for the readiness probe of the sidecar container. + // +optional + ReadinessProbe *ProbeConfig `json:"readinessProbe,omitempty"` } // ObjectStoreSpec defines the desired state of ObjectStore. diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 031dcbbc..56ace98f 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -41,6 +41,16 @@ func (in *InstanceSidecarConfiguration) DeepCopyInto(out *InstanceSidecarConfigu *out = new(ProbeConfig) **out = **in } + if in.LivenessProbe != nil { + in, out := &in.LivenessProbe, &out.LivenessProbe + *out = new(ProbeConfig) + **out = **in + } + if in.ReadinessProbe != nil { + in, out := &in.ReadinessProbe, &out.ReadinessProbe + *out = new(ProbeConfig) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSidecarConfiguration. diff --git a/config/crd/bases/barmancloud.cnpg.io_objectstores.yaml b/config/crd/bases/barmancloud.cnpg.io_objectstores.yaml index c4a9c1f8..ad76f2c6 100644 --- a/config/crd/bases/barmancloud.cnpg.io_objectstores.yaml +++ b/config/crd/bases/barmancloud.cnpg.io_objectstores.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.18.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: objectstores.barmancloud.cnpg.io spec: group: barmancloud.cnpg.io @@ -511,6 +511,78 @@ spec: - name type: object type: array + livenessProbe: + description: LivenessProbe defines the configuration for the liveness + probe of the sidecar container. + properties: + failureThreshold: + default: 10 + description: FailureThreshold is the minimum consecutive failures + for the probe to be considered failed. + format: int32 + type: integer + initialDelaySeconds: + default: 0 + description: InitialDelaySeconds is the number of seconds + after the container has started before startup probes are + initiated. + format: int32 + type: integer + periodSeconds: + default: 10 + description: PeriodSeconds is how often (in seconds) to perform + the probe. + format: int32 + type: integer + successThreshold: + default: 1 + description: SuccessThreshold is the minimum consecutive successes + for the probe to be considered successful. + format: int32 + type: integer + timeoutSeconds: + default: 10 + description: TimeoutSeconds is the number of seconds after + which the probe times out. + format: int32 + type: integer + type: object + readinessProbe: + description: ReadinessProbe defines the configuration for the + readiness probe of the sidecar container. + properties: + failureThreshold: + default: 10 + description: FailureThreshold is the minimum consecutive failures + for the probe to be considered failed. + format: int32 + type: integer + initialDelaySeconds: + default: 0 + description: InitialDelaySeconds is the number of seconds + after the container has started before startup probes are + initiated. + format: int32 + type: integer + periodSeconds: + default: 10 + description: PeriodSeconds is how often (in seconds) to perform + the probe. + format: int32 + type: integer + successThreshold: + default: 1 + description: SuccessThreshold is the minimum consecutive successes + for the probe to be considered successful. + format: int32 + type: integer + timeoutSeconds: + default: 10 + description: TimeoutSeconds is the number of seconds after + which the probe times out. + format: int32 + type: integer + type: object resources: description: Resources define cpu/memory requests and limits for the sidecar that runs in the instance pods. diff --git a/hack/examples/minio-store.yaml b/hack/examples/minio-store.yaml index b36fb240..40943c12 100644 --- a/hack/examples/minio-store.yaml +++ b/hack/examples/minio-store.yaml @@ -19,6 +19,18 @@ spec: periodSeconds: 1 failureThreshold: 10 successThreshold: 1 + livenessProbe: + initialDelaySeconds: 30 + timeoutSeconds: 5 + periodSeconds: 10 + failureThreshold: 3 + successThreshold: 1 + readinessProbe: + initialDelaySeconds: 5 + timeoutSeconds: 5 + periodSeconds: 5 + failureThreshold: 3 + successThreshold: 1 configuration: endpointCA: name: minio-server-tls diff --git a/internal/cnpgi/operator/lifecycle.go b/internal/cnpgi/operator/lifecycle.go index 3e5299be..cd4b0dda 100644 --- a/internal/cnpgi/operator/lifecycle.go +++ b/internal/cnpgi/operator/lifecycle.go @@ -131,19 +131,33 @@ func (impl LifecycleImplementation) reconcileJob( return nil, err } + livenessProbe, err := impl.collectSidecarLivenessProbeForRecoveryJob(ctx, pluginConfiguration) + if err != nil { + return nil, err + } + + readinessProbe, err := impl.collectSidecarReadinessProbeForRecoveryJob(ctx, pluginConfiguration) + if err != nil { + return nil, err + } + return reconcileJob(ctx, cluster, request, sidecarConfiguration{ - env: env, - certificates: certificates, - resources: resources, - startupProbe: startupProbe, + env: env, + certificates: certificates, + resources: resources, + startupProbe: startupProbe, + livenessProbe: livenessProbe, + readinessProbe: readinessProbe, }) } type sidecarConfiguration struct { - env []corev1.EnvVar - certificates []corev1.VolumeProjection - resources corev1.ResourceRequirements - startupProbe *barmancloudv1.ProbeConfig + env []corev1.EnvVar + certificates []corev1.VolumeProjection + resources corev1.ResourceRequirements + startupProbe *barmancloudv1.ProbeConfig + livenessProbe *barmancloudv1.ProbeConfig + readinessProbe *barmancloudv1.ProbeConfig } func reconcileJob( @@ -230,11 +244,23 @@ func (impl LifecycleImplementation) reconcilePod( return nil, err } + livenessProbe, err := impl.collectSidecarLivenessProbeForInstancePod(ctx, pluginConfiguration) + if err != nil { + return nil, err + } + + readinessProbe, err := impl.collectSidecarReadinessProbeForInstancePod(ctx, pluginConfiguration) + if err != nil { + return nil, err + } + return reconcilePod(ctx, cluster, request, pluginConfiguration, sidecarConfiguration{ - env: env, - certificates: certificates, - resources: resources, - startupProbe: startupProbe, + env: env, + certificates: certificates, + resources: resources, + startupProbe: startupProbe, + livenessProbe: livenessProbe, + readinessProbe: readinessProbe, }) } @@ -325,25 +351,37 @@ func reconcilePodSpec( }, } - // Apply configurable probe settings if available - if config.startupProbe != nil { - // Copy timing and threshold settings from user configuration - baseProbe.InitialDelaySeconds = config.startupProbe.InitialDelaySeconds - baseProbe.TimeoutSeconds = config.startupProbe.TimeoutSeconds - baseProbe.PeriodSeconds = config.startupProbe.PeriodSeconds - baseProbe.FailureThreshold = config.startupProbe.FailureThreshold - baseProbe.SuccessThreshold = config.startupProbe.SuccessThreshold - } else { - // Fallback to default values - baseProbe.FailureThreshold = 10 - baseProbe.TimeoutSeconds = 10 - } + startupProbe := createProbe(baseProbe, config.startupProbe, &barmancloudv1.ProbeConfig{ + FailureThreshold: 10, + TimeoutSeconds: 10, + InitialDelaySeconds: 0, + SuccessThreshold: 1, + PeriodSeconds: 10, + }) + + livenessProbe := createProbe(baseProbe, config.livenessProbe, &barmancloudv1.ProbeConfig{ + FailureThreshold: 3, + TimeoutSeconds: 10, + InitialDelaySeconds: 0, + SuccessThreshold: 1, + PeriodSeconds: 10, + }) + + readinessProbe := createProbe(baseProbe, config.readinessProbe, &barmancloudv1.ProbeConfig{ + FailureThreshold: 3, + TimeoutSeconds: 10, + InitialDelaySeconds: 0, + SuccessThreshold: 1, + PeriodSeconds: 10, + }) // fixed values sidecarTemplate.Name = "plugin-barman-cloud" sidecarTemplate.Image = viper.GetString("sidecar-image") sidecarTemplate.ImagePullPolicy = cluster.Spec.ImagePullPolicy - sidecarTemplate.StartupProbe = baseProbe.DeepCopy() + sidecarTemplate.StartupProbe = startupProbe + sidecarTemplate.LivenessProbe = livenessProbe + sidecarTemplate.ReadinessProbe = readinessProbe sidecarTemplate.SecurityContext = &corev1.SecurityContext{ AllowPrivilegeEscalation: ptr.To(false), RunAsNonRoot: ptr.To(true), @@ -567,3 +605,33 @@ func getCNPGJobRole(job *batchv1.Job) string { return "" } + +// createProbe creates a probe using the base probe's handler and applies configuration or default values +func createProbe(baseProbe *corev1.Probe, config *barmancloudv1.ProbeConfig, defaults *barmancloudv1.ProbeConfig) *corev1.Probe { + probe := baseProbe.DeepCopy() + probe.FailureThreshold = defaults.FailureThreshold + probe.TimeoutSeconds = defaults.TimeoutSeconds + probe.InitialDelaySeconds = defaults.InitialDelaySeconds + probe.SuccessThreshold = defaults.SuccessThreshold + probe.PeriodSeconds = defaults.PeriodSeconds + + if config != nil { + if config.InitialDelaySeconds != 0 { + probe.InitialDelaySeconds = config.InitialDelaySeconds + } + if config.TimeoutSeconds != 0 { + probe.TimeoutSeconds = config.TimeoutSeconds + } + if config.PeriodSeconds != 0 { + probe.PeriodSeconds = config.PeriodSeconds + } + if config.SuccessThreshold != 0 { + probe.SuccessThreshold = config.SuccessThreshold + } + if config.FailureThreshold != 0 { + probe.FailureThreshold = config.FailureThreshold + } + } + + return probe +} diff --git a/internal/cnpgi/operator/lifecycle_probes.go b/internal/cnpgi/operator/lifecycle_probes.go index 4bee0df9..fc4c345f 100644 --- a/internal/cnpgi/operator/lifecycle_probes.go +++ b/internal/cnpgi/operator/lifecycle_probes.go @@ -7,9 +7,14 @@ import ( "github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/operator/config" ) -func (impl LifecycleImplementation) collectSidecarStartupProbeForRecoveryJob( +// probeAccessor is a function type that extracts a specific probe configuration from an ObjectStore +type probeAccessor func(*barmancloudv1.ObjectStore) *barmancloudv1.ProbeConfig + +// collectSidecarProbeForRecoveryJob is a generic function to collect probe configurations for recovery jobs +func (impl LifecycleImplementation) collectSidecarProbeForRecoveryJob( ctx context.Context, configuration *config.PluginConfiguration, + accessor probeAccessor, ) (*barmancloudv1.ProbeConfig, error) { if len(configuration.RecoveryBarmanObjectName) > 0 { var barmanObjectStore barmancloudv1.ObjectStore @@ -17,43 +22,102 @@ func (impl LifecycleImplementation) collectSidecarStartupProbeForRecoveryJob( return nil, err } - return barmanObjectStore.Spec.InstanceSidecarConfiguration.StartupProbe, nil + return accessor(&barmanObjectStore), nil } return nil, nil } -func (impl LifecycleImplementation) collectSidecarStartupProbeForInstancePod( +// collectSidecarProbeForInstancePod is a generic function to collect probe configurations for instance pods +func (impl LifecycleImplementation) collectSidecarProbeForInstancePod( ctx context.Context, configuration *config.PluginConfiguration, + accessor probeAccessor, + probeType string, ) (*barmancloudv1.ProbeConfig, error) { if len(configuration.BarmanObjectName) > 0 { // On a replica cluster that also archives, the designated primary // will use both the replica source object store and the object store // of the cluster. // In this case, we use the cluster object store for configuring - // the startup probe of the sidecar container. + // the probe of the sidecar container. var barmanObjectStore barmancloudv1.ObjectStore if err := impl.Client.Get(ctx, configuration.GetBarmanObjectKey(), &barmanObjectStore); err != nil { return nil, err } - return barmanObjectStore.Spec.InstanceSidecarConfiguration.StartupProbe, nil + return accessor(&barmanObjectStore), nil } if len(configuration.RecoveryBarmanObjectName) > 0 { // On a replica cluster that doesn't archive, the designated primary // uses only the replica source object store. // In this case, we use the replica source object store for configuring - // the startup probe of the sidecar container. + // the probe of the sidecar container. var barmanObjectStore barmancloudv1.ObjectStore if err := impl.Client.Get(ctx, configuration.GetRecoveryBarmanObjectKey(), &barmanObjectStore); err != nil { return nil, err } - return barmanObjectStore.Spec.InstanceSidecarConfiguration.StartupProbe, nil + return accessor(&barmanObjectStore), nil } return nil, nil } + +// Specific probe collection methods that use the generic functions + +func (impl LifecycleImplementation) collectSidecarStartupProbeForRecoveryJob( + ctx context.Context, + configuration *config.PluginConfiguration, +) (*barmancloudv1.ProbeConfig, error) { + return impl.collectSidecarProbeForRecoveryJob(ctx, configuration, func(store *barmancloudv1.ObjectStore) *barmancloudv1.ProbeConfig { + return store.Spec.InstanceSidecarConfiguration.StartupProbe + }) +} + +func (impl LifecycleImplementation) collectSidecarStartupProbeForInstancePod( + ctx context.Context, + configuration *config.PluginConfiguration, +) (*barmancloudv1.ProbeConfig, error) { + return impl.collectSidecarProbeForInstancePod(ctx, configuration, func(store *barmancloudv1.ObjectStore) *barmancloudv1.ProbeConfig { + return store.Spec.InstanceSidecarConfiguration.StartupProbe + }, "startup") +} + +func (impl LifecycleImplementation) collectSidecarLivenessProbeForRecoveryJob( + ctx context.Context, + configuration *config.PluginConfiguration, +) (*barmancloudv1.ProbeConfig, error) { + return impl.collectSidecarProbeForRecoveryJob(ctx, configuration, func(store *barmancloudv1.ObjectStore) *barmancloudv1.ProbeConfig { + return store.Spec.InstanceSidecarConfiguration.LivenessProbe + }) +} + +func (impl LifecycleImplementation) collectSidecarLivenessProbeForInstancePod( + ctx context.Context, + configuration *config.PluginConfiguration, +) (*barmancloudv1.ProbeConfig, error) { + return impl.collectSidecarProbeForInstancePod(ctx, configuration, func(store *barmancloudv1.ObjectStore) *barmancloudv1.ProbeConfig { + return store.Spec.InstanceSidecarConfiguration.LivenessProbe + }, "liveness") +} + +func (impl LifecycleImplementation) collectSidecarReadinessProbeForRecoveryJob( + ctx context.Context, + configuration *config.PluginConfiguration, +) (*barmancloudv1.ProbeConfig, error) { + return impl.collectSidecarProbeForRecoveryJob(ctx, configuration, func(store *barmancloudv1.ObjectStore) *barmancloudv1.ProbeConfig { + return store.Spec.InstanceSidecarConfiguration.ReadinessProbe + }) +} + +func (impl LifecycleImplementation) collectSidecarReadinessProbeForInstancePod( + ctx context.Context, + configuration *config.PluginConfiguration, +) (*barmancloudv1.ProbeConfig, error) { + return impl.collectSidecarProbeForInstancePod(ctx, configuration, func(store *barmancloudv1.ObjectStore) *barmancloudv1.ProbeConfig { + return store.Spec.InstanceSidecarConfiguration.ReadinessProbe + }, "readiness") +} diff --git a/internal/cnpgi/operator/lifecycle_test.go b/internal/cnpgi/operator/lifecycle_test.go index 36532010..f7b6dcdd 100644 --- a/internal/cnpgi/operator/lifecycle_test.go +++ b/internal/cnpgi/operator/lifecycle_test.go @@ -220,6 +220,72 @@ var _ = Describe("LifecycleImplementation", func() { Expect(string(response.JsonPatch)).To(ContainSubstring("\"successThreshold\":1")) }) + It("decouples probe configurations - startupProbe doesn't affect other probes", func(ctx SpecContext) { + // Configure only startupProbe with custom settings + startupProbeConfig := &barmancloudv1.ProbeConfig{ + InitialDelaySeconds: 5, + TimeoutSeconds: 20, + PeriodSeconds: 3, + FailureThreshold: 8, + SuccessThreshold: 2, + } + + pod := &corev1.Pod{ + TypeMeta: podTypeMeta, + ObjectMeta: metav1.ObjectMeta{ + Name: "test-pod", + }, + Spec: corev1.PodSpec{ + Containers: []corev1.Container{ + { + Name: "postgres", + }, + }, + }, + } + + podJSON, err := json.Marshal(pod) + Expect(err).NotTo(HaveOccurred()) + + request := &lifecycle.OperatorLifecycleRequest{ + ObjectDefinition: podJSON, + } + + response, err := reconcilePod(ctx, cluster, request, pluginConfiguration, sidecarConfiguration{ + startupProbe: startupProbeConfig, + // livenessProbe and readinessProbe are nil - should use defaults + }) + Expect(err).NotTo(HaveOccurred()) + Expect(response).NotTo(BeNil()) + Expect(response.JsonPatch).NotTo(BeEmpty()) + + patchStr := string(response.JsonPatch) + + // Verify startupProbe has custom settings + Expect(patchStr).To(ContainSubstring("startupProbe")) + Expect(patchStr).To(ContainSubstring("\"initialDelaySeconds\":5")) + Expect(patchStr).To(ContainSubstring("\"timeoutSeconds\":20")) + Expect(patchStr).To(ContainSubstring("\"periodSeconds\":3")) + Expect(patchStr).To(ContainSubstring("\"failureThreshold\":8")) + Expect(patchStr).To(ContainSubstring("\"successThreshold\":2")) + + // Verify livenessProbe has default settings (not affected by startupProbe) + Expect(patchStr).To(ContainSubstring("livenessProbe")) + Expect(patchStr).To(ContainSubstring("\"failureThreshold\":3")) // default for liveness + Expect(patchStr).To(ContainSubstring("\"timeoutSeconds\":10")) // default for liveness + // initialDelaySeconds: 0 is omitted from JSON when it's the zero value + + // Verify readinessProbe has default settings (not affected by startupProbe) + Expect(patchStr).To(ContainSubstring("readinessProbe")) + Expect(patchStr).To(ContainSubstring("\"failureThreshold\":3")) // default for readiness + Expect(patchStr).To(ContainSubstring("\"timeoutSeconds\":10")) // default for readiness + // initialDelaySeconds: 0 is omitted from JSON when it's the zero value + + // Verify that livenessProbe and readinessProbe don't have startupProbe values + Expect(patchStr).NotTo(MatchRegexp(`"livenessProbe"[^}]*"initialDelaySeconds":5`)) + Expect(patchStr).NotTo(MatchRegexp(`"readinessProbe"[^}]*"initialDelaySeconds":5`)) + }) + It("returns a patch for a valid pod", func(ctx SpecContext) { pod := &corev1.Pod{ TypeMeta: podTypeMeta, diff --git a/manifest.yaml b/manifest.yaml index 7248ce9a..84ed5bc5 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -510,6 +510,78 @@ spec: - name type: object type: array + livenessProbe: + description: LivenessProbe defines the configuration for the liveness + probe of the sidecar container. + properties: + failureThreshold: + default: 10 + description: FailureThreshold is the minimum consecutive failures + for the probe to be considered failed. + format: int32 + type: integer + initialDelaySeconds: + default: 0 + description: InitialDelaySeconds is the number of seconds + after the container has started before startup probes are + initiated. + format: int32 + type: integer + periodSeconds: + default: 10 + description: PeriodSeconds is how often (in seconds) to perform + the probe. + format: int32 + type: integer + successThreshold: + default: 1 + description: SuccessThreshold is the minimum consecutive successes + for the probe to be considered successful. + format: int32 + type: integer + timeoutSeconds: + default: 10 + description: TimeoutSeconds is the number of seconds after + which the probe times out. + format: int32 + type: integer + type: object + readinessProbe: + description: ReadinessProbe defines the configuration for the + readiness probe of the sidecar container. + properties: + failureThreshold: + default: 10 + description: FailureThreshold is the minimum consecutive failures + for the probe to be considered failed. + format: int32 + type: integer + initialDelaySeconds: + default: 0 + description: InitialDelaySeconds is the number of seconds + after the container has started before startup probes are + initiated. + format: int32 + type: integer + periodSeconds: + default: 10 + description: PeriodSeconds is how often (in seconds) to perform + the probe. + format: int32 + type: integer + successThreshold: + default: 1 + description: SuccessThreshold is the minimum consecutive successes + for the probe to be considered successful. + format: int32 + type: integer + timeoutSeconds: + default: 10 + description: TimeoutSeconds is the number of seconds after + which the probe times out. + format: int32 + type: integer + type: object resources: description: Resources define cpu/memory requests and limits for the sidecar that runs in the instance pods. @@ -576,6 +648,42 @@ spec: The retentionCheckInterval defines the frequency at which the system checks and enforces retention policies. type: integer + startupProbe: + description: StartupProbe defines the configuration for the startup + probe of the sidecar container. + properties: + failureThreshold: + default: 10 + description: FailureThreshold is the minimum consecutive failures + for the probe to be considered failed. + format: int32 + type: integer + initialDelaySeconds: + default: 0 + description: InitialDelaySeconds is the number of seconds + after the container has started before startup probes are + initiated. + format: int32 + type: integer + periodSeconds: + default: 10 + description: PeriodSeconds is how often (in seconds) to perform + the probe. + format: int32 + type: integer + successThreshold: + default: 1 + description: SuccessThreshold is the minimum consecutive successes + for the probe to be considered successful. + format: int32 + type: integer + timeoutSeconds: + default: 10 + description: TimeoutSeconds is the number of seconds after + which the probe times out. + format: int32 + type: integer + type: object type: object retentionPolicy: description: |-