utils

package
v0.3.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	CappNS  = "capp-operator-system"
	CappKey = "capp"
)

Variables

View Source
var (
	CappAPIGroup      = cappv1alpha1.GroupVersion.Group
	CappNamespaceKey  = CappAPIGroup + "/parent-capp-ns"
	CappResourceKey   = CappAPIGroup + "/parent-capp"
	ManagedByLabelKey = CappAPIGroup + "/managed-by"
)

Functions

func FilterKeysWithoutPrefix

func FilterKeysWithoutPrefix(object map[string]string, prefix string) map[string]string

FilterKeysWithoutPrefix removes keys from a map if they don't start with a given prefix

func FilterMap

func FilterMap(originalMap map[string]string, substring string) map[string]string

FilterMap returns a new map containing only the key-value pairs where the key contains the specified substring.

func GenerateRecordName added in v0.3.0

func GenerateRecordName(hostname, suffix string) string

GenerateRecordName generates the hostname based on the provided suffix and a dot(".") trailing character. It returns the original hostname with the suffix removed if it was present, otherwise the original hostname.

func GenerateResourceName added in v0.3.0

func GenerateResourceName(hostname, suffix string) string

GenerateResourceName generates the hostname based on the provided suffix and a dot(".") trailing character. If the hostname does not already end with the suffix (minus the trailing dot), it appends the suffix to the hostname.

func GenerateSecretName added in v0.3.0

func GenerateSecretName(resourceName string) string

GenerateSecretName generates TLS secret name for certificate and domain mapping.

func GetDNSConfig added in v0.3.0

func GetDNSConfig(ctx context.Context, k8sClient client.Client) (map[string]string, error)

GetDNSConfig returns the data of the DNS ConfigMap.

func GetDNSRecordFromConfig added in v0.3.0

func GetDNSRecordFromConfig(dnsConfig map[string]string) (string, error)

GetDNSRecordFromConfig returns the DNSRecord to be used for the record from a ConfigMap.

func GetIssuerNameFromConfig added in v0.3.3

func GetIssuerNameFromConfig(dnsConfig map[string]string) (string, error)

GetIssuerNameFromConfig returns the name of the Certificate Issuer to be used for the Certificate from a ConfigMap.

func GetListOptions added in v0.3.0

func GetListOptions(set labels.Set) client.ListOptions

GetListOptions returns a list option object from a given Set.

func GetXPProviderFromConfig added in v0.3.3

func GetXPProviderFromConfig(dnsConfig map[string]string) (string, error)

GetXPProviderFromConfig returns the Crossplane provider to be used for the record from a ConfigMap.

func GetZoneFromConfig added in v0.3.0

func GetZoneFromConfig(dnsConfig map[string]string) (string, error)

GetZoneFromConfig returns the zone to be used for the record from a ConfigMap.

func IsCustomHostnameSet added in v0.3.2

func IsCustomHostnameSet(hostname string) bool

IsCustomHostnameSet returns a boolean indicating whether a custom hostname is set.

func IsDNSRecordAvailable added in v0.3.0

func IsDNSRecordAvailable(ctx context.Context, k8sClient client.Client, name, namespace string) (bool, error)

IsDNSRecordAvailable returns a boolean indicating whether a CNAMERecord is currently available.

func IsOnOpenshift

func IsOnOpenshift(config *rest.Config) (bool, error)

IsOnOpenshift returns true if the cluster has the openshift config group

func MergeMaps

func MergeMaps(m1 map[string]string, m2 map[string]string) map[string]string

MergeMaps merges two string-string maps by combining their key-value pairs into a new map.

func TruncateCommonName added in v0.3.3

func TruncateCommonName(s string) string

TruncateCommonName truncates the CommonName string to be no longer than 64 characters.

Types

This section is empty.

Jump to

Keyboard shortcuts

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