k8s

package
v0.40.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SocatImage = "quay.io/boson/alpine-socat:1.7.4.3-r1-non-root"
View Source
var TarImage = "quay.io/boson/alpine-socat:1.7.4.3-r1-non-root"

Functions

func CreatePersistentVolumeClaim

func CreatePersistentVolumeClaim(ctx context.Context, name, namespaceOverride string, labels map[string]string, annotations map[string]string, accessMode corev1.PersistentVolumeAccessMode, resourceRequest resource.Quantity) (err error)

func DeletePersistentVolumeClaims

func DeletePersistentVolumeClaims(ctx context.Context, namespaceOverride string, listOptions metav1.ListOptions) (err error)

func DeleteSecrets

func DeleteSecrets(ctx context.Context, namespaceOverride string, listOptions metav1.ListOptions) (err error)

func EnsureDockerRegistrySecretExist

func EnsureDockerRegistrySecretExist(ctx context.Context, name, namespaceOverride string, labels map[string]string, annotations map[string]string, username, password, server string) (err error)

func EnsureSecretExist

func EnsureSecretExist(ctx context.Context, secret corev1.Secret, namespaceOverride string) (err error)

func GetClientConfig

func GetClientConfig() clientcmd.ClientConfig

func GetConfigMap

func GetConfigMap(ctx context.Context, name, namespaceOverride string) (*corev1.ConfigMap, error)

func GetDefaultOpenShiftRegistry added in v0.38.1

func GetDefaultOpenShiftRegistry() string

func GetManifestivalClient added in v0.38.0

func GetManifestivalClient() (manifestival.Client, error)

func GetNamespace

func GetNamespace(defaultNamespace string) (namespace string, err error)

func GetOpenShiftDockerCredentialLoaders added in v0.38.1

func GetOpenShiftDockerCredentialLoaders() []creds.CredentialsCallback

func GetOpenShiftServiceCA added in v0.38.1

func GetOpenShiftServiceCA(ctx context.Context) (*x509.Certificate, error)

func GetPersistentVolumeClaim

func GetPersistentVolumeClaim(ctx context.Context, name, namespaceOverride string) (*corev1.PersistentVolumeClaim, error)

func GetPodLogs

func GetPodLogs(ctx context.Context, namespace, podName, containerName string) (string, error)

GetPodLogs returns logs from a specified Container in a Pod, if container is empty string, then the first container in the pod is selected.

func GetSecret

func GetSecret(ctx context.Context, name, namespaceOverride string) (*corev1.Secret, error)

func GetServiceAccount added in v0.38.0

func GetServiceAccount(ctx context.Context, referencedServiceAccount, namespace string) error

func HandleDockerCfgJSONContent

func HandleDockerCfgJSONContent(username, password, email, server string) ([]byte, error)

func IsOpenShift added in v0.38.1

func IsOpenShift() bool

func ListConfigMapsNamesIfConnected

func ListConfigMapsNamesIfConnected(ctx context.Context, namespaceOverride string) (names []string, err error)

ListConfigMapsNamesIfConnected lists names of ConfigMaps present and the current k8s context returns empty list, if not connected to any cluster

func ListPersistentVolumeClaimsNamesIfConnected added in v0.38.0

func ListPersistentVolumeClaimsNamesIfConnected(ctx context.Context, namespaceOverride string) (names []string, err error)

ListPersistentVolumeClaimsNamesIfConnected lists names of PersistentVolumeClaims present and the current k8s context returns empty list, if not connected to any cluster

func ListSecretsNamesIfConnected

func ListSecretsNamesIfConnected(ctx context.Context, namespaceOverride string) (names []string, err error)

ListSecretsNamesIfConnected lists names of Secrets present and the current k8s context returns empty list, if not connected to any cluster

func NewClientAndResolvedNamespace

func NewClientAndResolvedNamespace(defaultNamespace string) (client *kubernetes.Clientset, namespace string, err error)

func NewDynamicClient

func NewDynamicClient() (dynamic.Interface, error)

func NewInClusterDialer

func NewInClusterDialer(ctx context.Context, clientConfig clientcmd.ClientConfig) (*contextDialer, error)

NewInClusterDialer creates context dialer that will dial TCP connections via POD running in k8s cluster. This is useful when accessing k8s services that are not exposed outside cluster (e.g. openshift image registry).

Usage:

dialer, err := k8s.NewInClusterDialer(ctx)
if err != nil {
    return err
}
defer dialer.Close()

transport := &http.Transport{
    DialContext: dialer.DialContext,
}

var client = http.Client{
    Transport: transport,
}

func NewKubernetesClientset

func NewKubernetesClientset() (*kubernetes.Clientset, error)

func NewLazyInitInClusterDialer

func NewLazyInitInClusterDialer(clientConfig clientcmd.ClientConfig) *lazyInitInClusterDialer

func UploadToVolume

func UploadToVolume(ctx context.Context, content io.Reader, claimName, namespace string) error

UploadToVolume uploads files (passed in form of tar stream) into volume.

Types

type OpenshiftMetadataDecorator added in v0.38.1

type OpenshiftMetadataDecorator struct{}

func (OpenshiftMetadataDecorator) UpdateAnnotations added in v0.38.1

func (o OpenshiftMetadataDecorator) UpdateAnnotations(f fn.Function, annotations map[string]string) map[string]string

func (OpenshiftMetadataDecorator) UpdateLabels added in v0.38.1

func (o OpenshiftMetadataDecorator) UpdateLabels(f fn.Function, labels map[string]string) map[string]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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