kommons

package module
v0.31.5 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 70 Imported by: 65

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CoreAPIGroups = []string{
	"admissionregistration.k8s.io",
	"apiextensions.k8s.io",
	"apiregistration.k8s.io",
	"apps",
	"authentication.k8s.io",
	"authorization.k8s.io",
	"autoscaling",
	"batch",
	"certificates.k8s.io",
	"coordination.k8s.io",
	"discovery.k8s.io",
	"events.k8s.io",
	"extensions",
	"flowcontrol.apiserver.k8s.io",
	"networking.k8s.io",
	"node.k8s.io",
	"policy",
	"rbac.authorization.k8s.io",
	"scheduling.k8s.io",
	"storage.k8s.io",
}
View Source
var KustomizedLabel = "kustomize/patched"
View Source
var (
	TrivialTypes = map[string]IsType{
		"Canary":                IsCanary,
		"ClusterRole":           IsClusterRole,
		"ClusterRoleBinding":    IsClusterRoleBinding,
		"ConfigMap":             IsConfigMap,
		"CronJob":               IsCronJob,
		"Ingress":               IsIngress,
		"PersistentVolumeClaim": IsPVC,
		"Role":                  IsRole,
		"RoleBinding":           IsRoleBinding,
		"Secret":                IsSecret,
	}
)

Functions

func AsClusterRoleBinding

func AsClusterRoleBinding(obj *unstructured.Unstructured) (*rbac.ClusterRoleBinding, error)

func AsDaemonSet

func AsDaemonSet(obj *unstructured.Unstructured) (*appsv1.DaemonSet, error)

func AsDeployment

func AsDeployment(obj *unstructured.Unstructured) (*appsv1.Deployment, error)

func AsIngress

func AsIngress(obj *unstructured.Unstructured) (*networking.Ingress, error)

func AsPodTemplate

func AsPodTemplate(obj *unstructured.Unstructured) (*v1.PodTemplateSpec, error)

func AsRoleBinding

func AsRoleBinding(obj *unstructured.Unstructured) (*rbac.RoleBinding, error)

func AsSecret

func AsSecret(obj *unstructured.Unstructured) (*v1.Secret, error)

func AsService

func AsService(obj *unstructured.Unstructured) (*v1.Service, error)

func AsStatefulSet

func AsStatefulSet(obj *unstructured.Unstructured) (*appsv1.StatefulSet, error)

func CreateKubeConfig

func CreateKubeConfig(clusterName string, ca certs.CertificateAuthority, endpoint string, group string, user string, expiry time.Duration) ([]byte, error)

func CreateMultiKubeConfig

func CreateMultiKubeConfig(ca certs.CertificateAuthority, clusters map[string]string, group string, user string, expiry time.Duration) ([]byte, error)

CreateMultiKubeConfig creates a kubeconfig file contents for a map of cluster name -> cluster API endpoint hosts, all with a shared user name, group and cert expiry. NOTE: these clusters all need to share the same plaform CA

func CreateOIDCKubeConfig

func CreateOIDCKubeConfig(clusterName string, ca certs.CertificateAuthority, endpoint, idpURL, idToken, accessToken, refreshToken string) ([]byte, error)

func DefaultSubjects

func DefaultSubjects(subjects []rbac.Subject) []rbac.Subject

func DefaultsClusterRoleBinding

func DefaultsClusterRoleBinding(rb *rbac.ClusterRoleBinding) *rbac.ClusterRoleBinding

func DefaultsContainer

func DefaultsContainer(container v1.Container) v1.Container

func DefaultsContainers

func DefaultsContainers(containers []v1.Container) []v1.Container

func DefaultsDaemonSet

func DefaultsDaemonSet(daemeonset *appsv1.DaemonSet) *appsv1.DaemonSet

func DefaultsDeployment

func DefaultsDeployment(deploy *appsv1.Deployment) *appsv1.Deployment

func DefaultsPod

func DefaultsPod(pod v1.PodTemplateSpec) v1.PodTemplateSpec

func DefaultsProbe

func DefaultsProbe(probe *v1.Probe) *v1.Probe

func DefaultsRoleBinding

func DefaultsRoleBinding(rb *rbac.RoleBinding) *rbac.RoleBinding

func DefaultsService

func DefaultsService(svc *v1.Service) *v1.Service

func DefaultsStatefulSet

func DefaultsStatefulSet(sts *appsv1.StatefulSet) *appsv1.StatefulSet

func Diff

func Diff(from, to *unstructured.Unstructured) string

func GetContainerStatus

func GetContainerStatus(pod v1.Pod) string

func GetCurrentClusterNameFrom

func GetCurrentClusterNameFrom(kubeConfigPath string) string

GetCurrentClusterNameFrom returns the name of the cluster associated with the currentContext of the specified kubeconfig file

func GetDNS1192Name added in v0.21.0

func GetDNS1192Name(s string) string

GetDNS1192Name trasforms a name into a DNS-1192 compliant name

func GetLastRestartTime

func GetLastRestartTime(pod v1.Pod) *time.Time

func GetNodeStatus

func GetNodeStatus(node v1.Node) string

func GetOwner

func GetOwner(pod v1.Pod) string

func GetPodStatus

func GetPodStatus(pod v1.Pod) string

func GetUnstructuredObjects

func GetUnstructuredObjects(data []byte) ([]*unstructured.Unstructured, error)

func GetUnstructuredObjectsFromJson added in v0.20.1

func GetUnstructuredObjectsFromJson(data []byte) ([]*unstructured.Unstructured, error)

func GetValidName

func GetValidName(name string) string

func HasTaint

func HasTaint(node v1.Node, name string) bool

func IsAPIResourceMissing added in v0.4.9

func IsAPIResourceMissing(err error) bool

func IsAnyRoleBinding

func IsAnyRoleBinding(obj *unstructured.Unstructured) bool

func IsApp

func IsApp(obj *unstructured.Unstructured) bool

IsApp returns true if the obj is a Deployment, Statetefulset or DaemonSet

func IsAppReady

func IsAppReady(item *unstructured.Unstructured) (bool, string)

func IsBuilder added in v0.12.0

func IsBuilder(obj *unstructured.Unstructured) bool

func IsBuilderReady added in v0.12.0

func IsBuilderReady(item *unstructured.Unstructured) (bool, string)

func IsCanary added in v0.7.2

func IsCanary(obj *unstructured.Unstructured) bool

func IsClusterRole

func IsClusterRole(obj *unstructured.Unstructured) bool

func IsClusterRoleBinding

func IsClusterRoleBinding(obj *unstructured.Unstructured) bool

func IsConfigMap

func IsConfigMap(obj *unstructured.Unstructured) bool

func IsConstraintTemplate

func IsConstraintTemplate(obj *unstructured.Unstructured) bool

func IsCronJob added in v0.7.2

func IsCronJob(obj *unstructured.Unstructured) bool

func IsCustomResourceDefinition

func IsCustomResourceDefinition(obj *unstructured.Unstructured) bool

func IsCustomResourceDefinitionV1Beta1

func IsCustomResourceDefinitionV1Beta1(obj *unstructured.Unstructured) bool

func IsDaemonSet

func IsDaemonSet(obj *unstructured.Unstructured) bool

func IsDataContainerReady added in v0.14.0

func IsDataContainerReady(item *unstructured.Unstructured) (bool, string)

func IsDeleted

func IsDeleted(object metav1.Object) bool

func IsDeployment

func IsDeployment(obj *unstructured.Unstructured) bool

func IsDeploymentReady added in v0.7.2

func IsDeploymentReady(d *appsv1.Deployment) (bool, string)

func IsDiffable

func IsDiffable(obj *unstructured.Unstructured) bool

func IsElasticReady

func IsElasticReady(item *unstructured.Unstructured) (bool, string)

func IsElasticsearch added in v0.7.2

func IsElasticsearch(obj *unstructured.Unstructured) bool

func IsImage added in v0.12.0

func IsImage(obj *unstructured.Unstructured) bool

func IsImageReady added in v0.12.0

func IsImageReady(item *unstructured.Unstructured) (bool, string)

func IsIngress

func IsIngress(obj *unstructured.Unstructured) bool

func IsKafka added in v0.14.0

func IsKafka(obj *unstructured.Unstructured) bool

func IsKibana added in v0.7.2

func IsKibana(obj *unstructured.Unstructured) bool

func IsKustomized

func IsKustomized(to *unstructured.Unstructured) bool

func IsMasterNode

func IsMasterNode(node v1.Node) bool

func IsMongoDB added in v0.8.0

func IsMongoDB(obj *unstructured.Unstructured) bool

func IsNil

func IsNil(object runtime.Object) bool

func IsNode added in v0.27.0

func IsNode(obj *unstructured.Unstructured) bool

func IsNodeReady added in v0.27.0

func IsNodeReady(item *unstructured.Unstructured) (bool, string)

func IsPVC

func IsPVC(obj *unstructured.Unstructured) bool

func IsPod added in v0.30.2

func IsPod(obj *unstructured.Unstructured) bool

func IsPodCrashLoopBackoff

func IsPodCrashLoopBackoff(pod v1.Pod) bool

func IsPodDaemonSet

func IsPodDaemonSet(pod v1.Pod) bool

func IsPodFinished

func IsPodFinished(pod v1.Pod) bool

func IsPodHealthy

func IsPodHealthy(pod v1.Pod) bool

func IsPodPending

func IsPodPending(pod v1.Pod) bool

func IsPodReady

func IsPodReady(pod v1.Pod) bool

func IsPodReadyAndRunning added in v0.30.2

func IsPodReadyAndRunning(item *unstructured.Unstructured) (bool, string)

func IsPostgresql added in v0.7.2

func IsPostgresql(obj *unstructured.Unstructured) bool

func IsPostgresqlDB added in v0.11.2

func IsPostgresqlDB(obj *unstructured.Unstructured) bool

func IsRedisFailover added in v0.7.2

func IsRedisFailover(obj *unstructured.Unstructured) bool

func IsRole

func IsRole(obj *unstructured.Unstructured) bool

func IsRoleBinding

func IsRoleBinding(obj *unstructured.Unstructured) bool

func IsSecret

func IsSecret(obj *unstructured.Unstructured) bool

func IsService

func IsService(obj *unstructured.Unstructured) bool

func IsServiceAccount

func IsServiceAccount(obj *unstructured.Unstructured) bool

func IsServiceReady added in v0.14.0

func IsServiceReady(item *unstructured.Unstructured, client *Client) (bool, string)

func IsStatefulSet

func IsStatefulSet(obj *unstructured.Unstructured) bool

func IsStatefulSetReady added in v0.7.2

func IsStatefulSetReady(sts *appsv1.StatefulSet) (bool, string)

func IsStaticPod

func IsStaticPod(pod v1.Pod) bool

IsStaticPod returns true if the pod is static i.e. declared in /etc/kubernetes/manifests and read directly by the kubelet

func LowResourceRequirements

func LowResourceRequirements() v1.ResourceRequirements

func NewCommandJob

func NewCommandJob(node, command string) v1.PodSpec

func NewDeployment

func NewDeployment(ns, name, image string, labels map[string]string, port int32, args ...string) *apps.Deployment

func NewObjectMeta

func NewObjectMeta(ns, name string) metav1.ObjectMeta

func RemoveTaint

func RemoveTaint(taints []v1.Taint, name string) []v1.Taint

func RequiresReplacement

func RequiresReplacement(obj *unstructured.Unstructured, err error) bool

func Sanitize

func Sanitize(objects ...*unstructured.Unstructured)

Sanitize will remove "runtime" fields from objects that woulds otherwise increase the verbosity of diffs

func SetAnnotation

func SetAnnotation(obj *unstructured.Unstructured, key string, value string)

func StripIdentifiers

func StripIdentifiers(object *unstructured.Unstructured) *unstructured.Unstructured

func TestDaemonSet

func TestDaemonSet(client kubernetes.Interface, ns string, name string, t *console.TestResults)

func TestDeploy

func TestDeploy(client kubernetes.Interface, ns string, deploymentName string, t *console.TestResults)

func TestNamespace

func TestNamespace(client kubernetes.Interface, ns string, t *console.TestResults)

func TestPod

func TestPod(testName string, client kubernetes.Interface, events typedv1.EventInterface, pod v1.Pod) error

func TestPodsByLabels

func TestPodsByLabels(client kubernetes.Interface, testName string, ns string, labelMap map[string]string, t *console.TestResults)

func TestStatefulSet added in v0.30.0

func TestStatefulSet(client kubernetes.Interface, ns string, name string, t *console.TestResults)

func ToJson

func ToJson(to *unstructured.Unstructured) string

func ToUnstructured

func ToUnstructured(unstructuredObj *unstructured.Unstructured, obj interface{}) (*unstructured.Unstructured, error)

func ToYaml

func ToYaml(to *unstructured.Unstructured) string

func UnwrapError added in v0.4.9

func UnwrapError(err error) string

func Validate

func Validate(object runtime.Object) error

Types

type ApplyHook

type ApplyHook func(namespace string, obj unstructured.Unstructured)

type Builder

type Builder struct {
	Objects     []runtime.Object
	Namespace   string
	Labels      map[string]string
	Annotations map[string]string
}

func (*Builder) AddAnnotations

func (b *Builder) AddAnnotations(annotations map[string]string) *Builder

func (*Builder) AddLabels

func (b *Builder) AddLabels(labels map[string]string) *Builder

func (*Builder) Append

func (b *Builder) Append(objects ...runtime.Object) *Builder

func (*Builder) ConfigMap

func (b *Builder) ConfigMap(name string, data map[string]string) *Builder

func (*Builder) Deployment

func (b *Builder) Deployment(name, image string) *DeploymentBuilder

func (*Builder) ObjectMeta

func (b *Builder) ObjectMeta(name string) metav1.ObjectMeta

func (*Builder) Secret

func (b *Builder) Secret(name string, data map[string][]byte) *Builder

func (*Builder) ServiceAccount

func (b *Builder) ServiceAccount(name string) *ServiceAccountBuilder

func (*Builder) SetNamespace

func (b *Builder) SetNamespace(namespace string) *Builder

type CRD

type CRD struct {
	Kind       string                 `yaml:"kind,omitempty"`
	APIVersion string                 `yaml:"apiVersion,omitempty"`
	Metadata   Metadata               `yaml:"metadata,omitempty"`
	Spec       map[string]interface{} `yaml:"spec,omitempty"`
}

type Client

type Client struct {
	logger.Logger
	GetKubeConfigBytes   func() ([]byte, error)
	GetRESTConfig        func() (*rest.Config, error)
	GetKustomizePatches  func() ([]string, error)
	ApplyDryRun          bool
	ApplyHook            ApplyHook
	ImmutableAnnotations []string
	Trace                bool
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config *rest.Config, logger logger.Logger) *Client

func NewClientFromBytes

func NewClientFromBytes(kubeconfig []byte) (*Client, error)

func NewClientFromDefaults

func NewClientFromDefaults(log logger.Logger) (*Client, error)

func (*Client) Annotate

func (c *Client) Annotate(obj runtime.Object, annotations map[string]string) error

func (*Client) Apply

func (c *Client) Apply(namespace string, objects ...runtime.Object) error

func (*Client) ApplyText

func (c *Client) ApplyText(namespace string, specs ...string) error

func (*Client) ApplyUnstructured

func (c *Client) ApplyUnstructured(namespace string, objects ...*unstructured.Unstructured) error

func (*Client) Cordon

func (c *Client) Cordon(nodeName string) error

func (*Client) CreateOrUpdateConfigMap

func (c *Client) CreateOrUpdateConfigMap(name, ns string, data map[string]string) error

func (*Client) CreateOrUpdateNamespace

func (c *Client) CreateOrUpdateNamespace(name string, labels, annotations map[string]string) error

func (*Client) CreateOrUpdateSecret

func (c *Client) CreateOrUpdateSecret(name, ns string, data map[string][]byte) error

func (*Client) DeleteByKind

func (c *Client) DeleteByKind(kind, namespace, name string) error

func (*Client) DeleteUnstructured

func (c *Client) DeleteUnstructured(namespace string, objects ...*unstructured.Unstructured) error

func (*Client) Drain

func (c *Client) Drain(nodeName string, timeout time.Duration) error

func (*Client) EvictNode

func (c *Client) EvictNode(nodeName string) error

func (*Client) EvictPod

func (c *Client) EvictPod(pod v1.Pod) error

func (*Client) ExecutePodf

func (c *Client) ExecutePodf(namespace, pod, container string, command ...string) (string, string, error)

ExecutePodf runs the specified shell command inside a container of the specified pod

func (*Client) Executef

func (c *Client) Executef(node string, timeout time.Duration, command string, args ...interface{}) (string, error)

Executef runs the specified shell command on a node by creating a pre-scheduled pod that runs in the host namespace

func (*Client) ExposeIngress

func (c *Client) ExposeIngress(namespace, service string, domain string, port int, annotations map[string]string) error

func (*Client) ForceDeleteNamespace

func (c *Client) ForceDeleteNamespace(ns string, timeout time.Duration) error

ForceDeleteNamespace deletes a namespace forcibly by overriding it's finalizers first

func (*Client) Get

func (c *Client) Get(namespace string, name string, obj runtime.Object) error

func (*Client) GetAPIResource

func (c *Client) GetAPIResource(name string) (*metav1.APIResource, error)

func (*Client) GetByKind

func (c *Client) GetByKind(kind, namespace, name string) (*unstructured.Unstructured, error)

func (*Client) GetClientByKind

func (c *Client) GetClientByKind(kind string) (dynamic.NamespaceableResourceInterface, error)

func (*Client) GetClientset

func (c *Client) GetClientset() (*kubernetes.Clientset, error)

GetClientset creates a new k8s client

func (*Client) GetConditions

func (c *Client) GetConditions(item *unstructured.Unstructured) (kommonsv1.ConditionList, error)

func (*Client) GetConditionsForNode

func (c *Client) GetConditionsForNode(name string) (map[v1.NodeConditionType]v1.ConditionStatus, error)

func (*Client) GetConfigMap

func (c *Client) GetConfigMap(namespace, name string) *map[string]string

GetConfigMap returns the data of a secret or nil for any error

func (*Client) GetConfigMapV2 added in v0.29.0

func (c *Client) GetConfigMapV2(ctx context.Context, namespace, name string) (*map[string]string, error)

GetConfigMap returns the data of a secret or nil for any error

func (*Client) GetDynamicClient

func (c *Client) GetDynamicClient() (dynamic.Interface, error)

GetDynamicClient creates a new k8s client

func (*Client) GetDynamicClientForUser

func (c *Client) GetDynamicClientForUser(namespace string, obj runtime.Object, user string) (dynamic.ResourceInterface, *schema.GroupVersionResource, *unstructured.Unstructured, error)

func (*Client) GetEnvValue added in v0.7.0

func (c *Client) GetEnvValue(input EnvVar, namespace string) (string, string, error)

func (*Client) GetEnvValueFromCache added in v0.29.0

func (c *Client) GetEnvValueFromCache(input EnvVar, namespace string, expiry time.Duration) (string, string, error)

func (*Client) GetEventsFor

func (c *Client) GetEventsFor(kind string, object metav1.Object) ([]v1.Event, error)

func (*Client) GetFirstPodByLabelSelector

func (c *Client) GetFirstPodByLabelSelector(namespace string, labelSelector string) (*v1.Pod, error)

Returns the first pod found by label

func (*Client) GetHealth

func (c *Client) GetHealth() Health

func (*Client) GetJobPod added in v0.9.0

func (c *Client) GetJobPod(namespace, jobName string) (string, error)

func (*Client) GetKustomize

func (c *Client) GetKustomize() (*kustomize.Manager, error)

func (*Client) GetMasterNode

func (c *Client) GetMasterNode() (string, error)

GetMasterNode returns the name of the first node found labelled as a master

func (*Client) GetMasterNodes

func (c *Client) GetMasterNodes() ([]string, error)

GetMasterNode returns a list of all master nodes

func (*Client) GetOrCreatePVC

func (c *Client) GetOrCreatePVC(namespace, name, size, class string) error

func (*Client) GetOrCreateSecret

func (c *Client) GetOrCreateSecret(name, ns string, data map[string][]byte) error

func (*Client) GetPodLogs added in v0.10.0

func (c *Client) GetPodLogs(namespace, podName, container string) (string, error)

func (*Client) GetPodReplicas

func (c *Client) GetPodReplicas(pod v1.Pod) (int, error)

func (*Client) GetProxyDialer

func (c *Client) GetProxyDialer(p proxy.Proxy) (*proxy.Dialer, error)

func (*Client) GetRESTConfigFromKubeconfig

func (c *Client) GetRESTConfigFromKubeconfig() (*rest.Config, error)

func (*Client) GetRESTConfigInCluster

func (c *Client) GetRESTConfigInCluster() (*rest.Config, error)

func (*Client) GetRestClient

func (c *Client) GetRestClient(obj unstructured.Unstructured) (*cliresource.Helper, error)

func (*Client) GetRestMapper

func (c *Client) GetRestMapper() (meta.RESTMapper, error)

func (*Client) GetSecret

func (c *Client) GetSecret(namespace, name string) *map[string][]byte

GetSecret returns the data of a secret or nil for any error

func (*Client) GetSecretV2 added in v0.29.0

func (c *Client) GetSecretV2(ctx context.Context, namespace, name string) (*map[string][]byte, error)

GetSecret returns the data of a secret or nil for any error

func (*Client) HasChanges

func (c *Client) HasChanges(from, to *unstructured.Unstructured) bool

func (*Client) HasConfigMap

func (c *Client) HasConfigMap(ns, name string) bool

func (*Client) HasSecret

func (c *Client) HasSecret(ns, name string) bool

func (*Client) IsCRDReady

func (c *Client) IsCRDReady(group, name string) (bool, string)

func (*Client) IsConditionReadyTrue added in v0.14.0

func (c *Client) IsConditionReadyTrue(item *unstructured.Unstructured) (bool, string)

func (*Client) IsConstraintTemplateReady

func (c *Client) IsConstraintTemplateReady(item *unstructured.Unstructured) (bool, string)

func (*Client) IsCoreType added in v0.18.0

func (c *Client) IsCoreType(object *unstructured.Unstructured) bool

func (*Client) IsElasticsearchReady added in v0.7.2

func (c *Client) IsElasticsearchReady(item *unstructured.Unstructured) (bool, string)

func (*Client) IsKibanaReady added in v0.7.2

func (c *Client) IsKibanaReady(item *unstructured.Unstructured) (bool, string)

func (*Client) IsMongoDBReady added in v0.8.0

func (c *Client) IsMongoDBReady(item *unstructured.Unstructured) (bool, string)

func (*Client) IsNamespaceReady

func (c *Client) IsNamespaceReady(ns string) (bool, string)

func (*Client) IsPostgresqlDBReady added in v0.11.2

func (c *Client) IsPostgresqlDBReady(item *unstructured.Unstructured) (bool, string)

func (*Client) IsPostgresqlReady added in v0.7.2

func (c *Client) IsPostgresqlReady(item *unstructured.Unstructured) (bool, string)

func (*Client) IsReady

func (c *Client) IsReady(item *unstructured.Unstructured) (bool, string)

func (*Client) IsReadyWithConditions added in v0.8.1

func (c *Client) IsReadyWithConditions(item *unstructured.Unstructured) (bool, string)

func (*Client) IsRedisFailoverReady added in v0.7.2

func (c *Client) IsRedisFailoverReady(item *unstructured.Unstructured) (bool, string)

func (*Client) IsTrivialType

func (c *Client) IsTrivialType(item *unstructured.Unstructured) bool

func (*Client) Label

func (c *Client) Label(obj runtime.Object, labels map[string]string) error

func (*Client) PingMaster

func (c *Client) PingMaster() bool

PingMaster attempts to connect to the API server and list nodes and services to ensure the API server is ready to accept any traffic

func (*Client) Refresh

func (*Client) RemoveVolumeAttachment

func (c *Client) RemoveVolumeAttachment(va storagev1.VolumeAttachment) error

Remove volume attachment

func (*Client) ResetConnection

func (c *Client) ResetConnection()

func (*Client) ResetRestMapper added in v0.15.0

func (c *Client) ResetRestMapper() error

Remove the reference to the existing RestMapper, forcing a recreation next time GetRestMapper is called Use when it is known that the existing discovery cache is stale to avoid having to wait for the 10 minute timeout

func (*Client) ScalePod

func (c *Client) ScalePod(pod v1.Pod, replicas int32) error

func (*Client) SetCondition

func (c *Client) SetCondition(item *unstructured.Unstructured, kind, status string) error

func (*Client) StreamLogs

func (c *Client) StreamLogs(namespace, name string) error

func (*Client) StreamLogsV2 added in v0.25.0

func (c *Client) StreamLogsV2(namespace, name string, timeout time.Duration, containerNames ...string) error

func (*Client) TriggerCronJobManually added in v0.11.0

func (c *Client) TriggerCronJobManually(namespace, cronJobName string) (string, error)

TriggerCronJobManually creates a Job from the cronJobName passed to the function and return the created job's name

func (*Client) Uncordon

func (c *Client) Uncordon(nodeName string) error

func (*Client) Update added in v0.6.1

func (c *Client) Update(namespace string, item runtime.Object) error

func (*Client) WaitFor

func (c *Client) WaitFor(obj runtime.Object, timeout time.Duration) (*unstructured.Unstructured, error)

func (*Client) WaitForAPIResource

func (c *Client) WaitForAPIResource(group, name string, timeout time.Duration) error

func (*Client) WaitForCRD

func (c *Client) WaitForCRD(kind, namespace, name string, timeout time.Duration, waitFN WaitFN) (*unstructured.Unstructured, error)

func (*Client) WaitForContainerStart added in v0.25.0

func (c *Client) WaitForContainerStart(ns, name string, timeout time.Duration, containerNames ...string) error

WaitForContainerStart waits for the specified containers to be started (or any container if no names are specified) - returns an error if the timeout is exceeded

func (*Client) WaitForDaemonSet

func (c *Client) WaitForDaemonSet(ns, name string, timeout time.Duration) error

WaitForDaemonSet waits for a statefulset to have at least 1 ready replica, or returns an error if the timeout is exceeded

func (*Client) WaitForDeployment

func (c *Client) WaitForDeployment(ns, name string, timeout time.Duration) error

WaitForDeployment waits for a deployment to have at least 1 ready replica, or returns an error if the timeout is exceeded

func (*Client) WaitForJob added in v0.11.0

func (c *Client) WaitForJob(ns, name string, timeout time.Duration) error

WaitForJob waits for a job to finish (the condition type "Complete" has status of "True"), or returns an error if the timeout is exceeded

func (*Client) WaitForNamespace

func (c *Client) WaitForNamespace(ns string, timeout time.Duration) error

func (*Client) WaitForNode

func (c *Client) WaitForNode(name string, timeout time.Duration, condition v1.NodeConditionType, statii ...v1.ConditionStatus) (map[v1.NodeConditionType]v1.ConditionStatus, error)

WaitForNode waits for a pod to be in the specified phase, or returns an error if the timeout is exceeded

func (*Client) WaitForPod

func (c *Client) WaitForPod(ns, name string, timeout time.Duration, phases ...v1.PodPhase) error

WaitForPod waits for a pod to be in the specified phase, or returns an error if the timeout is exceeded

func (*Client) WaitForPodByLabel added in v0.11.2

func (c *Client) WaitForPodByLabel(ns, label string, timeout time.Duration, phases ...v1.PodPhase) (*v1.Pod, error)

WaitForPod waits for a pod to be in the specified phase, or returns an error if the timeout is exceeded

func (*Client) WaitForPodCommand

func (c *Client) WaitForPodCommand(ns, name string, container string, timeout time.Duration, command ...string) error

WaitForPodCommand waits for a command executed in pod to succeed with an exit code of 0 error if the timeout is exceeded

func (*Client) WaitForResource

func (c *Client) WaitForResource(kind, namespace, name string, timeout time.Duration) (*unstructured.Unstructured, error)

func (*Client) WaitForRestMapping added in v0.5.1

func (c *Client) WaitForRestMapping(obj runtime.Object, timeout time.Duration) (*meta.RESTMapping, error)

func (*Client) WaitForStatefulSet

func (c *Client) WaitForStatefulSet(ns, name string, timeout time.Duration) error

WaitForStatefulSet waits for a statefulset to have at least 1 ready replica, or returns an error if the timeout is exceeded

func (*Client) WaitForTaintRemoval

func (c *Client) WaitForTaintRemoval(name string, timeout time.Duration, taintKey string) error

type ConfigMapKeySelector added in v0.7.0

type ConfigMapKeySelector struct {
	LocalObjectReference `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=localObjectReference"`
	Key                  string `json:"key" yaml:"key" protobuf:"bytes,2,opt,name=key"`
	Optional             *bool  `json:"optional,omitempty" yaml:"optional,omitempty" protobuf:"varint,3,opt,name=optional"`
}

+kubebuilder:object:generate=true

func (*ConfigMapKeySelector) DeepCopy added in v0.7.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapKeySelector.

func (*ConfigMapKeySelector) DeepCopyInto added in v0.7.0

func (in *ConfigMapKeySelector) DeepCopyInto(out *ConfigMapKeySelector)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DeploymentBuilder

type DeploymentBuilder struct {
	Builder     *Builder
	Name, Image string
	// contains filtered or unexported fields
}

func Deployment

func Deployment(name, image string) *DeploymentBuilder

func (*DeploymentBuilder) Annotations

func (d *DeploymentBuilder) Annotations(annotations map[string]string) *DeploymentBuilder

func (*DeploymentBuilder) Args

func (d *DeploymentBuilder) Args(args ...string) *DeploymentBuilder

func (*DeploymentBuilder) AsCronJob

func (d *DeploymentBuilder) AsCronJob(schedule string) *batchv1beta1.CronJob

func (*DeploymentBuilder) AsOneShotJob

func (d *DeploymentBuilder) AsOneShotJob() *batchv1.Job

func (*DeploymentBuilder) AsOneShotPod added in v0.9.0

func (d *DeploymentBuilder) AsOneShotPod() *v1.Pod

func (*DeploymentBuilder) Build

func (d *DeploymentBuilder) Build() *Builder

func (*DeploymentBuilder) Command

func (d *DeploymentBuilder) Command(cmd ...string) *DeploymentBuilder

func (*DeploymentBuilder) EnvFromConfigMap added in v0.9.0

func (d *DeploymentBuilder) EnvFromConfigMap(name string) *DeploymentBuilder

func (*DeploymentBuilder) EnvFromSecret added in v0.9.0

func (d *DeploymentBuilder) EnvFromSecret(name string) *DeploymentBuilder

func (*DeploymentBuilder) EnvVarFromConfigMap

func (d *DeploymentBuilder) EnvVarFromConfigMap(env, configmap, key string) *DeploymentBuilder

func (*DeploymentBuilder) EnvVarFromField

func (d *DeploymentBuilder) EnvVarFromField(env, field string) *DeploymentBuilder

func (*DeploymentBuilder) EnvVarFromSecret

func (d *DeploymentBuilder) EnvVarFromSecret(env, secret, key string) *DeploymentBuilder

func (*DeploymentBuilder) EnvVars

func (d *DeploymentBuilder) EnvVars(env map[string]string) *DeploymentBuilder

func (*DeploymentBuilder) Expose

func (d *DeploymentBuilder) Expose(ports ...int32) *DeploymentBuilder

func (*DeploymentBuilder) GetLabels

func (d *DeploymentBuilder) GetLabels() map[string]string

func (*DeploymentBuilder) Labels

func (d *DeploymentBuilder) Labels(labels map[string]string) *DeploymentBuilder

func (*DeploymentBuilder) MountConfigMap

func (d *DeploymentBuilder) MountConfigMap(cm, path string) *DeploymentBuilder

func (*DeploymentBuilder) MountSecret

func (d *DeploymentBuilder) MountSecret(secret, path string, mode int32) *DeploymentBuilder

func (*DeploymentBuilder) NodeAffinity

func (d *DeploymentBuilder) NodeAffinity(nodeReadinessLabel map[string]string) *DeploymentBuilder

func (*DeploymentBuilder) ObjectMeta

func (d *DeploymentBuilder) ObjectMeta() metav1.ObjectMeta

func (*DeploymentBuilder) PodAffinity

func (d *DeploymentBuilder) PodAffinity(labels map[string]string, topologyKey string) *DeploymentBuilder

func (*DeploymentBuilder) PodSpec

func (d *DeploymentBuilder) PodSpec() v1.PodSpec

func (*DeploymentBuilder) PodTemplate

func (d *DeploymentBuilder) PodTemplate() v1.PodTemplateSpec

func (*DeploymentBuilder) Ports

func (d *DeploymentBuilder) Ports(ports ...int32) *DeploymentBuilder

func (*DeploymentBuilder) Replicas

func (d *DeploymentBuilder) Replicas(replicas int) *DeploymentBuilder

func (*DeploymentBuilder) Resources

func (*DeploymentBuilder) ServiceAccount

func (d *DeploymentBuilder) ServiceAccount(name string) *DeploymentBuilder

type DynamicKind

type DynamicKind struct {
	APIVersion, Kind string
}

func (DynamicKind) GroupVersionKind

func (dk DynamicKind) GroupVersionKind() schema.GroupVersionKind

func (DynamicKind) SetGroupVersionKind

func (dk DynamicKind) SetGroupVersionKind(gvk schema.GroupVersionKind)

type EnvVar added in v0.7.0

type EnvVar struct {
	Name      string        `json:"name,omitempty" yaml:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
	Value     string        `json:"value,omitempty" yaml:"value,omitempty" protobuf:"bytes,2,opt,name=value"`
	ValueFrom *EnvVarSource `json:"valueFrom,omitempty" yaml:"valueFrom,omitempty" protobuf:"bytes,3,opt,name=valueFrom"`
}

+kubebuilder:object:generate=true

func (*EnvVar) DeepCopy added in v0.7.0

func (in *EnvVar) DeepCopy() *EnvVar

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvVar.

func (*EnvVar) DeepCopyInto added in v0.7.0

func (in *EnvVar) DeepCopyInto(out *EnvVar)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (EnvVar) GetCacheKey added in v0.29.0

func (e EnvVar) GetCacheKey() string

func (EnvVar) GetKey added in v0.29.0

func (e EnvVar) GetKey() string

func (EnvVar) IsEmpty added in v0.24.0

func (e EnvVar) IsEmpty() bool

type EnvVarSource added in v0.7.0

type EnvVarSource struct {
	ConfigMapKeyRef *ConfigMapKeySelector `json:"configMapKeyRef,omitempty" yaml:"configMapKeyRef,omitempty" protobuf:"bytes,3,opt,name=configMapKeyRef"`
	SecretKeyRef    *SecretKeySelector    `json:"secretKeyRef,omitempty" yaml:"secretKeyRef,omitempty" protobuf:"bytes,4,opt,name=secretKeyRef"`
}

+kubebuilder:object:generate=true

func (*EnvVarSource) DeepCopy added in v0.7.0

func (in *EnvVarSource) DeepCopy() *EnvVarSource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvVarSource.

func (*EnvVarSource) DeepCopyInto added in v0.7.0

func (in *EnvVarSource) DeepCopyInto(out *EnvVarSource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Health

type Health struct {
	RunningPods, PendingPods, ErrorPods, CrashLoopBackOff int
	ReadyNodes, UnreadyNodes                              int
	Error                                                 error
}

func (Health) GetNonReadyPods

func (h Health) GetNonReadyPods() int

func (Health) IsDegradedComparedTo

func (h Health) IsDegradedComparedTo(h2 Health, tolerance int) bool

func (Health) String

func (h Health) String() string

type IsType

type IsType func(*unstructured.Unstructured) bool

type Kindable

type Kindable interface {
	GetKind() string
}

type LocalObjectReference added in v0.7.0

type LocalObjectReference struct {
	Name string `json:"name,omitempty" yaml:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
}

+kubebuilder:object:generate=true

func (*LocalObjectReference) DeepCopy added in v0.7.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalObjectReference.

func (*LocalObjectReference) DeepCopyInto added in v0.7.0

func (in *LocalObjectReference) DeepCopyInto(out *LocalObjectReference)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Metadata

type Metadata struct {
	Name        string            `yaml:"name,omitempty"`
	Namespace   string            `yaml:"namespace,omitempty"`
	Labels      map[string]string `yaml:"labels,omitempty"`
	Annotations map[string]string `yaml:"annotations,omitempty"`
}

type Name

type Name struct {
	Name, Kind, Namespace string
}

func GetName

func GetName(obj interface{}) Name

func (Name) GetKind

func (n Name) GetKind() string

func (Name) GetName

func (n Name) GetName() string

func (Name) GetNamespace

func (n Name) GetNamespace() string

func (Name) String

func (n Name) String() string

type Nameable

type Nameable interface {
	GetName() string
	GetNamespace() string
}

type RuntimeObjectWithMetadata

type RuntimeObjectWithMetadata interface {
	GetObjectMeta() metav1.Object
	GetObjectKind() schema.ObjectKind
	DeepCopyObject() runtime.Object
}

type SecretKeySelector added in v0.7.0

type SecretKeySelector struct {
	LocalObjectReference `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=localObjectReference"`
	Key                  string `json:"key" yaml:"key" protobuf:"bytes,2,opt,name=key"`
	Optional             *bool  `json:"optional,omitempty" yaml:"optional,omitempty" protobuf:"varint,3,opt,name=optional"`
}

+kubebuilder:object:generate=true

func (*SecretKeySelector) DeepCopy added in v0.7.0

func (in *SecretKeySelector) DeepCopy() *SecretKeySelector

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretKeySelector.

func (*SecretKeySelector) DeepCopyInto added in v0.7.0

func (in *SecretKeySelector) DeepCopyInto(out *SecretKeySelector)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceAccountBuilder

type ServiceAccountBuilder struct {
	*Builder
	Name string
}

func (*ServiceAccountBuilder) AddClusterRole

func (s *ServiceAccountBuilder) AddClusterRole(role string) *ServiceAccountBuilder

func (*ServiceAccountBuilder) AddRole

type Spec

type Spec struct {
	Path  string
	Items []*unstructured.Unstructured
}

type Specs

type Specs []Spec

func Walk

func Walk(path string) (Specs, error)

Walk iterates recursively over each file in path and returns all of the objects contained

func (Specs) FilterBy

func (specs Specs) FilterBy(kind string) []*unstructured.Unstructured

type WaitFN

type WaitFN func(*unstructured.Unstructured) (bool, string)

type WebhookBuilder

type WebhookBuilder struct {
	*WebhookConfigBuilder
	admission.ValidatingWebhook
	CA            []byte
	Service, Path string
}

func (WebhookBuilder) Add

func (WebhookBuilder) Fail

func (b WebhookBuilder) Fail() WebhookBuilder

func (WebhookBuilder) Match

func (b WebhookBuilder) Match(groups, versions, resources []string) WebhookBuilder

func (WebhookBuilder) MatchAny

func (b WebhookBuilder) MatchAny() WebhookBuilder

func (WebhookBuilder) MatchKinds

func (b WebhookBuilder) MatchKinds(resources ...string) WebhookBuilder

func (WebhookBuilder) TimeoutSeconds

func (b WebhookBuilder) TimeoutSeconds(timeout int32) WebhookBuilder

func (WebhookBuilder) WithNamespaceLabel

func (b WebhookBuilder) WithNamespaceLabel(label string, values ...string) WebhookBuilder

func (WebhookBuilder) WithoutNamespaceLabel

func (b WebhookBuilder) WithoutNamespaceLabel(label string, values ...string) WebhookBuilder

type WebhookConfigBuilder

type WebhookConfigBuilder struct {
	admission.ValidatingWebhookConfiguration
	Service string
	CA      []byte
}

func (WebhookConfigBuilder) Build

func (WebhookConfigBuilder) BuildMutating

func (*WebhookConfigBuilder) NewHook

func (b *WebhookConfigBuilder) NewHook(Name, Path string) *WebhookBuilder

Directories

Path Synopsis
api
v1
Package kustomize contains helpers for working with embedded kustomize commands
Package kustomize contains helpers for working with embedded kustomize commands
testenv module

Jump to

Keyboard shortcuts

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