util

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ManagedByKey                      = "app.kubernetes.io/managed-by"
	HelmReleaseNamespaceAnnotationKey = "meta.helm.sh/release-namespace"
)
View Source
const (
	APIServerDeploymentName              = "kube-apiserver"
	OCMServerDeploymentName              = "multicluster-controlplane"
	VClusterServerDeploymentName         = "vcluster"
	CMDeploymentName                     = "kube-controller-manager"
	ProjectName                          = "kubeflex"
	DBReleaseName                        = "postgres"
	SystemNamespace                      = "kubeflex-system"
	SystemConfigMap                      = "kubeflex-config"
	AdminConfSecret                      = "admin-kubeconfig"
	OCMKubeConfigSecret                  = "multicluster-controlplane-kubeconfig"
	VClusterKubeConfigSecret             = "vc-vcluster"
	VClusterNodePortServiceName          = "vcluster-nodeport"
	VClusterServiceName                  = "vcluster"
	KubeconfigSecretKeyDefault           = "kubeconfig"
	KubeconfigSecretKeyInCluster         = "kubeconfig-incluster"
	KubeconfigSecretKeyVCluster          = "config"
	KubeconfigSecretKeyVClusterInCluster = "config-incluster"
)
View Source
const (
	UnableToRetrieveCompleteAPIListError = "unable to retrieve the complete list of server APIs"
)

Variables

This section is empty.

Functions

func CheckResourceExists added in v0.2.5

func CheckResourceExists(clientset kubernetes.Clientset, group, version, kind string) bool

func DropDatabase added in v0.2.5

func DropDatabase(ctx context.Context, cpName string, crClient client.Client) error

func GVKToGVR added in v0.4.0

func GVRToGVK added in v0.4.0

func GenerateDevLocalDNSName

func GenerateDevLocalDNSName(name, domain string) string

GenerateDevLocalDNSName: generates the local dns name for test/dev from the controlplane name

func GenerateHostedDNSName added in v0.2.1

func GenerateHostedDNSName(namespace, name string) []string

func GenerateNamespaceFromControlPlaneName

func GenerateNamespaceFromControlPlaneName(name string) string

func GenerateObjectInfoString added in v0.3.0

func GenerateObjectInfoString(obj unstructured.Unstructured) string

Used for generating a single string unique representation of the object for logging info

func GenerateOperatorDeploymentName

func GenerateOperatorDeploymentName() string

func GeneratePGConnectionString added in v0.2.5

func GeneratePGConnectionString(dbPassword, dbName string) string

func GeneratePSReplicaSetName

func GeneratePSReplicaSetName(releaseName string) string

func GeneratePSecretName

func GeneratePSecretName(releaseName string) string

func GetAPIServerDeploymentNameByControlPlaneType added in v0.2.0

func GetAPIServerDeploymentNameByControlPlaneType(controlPlaneType string) string

func GetGroupVersionKindFromObject added in v0.3.0

func GetGroupVersionKindFromObject(obj *unstructured.Unstructured) schema.GroupVersionKind

func GetKubeconfSecretKeyNameByControlPlaneType added in v0.2.0

func GetKubeconfSecretKeyNameByControlPlaneType(controlPlaneType string) string

func GetKubeconfSecretNameByControlPlaneType added in v0.2.0

func GetKubeconfSecretNameByControlPlaneType(controlPlaneType string) string

func GetKubernetesClusterVersionInfo

func GetKubernetesClusterVersionInfo(kubeconfig string) (string, error)

func GetPGDBPassword added in v0.2.5

func GetPGDBPassword(crClient client.Client) (string, error)

func IsAPIServerDeploymentReady added in v0.1.1

func IsAPIServerDeploymentReady(log logr.Logger, c client.Client, hcp tenancyv1alpha1.ControlPlane) (bool, error)

func IsClusterScoped added in v0.3.0

func IsClusterScoped(gvk schema.GroupVersionKind, apiResourceLists []*metav1.APIResourceList) (bool, error)

func IsInCluster added in v0.2.5

func IsInCluster() bool

func IsOpenShift added in v0.2.5

func IsOpenShift(clientset kubernetes.Clientset) bool

func ParseVersionNumber

func ParseVersionNumber(versionString string) string

func PrintStatus

func PrintStatus(message string, done chan bool, wg *sync.WaitGroup, chattyStatus bool)

PrintWithIcon prints a message with defined colors and a spinning icon in front that can be changed to checkmark when completed.

func RenderYAML added in v0.3.0

func RenderYAML(yamlTemplate []byte, data interface{}) ([]byte, error)

func ReplaceNotAllowedCharsInDBName added in v0.2.5

func ReplaceNotAllowedCharsInDBName(name string) string

func SetClusterScopedOwnerRefs added in v0.3.1

func SetClusterScopedOwnerRefs(c crc.Client, scheme *runtime.Scheme, hcp *tenancyv1alpha1.ControlPlane) error

func ToUnstructured added in v0.3.0

func ToUnstructured(raw []byte) (*unstructured.Unstructured, error)

func WaitForDeploymentReady

func WaitForDeploymentReady(clientset kubernetes.Clientset, name, namespace string) error

func WaitForNamespaceDeletion

func WaitForNamespaceDeletion(clientset kubernetes.Clientset, name string) error

func WaitForStatefulSetReady

func WaitForStatefulSetReady(clientset kubernetes.Clientset, name, namespace string) error

func ZeroFields added in v0.2.7

func ZeroFields(obj runtime.Object) runtime.Object

Types

This section is empty.

Jump to

Keyboard shortcuts

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