mirror of
https://github.com/YuzuZensai/netbird-kubernetes-operator.git
synced 2026-09-13 18:59:09 +00:00
Add health probe overrides to sidecar (#278)
Add support for overriding the health probes.
This is useful, for example, when injecting NetBird as a sidecar. In
that setup, the main container could start before NetBird has
established the VPN connection, resulting in failing to connect to
peers.
Example usage:
```yaml
apiVersion: netbird.io/v1alpha1
kind: SidecarProfile
metadata:
name: netbird-sidecar
labels:
spec:
injectionMode: Sidecar
setupKeyRef:
name: netbird-setup-key
containerOverride:
startupProbe:
exec:
command: ["netbird", "status", "--check", "startup"]
initialDelaySeconds: 10
failureThreshold: 10
periodSeconds: 5
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* SidecarProfile now supports overriding container health check probes
(startup, liveness, and readiness) for sidecar containers, enabling
fine-grained control over probe configurations.
* **Documentation**
* Updated API reference documentation with new probe override
configuration options.
<!-- review_stack_entry_start -->
[](https://app.coderabbit.ai/change-stack/netbirdio/kubernetes-operator/pull/278?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)
<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -15,6 +15,12 @@ type ContainerOverrideApplyConfiguration struct {
|
||||
Image *string `json:"image,omitempty"`
|
||||
Env []v1.EnvVar `json:"env,omitempty"`
|
||||
SecurityContext *v1.SecurityContext `json:"securityContext,omitempty"`
|
||||
// StartupProbe overrides the startup probe for the sidecar container.
|
||||
StartupProbe *v1.Probe `json:"startupProbe,omitempty"`
|
||||
// LivenessProbe overrides the liveness probe for the sidecar container.
|
||||
LivenessProbe *v1.Probe `json:"livenessProbe,omitempty"`
|
||||
// ReadinessProbe overrides the readiness probe for the sidecar container.
|
||||
ReadinessProbe *v1.Probe `json:"readinessProbe,omitempty"`
|
||||
}
|
||||
|
||||
// ContainerOverrideApplyConfiguration constructs a declarative configuration of the ContainerOverride type for use with
|
||||
@@ -48,3 +54,27 @@ func (b *ContainerOverrideApplyConfiguration) WithSecurityContext(value v1.Secur
|
||||
b.SecurityContext = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithStartupProbe sets the StartupProbe field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the StartupProbe field is set to the value of the last call.
|
||||
func (b *ContainerOverrideApplyConfiguration) WithStartupProbe(value v1.Probe) *ContainerOverrideApplyConfiguration {
|
||||
b.StartupProbe = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithLivenessProbe sets the LivenessProbe field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the LivenessProbe field is set to the value of the last call.
|
||||
func (b *ContainerOverrideApplyConfiguration) WithLivenessProbe(value v1.Probe) *ContainerOverrideApplyConfiguration {
|
||||
b.LivenessProbe = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithReadinessProbe sets the ReadinessProbe field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ReadinessProbe field is set to the value of the last call.
|
||||
func (b *ContainerOverrideApplyConfiguration) WithReadinessProbe(value v1.Probe) *ContainerOverrideApplyConfiguration {
|
||||
b.ReadinessProbe = &value
|
||||
return b
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user