k8s

package
v0.0.0-...-6ae417f Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanNeedRetry

func CanNeedRetry(err error) bool

CanNeedRetry works for errors from request for update, and returns true if object was changed at server side and client needs to read it again and retry update operation

func ExecToPodThroughAPI

func ExecToPodThroughAPI(command []string, containerName, podName, namespace string, stdin io.Reader) (string, string, error)

ExecToPodThroughAPI uninterractively exec to the pod with the command specified. :param string command: list of the str which specify the command. :param string pod_name: Pod name :param string namespace: namespace of the Pod. :param io.Reader stdin: Standerd Input if necessary, otherwise `nil` :return: string: Output of the command. (STDOUT)

string: Errors. (STDERR)
 error: If any error has occurred otherwise `nil`

func GetClientset

func GetClientset() kubernetes.Interface

func GetCoreV1

func GetCoreV1() corev1api.CoreV1Interface

GetCoreV1 first tries to get a config object which uses the service account kubernetes gives to pods,

func IsOpenshift

func IsOpenshift() bool

func Md5Sum

func Md5Sum(v []byte) string

func SetClientset

func SetClientset(v1 corev1api.CoreV1Interface, clset kubernetes.Interface)

Allows to overwrite clientset for unittests

func SetDeployerType

func SetDeployerType(client client.Client) error

func SetDeployerTypeE

func SetDeployerTypeE(v bool)

func UpdateNetworkStatus

func UpdateNetworkStatus(client client.Client) error

func YamlToStruct

func YamlToStruct(yamlString string, structPointer interface{}) error

Types

type ConfigMap

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

ConfigMap is used to create and modify config maps to configure owner

func (*ConfigMap) EnsureExists

func (c *ConfigMap) EnsureExists(dataSetter configMapFiller) error

EnsureExists is used to ensure that specific config map exists and is filled properly

type Kubernetes

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

Kubernetes is used to create and update meaningful objects

func New

func New(client client.Client, scheme *runtime.Scheme) *Kubernetes

New is used to create a new Kubernetes

func (*Kubernetes) ConfigMap

func (k *Kubernetes) ConfigMap(name, ownerType string, owner v1.Object) *ConfigMap

ConfigMap is used to create ConfigMap object

func (*Kubernetes) Owner

func (k *Kubernetes) Owner(owner object) *Owner

Owner is used to create Owner object

func (*Kubernetes) Secret

func (k *Kubernetes) Secret(name, ownerType string, owner v1.Object) *Secret

Secret is used to create Secret object

func (*Kubernetes) Service

func (k *Kubernetes) Service(name string, servType core.ServiceType, ports map[int32]string, ownerType string, owner v1.Object) *Service

Service is used to create Service object

type Owner

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

Owner is used to manipulate Kubernetes's owner relationships

func (Owner) EnsureOwns

func (o Owner) EnsureOwns(dependent object) error

EnsureOwns is used to ensure that relation between owner and dependent object exist

type Secret

type Secret struct {
	Secret *core.Secret
	// contains filtered or unexported fields
}

func (*Secret) EnsureExists

func (s *Secret) EnsureExists(dataSetter SecretFiller, force bool) error

type SecretFiller

type SecretFiller interface {
	FillSecret(sc *core.Secret, force bool) error
}

type Service

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

Service is used to create and manage kubernetes services

func (*Service) ClusterIP

func (s *Service) ClusterIP() string

ClusterIP is used to read clusterIP of service

func (*Service) EnsureExists

func (s *Service) EnsureExists() error

EnsureExists is used to make sure that kubernetes service exists and is correctly configured

func (*Service) NodePort

func (s *Service) NodePort(name string) int32

NodePort is used get nodeport associated with service

func (*Service) WithLabels

func (s *Service) WithLabels(labels map[string]string) *Service

WithLabels is used to set labels on Service

Jump to

Keyboard shortcuts

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