kubernetes

package
v0.0.0-...-04db488 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package kubernetes is for interactivity with the Kubernetes cluster API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kubernetes

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

Kubernetes is our k8s client object, implements internal/interfaces/kubernetes.go

func (*Kubernetes) EnsureNamespace

func (k *Kubernetes) EnsureNamespace(name string) error

EnsureNamespace will try to create a namespace, ignore the error if it already exists

func (*Kubernetes) FindConfigMap

func (k *Kubernetes) FindConfigMap(name string, namespace string, withKey string, withValue string) (*v1.ConfigMap, error)

FindConfigMap will seek out an existing configmap in the namespace matching a name and with a particular key/value set in data

func (*Kubernetes) GetSecretKeyValue

func (k *Kubernetes) GetSecretKeyValue(secretName string, namespace string, dataKey string) (string, error)

GetSecretKeyValue will retrieve a particular data key from a secret

func (*Kubernetes) Initialize

func (k *Kubernetes) Initialize(kubeconfigPath string, kubeContext string) error

Initialize will set up our object for connection to the desired cluster, and test that connection

func (*Kubernetes) InitializeLogConfigMap

func (k *Kubernetes) InitializeLogConfigMap(name string, namespace string, data map[string]string) (*v1.ConfigMap, error)

InitializeLogConfigMap will ensure a configmap exists by name, in a namespace, with data. If an existing configmap is found then it will not be modifed

func (*Kubernetes) InitializeShipConfigMap

func (k *Kubernetes) InitializeShipConfigMap(name string, namespace string, data map[string]string) (*v1.ConfigMap, error)

InitializeShipConfigMap will ensure a configmap exists by name, in a namespace, with data. If an existing configmap is found and it is presisting previous data, then remove any previous data in the new version of the configmap

func (*Kubernetes) IsRetryError

func (k *Kubernetes) IsRetryError(err error) bool

IsRetryError is used to determine whether or not we have an error that suggests we should retry TODO: I think eventually we'd pull down on the types here, and likely even make use of something like

the kerrors.SuggestsClientDelay, see
https://github.com/kubernetes/apimachinery/blob/master/pkg/api/errors/errors.go
This currently addresses a more unstable k8s cluster though

func (*Kubernetes) PatchConfigMap

func (k *Kubernetes) PatchConfigMap(name string, namespace string, data map[string]string) (*v1.ConfigMap, error)

PatchConfigMap will patch an existing configmap with the StrategicMergePatchType

Jump to

Keyboard shortcuts

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