kube

package
v1.62.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 45 Imported by: 29

Documentation

Index

Constants

View Source
const (
	RadixBranchAnnotation                            = "radix-branch"
	RadixGitTagsAnnotation                           = "radix.equinor.com/radix-git-tags"
	RadixCommitAnnotation                            = "radix.equinor.com/radix-commit"
	RadixConfigHash                                  = "radix.equinor.com/radix-config-hash"
	RadixBuildSecretHash                             = "radix.equinor.com/build-secret-hash"
	RadixComponentImagesAnnotation                   = "radix-component-images"
	RadixBuildComponentsAnnotation                   = "radix-build-component"
	RadixDeploymentNameAnnotation                    = "radix-deployment-name"
	RadixDeploymentPromotedFromDeploymentAnnotation  = "radix.equinor.com/radix-deployment-promoted-from-deployment"
	RadixDeploymentPromotedFromEnvironmentAnnotation = "radix.equinor.com/radix-deployment-promoted-from-environment"
	// RadixDeploymentObservedGeneration Used to verify kubernetes deployements are synced with active radix deployment, must contain the active RadixDeployments synced Generation
	RadixDeploymentObservedGeneration = "radix.equinor.com/radix-deployment-observed-generation"
	// RestoredStatusAnnotation See https://github.com/equinor/radix-velero-plugin/blob/master/velero-plugins/deployment/restore.go
	RestoredStatusAnnotation = "equinor.com/velero-restored-status"
)

Radix Annotations

View Source
const (
	RadixEnvironmentFinalizer = "radix.equinor.com/environment-finalizer"
	RadixDNSAliasFinalizer    = "radix.equinor.com/dnsalias-finalizer"
)

Radix Finalizers

View Source
const (
	K8sAppLabel                         = "k8s-app"
	RadixAppLabel                       = "radix-app"
	RadixEnvLabel                       = "radix-env"
	RadixComponentLabel                 = "radix-component"
	RadixDeploymentLabel                = "radix-deployment"
	RadixComponentTypeLabel             = "radix-component-type"
	RadixJobNameLabel                   = "radix-job-name"
	RadixAuxiliaryComponentLabel        = "radix-aux-component"
	RadixAuxiliaryComponentTypeLabel    = "radix-aux-component-type"
	RadixCommitLabel                    = "radix-commit"
	RadixImageTagLabel                  = "radix-image-tag"
	RadixJobTypeLabel                   = "radix-job-type"
	RadixJobTypeJob                     = "job"                   // Outer job
	RadixJobTypeManagerAux              = "job-manager-auxiliary" // Outer job
	RadixJobTypeBuild                   = "build"
	RadixJobTypeCloneConfig             = "clone-config"
	RadixJobTypePreparePipelines        = "prepare-pipelines"
	RadixJobTypeRunPipelines            = "run-pipelines"
	RadixJobTypeJobSchedule             = "job-scheduler"
	RadixJobTypeBatchSchedule           = "batch-scheduler"
	RadixDefaultAliasLabel              = "radix-default-alias"
	RadixActiveClusterAliasLabel        = "radix-app-active-cluster-alias"
	RadixAppAliasLabel                  = "radix-app-alias"
	RadixExternalAliasLabel             = "radix-app-external-alias"
	RadixExternalAliasFQDNLabel         = "radix-app-external-alias-fqdn"
	RadixAliasLabel                     = "radix-alias"
	RadixMountTypeLabel                 = "mount-type"
	RadixVolumeMountNameLabel           = "radix-volume-mount-name"
	RadixGpuLabel                       = "radix-node-gpu"
	RadixGpuCountLabel                  = "radix-node-gpu-count"
	RadixJobNodeLabel                   = "nodepooltasks"
	RadixNamespace                      = "radix-namespace"
	RadixConfigMapTypeLabel             = "radix-config-map-type"
	RadixSecretTypeLabel                = "radix-secret-type"
	RadixSecretRefTypeLabel             = "radix-secret-ref-type"
	RadixSecretRefNameLabel             = "radix-secret-ref-name"
	RadixUserDefinedNetworkPolicyLabel  = "is-user-defined"
	RadixPodIsJobSchedulerLabel         = "is-job-scheduler-pod"
	RadixPodIsJobAuxObjectLabel         = "is-job-aux-object"
	IsServiceAccountForComponent        = "is-service-account-for-component"
	IsServiceAccountForSubPipelineLabel = "is-service-account-for-subpipeline"
	RadixBatchNameLabel                 = "radix-batch-name"
	RadixBatchJobNameLabel              = "radix-batch-job-name"
	RadixBatchTypeLabel                 = "radix-batch-type"
	RadixAccessValidationLabel          = "radix-access-validation"
	RadixPipelineTypeLabels             = "radix-pipeline"
	RadixTriggerLabel                   = "radix-keda-trigger"

	// NodeTaintGpuCountKey defines the taint key on GPU nodes.
	// Pods required to run on nodes with this taint must add a toleration with effect NoSchedule
	NodeTaintGpuCountKey = "radix-node-gpu-count"
	NodeTaintJobsKey     = "nodepooltasks"
)

Radix Labels

Variables

This section is empty.

Functions

func BuildAzureKeyVaultSecretProviderClass added in v1.22.1

func BuildAzureKeyVaultSecretProviderClass(tenantId string, appName string, radixDeploymentName string, radixDeployComponentName string, azureKeyVault radixv1.RadixAzureKeyVault, identity *radixv1.Identity) (*secretsstorev1.SecretProviderClass, error)

BuildAzureKeyVaultSecretProviderClass Build a SecretProviderClass for Azure Key vault secret-ref

func BuildRadixConfigEnvVarsConfigMap added in v1.15.0

func BuildRadixConfigEnvVarsConfigMap(appName, componentName string) *corev1.ConfigMap

BuildRadixConfigEnvVarsConfigMap Build environment-variables config-map

func BuildRadixConfigEnvVarsMetadataConfigMap added in v1.15.0

func BuildRadixConfigEnvVarsMetadataConfigMap(appName, componentName string) *corev1.ConfigMap

BuildRadixConfigEnvVarsMetadataConfigMap Build environment-variables metadata config-map

func CreateAppRole added in v1.20.3

func CreateAppRole(appName, roleName string, customLabels map[string]string, ruleBuilders ...RuleBuilder) *rbacv1.Role

func CreateManageSecretRole added in v1.3.0

func CreateManageSecretRole(appName, roleName string, secretNames []string, customLabels map[string]string) *rbacv1.Role

CreateManageSecretRole creates a role that can manage a secret with predefined set of verbs

func CreateReadSecretRole added in v1.39.3

func CreateReadSecretRole(appName, roleName string, secretNames []string, customLabels map[string]string) *rbacv1.Role

CreateReadSecretRole creates a role that can read a secret with predefined set of verbs

func GetAzureKeyVaultSecretRefSecretName added in v1.17.2

func GetAzureKeyVaultSecretRefSecretName(componentName, radixDeploymentName, azKeyVaultName string, secretType corev1.SecretType) string

GetAzureKeyVaultSecretRefSecretName Gets a secret name for Azure KeyVault RadixSecretRefs

func GetComponentSecretProviderClassName added in v1.17.2

func GetComponentSecretProviderClassName(radixDeploymentName, radixDeployComponentName string, radixSecretRefType radixv1.RadixSecretRefType, secretRefName string) string

GetComponentSecretProviderClassName Gets unique name of the component secret storage class

func GetEnvVarsConfigMapName added in v1.15.0

func GetEnvVarsConfigMapName(componentName string) string

GetEnvVarsConfigMapName Get config-map name for environment variables

func GetEnvVarsMetadataConfigMapName added in v1.15.0

func GetEnvVarsMetadataConfigMapName(componentName string) string

GetEnvVarsMetadataConfigMapName Get config-map name for environment variables metadata

func GetEnvVarsMetadataFromConfigMap added in v1.15.0

func GetEnvVarsMetadataFromConfigMap(ctx context.Context, envVarsMetadataConfigMap *corev1.ConfigMap) (map[string]EnvVarMetadata, error)

GetEnvVarsMetadataFromConfigMap Get environment-variables metadata from config-map

func GetRadixDNSAliasMap added in v1.47.0

func GetRadixDNSAliasMap(ctx context.Context, radixClient radixclient.Interface) (map[string]*radixv1.RadixDNSAlias, error)

GetRadixDNSAliasMap Gets a map of all RadixDNSAliases

func GetRoleBindingSubjects added in v1.60.0

func GetRoleBindingSubjects(groups, users []string) []rbacv1.Subject

GetRoleBindingSubjects Get subjects for list of ad groups

func GetRolebindingToClusterRoleForServiceAccountWithLabels added in v1.3.0

func GetRolebindingToClusterRoleForServiceAccountWithLabels(roleName, serviceAccountName, serviceAccountNamespace string, labels map[string]string) *rbacv1.RoleBinding

GetRolebindingToClusterRoleForServiceAccountWithLabels Get role binding object

func GetRolebindingToClusterRoleForSubjects added in v1.5.0

func GetRolebindingToClusterRoleForSubjects(appName, roleName string, subjects []rbacv1.Subject) *rbacv1.RoleBinding

GetRolebindingToClusterRoleForSubjects Get role binding object for list of subjects

func GetRolebindingToClusterRoleForSubjectsWithLabels added in v1.5.0

func GetRolebindingToClusterRoleForSubjectsWithLabels(roleName string, subjects []rbacv1.Subject, labels map[string]string) *rbacv1.RoleBinding

GetRolebindingToClusterRoleForSubjectsWithLabels Get role binding object for list of subjects with labels set

func GetRolebindingToRoleForServiceAccountWithLabels added in v1.3.0

func GetRolebindingToRoleForServiceAccountWithLabels(roleName, serviceAccountName, serviceAccountNamespace string, labels map[string]string) *rbacv1.RoleBinding

GetRolebindingToRoleForServiceAccountWithLabels Get role binding object

func GetRolebindingToRoleForSubjectsWithLabels added in v1.5.0

func GetRolebindingToRoleForSubjectsWithLabels(roleName string, subjects []rbacv1.Subject, labels map[string]string) *rbacv1.RoleBinding

GetRolebindingToRoleForSubjectsWithLabels Get role binding object for list of subjects with labels set

func GetRolebindingToRoleWithLabelsForSubjects added in v1.5.0

func GetRolebindingToRoleWithLabelsForSubjects(roleName string, subjects []rbacv1.Subject, labels map[string]string) *rbacv1.RoleBinding

GetRolebindingToRoleWithLabelsForSubjects Get rolebinding object with subjects as input

func GetSecretRefAzureKeyVaultItemDataKey added in v1.22.1

func GetSecretRefAzureKeyVaultItemDataKey(keyVaultItem *radixv1.RadixAzureKeyVaultItem) string

GetSecretRefAzureKeyVaultItemDataKey Get item data key for the Azure Key vault secret-ref

func GetSecretTypeForRadixAzureKeyVault added in v1.17.2

func GetSecretTypeForRadixAzureKeyVault(k8sSecretType *radixv1.RadixAzureKeyVaultK8sSecretType) corev1.SecretType

GetSecretTypeForRadixAzureKeyVault Gets corev1.SecretType by RadixAzureKeyVaultK8sSecretType

func IsEmptyPatch added in v1.13.0

func IsEmptyPatch(patchBytes []byte) bool

func MergeOwnerReferences added in v1.47.1

func MergeOwnerReferences(ownerReferences1 []metav1.OwnerReference, ownerReferences2 ...metav1.OwnerReference) []metav1.OwnerReference

MergeOwnerReferences Merge lists of owner references

func MergePodDisruptionBudgets added in v1.21.9

func MergePodDisruptionBudgets(existingPdb *v1.PodDisruptionBudget, generatedPdb *v1.PodDisruptionBudget) ([]byte, error)

MergePodDisruptionBudgets returns patch bytes between two PDBs

func SetEnvVarsMetadataMapToConfigMap added in v1.15.0

func SetEnvVarsMetadataMapToConfigMap(configMap *corev1.ConfigMap, envVarsMetadataMap map[string]EnvVarMetadata) error

SetEnvVarsMetadataMapToConfigMap Set environment-variables metadata to config-map

Types

type EnvVarMetadata added in v1.15.0

type EnvVarMetadata struct {
	RadixConfigValue string
}

EnvVarMetadata Metadata for environment variables

type Kube

type Kube struct {
	RrLister                 v1Lister.RadixRegistrationLister
	ReLister                 v1Lister.RadixEnvironmentLister
	RdLister                 v1Lister.RadixDeploymentLister
	RbLister                 v1Lister.RadixBatchLister
	RadixAlertLister         v1Lister.RadixAlertLister
	RadixDNSAliasLister      v1Lister.RadixDNSAliasLister
	NamespaceLister          coreListers.NamespaceLister
	SecretLister             coreListers.SecretLister
	DeploymentLister         appsv1Listers.DeploymentLister
	IngressLister            networkingListers.IngressLister
	ServiceLister            coreListers.ServiceLister
	RoleBindingLister        rbacListers.RoleBindingLister
	ClusterRoleBindingLister rbacListers.ClusterRoleBindingLister
	RoleLister               rbacListers.RoleLister
	ClusterRoleLister        rbacListers.ClusterRoleLister
	ServiceAccountLister     coreListers.ServiceAccountLister
	LimitRangeLister         coreListers.LimitRangeLister
	JobLister                batchListers.JobLister
	ScaledObjectLister       kedav1listers.ScaledObjectLister
	TriggerAuthLister        kedav1listers.TriggerAuthenticationLister
	// contains filtered or unexported fields
}

Kube Struct for accessing lower level kubernetes functions

func New

func New(client kubernetes.Interface, radixClient radixclient.Interface, kedaClient kedav2.Interface, secretProviderClient secretProviderClient.Interface) (*Kube, error)

New Constructor

func NewWithListers

func NewWithListers(client kubernetes.Interface,
	radixclient radixclient.Interface, kedaClient kedav2.Interface,
	secretProviderClient secretProviderClient.Interface,
	kubeInformerFactory kubeinformers.SharedInformerFactory,
	radixInformerFactory informers.SharedInformerFactory) (*Kube, error)

NewWithListers Constructor

func (*Kube) ApplyClusterRole

func (kubeutil *Kube) ApplyClusterRole(ctx context.Context, clusterrole *rbacv1.ClusterRole) error

ApplyClusterRole Creates or updates cluster-role

func (*Kube) ApplyClusterRoleBinding

func (kubeutil *Kube) ApplyClusterRoleBinding(ctx context.Context, clusterrolebinding *rbacv1.ClusterRoleBinding) error

ApplyClusterRoleBinding Creates or updates cluster-role-binding

func (*Kube) ApplyClusterRoleBindingToServiceAccount added in v1.42.4

func (kubeutil *Kube) ApplyClusterRoleBindingToServiceAccount(ctx context.Context, roleName string, serviceAccount *corev1.ServiceAccount, ownerReference []metav1.OwnerReference) error

ApplyClusterRoleBindingToServiceAccount Creates cluster-role-binding as a link between cluster role and service account

func (*Kube) ApplyConfigMap added in v1.15.0

func (kubeutil *Kube) ApplyConfigMap(ctx context.Context, namespace string, currentConfigMap, desiredConfigMap *corev1.ConfigMap) error

ApplyConfigMap Patch changes of environment-variables to config-map if any

func (*Kube) ApplyDeployment

func (kubeutil *Kube) ApplyDeployment(ctx context.Context, namespace string, currentDeployment *appsv1.Deployment, desiredDeployment *appsv1.Deployment) error

ApplyDeployment Create or update deployment in provided namespace

func (*Kube) ApplyEnvVarsMetadataConfigMap added in v1.15.0

func (kubeutil *Kube) ApplyEnvVarsMetadataConfigMap(ctx context.Context, namespace string, envVarsMetadataConfigMap *corev1.ConfigMap, envVarsMetadataMap map[string]EnvVarMetadata) error

ApplyEnvVarsMetadataConfigMap Save changes of environment-variables metadata to config-map

func (*Kube) ApplyIngress

func (kubeutil *Kube) ApplyIngress(ctx context.Context, namespace string, ingress *networkingv1.Ingress) error

ApplyIngress Will create or update ingress in provided namespace

func (*Kube) ApplyLimitRange

func (kubeutil *Kube) ApplyLimitRange(ctx context.Context, namespace string, limitRange *corev1.LimitRange) error

ApplyLimitRange Applies limit range to namespace

func (*Kube) ApplyNamespace

func (kubeutil *Kube) ApplyNamespace(ctx context.Context, name string, labels map[string]string, ownerRefs []metav1.OwnerReference) error

ApplyNamespace Creates a new namespace, if not exists already

func (*Kube) ApplyNetworkPolicy added in v1.20.0

func (kubeutil *Kube) ApplyNetworkPolicy(ctx context.Context, networkPolicy *v1.NetworkPolicy, ns string) error

ApplyNetworkPolicy Applies a k8s network policy to specified namespace

func (*Kube) ApplyRole

func (kubeutil *Kube) ApplyRole(ctx context.Context, namespace string, role *rbacv1.Role) error

ApplyRole Creates or updates role

func (*Kube) ApplyRoleBinding

func (kubeutil *Kube) ApplyRoleBinding(ctx context.Context, namespace string, role *rbacv1.RoleBinding) error

ApplyRoleBinding Creates or updates role

func (*Kube) ApplyRoleBindingToServiceAccount added in v1.42.4

func (kubeutil *Kube) ApplyRoleBindingToServiceAccount(ctx context.Context, roleKind, roleName, namespace string, serviceAccount *corev1.ServiceAccount, ownerReference []metav1.OwnerReference) error

ApplyRoleBindingToServiceAccount Creates role-binding as a link between role and service account

func (*Kube) ApplyScaledObject added in v1.55.0

func (kubeutil *Kube) ApplyScaledObject(ctx context.Context, namespace string, scaledObject *v1alpha1.ScaledObject) error

ApplyScaledObject Will create or update ScaledObject in provided namespace

func (*Kube) ApplySecret deprecated

func (kubeutil *Kube) ApplySecret(ctx context.Context, namespace string, secret *corev1.Secret) (savedSecret *corev1.Secret, err error)

Deprecated: ApplySecret is not safe to use because it does not use the resourceVersion of the supplied secret when updating. Use UpdateSecret or CreateSecret instead. ApplySecret Creates or updates secret to namespace

func (*Kube) ApplyService added in v1.4.1

func (kubeutil *Kube) ApplyService(ctx context.Context, namespace string, service *corev1.Service) error

ApplyService Will create or update service in provided namespace

func (*Kube) ApplyServiceAccount

func (kubeutil *Kube) ApplyServiceAccount(ctx context.Context, serviceAccount *corev1.ServiceAccount) (*corev1.ServiceAccount, error)

ApplyServiceAccount Creates or updates service account

func (*Kube) ApplyTriggerAuthentication added in v1.55.0

func (kubeutil *Kube) ApplyTriggerAuthentication(ctx context.Context, namespace string, auth v1alpha1.TriggerAuthentication) error

ApplyTriggerAuthentication Will create or update TriggerAuthentication in provided namespace

func (*Kube) BuildLimitRange

func (kubeutil *Kube) BuildLimitRange(namespace, name, appName string, defaultResourceMemory, defaultRequestCPU, defaultRequestMemory *resource.Quantity) *corev1.LimitRange

BuildLimitRange Builds a limit range spec

func (*Kube) CreateConfigMap added in v1.15.0

func (kubeutil *Kube) CreateConfigMap(ctx context.Context, namespace string, configMap *corev1.ConfigMap) (*corev1.ConfigMap, error)

CreateConfigMap Create config map

func (*Kube) CreateDeployment added in v1.38.0

func (kubeutil *Kube) CreateDeployment(ctx context.Context, namespace string, deployment *appsv1.Deployment) (*appsv1.Deployment, error)

CreateDeployment Created deployment

func (*Kube) CreateRadixDNSAlias added in v1.47.0

func (kubeutil *Kube) CreateRadixDNSAlias(ctx context.Context, radixDNSAlias *radixv1.RadixDNSAlias) error

CreateRadixDNSAlias Creates RadixDNSAlias

func (*Kube) CreateSecret added in v1.57.14

func (kubeutil *Kube) CreateSecret(ctx context.Context, namespace string, secret *corev1.Secret) (*corev1.Secret, error)

func (*Kube) CreateSecretProviderClass added in v1.17.2

func (kubeutil *Kube) CreateSecretProviderClass(ctx context.Context, namespace string, secretProviderClass *secretsstorev1.SecretProviderClass) (savedSecret *secretsstorev1.SecretProviderClass, err error)

CreateSecretProviderClass Creates secret provider class to namespace

func (*Kube) CreateServiceAccount added in v1.30.0

func (kubeutil *Kube) CreateServiceAccount(ctx context.Context, namespace, name string) (*corev1.ServiceAccount, error)

CreateServiceAccount create a service account

func (*Kube) DeleteClusterRole added in v1.47.1

func (kubeutil *Kube) DeleteClusterRole(ctx context.Context, name string) error

DeleteClusterRole Deletes a role in a namespace

func (*Kube) DeleteClusterRoleBinding added in v1.5.0

func (kubeutil *Kube) DeleteClusterRoleBinding(ctx context.Context, name string) error

DeleteClusterRoleBinding Deletes a clusterrolebinding

func (*Kube) DeleteConfigMap added in v1.21.11

func (kubeutil *Kube) DeleteConfigMap(ctx context.Context, namespace string, name string) error

DeleteConfigMap Deletes config-maps

func (*Kube) DeleteDeployment added in v1.38.0

func (kubeutil *Kube) DeleteDeployment(ctx context.Context, namespace, name string) error

DeleteDeployment Delete deployment

func (*Kube) DeleteIngresses added in v1.47.0

func (kubeutil *Kube) DeleteIngresses(ctx context.Context, ingresses ...networkingv1.Ingress) error

DeleteIngresses Deletes ingresses

func (*Kube) DeleteRadixBatch added in v1.43.2

func (kubeutil *Kube) DeleteRadixBatch(ctx context.Context, namespace, name string) error

DeleteRadixBatch Deletes a batch

func (*Kube) DeleteRadixDNSAliases added in v1.47.0

func (kubeutil *Kube) DeleteRadixDNSAliases(ctx context.Context, radixDNSAliases ...*radixv1.RadixDNSAlias) error

DeleteRadixDNSAliases Delete RadixDNSAliases

func (*Kube) DeleteRole added in v1.5.0

func (kubeutil *Kube) DeleteRole(ctx context.Context, namespace, name string) error

DeleteRole Deletes a role in a namespace

func (*Kube) DeleteRoleBinding added in v1.5.0

func (kubeutil *Kube) DeleteRoleBinding(ctx context.Context, namespace, name string) error

DeleteRoleBinding Deletes a rolebinding in a namespace

func (*Kube) DeleteScaledObject added in v1.55.0

func (kubeutil *Kube) DeleteScaledObject(ctx context.Context, scaledObjects ...*v1alpha1.ScaledObject) error

DeleteScaledObject Deletes ScaledObject

func (*Kube) DeleteSecret added in v1.5.2

func (kubeutil *Kube) DeleteSecret(ctx context.Context, namespace, secretName string) error

DeleteSecret Deletes a secret in a namespace

func (*Kube) DeleteServiceAccount added in v1.5.0

func (kubeutil *Kube) DeleteServiceAccount(ctx context.Context, namespace, name string) error

DeleteServiceAccount Deletes service account

func (*Kube) DeleteTriggerAuthentication added in v1.55.0

func (kubeutil *Kube) DeleteTriggerAuthentication(ctx context.Context, triggerAuth ...*v1alpha1.TriggerAuthentication) error

DeleteTriggerAuthentication Deletes TriggerAuthentications

func (*Kube) GetActiveDeployment added in v1.15.0

func (kubeutil *Kube) GetActiveDeployment(ctx context.Context, namespace string) (*v1.RadixDeployment, error)

GetActiveDeployment Get active RadixDeployment for the namespace

func (*Kube) GetClusterActiveEgressIps added in v1.16.9

func (kubeutil *Kube) GetClusterActiveEgressIps(ctx context.Context) (string, error)

GetClusterActiveEgressIps Gets cluster active ips from config map in default namespace

func (*Kube) GetClusterName

func (kubeutil *Kube) GetClusterName(ctx context.Context) (string, error)

GetClusterName Gets the global name of the cluster from config map in default namespace

func (*Kube) GetClusterRole added in v1.4.2

func (kubeutil *Kube) GetClusterRole(ctx context.Context, name string) (*rbacv1.ClusterRole, error)

GetClusterRole Gets cluster role

func (*Kube) GetClusterRoleBinding added in v1.47.1

func (kubeutil *Kube) GetClusterRoleBinding(ctx context.Context, name string) (*rbacv1.ClusterRoleBinding, error)

GetClusterRoleBinding Gets cluster role binding

func (*Kube) GetConfigMap

func (kubeutil *Kube) GetConfigMap(ctx context.Context, namespace, name string) (*corev1.ConfigMap, error)

GetConfigMap Gets config map by name

func (*Kube) GetDeployment added in v1.5.17

func (kubeutil *Kube) GetDeployment(ctx context.Context, namespace, name string) (*appsv1.Deployment, error)

func (*Kube) GetEnvNamespacesForApp added in v1.57.15

func (kubeutil *Kube) GetEnvNamespacesForApp(ctx context.Context, appName string) ([]*corev1.Namespace, error)

GetEnvNamespacesForApp Get all env namespaces for an application

func (*Kube) GetEnvVarsConfigMapAndMetadataMap added in v1.15.0

func (kubeutil *Kube) GetEnvVarsConfigMapAndMetadataMap(ctx context.Context, namespace string, componentName string) (*corev1.ConfigMap, *corev1.ConfigMap, map[string]EnvVarMetadata, error)

GetEnvVarsConfigMapAndMetadataMap Get environment-variables config-map, environment-variables metadata config-map and metadata map from it

func (*Kube) GetEnvVarsMetadataConfigMapAndMap added in v1.15.0

func (kubeutil *Kube) GetEnvVarsMetadataConfigMapAndMap(ctx context.Context, namespace string, componentName string) (*corev1.ConfigMap, map[string]EnvVarMetadata, error)

GetEnvVarsMetadataConfigMapAndMap Get environment-variables metadata config-map and map from it

func (*Kube) GetEnvironment added in v1.5.5

func (kubeutil *Kube) GetEnvironment(ctx context.Context, name string) (*radixv1.RadixEnvironment, error)

GetEnvironment Gets environment using lister from cache if present

func (*Kube) GetIngress added in v1.47.0

func (kubeutil *Kube) GetIngress(ctx context.Context, namespace, name string) (*networkingv1.Ingress, error)

GetIngress Gets an ingress by its name

func (*Kube) GetOrCreateEnvVarsConfigMapAndMetadataMap added in v1.15.0

func (kubeutil *Kube) GetOrCreateEnvVarsConfigMapAndMetadataMap(ctx context.Context, namespace, appName, componentName string) (*corev1.ConfigMap, *corev1.ConfigMap, error)

GetOrCreateEnvVarsConfigMapAndMetadataMap Get environment variables and its metadata config-maps

func (*Kube) GetRadixAlert added in v1.16.0

func (kubeutil *Kube) GetRadixAlert(ctx context.Context, namespace, name string) (*v1.RadixAlert, error)

GetRadixAlert Gets radix alert using lister if present

func (*Kube) GetRadixBatch added in v1.43.2

func (kubeutil *Kube) GetRadixBatch(ctx context.Context, namespace, name string) (*v1.RadixBatch, error)

GetRadixBatch Gets batches using lister if present

func (*Kube) GetRadixDNSAlias added in v1.47.0

func (kubeutil *Kube) GetRadixDNSAlias(ctx context.Context, name string) (*radixv1.RadixDNSAlias, error)

GetRadixDNSAlias Gets RadixDNSAlias using lister if present

func (*Kube) GetRadixDNSAliasWithSelector added in v1.47.0

func (kubeutil *Kube) GetRadixDNSAliasWithSelector(ctx context.Context, labelSelectorString string) (*radixv1.RadixDNSAliasList, error)

GetRadixDNSAliasWithSelector Get RadixDNSAliases with selector

func (*Kube) GetRadixDeployment

func (kubeutil *Kube) GetRadixDeployment(ctx context.Context, namespace, name string) (*v1.RadixDeployment, error)

GetRadixDeployment Gets deployment using lister if present

func (*Kube) GetRadixDeploymentsForApp added in v1.57.15

func (kubeutil *Kube) GetRadixDeploymentsForApp(ctx context.Context, appName string, labelSelector string) ([]v1.RadixDeployment, error)

GetRadixDeploymentsForApp Get all Radix deployments for an application

func (*Kube) GetRegistration

func (kubeutil *Kube) GetRegistration(ctx context.Context, name string) (*v1.RadixRegistration, error)

GetRegistration Gets registration using lister if present

func (*Kube) GetRole added in v1.4.2

func (kubeutil *Kube) GetRole(ctx context.Context, namespace, name string) (*rbacv1.Role, error)

GetRole Gets role

func (*Kube) GetRoleBinding added in v1.5.2

func (kubeutil *Kube) GetRoleBinding(ctx context.Context, namespace, name string) (*rbacv1.RoleBinding, error)

GetRoleBinding Gets rolebinding

func (*Kube) GetScaledObject added in v1.55.0

func (kubeutil *Kube) GetScaledObject(ctx context.Context, namespace, name string) (*v1alpha1.ScaledObject, error)

GetScaledObject Gets an ScaledObject by its name

func (*Kube) GetSecret added in v1.4.3

func (kubeutil *Kube) GetSecret(ctx context.Context, namespace, name string) (*corev1.Secret, error)

GetSecret Get secret from cache, if lister exist

func (*Kube) GetSecretProviderClass added in v1.17.2

func (kubeutil *Kube) GetSecretProviderClass(ctx context.Context, namespace string, className string) (*secretsstorev1.SecretProviderClass, error)

GetSecretProviderClass Gets secret provider class

func (*Kube) GetServiceAccount added in v1.31.0

func (kubeutil *Kube) GetServiceAccount(ctx context.Context, namespace, name string) (*corev1.ServiceAccount, error)

func (*Kube) GetSubscriptionId added in v1.16.7

func (kubeutil *Kube) GetSubscriptionId(ctx context.Context) (string, error)

GetSubscriptionId Gets the subscription-id from config map in default namespace

func (*Kube) KubeClient added in v1.18.0

func (kubeutil *Kube) KubeClient() kubernetes.Interface

KubeClient Kubernetes client

func (*Kube) ListClusterRoleBindingsWithSelector added in v1.47.1

func (kubeutil *Kube) ListClusterRoleBindingsWithSelector(ctx context.Context, labelSelectorString string) ([]*rbacv1.ClusterRoleBinding, error)

ListClusterRoleBindingsWithSelector List cluster roles

func (*Kube) ListClusterRolesWithSelector added in v1.47.1

func (kubeutil *Kube) ListClusterRolesWithSelector(ctx context.Context, labelSelectorString string) ([]*rbacv1.ClusterRole, error)

ListClusterRolesWithSelector List cluster roles

func (*Kube) ListConfigMaps added in v1.23.4

func (kubeutil *Kube) ListConfigMaps(ctx context.Context, namespace string) ([]*corev1.ConfigMap, error)

ListConfigMaps Lists config maps in namespace

func (*Kube) ListConfigMapsWithSelector added in v1.31.8

func (kubeutil *Kube) ListConfigMapsWithSelector(ctx context.Context, namespace string, labelSelectorString string) ([]*corev1.ConfigMap, error)

ListConfigMapsWithSelector Get a list of ConfigMaps by Label requirements

func (*Kube) ListDeployments added in v1.4.2

func (kubeutil *Kube) ListDeployments(ctx context.Context, namespace string) ([]*appsv1.Deployment, error)

ListDeployments List deployments

func (*Kube) ListDeploymentsWithSelector added in v1.18.0

func (kubeutil *Kube) ListDeploymentsWithSelector(ctx context.Context, namespace, labelSelectorString string) ([]*appsv1.Deployment, error)

ListDeploymentsWithSelector List deployments with selector

func (*Kube) ListEnvVarsConfigMaps added in v1.23.4

func (kubeutil *Kube) ListEnvVarsConfigMaps(ctx context.Context, namespace string) ([]*corev1.ConfigMap, error)

ListEnvVarsConfigMaps Lists config maps which contain env vars

func (*Kube) ListEnvVarsMetadataConfigMaps added in v1.23.4

func (kubeutil *Kube) ListEnvVarsMetadataConfigMaps(ctx context.Context, namespace string) ([]*corev1.ConfigMap, error)

ListEnvVarsMetadataConfigMaps Lists config maps which contain metadata of env vars

func (*Kube) ListEnvironments added in v1.5.5

func (kubeutil *Kube) ListEnvironments(ctx context.Context) ([]*radixv1.RadixEnvironment, error)

ListEnvironments lists environments from cache if lister is present

func (*Kube) ListIngresses added in v1.4.0

func (kubeutil *Kube) ListIngresses(ctx context.Context, namespace string) ([]*networkingv1.Ingress, error)

ListIngresses lists ingresses

func (*Kube) ListIngressesWithSelector added in v1.4.0

func (kubeutil *Kube) ListIngressesWithSelector(ctx context.Context, namespace string, labelSelectorString string) ([]*networkingv1.Ingress, error)

ListIngressesWithSelector lists ingresses

func (*Kube) ListJobs added in v1.10.2

func (kubeutil *Kube) ListJobs(ctx context.Context, namespace string) ([]*batchv1.Job, error)

ListJobs Lists jobs from cache or from cluster

func (*Kube) ListJobsWithSelector added in v1.32.0

func (kubeutil *Kube) ListJobsWithSelector(ctx context.Context, namespace, labelSelectorString string) ([]*batchv1.Job, error)

ListJobsWithSelector List jobs with selector

func (*Kube) ListNamespacesWithSelector added in v1.57.15

func (kubeutil *Kube) ListNamespacesWithSelector(ctx context.Context, labelSelectorString string) ([]*corev1.Namespace, error)

ListNamespacesWithSelector List namespaces with selector

func (*Kube) ListPodDisruptionBudgets added in v1.21.9

func (kubeutil *Kube) ListPodDisruptionBudgets(ctx context.Context, namespace string) ([]*v1.PodDisruptionBudget, error)

ListPodDisruptionBudgets lists PodDisruptionBudgets

func (*Kube) ListRadixAlert added in v1.16.0

func (kubeutil *Kube) ListRadixAlert(ctx context.Context, namespace string) ([]*v1.RadixAlert, error)

ListRadixAlert Gets radix alerts using lister if present

func (*Kube) ListRadixBatches added in v1.43.2

func (kubeutil *Kube) ListRadixBatches(ctx context.Context, namespace string) ([]*v1.RadixBatch, error)

ListRadixBatches Gets batches using lister if present

func (*Kube) ListRadixDNSAlias added in v1.47.0

func (kubeutil *Kube) ListRadixDNSAlias(ctx context.Context) ([]*radixv1.RadixDNSAlias, error)

ListRadixDNSAlias List RadixDNSAliases using lister if present

func (*Kube) ListRadixDNSAliasWithSelector added in v1.47.0

func (kubeutil *Kube) ListRadixDNSAliasWithSelector(ctx context.Context, labelSelectorString string) ([]*radixv1.RadixDNSAlias, error)

ListRadixDNSAliasWithSelector List RadixDNSAliases with selector

func (*Kube) ListRadixDeployments

func (kubeutil *Kube) ListRadixDeployments(ctx context.Context, namespace string) ([]*v1.RadixDeployment, error)

ListRadixDeployments Gets deployments using lister if present

func (*Kube) ListRegistrations

func (kubeutil *Kube) ListRegistrations(ctx context.Context) ([]*v1.RadixRegistration, error)

ListRegistrations lists registrations

func (*Kube) ListRoleBindings added in v1.4.1

func (kubeutil *Kube) ListRoleBindings(ctx context.Context, namespace string) ([]*rbacv1.RoleBinding, error)

ListRoleBindings Lists role bindings from cache or from cluster

func (*Kube) ListRoleBindingsWithSelector added in v1.4.1

func (kubeutil *Kube) ListRoleBindingsWithSelector(ctx context.Context, namespace string, labelSelectorString string) ([]*rbacv1.RoleBinding, error)

ListRoleBindingsWithSelector Lists role bindings from cache or from cluster using a selector

func (*Kube) ListRoles added in v1.4.2

func (kubeutil *Kube) ListRoles(ctx context.Context, namespace string) ([]*rbacv1.Role, error)

ListRoles List roles

func (*Kube) ListRolesWithSelector added in v1.4.2

func (kubeutil *Kube) ListRolesWithSelector(ctx context.Context, namespace string, labelSelectorString string) ([]*rbacv1.Role, error)

ListRolesWithSelector List roles

func (*Kube) ListScaledObject added in v1.55.0

func (kubeutil *Kube) ListScaledObject(ctx context.Context, namespace string) ([]*v1alpha1.ScaledObject, error)

ListScaledObject lists ScaledObject

func (*Kube) ListScaledObjectWithSelector added in v1.55.0

func (kubeutil *Kube) ListScaledObjectWithSelector(ctx context.Context, namespace string, labelSelectorString string) ([]*v1alpha1.ScaledObject, error)

ListScaledObjectWithSelector lists ScaledObject

func (*Kube) ListSecretExistsForLabels added in v1.17.2

func (kubeutil *Kube) ListSecretExistsForLabels(ctx context.Context, namespace string, labelSelector string) ([]corev1.Secret, error)

ListSecretExistsForLabels Gets list of secrets for specific labels

func (*Kube) ListSecrets added in v1.4.3

func (kubeutil *Kube) ListSecrets(ctx context.Context, namespace string) ([]*corev1.Secret, error)

ListSecrets secrets in namespace

func (*Kube) ListSecretsWithSelector added in v1.4.3

func (kubeutil *Kube) ListSecretsWithSelector(ctx context.Context, namespace string, labelSelectorString string) ([]*corev1.Secret, error)

ListSecretsWithSelector secrets in namespace

func (*Kube) ListServiceAccounts added in v1.31.0

func (kubeutil *Kube) ListServiceAccounts(ctx context.Context, namespace string) ([]*corev1.ServiceAccount, error)

ListServiceAccounts List service accounts in namespace

func (*Kube) ListServiceAccountsWithSelector added in v1.31.0

func (kubeutil *Kube) ListServiceAccountsWithSelector(ctx context.Context, namespace string, labelSelectorString string) ([]*corev1.ServiceAccount, error)

ListServiceAccountsWithSelector List service accounts with selector in namespace

func (*Kube) ListServices added in v1.4.1

func (kubeutil *Kube) ListServices(ctx context.Context, namespace string) ([]*corev1.Service, error)

ListServices Lists services from cache or from cluster

func (*Kube) ListServicesWithSelector added in v1.18.0

func (kubeutil *Kube) ListServicesWithSelector(ctx context.Context, namespace, labelSelectorString string) ([]*corev1.Service, error)

ListServices Lists services from cache or from cluster

func (*Kube) ListTriggerAuthentications added in v1.55.0

func (kubeutil *Kube) ListTriggerAuthentications(ctx context.Context, namespace string) ([]*v1alpha1.TriggerAuthentication, error)

ListTriggerAuthentications lists TriggerAuths

func (*Kube) ListTriggerAuthenticationsWithSelector added in v1.55.0

func (kubeutil *Kube) ListTriggerAuthenticationsWithSelector(ctx context.Context, namespace string, labelSelectorString string) ([]*v1alpha1.TriggerAuthentication, error)

ListTriggerAuthenticationsWithSelector lists TriggerAuths

func (*Kube) ListUserDefinedNetworkPolicies added in v1.19.0

func (kubeutil *Kube) ListUserDefinedNetworkPolicies(ctx context.Context, appName string, env string) (*v1.NetworkPolicyList, error)

ListUserDefinedNetworkPolicies Returns list of user defined network policies

func (*Kube) PatchIngress added in v1.47.0

func (kubeutil *Kube) PatchIngress(ctx context.Context, namespace string, oldIngress *networkingv1.Ingress, newIngress *networkingv1.Ingress) (*networkingv1.Ingress, error)

PatchIngress Patches an ingress, if there are changes

func (*Kube) PatchScaledObject added in v1.55.0

func (kubeutil *Kube) PatchScaledObject(ctx context.Context, namespace string, oldScaledObject *v1alpha1.ScaledObject, newScaledObject *v1alpha1.ScaledObject) (*v1alpha1.ScaledObject, error)

PatchScaledObject Patches an ScaledObject, if there are changes

func (*Kube) PatchTriggerAuthentication added in v1.55.0

func (kubeutil *Kube) PatchTriggerAuthentication(ctx context.Context, namespace string, oldAuth *v1alpha1.TriggerAuthentication, newAuthAuth *v1alpha1.TriggerAuthentication) (*v1alpha1.TriggerAuthentication, error)

PatchTriggerAuthentication Patches an TriggerAuthentication, if there are changes

func (*Kube) RadixClient added in v1.19.7

func (kubeutil *Kube) RadixClient() radixclient.Interface

RadixClient Radix Kubernetes CRD client

func (*Kube) SecretExists

func (kubeutil *Kube) SecretExists(ctx context.Context, namespace, secretName string) bool

SecretExists Checks if secret already exists

func (*Kube) UpdateConfigMap added in v1.15.0

func (kubeutil *Kube) UpdateConfigMap(ctx context.Context, original, modified *corev1.ConfigMap) (*corev1.ConfigMap, error)

UpdateConfigMap updates the `modified` configmap. If `original` is set, the two configmaps are compared, and the secret is only updated if they are not equal.

func (*Kube) UpdatePodDisruptionBudget added in v1.21.9

func (kubeutil *Kube) UpdatePodDisruptionBudget(ctx context.Context, namespace string, pdb *v1.PodDisruptionBudget) error

UpdatePodDisruptionBudget will update PodDisruptionBudgets in provided namespace

func (*Kube) UpdateRadixDNSAlias added in v1.47.0

func (kubeutil *Kube) UpdateRadixDNSAlias(ctx context.Context, radixDNSAlias *radixv1.RadixDNSAlias) error

UpdateRadixDNSAlias Update RadixDNSAlias

func (*Kube) UpdateRadixEnvironment added in v1.47.0

func (kubeutil *Kube) UpdateRadixEnvironment(ctx context.Context, radixEnvironment *radixv1.RadixEnvironment) (*radixv1.RadixEnvironment, error)

UpdateRadixEnvironment Updates changes of RadixEnvironment if any

func (*Kube) UpdateSecret added in v1.57.14

func (kubeutil *Kube) UpdateSecret(ctx context.Context, original, modified *corev1.Secret) (*corev1.Secret, error)

UpdateSecret updates the `modified` secret. If `original` is set, the two secrets are compared, and the secret is only updated if they are not equal.

type PodSecurityLevel added in v1.24.0

type PodSecurityLevel string
const (
	PrivilegedLevel PodSecurityLevel = "privileged"
	BaselineLevel   PodSecurityLevel = "baseline"
	RestrictedLevel PodSecurityLevel = "restricted"
)

type PodSecurityStandard added in v1.24.0

type PodSecurityStandard struct {
	// contains filtered or unexported fields
}

PodSecurityStandard defines methods to build pod security standard labels. See https://kubernetes.io/docs/concepts/security/pod-security-standards/

func NewAppNamespacePodSecurityStandardFromEnv added in v1.41.6

func NewAppNamespacePodSecurityStandardFromEnv() *PodSecurityStandard

NewAppNamespacePodSecurityStandardFromEnv builds pod security standard for app namespaces from environment variables

func NewEnvNamespacePodSecurityStandardFromEnv added in v1.41.6

func NewEnvNamespacePodSecurityStandardFromEnv() *PodSecurityStandard

NewEnvNamespacePodSecurityStandardFromEnv builds pod security standard for env namespaces from environment variables

func (*PodSecurityStandard) Audit added in v1.24.0

func (pss *PodSecurityStandard) Audit(level PodSecurityLevel, version string)

Audit pod policy violations. Policy violations will trigger the addition of an audit annotation to the event recorded in the audit log, but are otherwise allowed.

func (*PodSecurityStandard) Enforce added in v1.24.0

func (pss *PodSecurityStandard) Enforce(level PodSecurityLevel, version string)

Enforce policy Policy violations will cause the pod to be rejected.

func (*PodSecurityStandard) Labels added in v1.24.0

func (pss *PodSecurityStandard) Labels() map[string]string

Labels returns labels that will enforce pod security standard when applied on a namespace

func (*PodSecurityStandard) Warn added in v1.24.0

func (pss *PodSecurityStandard) Warn(level PodSecurityLevel, version string)

Warn triggers a user-facing warning (e.g. kubectl) when a pod violates the policy

type RadixBatchType added in v1.32.1

type RadixBatchType string

RadixBatchType defines value for use with label RadixBatchTypeLabel

const (
	RadixBatchTypeJob   RadixBatchType = "job"
	RadixBatchTypeBatch RadixBatchType = "batch"
)

type RadixConfigMapType added in v1.15.0

type RadixConfigMapType string

RadixConfigMapType Purpose of ConfigMap

const (
	// EnvVarsConfigMap ConfigMap contains environment variables
	EnvVarsConfigMap RadixConfigMapType = "env-vars"
	// EnvVarsMetadataConfigMap ConfigMap contains environment variables metadata
	EnvVarsMetadataConfigMap RadixConfigMapType = "env-vars-metadata"
	// RadixPipelineResultConfigMap Label of a ConfigMap, which keeps a Radix pipeline result
	RadixPipelineResultConfigMap RadixConfigMapType = "radix-pipeline-result"
)

type RadixSecretType added in v1.39.6

type RadixSecretType string

RadixSecretType defines value for use with label RadixSecretTypeLabel

const (
	// RadixSecretJobPayload Used by radix-job-scheduler to label secrets with payloads
	RadixSecretJobPayload RadixSecretType = "scheduler-job-payload"
)

type RuleBuilder added in v1.20.3

type RuleBuilder func() rbacv1.PolicyRule

func ManageSecretsRule added in v1.20.3

func ManageSecretsRule(secretNames []string) RuleBuilder

func ReadSecretsRule added in v1.39.3

func ReadSecretsRule(secretNames []string) RuleBuilder

type SecretProviderClassParameterObject added in v1.17.2

type SecretProviderClassParameterObject struct {
	// Name. Name of the Azure Key Vault object
	Name string `json:"objectName" yaml:"objectName"`
	// Type. Type of the Azure KeyVault object: secret, key, cert
	Type string `json:"objectType" yaml:"objectType"`
	// Alias. Optional. Specify the filename of the object when written to disk. Defaults to objectName if not provided.
	Alias string `json:"objectAlias,omitempty" yaml:"objectAlias,omitempty"`
	// Version. Optional. object versions, default to the latest if empty
	Version string `json:"objectVersion,omitempty" yaml:"objectVersion,omitempty"`
	// Format. Optional. The format of the Azure Key Vault object, supported types are pem and pfx. objectFormat: pfx is only supported with objectType: secret and PKCS12 or ECC certificates. Default format for certificates is pem.
	Format string `json:"objectFormat,omitempty" yaml:"objectFormat,omitempty"`
	// Encoding. Optional. Setting object encoding to base64 and object format to pfx will fetch and write the base64 decoded pfx binary
	Encoding string `json:"objectEncoding,omitempty" yaml:"objectEncoding,omitempty"`
}

SecretProviderClassParameterObject Object for SecretProviderClass parameters

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL