Documentation ¶
Index ¶
- Constants
- Variables
- func AgentAnnotationsWithOwnerRef(instance *agentv1alpha1.Agent) map[string]string
- func AgentEnv(instance *agentv1alpha1.Agent, agentGroup string) []corev1.EnvVar
- func AgentVolumeMounts(agentSpec agentv1alpha1.AgentSpec) []corev1.VolumeMount
- func AgentVolumes(agentSpec agentv1alpha1.AgentSpec) []corev1.Volume
- func CheckAndGenerateCertForOperator() error
- func CheckCertificate() bool
- func ClusterRoleBindingMutate(crb *rbacv1.ClusterRoleBinding, roleRef rbacv1.RoleRef, ...) controllerutil.MutateFn
- func ClusterRoleMutate(cr *rbacv1.ClusterRole, rules []rbacv1.PolicyRule) controllerutil.MutateFn
- func CommonLabels(commonLabels map[string]string, instanceName, component string) map[string]string
- func ConfigMapMutate(cm *corev1.ConfigMap, files map[string]string) controllerutil.MutateFn
- func ContainerEnvFrom(controllerSpec common.CommonSpec) []corev1.EnvFromSource
- func ContainerProbes(spec common.CommonSpec, scheme corev1.URIScheme) (*corev1.Probe, *corev1.Probe)
- func ContainerSecurityContext(containerSecurityContext common.ContainerSecurityContext) *corev1.SecurityContext
- func ControllerAnnotationsWithOwnerRef(instance *controllerv1alpha1.Controller) map[string]string
- func ControllerEnv(instance *controllerv1alpha1.Controller) []corev1.EnvVar
- func ControllerVolumeMounts(controllerSpec common.CommonSpec) []corev1.VolumeMount
- func ControllerVolumes(instance *controllerv1alpha1.Controller) []corev1.Volume
- func GenerateCertificate(dnsPrefix, namespace string) (*bytes.Buffer, *bytes.Buffer, *bytes.Buffer, error)
- func GetPort(addr string) (int32, error)
- func ImagePullSecrets(image common.Image) []corev1.LocalObjectReference
- func ImageString(image common.Image, repository string) string
- func MergeContainers(common, extra []corev1.Container) []corev1.Container
- func MergeEnvFromSources(common, extra []corev1.EnvFromSource) []corev1.EnvFromSource
- func MergeEnvVars(common, extra []corev1.EnvVar) []corev1.EnvVar
- func MergeImagePullSecrets(common, extra []corev1.LocalObjectReference) []corev1.LocalObjectReference
- func MergeVolumeMounts(common, extra []corev1.VolumeMount) []corev1.VolumeMount
- func MergeVolumes(common, extra []corev1.Volume) []corev1.Volume
- func MutatingWebhookConfigurationMutate(mwc *admissionregistrationv1.MutatingWebhookConfiguration, ...) controllerutil.MutateFn
- func PodSecurityContext(podSecurityContext common.PodSecurityContext) *corev1.PodSecurityContext
- func SecretDataKey(spec *common.SecretKeyRef) string
- func SecretMutate(secret *corev1.Secret, data map[string][]byte) controllerutil.MutateFn
- func SecretName(instance, component string, spec *common.APIKeySecret) string
- func SelectorLabels(instance, component string) map[string]string
- func ServiceAccountMutate(sa *corev1.ServiceAccount, automountServiceAccountToken *bool) controllerutil.MutateFn
- func ServiceMutate(svc *corev1.Service, spec corev1.ServiceSpec) controllerutil.MutateFn
- func UpdateResource(client client.Client, ctx context.Context, instance client.Object) error
- func ValidatingWebhookConfigurationMutate(vwc *admissionregistrationv1.ValidatingWebhookConfiguration, ...) controllerutil.MutateFn
- func WriteFile(filepath string, sCert *bytes.Buffer) error
Constants ¶
const ( // MutatingWebhookURI defines the URI for the Mutating Webhook for Pods. MutatingWebhookURI = "/mutate-pod" // AgentMutatingWebhookURI defines the URI for the Mutating Webhook for Agents. AgentMutatingWebhookURI = "agent-defaulter" // ControllerMutatingWebhookURI defines the URI for the Mutating Webhook for Controllers. ControllerMutatingWebhookURI = "controller-defaulter" // SecretKey defines the Kubernetes secret data key. SecretKey = "apiKey" // AppName defines name of the application. AppName = "aperture" // OperatorName defines operator name. OperatorName = AppName + "-operator" // ControllerServiceName defines controller service name. ControllerServiceName = AppName + "-controller" // AgentServiceName defines agent service name. AgentServiceName = AppName + "-agent" // PodMutatingWebhookName defines agent service name. PodMutatingWebhookName = AppName + "-injector" // AgentMutatingWebhookName defines agent service name. AgentMutatingWebhookName = AppName + "-" + AgentMutatingWebhookURI // ControllerMutatingWebhookName defines Controller Mutating Webhook Name. ControllerMutatingWebhookName = AppName + "-" + ControllerMutatingWebhookURI // ValidatingWebhookName defines Validating Webhook name. ValidatingWebhookName = ControllerServiceName + "-webhook" // FinalizerName defines finalizer name. FinalizerName = "fluxninja.com/finalizer" // SidecarKey defines sidecar key. SidecarKey = "sidecar.fluxninja.com" // SidecarAnnotationKey defines sidecar annotation key. SidecarAnnotationKey = SidecarKey + "/injection" // SidecarLabelKey defines sidecar label key. SidecarLabelKey = AppName + "-injection" // AgentGroupKey defines agent group key. AgentGroupKey = SidecarKey + "/agent-group" // V1Version defines v1 version. V1Version = "v1" // V1Alpha1Version defines v1alpha1 version. V1Alpha1Version = "v1alpha1" // Enabled string. Enabled = "enabled" // ValidatingWebhookSvcName defines Validating Webhook service name. ValidatingWebhookSvcName = ValidatingWebhookName // WebhookClientCertName defines client cert name. WebhookClientCertName = "client.pem" // ControllerCertKeyName defines controller key file name. ControllerCertKeyName = "key.pem" // ControllerCertName defines controller cert name. ControllerCertName = "crt.pem" // ControllerCertPath defines controller cert path. ControllerCertPath = "/etc/aperture/aperture-controller/certs" // Server string. Server = "server" // TCP string. TCP = "TCP" // DistCache string. DistCache = "dist-cache" // MemberList string. MemberList = "memberlist" // ApertureFluxNinjaPlugin defines FluxNinja plugin name. ApertureFluxNinjaPlugin = "aperture-plugin-fluxninja" // DefaulterAnnotationKey defines annotation key for set defaults. DefaulterAnnotationKey = "fluxninja.com/set-defaults" // FailedStatus string. FailedStatus = "failed" // PolicyValidatingWebhookName defines Validating Webhook name for Policy. PolicyValidatingWebhookName = "policy-validator.fluxninja.com" // PolicyValidatingWebhookURI defines Validating Webhook URI for Policy. PolicyValidatingWebhookURI = "/validate/policy" // OtelDebugPort string. OtelDebugPort = "otel-debug" // OtelHealthcheckPort string. OtelHealthcheckPort = "otel-health" // OtelPprofPort string. OtelPprofPort = "otel-pprof" // OtelZpagesPort string. OtelZpagesPort = "otel-zpages" // MinimumKubernetesVersion defines minimum kubernetes version required by Aperture. MinimumKubernetesVersion = "v1.23.0" )
Variables ¶
var ( // PolicyFilePath defines default path for the policies on Controller. PolicyFilePath = filepath.Join("/", "etc", "aperture", "aperture-controller", "policies") // Test string. Test = "test" // TestTwo string. TestTwo = "test2" // TestArray array. TestArray = []string{Test} // TestArrayTwo array. TestArrayTwo = []string{TestTwo, Test} // TestMap map. TestMap = map[string]string{ Test: Test, } // TestMapTwo map. TestMapTwo = map[string]string{ Test: Test, TestTwo: TestTwo, } // K8sClient defines Kubernetes client for tests. K8sClient client.Client // K8sDynamicClient defines Kubernetes Dynamic client for tests. K8sDynamicClient dynamic.Interface // K8sManager defines Kubernetes Manager for tests. K8sManager ctrl.Manager // Ctx context. Ctx context.Context // DefaultAgentInstance defines default Agent instance for tests. DefaultAgentInstance *agentv1alpha1.Agent // DefaultControllerInstance defines default Controller instance for tests. DefaultControllerInstance *controllerv1alpha1.Controller // CertDir defines cert directory for tests. CertDir = filepath.Join(".", "certs") // PoliciesDir defines policies directory for tests. PoliciesDir = filepath.Join(".", "policies") // CurrentKubernetesVersion is pointer of type `apimachineryversion.Version`, which defines local kubernetes version. CurrentKubernetesVersion *apimachineryversion.Version // MinimumKubernetesVersionBool defines if minimum kubernetes version required by Aperture is met. MinimumKubernetesVersionBool bool )
Functions ¶
func AgentAnnotationsWithOwnerRef ¶ added in v0.3.0
func AgentAnnotationsWithOwnerRef(instance *agentv1alpha1.Agent) map[string]string
AgentAnnotationsWithOwnerRef prepares the map for Annotation with reference to the creator instance.
func AgentEnv ¶ added in v0.3.0
func AgentEnv(instance *agentv1alpha1.Agent, agentGroup string) []corev1.EnvVar
AgentEnv prepares env resources for Agents' container.
func AgentVolumeMounts ¶ added in v0.3.0
func AgentVolumeMounts(agentSpec agentv1alpha1.AgentSpec) []corev1.VolumeMount
AgentVolumeMounts prepares volumeMounts for Agents' container.
func AgentVolumes ¶ added in v0.3.0
func AgentVolumes(agentSpec agentv1alpha1.AgentSpec) []corev1.Volume
AgentVolumes prepares volumes for Agent.
func CheckAndGenerateCertForOperator ¶
func CheckAndGenerateCertForOperator() error
CheckAndGenerateCertForOperator checks if existing certificates are present and creates new if not present.
func CheckCertificate ¶ added in v0.3.0
func CheckCertificate() bool
CheckCertificate checks if existing certificates are available.
func ClusterRoleBindingMutate ¶ added in v0.3.0
func ClusterRoleBindingMutate(crb *rbacv1.ClusterRoleBinding, roleRef rbacv1.RoleRef, subjects []rbacv1.Subject) controllerutil.MutateFn
ClusterRoleBindingMutate returns a mutate function that can be used to update the Service's service spec.
func ClusterRoleMutate ¶ added in v0.3.0
func ClusterRoleMutate(cr *rbacv1.ClusterRole, rules []rbacv1.PolicyRule) controllerutil.MutateFn
ClusterRoleMutate returns a mutate function that can be used to update the ClusterRole's spec.
func CommonLabels ¶ added in v0.3.0
CommonLabels prepares common labels used by all resources.
func ConfigMapMutate ¶ added in v0.3.0
ConfigMapMutate returns a mutate function that can be used to update the ConfigMap's configuration data.
func ContainerEnvFrom ¶ added in v0.3.0
func ContainerEnvFrom(controllerSpec common.CommonSpec) []corev1.EnvFromSource
ContainerEnvFrom prepares EnvFrom resource for Agent and Controllers' container.
func ContainerProbes ¶ added in v0.3.0
func ContainerProbes(spec common.CommonSpec, scheme corev1.URIScheme) (*corev1.Probe, *corev1.Probe)
ContainerProbes prepares livenessProbe and readinessProbe based on the provided parameters.
func ContainerSecurityContext ¶ added in v0.3.0
func ContainerSecurityContext(containerSecurityContext common.ContainerSecurityContext) *corev1.SecurityContext
ContainerSecurityContext prepares SecurityContext for containers based on the provided parameter.
func ControllerAnnotationsWithOwnerRef ¶ added in v0.3.0
func ControllerAnnotationsWithOwnerRef(instance *controllerv1alpha1.Controller) map[string]string
ControllerAnnotationsWithOwnerRef prepares the map for Annotation with reference to the creator instance.
func ControllerEnv ¶ added in v0.3.0
func ControllerEnv(instance *controllerv1alpha1.Controller) []corev1.EnvVar
ControllerEnv prepares env resources for Controller' container.
func ControllerVolumeMounts ¶ added in v0.3.0
func ControllerVolumeMounts(controllerSpec common.CommonSpec) []corev1.VolumeMount
ControllerVolumeMounts prepares volumeMounts for Controllers' container.
func ControllerVolumes ¶ added in v0.3.0
func ControllerVolumes(instance *controllerv1alpha1.Controller) []corev1.Volume
ControllerVolumes prepares volumes for Controller.
func GenerateCertificate ¶ added in v0.3.0
func GenerateCertificate(dnsPrefix, namespace string) (*bytes.Buffer, *bytes.Buffer, *bytes.Buffer, error)
GenerateCertificate generates certificate and stores it in the desired location.
func ImagePullSecrets ¶ added in v0.3.0
func ImagePullSecrets(image common.Image) []corev1.LocalObjectReference
ImagePullSecrets prepares ImagePullSecrets string slice from the provided Image struct.
func ImageString ¶ added in v0.3.0
ImageString prepares image string from the provided Image struct.
func MergeContainers ¶ added in v0.3.0
MergeContainers merges common and provided Container/Init Container of Kubernetes container.
func MergeEnvFromSources ¶ added in v0.3.0
func MergeEnvFromSources(common, extra []corev1.EnvFromSource) []corev1.EnvFromSource
MergeEnvFromSources merges common and provided extra Environment From of Kubernetes container.
func MergeEnvVars ¶ added in v0.3.0
MergeEnvVars merges common and provided extra Environment variables of Kubernetes container.
func MergeImagePullSecrets ¶ added in v0.3.0
func MergeImagePullSecrets(common, extra []corev1.LocalObjectReference) []corev1.LocalObjectReference
MergeImagePullSecrets merges common and provided Image Pull Secrets of Kubernetes.
func MergeVolumeMounts ¶ added in v0.3.0
func MergeVolumeMounts(common, extra []corev1.VolumeMount) []corev1.VolumeMount
MergeVolumeMounts merges common and provided extra Volume mounts of Kubernetes container.
func MergeVolumes ¶ added in v0.3.0
MergeVolumes merges common and provided extra Volume of Kubernetes Pod.
func MutatingWebhookConfigurationMutate ¶ added in v0.3.0
func MutatingWebhookConfigurationMutate(mwc *admissionregistrationv1.MutatingWebhookConfiguration, webhooks []admissionregistrationv1.MutatingWebhook) controllerutil.MutateFn
MutatingWebhookConfigurationMutate returns a mutate function that can be used to update the MutatingWebhookConfiguration's spec.
func PodSecurityContext ¶ added in v0.3.0
func PodSecurityContext(podSecurityContext common.PodSecurityContext) *corev1.PodSecurityContext
PodSecurityContext prepares SecurityContext for Pods based on the provided parameter.
func SecretDataKey ¶ added in v0.3.0
func SecretDataKey(spec *common.SecretKeyRef) string
SecretDataKey fetches Key for ApiKey secret from config or generates the Key if not present in config.
func SecretMutate ¶ added in v0.3.0
SecretMutate returns a mutate function that can be used to update the Secret's data.
func SecretName ¶ added in v0.3.0
func SecretName(instance, component string, spec *common.APIKeySecret) string
SecretName fetches name for ApiKey secret from config or generates the name if not present in config.
func SelectorLabels ¶ added in v0.3.0
SelectorLabels prepares the labels used for Selector.
func ServiceAccountMutate ¶ added in v0.3.0
func ServiceAccountMutate(sa *corev1.ServiceAccount, automountServiceAccountToken *bool) controllerutil.MutateFn
ServiceAccountMutate returns a mutate function that can be used to update the ClusterRole's spec.
func ServiceMutate ¶ added in v0.3.0
func ServiceMutate(svc *corev1.Service, spec corev1.ServiceSpec) controllerutil.MutateFn
ServiceMutate returns a mutate function that can be used to update the Service's spec.
func UpdateResource ¶ added in v0.3.0
UpdateResource updates the Aperture resource in Kubernetes.
func ValidatingWebhookConfigurationMutate ¶ added in v0.3.0
func ValidatingWebhookConfigurationMutate(vwc *admissionregistrationv1.ValidatingWebhookConfiguration, webhooks []admissionregistrationv1.ValidatingWebhook) controllerutil.MutateFn
ValidatingWebhookConfigurationMutate returns a mutate function that can be used to update the ValidatingWebhookConfiguration's spec.
Types ¶
This section is empty.