mirror of
https://github.com/YuzuZensai/netbird-kubernetes-operator.git
synced 2026-09-13 10:49:15 +00:00
Add sidecar profile (#192)
This change adds a new SidecarProfile resource which allows configuring client sidecar injection into pods. It replaces the older annotation based solution. This removes any pod specific configuration from the setup key and puts it all in this side car configuration. Fixes #188 Signed-off-by: Philip Laine <philip.laine@gmail.com>
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
// Code generated by controller-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
apiv1alpha1 "github.com/netbirdio/kubernetes-operator/api/v1alpha1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
// SidecarProfileSpecApplyConfiguration represents a declarative configuration of the SidecarProfileSpec type for use
|
||||
// with apply.
|
||||
//
|
||||
// SidecarProfileSpec defines the desired state of SidecarProfile.
|
||||
type SidecarProfileSpecApplyConfiguration struct {
|
||||
// SetupKeyRef is the reference to the setup key used in the client.
|
||||
SetupKeyRef *v1.LocalObjectReference `json:"setupKeyRef,omitempty"`
|
||||
// PodSelector determines which pods the profile should apply to.
|
||||
// An empty slector means the profile will apply to all pods in the namespace.
|
||||
PodSelector *metav1.LabelSelectorApplyConfiguration `json:"podSelector,omitempty"`
|
||||
// InjectionMode defines whether the sidecar is injected as a native Kubernetes sidecar container or as a regular container.
|
||||
InjectionMode *apiv1alpha1.InjectionMode `json:"injectionMode,omitempty"`
|
||||
// ExtraDNSLabels assigns additional DNS names to peers beyond their default hostname.
|
||||
ExtraDNSLabels []string `json:"extraDNSLabels,omitempty"`
|
||||
ContainerOverride *ContainerOverrideApplyConfiguration `json:"containerOverride,omitempty"`
|
||||
}
|
||||
|
||||
// SidecarProfileSpecApplyConfiguration constructs a declarative configuration of the SidecarProfileSpec type for use with
|
||||
// apply.
|
||||
func SidecarProfileSpec() *SidecarProfileSpecApplyConfiguration {
|
||||
return &SidecarProfileSpecApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithSetupKeyRef sets the SetupKeyRef 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 SetupKeyRef field is set to the value of the last call.
|
||||
func (b *SidecarProfileSpecApplyConfiguration) WithSetupKeyRef(value v1.LocalObjectReference) *SidecarProfileSpecApplyConfiguration {
|
||||
b.SetupKeyRef = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithPodSelector sets the PodSelector 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 PodSelector field is set to the value of the last call.
|
||||
func (b *SidecarProfileSpecApplyConfiguration) WithPodSelector(value *metav1.LabelSelectorApplyConfiguration) *SidecarProfileSpecApplyConfiguration {
|
||||
b.PodSelector = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithInjectionMode sets the InjectionMode 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 InjectionMode field is set to the value of the last call.
|
||||
func (b *SidecarProfileSpecApplyConfiguration) WithInjectionMode(value apiv1alpha1.InjectionMode) *SidecarProfileSpecApplyConfiguration {
|
||||
b.InjectionMode = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithExtraDNSLabels adds the given value to the ExtraDNSLabels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the ExtraDNSLabels field.
|
||||
func (b *SidecarProfileSpecApplyConfiguration) WithExtraDNSLabels(values ...string) *SidecarProfileSpecApplyConfiguration {
|
||||
for i := range values {
|
||||
b.ExtraDNSLabels = append(b.ExtraDNSLabels, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithContainerOverride sets the ContainerOverride 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 ContainerOverride field is set to the value of the last call.
|
||||
func (b *SidecarProfileSpecApplyConfiguration) WithContainerOverride(value *ContainerOverrideApplyConfiguration) *SidecarProfileSpecApplyConfiguration {
|
||||
b.ContainerOverride = value
|
||||
return b
|
||||
}
|
||||
Reference in New Issue
Block a user