kubernetes

package
v0.0.0-...-9d8613e Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSecret

func CreateSecret(client teiidclient.Client, name, namespace string, owner metav1.Object, data map[string][]byte) error

CreateSecret --

func EnsureObject

func EnsureObject(obj v1alpha1.OpenShiftObject, err error, client k8sclient.Writer) error

EnsureObject creates an object based on the error passed in from a `client.Get`

func EnvironmentPropertiesExists

func EnvironmentPropertiesExists(ctx context.Context, client k8sclient.Reader, namespace string, envs []corev1.EnvVar) bool

EnvironmentPropertiesExists --

func GetConfigMap

func GetConfigMap(context context.Context, client k8sclient.Reader, name string, namespace string) (*corev1.ConfigMap, error)

GetConfigMap --

func GetConfigMapRefValue

func GetConfigMapRefValue(ctx context.Context, client k8sclient.Reader, namespace string, selector *corev1.ConfigMapKeySelector) (string, error)

GetConfigMapRefValue returns the value of a configmap in the supplied namespace

func GetSecret

func GetSecret(context context.Context, client k8sclient.Reader, name string, namespace string) (*corev1.Secret, error)

GetSecret --

func GetSecretRefValue

func GetSecretRefValue(ctx context.Context, client k8sclient.Reader, namespace string, selector *corev1.SecretKeySelector) (string, error)

GetSecretRefValue returns the value of a secret in the supplied namespace --

func GetService

func GetService(context context.Context, client k8sclient.Reader, name string, namespace string) (*corev1.Service, error)

GetService --

func HasConfigMap

func HasConfigMap(context context.Context, client k8sclient.Reader, name string, namespace string) bool

HasConfigMap --

func HasSecret

func HasSecret(context context.Context, client k8sclient.Reader, name string, namespace string) bool

HasSecret --

func HasServerGroup

func HasServerGroup(client kubernetes.Interface, groupName string) bool

HasServerGroup detects if the given api group is supported by the server

func IsOpenshift

func IsOpenshift(client kubernetes.Interface) bool

IsOpenshift detects if the application is running on OpenShift or not

func JSONToYAML

func JSONToYAML(src []byte) ([]byte, error)

JSONToYAML --

func ResolveValueSource

func ResolveValueSource(ctx context.Context, client k8sclient.Reader, namespace string, valueSource *v1alpha1.ValueSource) (string, error)

ResolveValueSource --

func RevisionOfConfigMapOrSecret

func RevisionOfConfigMapOrSecret(ctx context.Context, client k8sclient.Reader, namespace string, env corev1.EnvVar) (string, error)

RevisionOfConfigMapOrSecret --

func ToJSON

func ToJSON(value runtime.Object) ([]byte, error)

ToJSON --

func ToYAML

func ToYAML(value runtime.Object) ([]byte, error)

ToYAML --

func ValidateEnvironmentPropertyNames

func ValidateEnvironmentPropertyNames(envs []corev1.EnvVar) error

ValidateEnvironmentPropertyNames --

Types

type ResourceInterface

type ResourceInterface interface {
	// Create creates a new Kubernetes object in the cluster.
	// Note that no checks will be performed in the cluster. If you're not sure, use CreateIfNotExists.
	Create(resource ResourceObject) error
	// CreateIfNotExists will fetch for the object resource in the Kubernetes cluster, if not exists, will create it.
	CreateIfNotExists(resource ResourceObject) (exists bool, err error)
	// FetchWithKey fetches and binds a resource from the Kubernetes cluster with the defined key. If not exists, returns false.
	FetchWithKey(key types.NamespacedName, resource ResourceObject) (exists bool, err error)
	// Fetch fetches and binds a resource with given name and namespace from the Kubernetes cluster. If not exists, returns false.
	Fetch(resource ResourceObject) (exists bool, err error)
	// ListWithNamespace fetches and binds a list resource from the Kubernetes cluster with the defined namespace.
	ListWithNamespace(namespace string, list runtime.Object) error
	// ListWithNamespaceAndLabel same as ListWithNamespace, but also limit the query scope by the given labels
	ListWithNamespaceAndLabel(namespace string, list runtime.Object, labels map[string]string) error
	Delete(resource ResourceObject) error
	// UpdateStatus update the given object status
	UpdateStatus(resource ResourceObject) error
	// Update the given object
	Update(resource ResourceObject) error
}

ResourceInterface has functions that interacts with any resource object in the Kubernetes cluster

func Resource

Resource --

type ResourceObject

type ResourceObject interface {
	metav1.Object
	runtime.Object
}

ResourceObject is any object in a Kubernetes or OpenShift cluster

Jump to

Keyboard shortcuts

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