Documentation ¶
Index ¶
- Constants
- Variables
- func ConditionSlicesEqual(conditions1, conditions2 []v1alpha1.Condition) bool
- func ConditionsEqualIgnoreTransitionTime(c1, c2 v1alpha1.Condition) bool
- func ConstructManagedFieldsV1Set(managedFields []v1.ManagedFieldsEntry) (*fieldpath.Set, error)
- func ConstructTrimmedSpecWithManagedFields(resource *Resource, jsonSchema *apiextensions.JSONSchemaProps, ...) (map[string]interface{}, error)
- func ContainerTypes(containers []corekccv1alpha1.Container) []corekccv1alpha1.ContainerType
- func ContainerTypesFor(hierarchicalRefs []corekccv1alpha1.HierarchicalReference) []corekccv1alpha1.ContainerType
- func CurrentNamespace() string
- func EnsureFinalizer(o metav1.Object, finalizer string) (found bool)
- func EnsureFinalizers(o metav1.Object, finalizers ...string) (found bool)
- func EnsureHierarchicalReference(ctx context.Context, resource *Resource, ...) error
- func EnsureManagementConflictPreventionAnnotationForTFBasedResource(ctx context.Context, c client.Client, obj metav1.Object, ...) error
- func FormatAnnotation(annotationName string) string
- func GVKListContains(gvkList []schema.GroupVersionKind, gvk schema.GroupVersionKind) bool
- func GVKSetToList(gvkSet map[schema.GroupVersionKind]bool) []schema.GroupVersionKind
- func GenerateMutableButUnreadableFieldsAnnotation(resource *Resource, mutableButUnreadablePaths [][]string) (string, error)
- func GenerateMutableButUnreadableFieldsState(resource *Resource, mutableButUnreadablePaths [][]string) (map[string]interface{}, error)
- func GetAPIVersionFromCRD(crd *apiextensions.CustomResourceDefinition) string
- func GetAnnotation(annotation string, obj metav1.Object) (string, bool)
- func GetAnnotationForContainerType(containerType corekccv1alpha1.ContainerType) string
- func GetContainerAnnotation(annotations map[string]string, containerTypes []corekccv1alpha1.ContainerType) (string, corekccv1alpha1.ContainerType, error)
- func GetHierarchicalReference(resource *Resource, hierarchicalRefs []corekccv1alpha1.HierarchicalReference) (*corekccv1alpha1.ResourceReference, corekccv1alpha1.HierarchicalReference, ...)
- func GetHierarchicalReferenceFromSpec(spec map[string]interface{}, ...) (*corekccv1alpha1.ResourceReference, corekccv1alpha1.HierarchicalReference, ...)
- func GetK8sManagedFields(u *unstructured.Unstructured) (*fieldpath.Set, error)
- func GetMutableButUnreadableFieldsFromAnnotations(resource *Resource, mutableButUnreadablePaths [][]string) (map[string]interface{}, error)
- func GetNamespacedName(obj metav1.Object) types.NamespacedName
- func GetOpenAPIV3SchemaFromCRD(crd *apiextensions.CustomResourceDefinition) *apiextensions.JSONSchemaProps
- func GetProjectIDForNamespace(ctx context.Context, c client.Client, namespaceName string) (string, error)
- func GetReadyCondition(r *Resource) (condition k8sv1alpha1.Condition, found bool)
- func GetReferencedResourceAsUnstruct(resourceRef *corekccv1alpha1.ResourceReference, gvk schema.GroupVersionKind, ...) (*unstructured.Unstructured, error)
- func GetSecretVal(secretKeyRef *corekccv1alpha1.SecretKeyReference, secretNamespace string, ...) (secretVal string, secretVersion string, err error)
- func GetSecretVersionsFromAnnotations(resource *Resource) (map[string]string, error)
- func GetVersionFromCRD(crd *apiextensions.CustomResourceDefinition) string
- func HasAbandonAnnotation(obj metav1.Object) bool
- func HasFinalizer(o metav1.Object, finalizer string) bool
- func HierarchicalReferenceTypeFor(containerType corekccv1alpha1.ContainerType) corekccv1alpha1.HierarchicalReferenceType
- func HierarchicalReferenceWithType(hierarchicalRefs []corekccv1alpha1.HierarchicalReference, ...) *corekccv1alpha1.HierarchicalReference
- func HierarchicalReferencesToFields(hierarchicalRefs []corekccv1alpha1.HierarchicalReference) []string
- func IsAnnotationsUpdateRequired(resource *Resource, original *Resource) bool
- func IsDeleted(objectMeta *metav1.ObjectMeta) bool
- func IsK8sManaged(key string, specObj map[string]interface{}, managedFields *fieldpath.Set) bool
- func IsKeyInSecretNotFoundError(err error) bool
- func IsManagedByKCC(gvk schema.GroupVersionKind) bool
- func IsProjectScoped(containers []corekccv1alpha1.Container) bool
- func IsReferenceNotFoundError(err error) bool
- func IsReferenceNotReadyError(err error) bool
- func IsResourceReady(r *Resource) bool
- func IsSecretNotFoundError(err error) bool
- func IsSpecOrStatusUpdateRequired(resource *Resource, original *Resource) bool
- func IsTransitiveDependencyNotFoundError(err error) bool
- func IsTransitiveDependencyNotReadyError(err error) bool
- func KindWithoutServicePrefix(gvk schema.GroupVersionKind) string
- func MarshalAsConditionsSlice(obj []interface{}) ([]v1alpha1.Condition, error)
- func MarshalObjectAsUnstructured(o metav1.Object) (*unstructured.Unstructured, error)
- func NewCustomReadyCondition(status v1.ConditionStatus, rs, msg string) v1alpha1.Condition
- func NewErroringClient() client.Client
- func NewReadyCondition() v1alpha1.Condition
- func NewReadyConditionWithError(err error) v1alpha1.Condition
- func OutputOnlyFieldsAreUnderObservedState(gvk schema.GroupVersionKind) bool
- func OverlayManagedFieldsOntoState(spec, stateAsKRM map[string]interface{}, managedFields *fieldpath.Set, ...) (map[string]interface{}, error)
- func ReadyConditionMatches(resource *Resource, status corev1.ConditionStatus, rs, msg string) bool
- func RemoveAnnotation(annotation string, obj metav1.Object)
- func RemoveFinalizer(o metav1.Object, finalizer string)
- func RenameStatusFieldWithReservedName(field string) string
- func RenameStatusFieldWithReservedNameIfResourceNotExcluded(tfResourceName, field string) string
- func RenameStatusFieldsWithReservedNames(status *apiextensions.JSONSchemaProps) (*apiextensions.JSONSchemaProps, error)
- func RenameStatusFieldsWithReservedNamesIfResourceNotExcluded(tfResourceName string, status *apiextensions.JSONSchemaProps) (*apiextensions.JSONSchemaProps, error)
- func ReservedStatusFieldNames() map[string]bool
- func SetAnnotation(annotation, val string, obj metav1.Object)
- func SetDefaultContainerAnnotation(obj metav1.Object, ns *corev1.Namespace, ...) error
- func SetDefaultHierarchicalReference(resource *Resource, ns *corev1.Namespace, ...) error
- func SetHierarchicalReference(resource *Resource, hierarchicalRef *corekccv1alpha1.HierarchicalReference, ...) error
- func SortGVKsByKind(gvks []schema.GroupVersionKind) []schema.GroupVersionKind
- func SupportsStateIntoSpecMerge(gvk schema.GroupVersionKind) bool
- func ToGVR(gvk schema.GroupVersionKind) schema.GroupVersionResource
- func TriggerManagedFieldsMetadata(ctx context.Context, c client.Client, u *unstructured.Unstructured) (*unstructured.Unstructured, error)
- func UpdateOrRemoveObservedSecretVersionsAnnotation(resource *Resource, secretVersions map[string]string, hasSensitiveFields bool) error
- func UpdateSchema(schemaRef *SchemaReference, crd *apiextensions.CustomResourceDefinition) error
- func ValidateOrDefaultManagementConflictPreventionAnnotationForDCLBasedResource(obj metav1.Object, ns *corev1.Namespace, schema *openapi.Schema) error
- func ValidateOrDefaultManagementConflictPreventionAnnotationForTFBasedResource(obj metav1.Object, ns *corev1.Namespace, rc *corekccv1alpha1.ResourceConfig, ...) error
- func ValueToDNSSubdomainName(value string) string
- type Defaulter
- type ErrorWithReason
- type ImmutableFieldsMutationError
- type KeyInSecretNotFoundError
- type ManagementConflictPreventionPolicy
- type ReferenceNotFoundError
- type ReferenceNotReadyError
- type Resource
- func GetReferencedResource(resourceRef *corekccv1alpha1.ResourceReference, gvk schema.GroupVersionKind, ...) (*Resource, error)
- func GetReferencedResourceIfReady(resourceRef *corekccv1alpha1.ResourceReference, gvk schema.GroupVersionKind, ...) (*Resource, error)
- func NewResource(u *unstructured.Unstructured) (*Resource, error)
- type ResourceIDNotFoundError
- type SchemaReference
- type SchemaReferenceUpdater
- type SecretNotFoundError
- type ServerGeneratedIDNotFoundError
- type StateIntoSpecDefaulter
- type TransitiveDependencyNotFoundError
- type TransitiveDependencyNotReadyError
Constants ¶
const ( CNRMGroup = "cnrm.cloud.google.com" APIDomainSuffix = ".cnrm.cloud.google.com" SystemNamespace = "cnrm-system" ControllerManagerNamePrefix = "cnrm-controller-manager" ControllerMaxConcurrentReconciles = 20 ReconcileDeadline = 59 * time.Minute TimeToLeaseExpiration = 40 * time.Minute TimeToLeaseRenewal = 20 * time.Minute MeanReconcileReenqueuePeriod = 10 * time.Minute JitterFactor = 2.0 UpToDate = "UpToDate" UpToDateMessage = "The resource is up to date" Created = "Created" CreatedMessage = "Successfully created" CreateFailed = "CreateFailed" CreateFailedMessageTmpl = "Create call failed: %v" Updating = "Updating" UpdatingMessage = "Update in progress" UpdateFailed = "UpdateFailed" Deleting = "Deleting" DeletingMessage = "Deletion in progress" Deleted = "Deleted" DeletedMessage = "Successfully deleted" DeleteFailed = "DeleteFailed" NoCondition = "NoCondition" DeleteFailedMessageTmpl = "Delete call failed: %v" Unmanaged = "Unmanaged" UnmanagedMessageTmpl = "No controller is managing this resource. Check if a ConfigConnectorContext exists for resource's namespace, '%v'" ControllerFinalizerName = "cnrm.cloud.google.com/finalizer" DeletionDefenderFinalizerName = "cnrm.cloud.google.com/deletion-defender" DependencyNotReady = "DependencyNotReady" DependencyNotFound = "DependencyNotFound" DependencyInvalid = "DependencyInvalid" ManagementConflict = "ManagementConflict" PreActuationTransformFailed = "PreActuationTransformFailed" PostActuationTransformFailed = "PostActuationTransformFailed" DeletionPolicyDelete = "delete" DeletionPolicyAbandon = "abandon" AnnotationPrefix = CNRMGroup NamespaceEnvVar = "NAMESPACE" ImmediateReconcileRequestsBufferSize = 10000 MaxNumResourceWatcherRoutines = 10000 ControllerManagedFieldManager = "cnrm-controller-manager" UnmanagedDetectorFieldManager = "cnrm-unmanaged-detector" SupportsSSAManager = "supports-ssa" // Management conflict prevention policies ManagementConflictPreventionPolicyNone = "none" ManagementConflictPreventionPolicyResource = "resource" // State into spec annotation values StateMergeIntoSpec = "merge" StateAbsentInSpec = "absent" StateIntoSpecDefaultValueV1Beta1 = StateMergeIntoSpec // Core kubernetes constants LastAppliedConfigurationAnnotation = "kubectl.kubernetes.io/last-applied-configuration" ManagedFieldsTypeFieldsV1 = "FieldsV1" ResourceIDFieldName = "resourceID" ResourceIDFieldPath = "spec." + ResourceIDFieldName // selfLink may not present in every KRM resource status. SelfLinkFieldName = "selfLink" ObservedStateFieldName = "observedState" StabilityLevelStable = "stable" StabilityLevelAlpha = "alpha" KCCAPIVersionV1Beta1 = "v1beta1" KCCAPIVersionV1Alpha1 = "v1alpha1" )
TODO: clean up old conditions used in handcrafted controllers
Variables ¶
var ( DeletionPolicyAnnotation = FormatAnnotation("deletion-policy") ReconcileIntervalInSecondsAnnotation = FormatAnnotation("reconcile-interval-in-seconds") // Annotations for Container objects ProjectIDAnnotation = FormatAnnotation("project-id") FolderIDAnnotation = FormatAnnotation("folder-id") OrgIDAnnotation = FormatAnnotation("organization-id") ContainerAnnotations = []string{ ProjectIDAnnotation, FolderIDAnnotation, OrgIDAnnotation, } ManagementConflictPreventionPolicyAnnotation = "management-conflict-prevention-policy" ManagementConflictPreventionPolicyFullyQualifiedAnnotation = FormatAnnotation(ManagementConflictPreventionPolicyAnnotation) ManagementConflictPreventionPolicyValues = []string{ ManagementConflictPreventionPolicyNone, ManagementConflictPreventionPolicyResource, } KCCComponentLabel = FormatAnnotation("component") KCCSystemLabel = FormatAnnotation("system") KCCVersionLabel = FormatAnnotation("version") ScopedNamespaceLabel = FormatAnnotation("scoped-namespace") DCL2CRDLabel = FormatAnnotation("dcl2crd") KCCStabilityLabel = FormatAnnotation("stability-level") MutableButUnreadableFieldsAnnotation = FormatAnnotation("mutable-but-unreadable-fields") ObservedSecretVersionsAnnotation = FormatAnnotation("observed-secret-versions") SupportsSSAAnnotation = FormatAnnotation("supports-ssa") BlueprintAttributionAnnotation = FormatAnnotation("blueprint") StateIntoSpecAnnotation = FormatAnnotation("state-into-spec") StateIntoSpecAnnotationValues = []string{ StateMergeIntoSpec, StateAbsentInSpec, } // TODO(kcc-eng): Adjust the timeout back down after b/237398742 is fixed. WebhookTimeoutSeconds = int32(10) ReservedStatusFieldNamesForFutureUse = []string{"generation"} NamespaceIDConfigMapNN = types.NamespacedName{ Namespace: SystemNamespace, Name: "namespace-id", } // IgnoredKindList contains special or deprecated Kinds that should be // ignored by the controllers. IgnoredKindList = map[string]bool{ "ServiceMapping": true, "GameServicesRealm": true, } )
Functions ¶
func ConditionSlicesEqual ¶
func ConstructManagedFieldsV1Set ¶
func ConstructManagedFieldsV1Set(managedFields []v1.ManagedFieldsEntry) (*fieldpath.Set, error)
ConstructManagedFieldsV1Set takes the given managed field entries and constructs a set of all the k8s-managed fields from the spec.
func ConstructTrimmedSpecWithManagedFields ¶
func ConstructTrimmedSpecWithManagedFields(resource *Resource, jsonSchema *apiextensions.JSONSchemaProps, hierarchicalRefs []corekccv1alpha1.HierarchicalReference) (map[string]interface{}, error)
Construct the trimmed spec that only contains k8s managed fields.
The DCL SDK's Apply() function can take a partial state that only contains fields that users have an opinion on. Here we will look into the managed-fields set and trim the full spec to only preserve fields that are k8s-managed (i.e. users want KCC to enforce those fields to their desired state). DCL will take the generated partial state, enforce specified fields and ignore unspecified fields by preserving live values from the underlying API.
func ContainerTypes ¶
func ContainerTypes(containers []corekccv1alpha1.Container) []corekccv1alpha1.ContainerType
func ContainerTypesFor ¶
func ContainerTypesFor(hierarchicalRefs []corekccv1alpha1.HierarchicalReference) []corekccv1alpha1.ContainerType
func CurrentNamespace ¶
func CurrentNamespace() string
func EnsureHierarchicalReference ¶
func EnsureHierarchicalReference(ctx context.Context, resource *Resource, hierarchicalRefs []corekccv1alpha1.HierarchicalReference, containers []corekccv1alpha1.Container, c client.Client) error
EnsureHierarchicalReference ensures that the given resource has a hierarchical reference and will set one if none is found.
func FormatAnnotation ¶
func GVKListContains ¶
func GVKListContains(gvkList []schema.GroupVersionKind, gvk schema.GroupVersionKind) bool
func GVKSetToList ¶
func GVKSetToList(gvkSet map[schema.GroupVersionKind]bool) []schema.GroupVersionKind
func GetAPIVersionFromCRD ¶
func GetAPIVersionFromCRD(crd *apiextensions.CustomResourceDefinition) string
func GetAnnotationForContainerType ¶
func GetAnnotationForContainerType(containerType corekccv1alpha1.ContainerType) string
func GetContainerAnnotation ¶
func GetContainerAnnotation(annotations map[string]string, containerTypes []corekccv1alpha1.ContainerType) (string, corekccv1alpha1.ContainerType, error)
GetContainerAnnotation will get the appropriate container annotation from the given annotations.
func GetHierarchicalReference ¶
func GetHierarchicalReference(resource *Resource, hierarchicalRefs []corekccv1alpha1.HierarchicalReference) ( *corekccv1alpha1.ResourceReference, corekccv1alpha1.HierarchicalReference, error)
GetHierarchicalReference gets the resource reference within the resource that corresponds to any of the given hierarchical reference configurations, as well as the the hierarchical reference configuration associated with the resource reference. Returns a nil resource reference if none is found. Returns an error if multiple resource references are found (an invalid resource state as resources can have at most one hierarchical reference).
func GetHierarchicalReferenceFromSpec ¶
func GetHierarchicalReferenceFromSpec(spec map[string]interface{}, hierarchicalRefs []corekccv1alpha1.HierarchicalReference) ( *corekccv1alpha1.ResourceReference, corekccv1alpha1.HierarchicalReference, error)
func GetK8sManagedFields ¶
func GetK8sManagedFields(u *unstructured.Unstructured) (*fieldpath.Set, error)
func GetNamespacedName ¶
func GetNamespacedName(obj metav1.Object) types.NamespacedName
func GetOpenAPIV3SchemaFromCRD ¶
func GetOpenAPIV3SchemaFromCRD(crd *apiextensions.CustomResourceDefinition) *apiextensions.JSONSchemaProps
func GetReadyCondition ¶
func GetReadyCondition(r *Resource) (condition k8sv1alpha1.Condition, found bool)
func GetReferencedResourceAsUnstruct ¶
func GetReferencedResourceAsUnstruct(resourceRef *corekccv1alpha1.ResourceReference, gvk schema.GroupVersionKind, resourceNamespace string, kubeClient client.Client) (*unstructured.Unstructured, error)
func GetSecretVal ¶
func GetSecretVal(secretKeyRef *corekccv1alpha1.SecretKeyReference, secretNamespace string, kubeClient client.Client) (secretVal string, secretVersion string, err error)
func GetVersionFromCRD ¶
func GetVersionFromCRD(crd *apiextensions.CustomResourceDefinition) string
func HasAbandonAnnotation ¶
func HierarchicalReferenceTypeFor ¶
func HierarchicalReferenceTypeFor(containerType corekccv1alpha1.ContainerType) corekccv1alpha1.HierarchicalReferenceType
func HierarchicalReferenceWithType ¶
func HierarchicalReferenceWithType(hierarchicalRefs []corekccv1alpha1.HierarchicalReference, hType corekccv1alpha1.HierarchicalReferenceType) *corekccv1alpha1.HierarchicalReference
func HierarchicalReferencesToFields ¶
func HierarchicalReferencesToFields(hierarchicalRefs []corekccv1alpha1.HierarchicalReference) []string
func IsDeleted ¶
func IsDeleted(objectMeta *metav1.ObjectMeta) bool
func IsK8sManaged ¶
func IsKeyInSecretNotFoundError ¶ added in v1.114.0
func IsManagedByKCC ¶
func IsManagedByKCC(gvk schema.GroupVersionKind) bool
func IsProjectScoped ¶
func IsProjectScoped(containers []corekccv1alpha1.Container) bool
func IsReferenceNotReadyError ¶ added in v1.114.0
func IsResourceReady ¶
func IsSecretNotFoundError ¶ added in v1.114.0
func IsTransitiveDependencyNotFoundError ¶ added in v1.114.0
func IsTransitiveDependencyNotReadyError ¶ added in v1.114.0
func KindWithoutServicePrefix ¶
func KindWithoutServicePrefix(gvk schema.GroupVersionKind) string
KindWithoutServicePrefix returns the kind without the service prefix (e.g. "ComputeBackendBucket => "BackendBucket"). Kinds which do not contain a service prefix are returned directly (e.g. "Project" => "Project").
func MarshalObjectAsUnstructured ¶
func MarshalObjectAsUnstructured(o metav1.Object) (*unstructured.Unstructured, error)
func NewCustomReadyCondition ¶
func NewCustomReadyCondition(status v1.ConditionStatus, rs, msg string) v1alpha1.Condition
func NewErroringClient ¶
Some packages, like 'gcpclient' make use of krmtotf which is tightly coupled with the controller-runtime client. However, krmtotf does not actually need the client if all the resources passed in have all references resolved, etc. To enable usage of the library but also to avoid panics, this erroring client can be passed to krmtotf methods.
func NewReadyCondition ¶
func OutputOnlyFieldsAreUnderObservedState ¶ added in v1.114.1
func OutputOnlyFieldsAreUnderObservedState(gvk schema.GroupVersionKind) bool
func OverlayManagedFieldsOntoState ¶
func OverlayManagedFieldsOntoState(spec, stateAsKRM map[string]interface{}, managedFields *fieldpath.Set, jsonSchema *apiextensions.JSONSchemaProps, hierarchicalRefs []corekccv1alpha1.HierarchicalReference) (map[string]interface{}, error)
OverlayManagedFieldsOntoState overlays the fields managed by Kubernetes managers onto the KRM-ified live state.
The return value is the union of stateAsKRM with managed fields from spec.
func ReadyConditionMatches ¶
func ReadyConditionMatches(resource *Resource, status corev1.ConditionStatus, rs, msg string) bool
func RemoveAnnotation ¶
func RemoveFinalizer ¶
func RenameStatusFieldWithReservedNameIfResourceNotExcluded ¶ added in v1.105.0
func RenameStatusFieldsWithReservedNames ¶
func RenameStatusFieldsWithReservedNames(status *apiextensions.JSONSchemaProps) (*apiextensions.JSONSchemaProps, error)
func RenameStatusFieldsWithReservedNamesIfResourceNotExcluded ¶ added in v1.105.0
func RenameStatusFieldsWithReservedNamesIfResourceNotExcluded(tfResourceName string, status *apiextensions.JSONSchemaProps) (*apiextensions.JSONSchemaProps, error)
func SetAnnotation ¶
func SetDefaultHierarchicalReference ¶
func SetDefaultHierarchicalReference(resource *Resource, ns *corev1.Namespace, hierarchicalRefs []corekccv1alpha1.HierarchicalReference, containers []corekccv1alpha1.Container) error
SetDefaultHierarchicalReference sets a hierarchical reference on the given resource if it doesn't have one. The resulting hierarchical reference is based on whichever of the following is found first: (1) Resource-level container annotations (if supported) (2) Namespace-level container annotations (3) Namespace name (if resource supports project references)
func SetHierarchicalReference ¶
func SetHierarchicalReference(resource *Resource, hierarchicalRef *corekccv1alpha1.HierarchicalReference, externalVal string) error
func SortGVKsByKind ¶
func SortGVKsByKind(gvks []schema.GroupVersionKind) []schema.GroupVersionKind
func SupportsStateIntoSpecMerge ¶ added in v1.116.0
func SupportsStateIntoSpecMerge(gvk schema.GroupVersionKind) bool
func ToGVR ¶ added in v1.90.0
func ToGVR(gvk schema.GroupVersionKind) schema.GroupVersionResource
ToGVR returns the equivalent GVR for a given GVK. Note that while GVKs and GVRs do not necessarily have a 1:1 mapping, GVKs and GVRs of CRDs do. (see https://book.kubebuilder.io/cronjob-tutorial/gvks.html#kinds-and-resources)
func TriggerManagedFieldsMetadata ¶
func TriggerManagedFieldsMetadata(ctx context.Context, c client.Client, u *unstructured.Unstructured) ( *unstructured.Unstructured, error)
TriggerManagedFieldsMetadata ensures that managed fields metadata is present on the given resource for Server-Side Apply (SSA) compatible clusters.
func UpdateSchema ¶ added in v1.101.0
func UpdateSchema(schemaRef *SchemaReference, crd *apiextensions.CustomResourceDefinition) error
UpdateSchema is a helper function to update the input schema reference using the input crd.
func ValidateOrDefaultManagementConflictPreventionAnnotationForTFBasedResource ¶
func ValidateOrDefaultManagementConflictPreventionAnnotationForTFBasedResource(obj metav1.Object, ns *corev1.Namespace, rc *corekccv1alpha1.ResourceConfig, tfResourceMap map[string]*tfschema.Resource) error
func ValueToDNSSubdomainName ¶
Types ¶
type Defaulter ¶ added in v1.114.0
type Defaulter interface {
ApplyDefaults(ctx context.Context, obj client.Object) (changed bool, err error)
}
func NewStateIntoSpecDefaulter ¶ added in v1.114.0
type ErrorWithReason ¶
func (ErrorWithReason) Error ¶
func (e ErrorWithReason) Error() string
type ImmutableFieldsMutationError ¶
type ImmutableFieldsMutationError struct {
// contains filtered or unexported fields
}
func NewImmutableFieldsMutationError ¶
func NewImmutableFieldsMutationError(immutableFields []string) *ImmutableFieldsMutationError
func (*ImmutableFieldsMutationError) Error ¶
func (e *ImmutableFieldsMutationError) Error() string
type KeyInSecretNotFoundError ¶
type KeyInSecretNotFoundError struct {
// contains filtered or unexported fields
}
func AsKeyInSecretNotFoundError ¶
func AsKeyInSecretNotFoundError(err error) (unwrappedErr *KeyInSecretNotFoundError, ok bool)
func NewKeyInSecretNotFoundError ¶
func NewKeyInSecretNotFoundError(key string, secret types.NamespacedName) *KeyInSecretNotFoundError
func (*KeyInSecretNotFoundError) Error ¶
func (e *KeyInSecretNotFoundError) Error() string
type ManagementConflictPreventionPolicy ¶
type ManagementConflictPreventionPolicy string
func GetManagementConflictPreventionAnnotationValue ¶
func GetManagementConflictPreventionAnnotationValue(obj metav1.Object) (ManagementConflictPreventionPolicy, error)
type ReferenceNotFoundError ¶
type ReferenceNotFoundError struct { RefResourceGVK schema.GroupVersionKind RefResource types.NamespacedName }
func AsReferenceNotFoundError ¶
func AsReferenceNotFoundError(err error) (unwrappedErr *ReferenceNotFoundError, ok bool)
func NewReferenceNotFoundError ¶
func NewReferenceNotFoundError(refResourceGVK schema.GroupVersionKind, refResource types.NamespacedName) *ReferenceNotFoundError
func NewReferenceNotFoundErrorForResource ¶
func NewReferenceNotFoundErrorForResource(r *Resource) *ReferenceNotFoundError
func (*ReferenceNotFoundError) Error ¶
func (e *ReferenceNotFoundError) Error() string
type ReferenceNotReadyError ¶
type ReferenceNotReadyError struct { RefResourceGVK schema.GroupVersionKind RefResource types.NamespacedName }
func AsReferenceNotReadyError ¶
func AsReferenceNotReadyError(err error) (unwrappedErr *ReferenceNotReadyError, ok bool)
func NewReferenceNotReadyErrorForResource ¶
func NewReferenceNotReadyErrorForResource(r *Resource) *ReferenceNotReadyError
func (*ReferenceNotReadyError) Error ¶
func (e *ReferenceNotReadyError) Error() string
type Resource ¶
type Resource struct { // Fundamental fields metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec map[string]interface{} `json:"spec,omitempty"` Status map[string]interface{} `json:"status,omitempty"` // ManagedFields is the set of spec fields whose desired state is managed // by Kubernetes. Fields that are not part of this set are considered // unmanaged, and their values in etcd will be updated to match the // underlying API. // // If this object is nil, all fields in the spec in etcd are considered // managed and their values will be constantly enforced. ManagedFields *fieldpath.Set `json:"-"` }
Resource represents a resource in KRM
func GetReferencedResource ¶
func GetReferencedResource(resourceRef *corekccv1alpha1.ResourceReference, gvk schema.GroupVersionKind, resourceNamespace string, kubeClient client.Client) (*Resource, error)
func GetReferencedResourceIfReady ¶
func GetReferencedResourceIfReady(resourceRef *corekccv1alpha1.ResourceReference, gvk schema.GroupVersionKind, resourceNamespace string, kubeClient client.Client) (*Resource, error)
func NewResource ¶
func NewResource(u *unstructured.Unstructured) (*Resource, error)
NewResource creates a Resource based on the given unstructured. NewResource can be used to create deep copies of a Resource by calling NewResource multiple times on the same unstructured since the Resource objects created are separate copies.
func (*Resource) GetNamespacedName ¶
func (r *Resource) GetNamespacedName() types.NamespacedName
func (*Resource) HasResourceIDField ¶
func (*Resource) IsResourceIDConfigured ¶
func (*Resource) MarshalAsUnstructured ¶
func (r *Resource) MarshalAsUnstructured() (*unstructured.Unstructured, error)
type ResourceIDNotFoundError ¶
type ResourceIDNotFoundError struct {
// contains filtered or unexported fields
}
func AsResourceIDNotFoundError ¶
func AsResourceIDNotFoundError(err error) (unwrappedErr *ResourceIDNotFoundError, ok bool)
func NewResourceIDNotFoundError ¶
func NewResourceIDNotFoundError(resourceGVK schema.GroupVersionKind, resource types.NamespacedName) *ResourceIDNotFoundError
func (*ResourceIDNotFoundError) Error ¶
func (e *ResourceIDNotFoundError) Error() string
type SchemaReference ¶ added in v1.101.0
type SchemaReference struct { CRD *apiextensions.CustomResourceDefinition JSONSchema *apiextensions.JSONSchemaProps GVK schema.GroupVersionKind }
type SchemaReferenceUpdater ¶ added in v1.101.0
type SchemaReferenceUpdater interface { // UpdateSchema updates the schema reference of the controller using // its corresponding CRD. UpdateSchema(crd *apiextensions.CustomResourceDefinition) error }
type SecretNotFoundError ¶
type SecretNotFoundError struct {
Secret types.NamespacedName
}
func AsSecretNotFoundError ¶
func AsSecretNotFoundError(err error) (unwrappedErr *SecretNotFoundError, ok bool)
func NewSecretNotFoundError ¶
func NewSecretNotFoundError(secret types.NamespacedName) *SecretNotFoundError
func (*SecretNotFoundError) Error ¶
func (e *SecretNotFoundError) Error() string
type ServerGeneratedIDNotFoundError ¶
type ServerGeneratedIDNotFoundError struct {
// contains filtered or unexported fields
}
func AsServerGeneratedIDNotFoundError ¶
func AsServerGeneratedIDNotFoundError(err error) (unwrappedErr *ServerGeneratedIDNotFoundError, ok bool)
func NewServerGeneratedIDNotFoundError ¶
func NewServerGeneratedIDNotFoundError(resourceGVK schema.GroupVersionKind, resource types.NamespacedName) *ServerGeneratedIDNotFoundError
func (*ServerGeneratedIDNotFoundError) Error ¶
func (e *ServerGeneratedIDNotFoundError) Error() string
type StateIntoSpecDefaulter ¶ added in v1.114.0
type StateIntoSpecDefaulter struct {
// contains filtered or unexported fields
}
StateIntoSpecDefaulter contains the required 'defaultValue' field and the optional 'userOverride' field.
func (*StateIntoSpecDefaulter) ApplyDefaults ¶ added in v1.114.0
type TransitiveDependencyNotFoundError ¶
type TransitiveDependencyNotFoundError struct { ResourceGVK schema.GroupVersionKind Resource types.NamespacedName }
func AsTransitiveDependencyNotFoundError ¶
func AsTransitiveDependencyNotFoundError(err error) (unwrappedErr *TransitiveDependencyNotFoundError, ok bool)
func NewTransitiveDependencyNotFoundError ¶
func NewTransitiveDependencyNotFoundError(resourceGVK schema.GroupVersionKind, resource types.NamespacedName) *TransitiveDependencyNotFoundError
func (*TransitiveDependencyNotFoundError) Error ¶
func (e *TransitiveDependencyNotFoundError) Error() string
type TransitiveDependencyNotReadyError ¶
type TransitiveDependencyNotReadyError struct { ResourceGVK schema.GroupVersionKind Resource types.NamespacedName }
func AsTransitiveDependencyNotReadyError ¶
func AsTransitiveDependencyNotReadyError(err error) (unwrappedErr *TransitiveDependencyNotReadyError, ok bool)
func NewTransitiveDependencyNotReadyError ¶
func NewTransitiveDependencyNotReadyError(resourceGVK schema.GroupVersionKind, resource types.NamespacedName) *TransitiveDependencyNotReadyError
func (*TransitiveDependencyNotReadyError) Error ¶
func (e *TransitiveDependencyNotReadyError) Error() string