Documentation ¶
Overview ¶
Package declared contains types and functions for interacting with resource declarations which are parsed from a Git repo.
Index ¶
- Constants
- func DeleteAllNamespacesError(previous []string) status.Error
- func IsRootManager(manager string) bool
- func ResourceManager(scope Scope, rsName string) string
- func ValidateScope(s string) error
- type Resources
- func (r *Resources) Declarations() []*unstructured.Unstructured
- func (r *Resources) GVKSet() map[schema.GroupVersionKind]bool
- func (r *Resources) Get(id core.ID) (*unstructured.Unstructured, bool)
- func (r *Resources) Update(ctx context.Context, objects []client.Object) ([]client.Object, status.Error)
- type Scope
- type ValueConverter
Constants ¶
const RootReconciler = Scope(":root")
RootReconciler is a special constant for a Scope for a reconciler which is running as the "root reconciler" (vs a namespace reconciler).
This Scope takes precedence over all others.
Variables ¶
This section is empty.
Functions ¶
func DeleteAllNamespacesError ¶
DeleteAllNamespacesError represents a failsafe error we return to ensure we don't accidentally delete all of a user's data. We've had filesystem read errors in the past which delete all Namespaces at once.
Thus, we require users to commit a change that deletes all but one Namespace before deleting the final one. This is the error we show to prevent us from taking such destructive action, and ensuring users know how to tell ACM that they really do want to delete all Namespaces.
func IsRootManager ¶
IsRootManager returns whether the manager is running on a root reconciler.
func ResourceManager ¶
ResourceManager returns the manager to indicate a resource is managed by a particular reconciler. If the manager is the default RootSync or RepoSync, only return the scope for backward compatibility. Otherwise, return scope_name.
func ValidateScope ¶
ValidateScope ensures the passed string is either the special RootReconciler value or is a valid Namespace name.
Types ¶
type Resources ¶
type Resources struct {
// contains filtered or unexported fields
}
Resources is a threadsafe container for a set of resources declared in a Git repo.
func (*Resources) Declarations ¶
func (r *Resources) Declarations() []*unstructured.Unstructured
Declarations returns all resource declarations from Git.
func (*Resources) GVKSet ¶
func (r *Resources) GVKSet() map[schema.GroupVersionKind]bool
GVKSet returns the set of all GroupVersionKind found in the git repo.
func (*Resources) Get ¶
func (r *Resources) Get(id core.ID) (*unstructured.Unstructured, bool)
Get returns a copy of the resource declaration as read from Git
type Scope ¶
type Scope string
Scope defines a distinct (but not necessarily disjoint) area of responsibility for a Reconciler.
func ManagerScopeAndName ¶
ManagerScopeAndName returns the scope and name of the resource manager.
type ValueConverter ¶
type ValueConverter struct {
// contains filtered or unexported fields
}
ValueConverter converts a runtime.Object into a TypedValue.
func NewValueConverter ¶
func NewValueConverter(dc discovery.DiscoveryInterface) (*ValueConverter, error)
NewValueConverter returns a ValueConverter initialized with the given discovery client.
func ValueConverterForTest ¶
func ValueConverterForTest() (*ValueConverter, error)
ValueConverterForTest returns a ValueConverter initialized for unit tests.
func (*ValueConverter) Refresh ¶
func (v *ValueConverter) Refresh() error
Refresh pulls fresh schemas from the openapi discovery endpoint and instantiates the ValueConverter with them. This can be called periodically as new custom types (eg CRDs) are added to the cluster.
func (*ValueConverter) TypedValue ¶
func (v *ValueConverter) TypedValue(obj runtime.Object) (*typed.TypedValue, error)
TypedValue returns the equivalent TypedValue for the given Object.