kube

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: MIT Imports: 22 Imported by: 29

Documentation

Index

Constants

View Source
const (
	RadixBranchAnnotation = "radix-branch"

	// 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 (
	RadixAppLabel                = "radix-app"
	RadixEnvLabel                = "radix-env"
	RadixComponentLabel          = "radix-component"
	RadixJobNameLabel            = "radix-job-name"
	RadixBuildLabel              = "radix-build"
	RadixCommitLabel             = "radix-commit"
	RadixImageTagLabel           = "radix-image-tag"
	RadixJobTypeLabel            = "radix-job-type"
	RadixJobTypeBuild            = "build"
	RadixAppAliasLabel           = "radix-app-alias"
	RadixExternalAliasLabel      = "radix-app-external-alias"
	RadixActiveClusterAliasLabel = "radix-app-active-cluster-alias"

	// Only for backward compatibility
	RadixBranchDeprecated = "radix-branch"
)

Radix Labels

Variables

This section is empty.

Functions

func GetRoleBindingGroups

func GetRoleBindingGroups(groups []string) []auth.Subject

GetRoleBindingGroups Get subjects for list of ad groups

Types

type Kube

type Kube struct {
	RrLister        v1Lister.RadixRegistrationLister
	RdLister        v1Lister.RadixDeploymentLister
	NamespaceLister coreListers.NamespaceLister
	// contains filtered or unexported fields
}

Kube Stuct for accessing lower level kubernetes functions

func New

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

New Constructor

func NewWithListers

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

NewWithListers Constructor

func (*Kube) ApplyClusterRole

func (k *Kube) ApplyClusterRole(clusterrole *auth.ClusterRole) error

ApplyClusterRole Creates or updates cluster-role

func (*Kube) ApplyClusterRoleBinding

func (k *Kube) ApplyClusterRoleBinding(clusterrolebinding *auth.ClusterRoleBinding) error

ApplyClusterRoleBinding Creates or updates cluster-role-binding

func (*Kube) ApplyClusterRoleToServiceAccount

func (k *Kube) ApplyClusterRoleToServiceAccount(roleName string, serviceAccount *corev1.ServiceAccount, ownerReference []metav1.OwnerReference) error

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

func (*Kube) ApplyDeployment

func (kube *Kube) ApplyDeployment(namespace string, deployment *v1beta1.Deployment) error

ApplyDeployment Create or update deployment in provided namespace

func (*Kube) ApplyIngress

func (kube *Kube) ApplyIngress(namespace string, ingress *v1beta1.Ingress) error

ApplyIngress Will create or update ingress in provided namespace

func (*Kube) ApplyLimitRange

func (k *Kube) ApplyLimitRange(namespace string, limitRange *corev1.LimitRange) error

ApplyLimitRange Applies limit range to namespace

func (*Kube) ApplyNamespace

func (kube *Kube) ApplyNamespace(name string, labels map[string]string, ownerRefs []metav1.OwnerReference) error

ApplyNamespace Creates a new namespace, if not exists allready

func (*Kube) ApplyRole

func (k *Kube) ApplyRole(namespace string, role *auth.Role) error

ApplyRole Creates or updates role

func (*Kube) ApplyRoleBinding

func (k *Kube) ApplyRoleBinding(namespace string, rolebinding *auth.RoleBinding) error

ApplyRoleBinding Creates or updates role-binding

func (*Kube) ApplySecret

func (k *Kube) ApplySecret(namespace string, secret *corev1.Secret) (*corev1.Secret, error)

ApplySecret Creates or updates secret to namespace

func (*Kube) ApplyServiceAccount

func (kube *Kube) ApplyServiceAccount(serviceAccountName, namespace string) (*corev1.ServiceAccount, error)

ApplyServiceAccount Creates or updates service account

func (*Kube) BuildLimitRange

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

BuildLimitRange Builds a limit range spec

func (*Kube) GetClusterName

func (kube *Kube) GetClusterName() (string, error)

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

func (*Kube) GetConfigMap

func (kube *Kube) GetConfigMap(namespace, name string) (*corev1.ConfigMap, error)

GetConfigMap Gets config map by name

func (*Kube) GetContainerRegistry

func (kube *Kube) GetContainerRegistry() (string, error)

GetContainerRegistry Gets the container registry from config map in default namespace

func (*Kube) GetRadixDeployment

func (kube *Kube) GetRadixDeployment(namespace, name string) (*v1.RadixDeployment, error)

GetRadixDeployment Gets deployment using lister if present

func (*Kube) GetRegistration

func (kube *Kube) GetRegistration(name string) (*v1.RadixRegistration, error)

GetRegistration Gets registration using lister if present

func (*Kube) ListRadixDeployments

func (kube *Kube) ListRadixDeployments(namespace string) ([]*v1.RadixDeployment, error)

ListRadixDeployments Gets deployments using lister if present

func (*Kube) ListRegistrations

func (kube *Kube) ListRegistrations() ([]*v1.RadixRegistration, error)

ListRegistrations lists registrations

func (*Kube) SecretExists

func (k *Kube) SecretExists(namespace, secretName string) bool

SecretExists Checks if secret allready exists

type NamespaceWatcher

type NamespaceWatcher interface {
	WaitFor(namespace string) error
}

NamespaceWatcher Watcher to wait for namespace to be created

type NamespaceWatcherImpl

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

NamespaceWatcherImpl Implementation of watcher

func NewNamespaceWatcherImpl

func NewNamespaceWatcherImpl(client kubernetes.Interface) NamespaceWatcherImpl

NewNamespaceWatcherImpl Constructor

func (NamespaceWatcherImpl) WaitFor

func (watcher NamespaceWatcherImpl) WaitFor(namespace string) error

WaitFor Waits for namespace to appear

Jump to

Keyboard shortcuts

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