utils

package
v0.3.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	CappConfigName = "capp-config"
	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 GetCappConfig added in v0.3.6

func GetCappConfig(k8sClient client.Client) (*cappv1alpha1.CappConfig, error)

GetCappConfig fetches and returns an existing instance of an existing cappConfig

func GetDNSConfig added in v0.3.0

func GetDNSConfig(ctx context.Context, k8sClient client.Client) (cappv1alpha1.DNSConfig, error)

GetDNSConfig returns the data of the DNS for the CappConfig CRD.

func GetDNSRecordFromConfig added in v0.3.0

func GetDNSRecordFromConfig(dnsConfig cappv1alpha1.DNSConfig) (string, error)

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

func GetIssuerNameFromConfig added in v0.3.3

func GetIssuerNameFromConfig(dnsConfig cappv1alpha1.DNSConfig) (string, error)

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

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 GetResource added in v0.3.6

func GetResource(k8sClient client.Client, obj client.Object, name, namespace string) error

GetResource fetches an existing resource and returns an instance of it.

func GetXPProviderFromConfig added in v0.3.3

func GetXPProviderFromConfig(dnsConfig cappv1alpha1.DNSConfig) (string, error)

GetXPProviderFromConfig returns the Crossplane provider to be used for the record from the CappConfig CRD.

func GetZoneFromConfig added in v0.3.0

func GetZoneFromConfig(dnsConfig cappv1alpha1.DNSConfig) (string, error)

GetZoneFromConfig returns the zone to be used for the record from the CappConfig CRD.

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