Documentation ¶
Index ¶
- Variables
- func AddEnvFromSourceFromToContainer(container *corev1.Container, envFromSource *corev1.EnvFromSource, ...) ([]corev1.EnvFromSource, error)
- func AddEnvVarToContainer(container *corev1.Container, envvar *corev1.EnvVar, ...) ([]corev1.EnvVar, error)
- func AddPortToContainer(container *corev1.Container, newPort *corev1.ContainerPort, ...) ([]corev1.ContainerPort, error)
- func AddVolumeMountToContainerWithMergeFunc(container *corev1.Container, volumeMount *corev1.VolumeMount, ...) ([]corev1.VolumeMount, error)
- func AddVolumeToPod(podSpec *corev1.PodSpec, volume *corev1.Volume, mergeFunc VolumeMergeFunction) ([]corev1.Volume, error)
- func AppendToValueEnvVarMergeFunction(current, newEnv *corev1.EnvVar) (*corev1.EnvVar, error)
- func DefaultEnvFromSourceFromMergeFunction(current, newEnv *corev1.EnvFromSource) (*corev1.EnvFromSource, error)
- func DefaultEnvVarMergeFunction(current, newEnv *corev1.EnvVar) (*corev1.EnvVar, error)
- func DefaultPortMergeFunction(current, newPort *corev1.ContainerPort) (*corev1.ContainerPort, error)
- func DefaultVolumeMergeFunction(current, newVolume *corev1.Volume) (*corev1.Volume, error)
- func DefaultVolumeMountMergeFunction(current, newVolumeMount *corev1.VolumeMount) (*corev1.VolumeMount, error)
- func ErrorOnMergeAttemptdEnvFromSourceFromMergeFunction(current, newEnv *corev1.EnvFromSource) (*corev1.EnvFromSource, error)
- func ErrorOnMergeAttemptdEnvVarMergeFunction(current, newEnv *corev1.EnvVar) (*corev1.EnvVar, error)
- func ErrorOnMergeAttemptdPortMergeFunction(current, newPort *corev1.ContainerPort) (*corev1.ContainerPort, error)
- func ErrorOnMergeAttemptdVolumeMergeFunction(current, newVolume *corev1.Volume) (*corev1.Volume, error)
- func ErrorOnMergeAttemptdVolumeMountMergeFunction(current, newVolumeMount *corev1.VolumeMount) (*corev1.VolumeMount, error)
- func IgnoreNewEnvFromSourceFromMergeFunction(current, newEnv *corev1.EnvFromSource) (*corev1.EnvFromSource, error)
- func IgnoreNewEnvVarMergeFunction(current, newEnv *corev1.EnvVar) (*corev1.EnvVar, error)
- func IgnoreNewPortMergeFunction(current, newPort *corev1.ContainerPort) (*corev1.ContainerPort, error)
- func IgnoreNewVolumeMergeFunction(current, newVolume *corev1.Volume) (*corev1.Volume, error)
- func IgnoreNewVolumeMountMergeFunction(current, newVolumeMount *corev1.VolumeMount) (*corev1.VolumeMount, error)
- func IsMergeAttemptedError(err error) bool
- func MergeConfigMapItemsVolumeMergeFunction(current, newVolume *corev1.Volume) (*corev1.Volume, error)
- func OverrideCurrentEnvFromSourceFromMergeFunction(current, newEnv *corev1.EnvFromSource) (*corev1.EnvFromSource, error)
- func OverrideCurrentEnvVarMergeFunction(current, newEnv *corev1.EnvVar) (*corev1.EnvVar, error)
- func OverrideCurrentPortMergeFunction(current, newPort *corev1.ContainerPort) (*corev1.ContainerPort, error)
- func OverrideCurrentVolumeMergeFunction(current, newVolume *corev1.Volume) (*corev1.Volume, error)
- func OverrideCurrentVolumeMountMergeFunction(current, newVolumeMount *corev1.VolumeMount) (*corev1.VolumeMount, error)
- func SortAndUnique(in []corev1.Capability) []corev1.Capability
- type APIServiceManager
- type AnnotationManager
- type CiliumPolicyManager
- type ConfigMapManager
- type EnvFromSourceFromMergeFunction
- type EnvVarManager
- type EnvVarMergeFunction
- type NetworkPolicyManager
- type PodSecurityManager
- type PortManager
- type PortMergeFunction
- type RBACManager
- type SecretManager
- type SecurityContextManager
- type ServiceManager
- type VolumeManager
- type VolumeMergeFunction
- type VolumeMountManager
- type VolumeMountMergeFunction
Constants ¶
This section is empty.
Variables ¶
var AllAgentContainers = map[commonv1.AgentContainerName]struct{}{ commonv1.CoreAgentContainerName: {}, commonv1.TraceAgentContainerName: {}, commonv1.ProcessAgentContainerName: {}, commonv1.SecurityAgentContainerName: {}, commonv1.SystemProbeContainerName: {}, commonv1.ClusterAgentContainerName: {}, commonv1.UnprivilegedSingleAgentContainerName: {}, }
AllAgentContainers is a map of all agent containers
Functions ¶
func AddEnvFromSourceFromToContainer ¶
func AddEnvFromSourceFromToContainer(container *corev1.Container, envFromSource *corev1.EnvFromSource, mergeFunc EnvFromSourceFromMergeFunction) ([]corev1.EnvFromSource, error)
AddEnvFromSourceFromToContainer use to add an EnvFromSource to container.
func AddEnvVarToContainer ¶
func AddEnvVarToContainer(container *corev1.Container, envvar *corev1.EnvVar, mergeFunc EnvVarMergeFunction) ([]corev1.EnvVar, error)
AddEnvVarToContainer used to add an EnvVar to a container
func AddPortToContainer ¶
func AddPortToContainer(container *corev1.Container, newPort *corev1.ContainerPort, mergeFunc PortMergeFunction) ([]corev1.ContainerPort, error)
AddPortToContainer used to add an Port to a container
func AddVolumeMountToContainerWithMergeFunc ¶
func AddVolumeMountToContainerWithMergeFunc(container *corev1.Container, volumeMount *corev1.VolumeMount, mergeFunc VolumeMountMergeFunction) ([]corev1.VolumeMount, error)
AddVolumeMountToContainerWithMergeFunc is used to add a corev1.VolumeMount to a container the mergeFunc can be provided to change the default merge behavior
func AddVolumeToPod ¶
func AddVolumeToPod(podSpec *corev1.PodSpec, volume *corev1.Volume, mergeFunc VolumeMergeFunction) ([]corev1.Volume, error)
AddVolumeToPod use to add a corev1.Volume to a Pod the mergeFunc can be provided to change the default merge behavior
func AppendToValueEnvVarMergeFunction ¶
AppendToValueEnvVarMergeFunction used when we add the new value to the existing corev1.EnvVar.
func DefaultEnvFromSourceFromMergeFunction ¶
func DefaultEnvFromSourceFromMergeFunction(current, newEnv *corev1.EnvFromSource) (*corev1.EnvFromSource, error)
DefaultEnvFromSourceFromMergeFunction default corev1.EnvFromSource merge function default correspond to OverrideCurrentEnvFromSourceMergeOption
func DefaultEnvVarMergeFunction ¶
DefaultEnvVarMergeFunction default corev1.EnvVar merge function default correspond to OverrideCurrentEnvVarMergeOption
func DefaultPortMergeFunction ¶
func DefaultPortMergeFunction(current, newPort *corev1.ContainerPort) (*corev1.ContainerPort, error)
DefaultPortMergeFunction default corev1.ContainerPort merge function default correspond to OverrideCurrentPortMergeFunction
func DefaultVolumeMergeFunction ¶
DefaultVolumeMergeFunction default corev1.Volume merge function default correspond to OverrideCurrentVolumeMergeOption
func DefaultVolumeMountMergeFunction ¶
func DefaultVolumeMountMergeFunction(current, newVolumeMount *corev1.VolumeMount) (*corev1.VolumeMount, error)
DefaultVolumeMountMergeFunction default corev1.VolumeMount merge function default correspond to OverrideCurrentVolumeMountMergeOption
func ErrorOnMergeAttemptdEnvFromSourceFromMergeFunction ¶
func ErrorOnMergeAttemptdEnvFromSourceFromMergeFunction(current, newEnv *corev1.EnvFromSource) (*corev1.EnvFromSource, error)
ErrorOnMergeAttemptdEnvFromSourceFromMergeFunction used to avoid replacing an existing corev1.EnvFromSource
func ErrorOnMergeAttemptdEnvVarMergeFunction ¶
func ErrorOnMergeAttemptdEnvVarMergeFunction(current, newEnv *corev1.EnvVar) (*corev1.EnvVar, error)
ErrorOnMergeAttemptdEnvVarMergeFunction used to avoid replacing an existing EnvVar
func ErrorOnMergeAttemptdPortMergeFunction ¶
func ErrorOnMergeAttemptdPortMergeFunction(current, newPort *corev1.ContainerPort) (*corev1.ContainerPort, error)
ErrorOnMergeAttemptdPortMergeFunction used to avoid replacing an existing ContainerPort
func ErrorOnMergeAttemptdVolumeMergeFunction ¶
func ErrorOnMergeAttemptdVolumeMergeFunction(current, newVolume *corev1.Volume) (*corev1.Volume, error)
ErrorOnMergeAttemptdVolumeMergeFunction used to avoid replacing an existing Volume
func ErrorOnMergeAttemptdVolumeMountMergeFunction ¶
func ErrorOnMergeAttemptdVolumeMountMergeFunction(current, newVolumeMount *corev1.VolumeMount) (*corev1.VolumeMount, error)
ErrorOnMergeAttemptdVolumeMountMergeFunction used to avoid replacing an existing VolumeMount
func IgnoreNewEnvFromSourceFromMergeFunction ¶
func IgnoreNewEnvFromSourceFromMergeFunction(current, newEnv *corev1.EnvFromSource) (*corev1.EnvFromSource, error)
IgnoreNewEnvFromSourceFromMergeFunction used when the existing corev1.EnvFromSource needs to be kept.
func IgnoreNewEnvVarMergeFunction ¶
IgnoreNewEnvVarMergeFunction used when the existing corev1.EnvVar needs to be kept.
func IgnoreNewPortMergeFunction ¶
func IgnoreNewPortMergeFunction(current, newPort *corev1.ContainerPort) (*corev1.ContainerPort, error)
IgnoreNewPortMergeFunction used when the existing corev1.ContainerPort needs to be kept.
func IgnoreNewVolumeMergeFunction ¶
IgnoreNewVolumeMergeFunction used when the existing corev1.Volume needs to be kept.
func IgnoreNewVolumeMountMergeFunction ¶
func IgnoreNewVolumeMountMergeFunction(current, newVolumeMount *corev1.VolumeMount) (*corev1.VolumeMount, error)
IgnoreNewVolumeMountMergeFunction used when the existing corev1.VolumeMount needs to be kept.
func IsMergeAttemptedError ¶
IsMergeAttemptedError returns true if the err is a MergeAttemptedError type
func MergeConfigMapItemsVolumeMergeFunction ¶
func MergeConfigMapItemsVolumeMergeFunction(current, newVolume *corev1.Volume) (*corev1.Volume, error)
MergeConfigMapItemsVolumeMergeFunction used when the existing corev1.Volume needs to be replace by the new one.
func OverrideCurrentEnvFromSourceFromMergeFunction ¶
func OverrideCurrentEnvFromSourceFromMergeFunction(current, newEnv *corev1.EnvFromSource) (*corev1.EnvFromSource, error)
OverrideCurrentEnvFromSourceFromMergeFunction used when the existing corev1.EnvFromSource new to be replace by the new one.
func OverrideCurrentEnvVarMergeFunction ¶
OverrideCurrentEnvVarMergeFunction used when the existing corev1.EnvVar new to be replace by the new one.
func OverrideCurrentPortMergeFunction ¶
func OverrideCurrentPortMergeFunction(current, newPort *corev1.ContainerPort) (*corev1.ContainerPort, error)
OverrideCurrentPortMergeFunction used when the existing corev1.ContainerPort new to be replace by the new one.
func OverrideCurrentVolumeMergeFunction ¶
OverrideCurrentVolumeMergeFunction used when the existing corev1.Volume new to be replace by the new one.
func OverrideCurrentVolumeMountMergeFunction ¶
func OverrideCurrentVolumeMountMergeFunction(current, newVolumeMount *corev1.VolumeMount) (*corev1.VolumeMount, error)
OverrideCurrentVolumeMountMergeFunction used when the existing corev1.VolumeMount new to be replace by the new one.
func SortAndUnique ¶
func SortAndUnique(in []corev1.Capability) []corev1.Capability
Types ¶
type APIServiceManager ¶
type APIServiceManager interface {
AddAPIService(name, namespace string, spec apiregistrationv1.APIServiceSpec) error
}
APIServiceManager is used to manage service resources.
func NewAPIServiceManager ¶
func NewAPIServiceManager(store dependencies.StoreClient) APIServiceManager
NewAPIServiceManager returns a new APIServiceManager instance
type AnnotationManager ¶
type AnnotationManager interface { // AddAnnotation use to add an annotation to a Pod. AddAnnotation(key, value string) }
AnnotationManager is used to manage adding annotations in a PodTemplateSpec
func NewAnnotationManager ¶
func NewAnnotationManager(podTmpl *corev1.PodTemplateSpec) AnnotationManager
NewAnnotationManager returns a new instance of the AnnotationManager
type CiliumPolicyManager ¶
type CiliumPolicyManager interface {
AddCiliumPolicy(name, namespace string, policySpecs []cilium.NetworkPolicySpec) error
}
CiliumPolicyManager is used to manage cilium policy resources.
func NewCiliumPolicyManager ¶
func NewCiliumPolicyManager(store dependencies.StoreClient) CiliumPolicyManager
NewCiliumPolicyManager returns a new CiliumPolicyManager instance
type ConfigMapManager ¶
type ConfigMapManager interface {
AddConfigMap(name, namespace string, data map[string]string) error
}
ConfigMapManager is used to manage configmap resources.
func NewConfigMapManager ¶
func NewConfigMapManager(store dependencies.StoreClient) ConfigMapManager
NewConfigMapManager returns a new ConfigMapManager instance
type EnvFromSourceFromMergeFunction ¶
type EnvFromSourceFromMergeFunction func(current, newEnv *corev1.EnvFromSource) (*corev1.EnvFromSource, error)
EnvFromSourceFromMergeFunction signature for corev1.EnvFromSource merge function
type EnvVarManager ¶
type EnvVarManager interface { // AddEnvVar use to add an environment variable to all containers present in the Pod. AddEnvVar(newEnvVar *corev1.EnvVar) // AddEnvVarWithMergeFunc use to add an environment variable to all containers present in the Pod. // The way the EnvVar is merge with an existing EnvVar can be tune thank to the EnvVarMergeFunction parameter. AddEnvVarWithMergeFunc(newEnvVar *corev1.EnvVar, mergeFunc EnvVarMergeFunction) error // AddEnvVarToContainer use to add an environment variable to a specific container present in the Pod. AddEnvVarToContainer(containerName commonv1.AgentContainerName, newEnvVar *corev1.EnvVar) // AddEnvVarToContainers use to add an environment variable to specified containers present in the Pod. AddEnvVarToContainers(containerNames []commonv1.AgentContainerName, newEnvVar *corev1.EnvVar) // AddEnvVarToInitContainer use to add an environment variable to a specific init container present in the Pod. AddEnvVarToInitContainer(containerName commonv1.AgentContainerName, newEnvVar *corev1.EnvVar) // AddEnvVarWithMergeFunc use to add an environment variable to a specific container present in the Pod. // The way the EnvVar is merge with an existing EnvVar can be tune thank to the EnvVarMergeFunction parameter. AddEnvVarToContainerWithMergeFunc(containerName commonv1.AgentContainerName, newEnvVar *corev1.EnvVar, mergeFunc EnvVarMergeFunction) error }
EnvVarManager use to manage adding Environment variable to container in a PodTemplateSpec
func NewEnvVarManager ¶
func NewEnvVarManager(podTmpl *corev1.PodTemplateSpec) EnvVarManager
NewEnvVarManager return new instance of the EnvVarManager
type EnvVarMergeFunction ¶
EnvVarMergeFunction signature for corev1.EnvVar merge function
type NetworkPolicyManager ¶
type NetworkPolicyManager interface {
AddKubernetesNetworkPolicy(name, namespace string, podSelector metav1.LabelSelector, policyTypes []netv1.PolicyType, ingress []netv1.NetworkPolicyIngressRule, egress []netv1.NetworkPolicyEgressRule) error
}
NetworkPolicyManager is used to manage network policy resources.
func NewNetworkPolicyManager ¶
func NewNetworkPolicyManager(store dependencies.StoreClient) NetworkPolicyManager
NewNetworkPolicyManager returns a new NetworkPolicyManager instance
type PodSecurityManager ¶
type PodSecurityManager interface { // GetPodSecurityPolicy gets a PodSecurityPolicy GetPodSecurityPolicy(namespace string, pspName string) (*policyv1beta1.PodSecurityPolicy, error) // UpdatePodSecurityPolicy updates a PodSecurityPolicy UpdatePodSecurityPolicy(*policyv1beta1.PodSecurityPolicy) }
PodSecurityManager use to manage Security resources.
func NewPodSecurityManager ¶
func NewPodSecurityManager(store dependencies.StoreClient) PodSecurityManager
NewPodSecurityManager return new PodSecurityManager instance
type PortManager ¶
type PortManager interface { // AddPortToContainer use to add a port to a specific container present in the Pod. AddPortToContainer(containerName commonv1.AgentContainerName, newPort *corev1.ContainerPort) // AddPortWithMergeFunc use to add a port to a specific container present in the Pod. // The way the Port is merge with an existing Port can be tune thank to the PortMergeFunction parameter. AddPortToContainerWithMergeFunc(containerName commonv1.AgentContainerName, newPort *corev1.ContainerPort, mergeFunc PortMergeFunction) error }
PortManager use to manage adding ports to a container in a PodTemplateSpec
func NewPortManager ¶
func NewPortManager(podTmpl *corev1.PodTemplateSpec) PortManager
NewPortManager return new instance of the PortManager
type PortMergeFunction ¶
type PortMergeFunction func(current, newPort *corev1.ContainerPort) (*corev1.ContainerPort, error)
PortMergeFunction signature for corev1.ContainerPort merge function
type RBACManager ¶
type RBACManager interface { AddServiceAccount(namespace string, name string) error AddServiceAccountByComponent(namespace, name, component string) error AddPolicyRules(namespace string, roleName string, saName string, policies []rbacv1.PolicyRule) error AddPolicyRulesByComponent(namespace string, roleName string, saName string, policies []rbacv1.PolicyRule, component string) error AddRoleBinding(roleNamespace, roleName, saNamespace, saName string, roleRef rbacv1.RoleRef) error AddClusterPolicyRules(namespace string, roleName string, saName string, policies []rbacv1.PolicyRule) error AddClusterPolicyRulesByComponent(namespace string, roleName string, saName string, policies []rbacv1.PolicyRule, component string) error AddClusterRoleBinding(namespace string, name string, saName string, roleRef rbacv1.RoleRef) error DeleteServiceAccountByComponent(component, namespace string) error DeleteRoleByComponent(component, namespace string) error DeleteClusterRoleByComponent(component string) error }
RBACManager use to manage RBAC resources.
func NewRBACManager ¶
func NewRBACManager(store dependencies.StoreClient) RBACManager
NewRBACManager return new RBACManager instance
type SecretManager ¶
type SecretManager interface { AddSecret(secretNamespace, secretName, key, value string) error AddAnnotations(logger logr.Logger, secretNamespace, secretName string, extraAnnotations map[string]string) error }
SecretManager Kubernetes Secret Manager interface
func NewSecretManager ¶
func NewSecretManager(store dependencies.StoreClient) SecretManager
NewSecretManager return new SecretManager instance
type SecurityContextManager ¶
type SecurityContextManager interface { // AddCapabilitiesToContainer Adds capabilities to a container in the PodTemplate. AddCapabilitiesToContainer(capabilities []corev1.Capability, containerName commonv1.AgentContainerName) }
SecurityContextManager use to add Security Context settings to containers.
func NewSecurityContextManager ¶
func NewSecurityContextManager(podTmpl *corev1.PodTemplateSpec) SecurityContextManager
NewSecurityContextManager returns a new instance of the SecurityContextManager
type ServiceManager ¶
type ServiceManager interface {
AddService(name, namespace string, selector map[string]string, ports []corev1.ServicePort, internalTrafficPolicy *corev1.ServiceInternalTrafficPolicyType) error
}
ServiceManager is used to manage service resources.
func NewServiceManager ¶
func NewServiceManager(store dependencies.StoreClient) ServiceManager
NewServiceManager returns a new ServiceManager instance
type VolumeManager ¶
type VolumeManager interface { // Add the volume to the PodTemplate. AddVolume(volume *corev1.Volume) // Add the volume to the PodTemplate. // Provide merge functions if the merge is specific. AddVolumeWithMergeFunc(volume *corev1.Volume, volumeMergeFunc VolumeMergeFunction) error }
VolumeManager use to add a Volume to Pod and associated containers.
func NewVolumeManager ¶
func NewVolumeManager(podTmpl *corev1.PodTemplateSpec) VolumeManager
NewVolumeManager returns a new instance of the VolumeManager
type VolumeMergeFunction ¶
VolumeMergeFunction signature for corev1.Volume merge function
type VolumeMountManager ¶
type VolumeMountManager interface { // Add the volumeMount to all containers of the PodTemplate. AddVolumeMount(volumeMount *corev1.VolumeMount) // Add the volumeMount to one container of the PodTemplate. AddVolumeMountToContainer(volumeMount *corev1.VolumeMount, containerName commonv1.AgentContainerName) // Add the volumeMount to an init container pfo the PodTemplate. AddVolumeMountToInitContainer(volumeMount *corev1.VolumeMount, containerName commonv1.AgentContainerName) // Add the volumeMount to a list of containers in the PodTemplate. AddVolumeMountToContainers(volumeMount *corev1.VolumeMount, containerNames []commonv1.AgentContainerName) // Add the volumeMount to the container matching the containerName. // Provide merge functions if the merge is specific. AddVolumeMountToContainerWithMergeFunc(volumeMount *corev1.VolumeMount, containerName commonv1.AgentContainerName, volumeMountMergeFunc VolumeMountMergeFunction) error }
VolumeMountManager use to add a Volume to Pod and associated containers.
func NewVolumeMountManager ¶
func NewVolumeMountManager(podTmpl *corev1.PodTemplateSpec) VolumeMountManager
NewVolumeMountManager returns a new instance of the VolumeMountManager
type VolumeMountMergeFunction ¶
type VolumeMountMergeFunction func(current, newVolumeMount *corev1.VolumeMount) (*corev1.VolumeMount, error)
VolumeMountMergeFunction signature for corev1.VolumeMount merge function