kube

package
v3.9.3 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 19 Imported by: 85

Documentation

Index

Constants

View Source
const (
	// DefaultNamespace the standard namespace for Jenkins X
	DefaultNamespace = "jx"

	// PodNamespaceFile the file path and name for pod namespace
	PodNamespaceFile = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"
)
View Source
const (
	// ServiceJenkins is the name of the Jenkins Service
	ServiceJenkins = "jenkins"

	// ServiceChartMuseum the service name of the Helm ChartMuseum service
	ServiceChartMuseum = "jenkins-x-chartmuseum"

	// SecretJenkinsChartMuseum the chart museum secret
	SecretJenkinsChartMuseum = "jenkins-x-chartmuseum"

	// SecretBucketRepo the bucket repo secret if using it as a chart repositoru
	SecretBucketRepo = "jenkins-x-bucketrepo"

	// LocalHelmRepoName is the default name of the local chart repository where CI/CD releases go to
	LocalHelmRepoName = "releases"

	// LabelTeam indicates the team name an environment belongs to
	LabelTeam = "team"

	// LabelEnvironment indicates the name of the environment
	LabelEnvironment = "env"

	// LabelValueDevEnvironment is the value of the LabelTeam label for Development environments (system namespace)
	LabelValueDevEnvironment = "dev"

	// AnnotationHost used to indicate the host if using NodePort Ingress resources on premise without a LoadBalancer
	AnnotationHost = "jenkins.io/host"

	// SecretBasicAuth the name for the Jenkins X basic auth secret
	SecretBasicAuth = "jx-basic-auth" // #nosec
)

Variables

This section is empty.

Functions

func AddUserToConfig

func AddUserToConfig(user string, token string, config *api.Config) (*api.Config, error)

AddUserToConfig adds the given user to the config

func CertificateAuthorityData

func CertificateAuthorityData(config *api.Config, context *api.Context) []byte

CertificateAuthorityData returns the certificate authority data for the given context

func Cluster

func Cluster(config *api.Config) string

Cluster returns the cluster of the given config

func CurrentCluster

func CurrentCluster(config *api.Config) (string, *api.Cluster)

CurrentCluster returns the current cluster

func CurrentContext

func CurrentContext(config *api.Config) *api.Context

CurrentContext returns the current context

func CurrentContextName

func CurrentContextName(config *api.Config) string

CurrentContextName returns the current context name

func CurrentNamespace

func CurrentNamespace(config *api.Config) string

CurrentNamespace returns the current namespace in the context

func CurrentServer

func CurrentServer(config *api.Config) string

CurrentServer returns the current context's server

func IsInCluster

func IsInCluster() bool

IsInCluster tells if we are running incluster

func IsNoKubernetes added in v3.0.48

func IsNoKubernetes() bool

IsNoKubernetes returns true if we are inside a GitHub Action or not using kubernetes

func LazyCreateDynamicClient

func LazyCreateDynamicClient(client dynamic.Interface) (dynamic.Interface, error)

LazyCreateDynamicClient lazily creates the dynamic client if its not defined

func LazyCreateKubeClient

func LazyCreateKubeClient(client kubernetes.Interface) (kubernetes.Interface, error)

LazyCreateKubeClient lazy creates the kube client if its not defined

func LazyCreateKubeClientAndNamespace

func LazyCreateKubeClientAndNamespace(client kubernetes.Interface, ns string) (kubernetes.Interface, string, error)

LazyCreateKubeClientAndNamespace lazy creates the kube client and/or the current namespace if not already defined

func LazyCreateKubeClientWithMandatory added in v3.0.66

func LazyCreateKubeClientWithMandatory(client kubernetes.Interface, mandatory bool) (kubernetes.Interface, error)

LazyCreateKubeClientWithMandatory if mandatory is specified then the env vars are ignored to determine if we use kubernetes or not

func LoadConfig

func LoadConfig() (*api.Config, *clientcmd.PathOptions, error)

LoadConfig loads the Kubernetes configuration

func NewFakeKubernetesClient added in v3.0.56

func NewFakeKubernetesClient(ns string) *fake.Clientset

NewFakeKubernetesClient creates a fake k8s client if we have disabled kubernetes

func Server

func Server(config *api.Config, context *api.Context) string

Server returns the server of the given context

func SortListWatchByName

func SortListWatchByName(listWatch *cache.ListWatch)

func SortRuntimeObjectsByName

func SortRuntimeObjectsByName(objects []runtime.Object)

func ToMetaTime added in v3.0.26

func ToMetaTime(t *time.Time) *metav1.Time

ToMetaTime converts the go time pointer to a meta time

func UpdateConfig

func UpdateConfig(namespace string, server string, caData string, user string, token string) error

UpdateConfig defines new config entries for jx

Types

type ByName

type ByName []runtime.Object

func (ByName) Len

func (a ByName) Len() int

func (ByName) Less

func (a ByName) Less(i, j int) bool

func (ByName) Swap

func (a ByName) Swap(i, j int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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