Documentation ¶
Index ¶
- Constants
- Variables
- func AddFinalizer(ctx context.Context, c client.Client, obj client.Object, finalizerKey string) error
- func HasSuspendLabel(o client.Object) bool
- func InitRedditLabels(applicationName, applicationVersion, componentName string)
- func MustGVKForObject(obj client.Object, scheme *runtime.Scheme) schema.GroupVersionKind
- func MustTypedObjectRefFromObject(obj client.Object, scheme *runtime.Scheme) *api.TypedObjectRef
- func NewObjectForGVK(scheme *runtime.Scheme, gvk schema.GroupVersionKind) (client.Object, error)
- func RedditLabels(controllerName string) map[string]string
- func RemoveFinalizer(ctx context.Context, c client.Client, obj client.Object, finalizerKey string) error
- func ResourceScope(o client.Object, scheme *runtime.Scheme, mapper meta.RESTMapper) (meta.RESTScopeName, error)
- func SetControllerRef(o client.Object, owner client.Object, scheme *runtime.Scheme) error
- func SetOwnerRef(o client.Object, owner client.Object, scheme *runtime.Scheme) error
- func SetRedditLabels(obj client.Object, controllerName string)
- func TypedObjectRefFromObject(obj client.Object, scheme *runtime.Scheme) (*api.TypedObjectRef, error)
- func WasCreated(o metav1.Object) bool
- func WasDeleted(o metav1.Object) bool
Constants ¶
const ( // ApplicationNameKey represents the name of the application ApplicationNameKey = "infrared.reddit.com/name" // ApplicationVersionKey represents the version of the application ApplicationVersionKey = "infrared.reddit.com/version" // ComponentNameKey represents the name of the specific component in the application ComponentNameKey = "infrared.reddit.com/component" // ManagedByKey represents the name of the controller managing the resource ManagedByKey = "infrared.reddit.com/managed-by" // SuspendKey is the label key on an object that should be used to temporarily suspend reconciliation on // an object. SuspendKey = "infrared.reddit.com/suspend" )
const ( // InfraredSystemNamespace is the namespace containing all Achilles related workloads. // TODO create single source of truth for this namespace, generate into controller manifests // the namespace in which reddit control-plane resources reside InfraredSystemNamespace = "infrared-system" // ClusterComponentsNamespace is the namespace containing ClusterComponentSets and related resources. ClusterComponentsNamespace = "infrared-cluster-components" )
Variables ¶
var ( // these variables should be overridden at program initialization time ApplicationName = "" ApplicationVersion = "" ComponentName = "" )
Functions ¶
func AddFinalizer ¶
func AddFinalizer( ctx context.Context, c client.Client, obj client.Object, finalizerKey string, ) error
AddFinalizer patches an object by adding the given finalizer key.
func HasSuspendLabel ¶
HasSuspendLabel checks if the label `SuspendKey` has been set in the object's meta.labels.
func InitRedditLabels ¶
func InitRedditLabels(applicationName, applicationVersion, componentName string)
InitRedditLabels must be invoked at application start to initialize labels.
func MustGVKForObject ¶
MustGVKForObject returns schema.GroupVersionKind for the given object using the provided runtime.Scheme, will panic if not registered in scheme
func MustTypedObjectRefFromObject ¶
MustTypedObjectRefFromObject returns *api.TypedObjectRef with GVK metadata provided from the provided runtime.Scheme, but panics if an error occurs.
func NewObjectForGVK ¶
NewObjectForGVK returns a new empty client.Object a given GroupVersionKind.
func RedditLabels ¶
RedditLabels is the set of labels common to all resources managed by an application
func RemoveFinalizer ¶
func RemoveFinalizer( ctx context.Context, c client.Client, obj client.Object, finalizerKey string, ) error
RemoveFinalizer patches an object by removing the given finalizer key.
func ResourceScope ¶
func ResourceScope( o client.Object, scheme *runtime.Scheme, mapper meta.RESTMapper, ) (meta.RESTScopeName, error)
ResourceScope returns the scope (namespace or cluster) of the provided object.
func SetControllerRef ¶
SetControllerRef sets an owner reference on the given object that references the owner object with controller flag set to true
func SetOwnerRef ¶
SetOwnerRef appends an owner reference on the given object that references the owner object with controller flag set to false
func SetRedditLabels ¶
SetRedditLabels updates an object's meta.labels with common reddit labels. Must be invoked inside the mutateFn of controllerutil.CreateOrUpdate or controllerutil.CreateOrPatch
func TypedObjectRefFromObject ¶
func TypedObjectRefFromObject(obj client.Object, scheme *runtime.Scheme) (*api.TypedObjectRef, error)
TypedObjectRefFromObject returns *api.TypedObjectRef with GVK metadata provided from the provided scheme
func WasCreated ¶
WasCreated returns true if the supplied object was created in the API server.
func WasDeleted ¶
WasDeleted returns true if the given object has been marked for deletion.Originally from
Types ¶
This section is empty.