Documentation
¶
Index ¶
- Constants
- func AddTenantPrefix(name string, tenantControlPlane *stewardv1alpha1.TenantControlPlane) string
- func AreGatewayResourcesAvailable(ctx context.Context, c client.Client, ...) bool
- func ArgsAddFlagValue(args map[string]string, flag, value string) bool
- func ArgsFromMapToSlice(args map[string]string) (slice []string)
- func ArgsFromSliceToMap(args []string) (m map[string]string)
- func ArgsRemoveFlag(args map[string]string, flag string) bool
- func CalculateMapChecksum(data any) string
- func CreateOrUpdateWithConflict(ctx context.Context, client client.Client, resource client.Object, ...) (res controllerutil.OperationResult, err error)
- func DecodeFromJSON(o string, to runtime.Object) (err error)
- func DecodeFromYAML(o string, to runtime.Object) (err error)
- func DecodeKubeconfig(secret corev1.Secret, key string) (*clientcmdapiv1.Config, error)
- func DecodeKubeconfigYAML(bytes []byte) (*clientcmdapiv1.Config, error)
- func EncodeToJSON(o runtime.Object) ([]byte, error)
- func EncodeToYaml(o runtime.Object) ([]byte, error)
- func GatewayAPIResourcesAvailable(ctx context.Context, discoveryClient discovery.DiscoveryInterface) (bool, error)
- func GetControlPlaneAddressAndPortFromHostname(hostname string, defaultPort int32) (address string, port int32)
- func GetObjectChecksum(obj client.Object) string
- func GetRESTClientConfig(ctx context.Context, client client.Client, ...) (*restclient.Config, error)
- func GetTenantClient(ctx context.Context, c client.Client, ...) (client.Client, error)
- func GetTenantClientSet(ctx context.Context, client client.Client, ...) (*clientset.Clientset, error)
- func GetTenantKubeconfig(ctx context.Context, client client.Client, ...) (*clientcmdapiv1.Config, error)
- func HasNamedContainer(container []corev1.Container, name string) (found bool, index int)
- func HasNamedVolume(volumes []corev1.Volume, name string) (found bool, index int)
- func HasNamedVolumeMount(volumeMounts []corev1.VolumeMount, name string) (found bool, index int)
- func IsGatewayAPIAvailableViaClient(ctx context.Context, c client.Client) bool
- func IsRotationRequested(obj client.Object) bool
- func IsTLSRouteAvailable(ctx context.Context, c client.Client, ...) bool
- func IsTLSRouteAvailableViaClient(ctx context.Context, c client.Client) bool
- func MergeMaps(maps ...map[string]string) map[string]string
- func SetLastRotationTimestamp(obj client.Object)
- func SetObjectChecksum(obj client.Object, data any)
- func StewardLabels(tcpName, resourceName string) map[string]string
- func TLSRouteAPIAvailable(ctx context.Context, discoveryClient discovery.DiscoveryInterface) (bool, error)
Constants ¶
const ( RotateCertificateRequestAnnotation = "certs.steward.butlerlabs.dev/rotate" CertificateX509Label = "x509" CertificateKubeconfigLabel = "kubeconfig" )
Variables ¶
This section is empty.
Functions ¶
func AddTenantPrefix ¶
func AddTenantPrefix(name string, tenantControlPlane *stewardv1alpha1.TenantControlPlane) string
func AreGatewayResourcesAvailable ¶
func AreGatewayResourcesAvailable(ctx context.Context, c client.Client, discoveryClient discovery.DiscoveryInterface) bool
AreGatewayResourcesAvailable checks if Gateway API is available in the cluster through a discovery Client with fallback to client-based check.
func ArgsAddFlagValue ¶
ArgsAddFlagValue performs upsert of a flag in the arguments map, returning true if created.
func ArgsFromMapToSlice ¶
ArgsFromMapToSlice create the slice of args, and sorting the resulting output in order to make it idempotent. Along with that, if a flag doesn't have a value, it's presented barely without a value assignment.
func ArgsFromSliceToMap ¶
ArgsFromSliceToMap transforms a slice of string into a map, simplifying the subsequent mangling.
func ArgsRemoveFlag ¶
ArgsRemoveFlag removes a flag from the arguments map, returning true if found and removed.
func CalculateMapChecksum ¶
CalculateMapChecksum orders the map according to its key, and calculating the overall md5 of the values. It's expected to work with ConfigMap (map[string]string) and Secrets (map[string][]byte).
func CreateOrUpdateWithConflict ¶
func CreateOrUpdateWithConflict(ctx context.Context, client client.Client, resource client.Object, f controllerutil.MutateFn) (res controllerutil.OperationResult, err error)
CreateOrUpdateWithConflict is a helper function that wraps the RetryOnConflict around the CreateOrUpdate function: this allows to fetch from the cache the latest modified object an try to apply the changes defined in the MutateFn without enqueuing back the request in order to get the latest changes of the resource.
func DecodeKubeconfig ¶
func DecodeKubeconfigYAML ¶
func DecodeKubeconfigYAML(bytes []byte) (*clientcmdapiv1.Config, error)
func EncodeToJSON ¶
EncodeToJSON returns the given object in JSON format and the error, respecting the Kubernetes struct tags.
func EncodeToYaml ¶
EncodeToYaml returns the given object in yaml format and the error.
func GatewayAPIResourcesAvailable ¶
func GatewayAPIResourcesAvailable(ctx context.Context, discoveryClient discovery.DiscoveryInterface) (bool, error)
NOTE: These functions are extremely similar, maybe they can be merged and accept a GVK. Explicit for now. GatewayAPIResourcesAvailable checks if Gateway API is available in the cluster.
func GetObjectChecksum ¶
GetObjectChecksum returns the annotation checksum in case this is set, otherwise, an empty string.
func GetRESTClientConfig ¶
func GetRESTClientConfig(ctx context.Context, client client.Client, tenantControlPlane *stewardv1alpha1.TenantControlPlane) (*restclient.Config, error)
func GetTenantClient ¶
func GetTenantClient(ctx context.Context, c client.Client, tenantControlPlane *stewardv1alpha1.TenantControlPlane) (client.Client, error)
func GetTenantClientSet ¶
func GetTenantClientSet(ctx context.Context, client client.Client, tenantControlPlane *stewardv1alpha1.TenantControlPlane) (*clientset.Clientset, error)
func GetTenantKubeconfig ¶
func GetTenantKubeconfig(ctx context.Context, client client.Client, tenantControlPlane *stewardv1alpha1.TenantControlPlane) (*clientcmdapiv1.Config, error)
func HasNamedContainer ¶
HasNamedContainer finds the Container in the provided slice by its name, returning a boolean if found, and its index.
func HasNamedVolume ¶
HasNamedVolume finds the Volume in the provided slice by its name, returning a boolean if found, and its index.
func HasNamedVolumeMount ¶
func HasNamedVolumeMount(volumeMounts []corev1.VolumeMount, name string) (found bool, index int)
HasNamedVolumeMount finds the VolumeMount in the provided slice by its name, returning a boolean if found, and its index.
func IsGatewayAPIAvailableViaClient ¶
IsGatewayAPIAvailableViaClient uses client to check Gateway API availability.
func IsRotationRequested ¶
func IsTLSRouteAvailable ¶
func IsTLSRouteAvailable(ctx context.Context, c client.Client, discoveryClient discovery.DiscoveryInterface) bool
IsTLSRouteAvailable checks if TLSRoute is available with fallback to client-based check.
func IsTLSRouteAvailableViaClient ¶
IsTLSRouteAvailableViaClient uses client to check TLSRoute availability.
func SetObjectChecksum ¶
SetObjectChecksum calculates the checksum for the given map and store it in the object annotations.
func StewardLabels ¶
func TLSRouteAPIAvailable ¶
func TLSRouteAPIAvailable(ctx context.Context, discoveryClient discovery.DiscoveryInterface) (bool, error)
TLSRouteAPIAvailable checks specifically for TLSRoute resource availability.
Types ¶
This section is empty.