k8s

package
v0.0.0-...-a0d9de1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDynamicClient

func BuildDynamicClient(bbConfig *bbConfig.GlobalConfiguration) (dynamic.Interface, error)

BuildDynamicClientFromFlags is a helper function that builds a dynamic client used to interact with the k8s cluster.

func BuildKubeConfig

func BuildKubeConfig(bbConfig *bbConfig.GlobalConfiguration) (*restClient.Config, error)

BuildKubeConfigFromFlags is a helper function that builds a config object used to interact with the k8s cluster. The configuration is sourced in the following order:

Read config from file specified using --kubeconfig flag Read config from file(s) specified using KUBECONFIG env variable Read config from default location at $HOME/.kube/config

If all these steps fail, fallback to default kubernetes config mechanism.

func CreateJob

func CreateJob(client kubernetes.Interface, namespace string, jobDesc *JobDesc) (*batchV1.Job, error)

CreateJob function creates a new k8s job and deploys it into the cluster using the given parameters

Returns the job and an error if there were any issues creating the job

func CreateNamespace

func CreateNamespace(k8sInterface kubernetes.Interface, namespace string) (*coreV1.Namespace, error)

CreateNamespace creates a new namespace in the k8s cluster using the given parameters

Returns the namespace and an error if there were any issues creating the namespace

func CreateRegistrySecret

func CreateRegistrySecret(k8sInterface kubernetes.Interface, namespace string, name string, server string, username string, password string) (*coreV1.Secret, error)

CreateRegistrySecret creates a new secret for docker registry credentials and deploys it into a k8s cluster using the given parameters

Returns a nil secret and an error if there were any issues creating the secret

func DeleteNamespace

func DeleteNamespace(k8sInterface kubernetes.Interface, namespace string) error

DeleteNamespace deletes a namespace in the k8s cluster using the given parameters

Returns an error if there were any issues deleting the namespace

func DeleteRegistrySecret

func DeleteRegistrySecret(k8sInterface kubernetes.Interface, namespace string, name string) error

DeleteRegistrySecret deletes docker registry secret

Returns an error if there were any issues deleting the secret

func GetKubeConfigFromPathList

func GetKubeConfigFromPathList(configPaths string) (*restClient.Config, error)

GetKubeConfigFromPathList is a helper function that builds config object used to interact with the k8s cluster using a list of kubeconfig file(s)

Types

type DockerConfig

type DockerConfig map[string]DockerConfigEntry

DockerConfig represents the config file used by the docker CLI. This config is mapping of reqistry server URIs to the credentials that can be used to pull images from them

type DockerConfigEntry

type DockerConfigEntry struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty" datapolicy:"password"`
	Auth     string `json:"auth,omitempty" datapolicy:"token"`
}

DockerConfigEntry holds user auth information that grants access to a docker registry

type DockerConfigJSON

type DockerConfigJSON struct {
	Authorizations DockerConfig `json:"auths" datapolicy:"token"`
	// +optional
	HTTPHeaders map[string]string `json:"HttpHeaders,omitempty" datapolicy:"token"`
}

DockerConfigJSON represents a local docker auth config file for pulling images.

type JobDesc

type JobDesc struct {
	Name               string
	ContainerName      string
	ContainerImage     string
	ImagePullSecret    string
	Command            []string
	Args               []string
	TTLSecondsOnFinish int32
}

JobDesc contains all the information needed to create a new k8s Job object in a cluster using the CreateJob function

Jump to

Keyboard shortcuts

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