utils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolAddr

func BoolAddr(b bool) *bool

Helper function for struct construction requiring a boolean pointer

func BoolToString

func BoolToString(b bool) string

func BoolToYesNo

func BoolToYesNo(report_stats bool) string

func CheckResourcePresenceFunc

func CheckResourcePresenceFunc(
	k8sClient client.Client,
	ctx context.Context,
	timeout time.Duration,
	interval time.Duration,
) func(client.Object, types.NamespacedName, metav1.OwnerReference)

func CheckStatusFunc

func CheckStatusFunc(
	k8sClient client.Client,
	ctx context.Context,
	timeout time.Duration,
	interval time.Duration,
) func(string, string, types.NamespacedName, client.Object)

func CheckSubresourceAbsenceFunc

func CheckSubresourceAbsenceFunc(
	k8sClient client.Client,
	ctx context.Context,
	timeout time.Duration,
	interval time.Duration,
) func(types.NamespacedName, ...client.Object)

func ComputeFQDN

func ComputeFQDN(name string, namespace string) string

func ComputeNamespace

func ComputeNamespace(defaultNamespace string, newNamespace string) string

ConfigMap that are created by the user could be living in a different namespace as Synapse. getConfigMapNamespace provides a way to default to the Synapse namespace if none is provided.

func Convert

func Convert(i interface{}) interface{}

func ConvertStructToMap

func ConvertStructToMap(in interface{}) (map[string]interface{}, error)

func DeleteResourceFunc

func DeleteResourceFunc(
	k8sClient client.Client,
	ctx context.Context,
	timeout time.Duration,
	interval time.Duration,
) func(client.Object, types.NamespacedName, bool)

func GetConfigMapCopy

func GetConfigMapCopy(
	client client.Client,
	sourceConfigMapName string,
	sourceConfigMapNamespace string,
	copyConfigMapObjectMeta metav1.ObjectMeta,
) (*corev1.ConfigMap, error)

getConfigMapCopy is a generic function which creates a copy of a given source ConfigMap. The resulting copy is a ConfigMap with similar data, and with metadata set by the 'copyConfigMapObjectMeta' argument.

func GetSynapseServerName

func GetSynapseServerName(s synapsev1alpha1.Synapse) (string, error)

func LoadYAMLFileFromConfigMapData

func LoadYAMLFileFromConfigMapData(
	configMap corev1.ConfigMap,
	filename string,
) (map[string]interface{}, error)

func UpdateConfigMap

func UpdateConfigMap(
	ctx context.Context,
	client client.Client,
	key types.NamespacedName,
	i interface{},
	updateData updateDataFunc,
	filename string,
) error

A generic function to update an existing ConfigMap. It takes as arguments: * The context * The key (name and namespace) of the ConfigMap to update * The Synapse object being reconciled * The function to be called to actually update the ConfigMap's content * The name of the file to update in the ConfigMap

func UpdateConfigMapData

func UpdateConfigMapData(
	cm *corev1.ConfigMap,
	i interface{},
	updateData updateDataFunc,
	filename string,
) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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