Documentation
¶
Index ¶
- Constants
- func AddFinalizer(obj metav1.Object, finalizers ...string)
- func AddOwnerRefAnnotation(ctx context.Context, client ctrlruntimeclient.Client, ...) error
- func GetCluster(ctx context.Context, client ctrlruntimeclient.Client, ...) (*v1alpha1.Cluster, error)
- func GetConfigMapData(ctx context.Context, client ctrlruntimeclient.Client, namespace string, ...) (string, error)
- func GetEnv(key, fallback string) string
- func GetFuncMap() template.FuncMap
- func GetNotificationSink(ctx context.Context, client ctrlruntimeclient.Client, ...) (*v1alpha1.NotificationSink, error)
- func GetOwnerRefsAnnotationRequests(ctx context.Context, c ctrlruntimeclient.Client, ...) []reconcile.Request
- func GetPluralEnv(key, fallback string) string
- func GetPluralEnvBool(key string, fallback bool) bool
- func GetPrAutomation(ctx context.Context, client ctrlruntimeclient.Client, ...) (*v1alpha1.PrAutomation, error)
- func GetScmConnection(ctx context.Context, client ctrlruntimeclient.Client, ...) (*v1alpha1.ScmConnection, error)
- func GetSecret(ctx context.Context, client ctrlruntimeclient.Client, ...) (*corev1.Secret, error)
- func GetSentinel(ctx context.Context, client ctrlruntimeclient.Client, ...) (*v1alpha1.Sentinel, error)
- func GetServiceDeployment(ctx context.Context, client ctrlruntimeclient.Client, ...) (*v1alpha1.ServiceDeployment, error)
- func HashObject(a any) (string, error)
- func HashString(s string) string
- func MakeTemplate(tmplate string) (*template.Template, error)
- func MarkCondition(set func(condition metav1.Condition), conditionType v1alpha1.ConditionType, ...)
- func MarkFalse(set func(metav1.Condition), conditionType v1alpha1.ConditionType, ...)
- func MarkReadOnly(resource v1alpha1.ReadOnlyPluralResource)
- func MarkTrue(set func(metav1.Condition), conditionType v1alpha1.ConditionType, ...)
- func OwnerRefAnnotationEventHandler[T ctrlruntimeclient.Object](c ctrlruntimeclient.Client, owner T) handler.EventHandler
- func RemoveFinalizer(obj metav1.Object, toRemove ...string)
- func RemoveOwnerRefsByGVK(obj ctrlruntimeclient.Object, apiVersion, kind string) bool
- func RenderString(tmplate string, ctx map[string]interface{}) (string, error)
- func RenderTemplate(wr io.Writer, tmplate string, ctx map[string]interface{}) error
- func SyncCondition(set func(condition metav1.Condition), ...)
- func TryAddControllerRef(ctx context.Context, client ctrlruntimeclient.Client, ...) error
- func TryAddOwnerRef(ctx context.Context, client ctrlruntimeclient.Client, ...) error
- func TryRemoveFinalizer(ctx context.Context, client ctrlruntimeclient.Client, ...) error
- func TryRemoveOwnerRef(ctx context.Context, client ctrlruntimeclient.Client, ...) error
- func TryToUpdate(ctx context.Context, client ctrlruntimeclient.Client, ...) error
- type ConsoleHelper
- type Patcher
Constants ¶
const (
EnvPrefix = "PLRL"
)
const OwnerRefAnnotation = "deployments.plural.sh/owner-ref"
Variables ¶
This section is empty.
Functions ¶
func AddFinalizer ¶
AddFinalizer will add the given finalizer to the object. It uses a StringSet to avoid duplicates.
func AddOwnerRefAnnotation ¶
func AddOwnerRefAnnotation(ctx context.Context, client ctrlruntimeclient.Client, owner, object ctrlruntimeclient.Object) error
func GetCluster ¶
func GetCluster(ctx context.Context, client ctrlruntimeclient.Client, ref *corev1.ObjectReference) (*v1alpha1.Cluster, error)
func GetConfigMapData ¶
func GetConfigMapData(ctx context.Context, client ctrlruntimeclient.Client, namespace string, ref *corev1.ConfigMapKeySelector) (string, error)
func GetEnv ¶
GetEnv - Lookup the environment variable provided and set to default value if variable isn't set.
func GetFuncMap ¶
func GetNotificationSink ¶
func GetNotificationSink(ctx context.Context, client ctrlruntimeclient.Client, ref *corev1.ObjectReference) (*v1alpha1.NotificationSink, error)
func GetOwnerRefsAnnotationRequests ¶
func GetOwnerRefsAnnotationRequests(ctx context.Context, c ctrlruntimeclient.Client, object, owner ctrlruntimeclient.Object) []reconcile.Request
func GetPluralEnv ¶
GetPluralEnv - Lookup the plural environment variable. It has to be prefixed with EnvPrefix. If the variable with the provided key is not set, fallback will be used.
func GetPluralEnvBool ¶
GetPluralEnvBool - Lookup the plural environment variable. It has to be prefixed with EnvPrefix. If the variable with the provided key is not set, fallback will be used.
func GetPrAutomation ¶
func GetPrAutomation(ctx context.Context, client ctrlruntimeclient.Client, ref *corev1.ObjectReference) (*v1alpha1.PrAutomation, error)
func GetScmConnection ¶
func GetScmConnection(ctx context.Context, client ctrlruntimeclient.Client, ref *corev1.ObjectReference) (*v1alpha1.ScmConnection, error)
func GetSecret ¶
func GetSecret(ctx context.Context, client ctrlruntimeclient.Client, ref *corev1.SecretReference) (*corev1.Secret, error)
func GetSentinel ¶
func GetSentinel(ctx context.Context, client ctrlruntimeclient.Client, ref *corev1.ObjectReference) (*v1alpha1.Sentinel, error)
func GetServiceDeployment ¶
func GetServiceDeployment(ctx context.Context, client ctrlruntimeclient.Client, ref *corev1.ObjectReference) (*v1alpha1.ServiceDeployment, error)
func HashObject ¶
func HashString ¶
func MarkCondition ¶
func MarkCondition(set func(condition metav1.Condition), conditionType v1alpha1.ConditionType, conditionStatus metav1.ConditionStatus, conditionReason v1alpha1.ConditionReason, message string)
func MarkFalse ¶
func MarkFalse(set func(metav1.Condition), conditionType v1alpha1.ConditionType, conditionReason v1alpha1.ConditionReason, message string)
func MarkReadOnly ¶
func MarkReadOnly(resource v1alpha1.ReadOnlyPluralResource)
func MarkTrue ¶
func MarkTrue(set func(metav1.Condition), conditionType v1alpha1.ConditionType, conditionReason v1alpha1.ConditionReason, message string)
func OwnerRefAnnotationEventHandler ¶
func OwnerRefAnnotationEventHandler[T ctrlruntimeclient.Object](c ctrlruntimeclient.Client, owner T) handler.EventHandler
func RemoveFinalizer ¶
RemoveFinalizer removes the given finalizers from the object.
func RemoveOwnerRefsByGVK ¶
func RemoveOwnerRefsByGVK(obj ctrlruntimeclient.Object, apiVersion, kind string) bool
RemoveOwnerRefsByGVK removes all owner references matching the specified API version and Kind from the object. This modifies the object in-place without patching. The caller is responsible for persisting the changes. This is useful for cleanup when migrating away from owner references for a specific resource type.
func RenderTemplate ¶
func SyncCondition ¶
func TryAddControllerRef ¶
func TryAddControllerRef(ctx context.Context, client ctrlruntimeclient.Client, owner ctrlruntimeclient.Object, controlled ctrlruntimeclient.Object, scheme *runtime.Scheme) error
func TryAddOwnerRef ¶
func TryAddOwnerRef(ctx context.Context, client ctrlruntimeclient.Client, owner ctrlruntimeclient.Object, object ctrlruntimeclient.Object, scheme *runtime.Scheme) error
func TryRemoveFinalizer ¶
func TryRemoveFinalizer(ctx context.Context, client ctrlruntimeclient.Client, obj ctrlruntimeclient.Object, finalizers ...string) error
func TryRemoveOwnerRef ¶
func TryRemoveOwnerRef(ctx context.Context, client ctrlruntimeclient.Client, owner ctrlruntimeclient.Object, controlled ctrlruntimeclient.Object, scheme *runtime.Scheme) error
func TryToUpdate ¶
func TryToUpdate(ctx context.Context, client ctrlruntimeclient.Client, object ctrlruntimeclient.Object) error
Types ¶
type ConsoleHelper ¶
type ConsoleHelper struct {
// contains filtered or unexported fields
}
func NewConsoleHelper ¶
func NewConsoleHelper(ctx context.Context, k8sClient k8sclient.Client) *ConsoleHelper
func (*ConsoleHelper) IDFromRef ¶
func (in *ConsoleHelper) IDFromRef(ref *v1.ObjectReference, resource v1alpha1.PluralResource) (*string, error)