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 ReconcilerNameFromScope(syncScope Scope, syncName string) string
- func ResourceManager(scope Scope, rsName string) string
- type Resources
- func (r *Resources) DeclaredCRDs() ([]*v1beta1.CustomResourceDefinition, status.MultiError)
- func (r *Resources) DeclaredGVKs() (map[schema.GroupVersionKind]struct{}, string)
- func (r *Resources) DeclaredObjects() ([]client.Object, string)
- func (r *Resources) DeclaredUnstructureds() ([]*unstructured.Unstructured, string)
- func (r *Resources) Get(id core.ID) (*unstructured.Unstructured, string, bool)
- func (r *Resources) Update(ctx context.Context, objects []client.Object, commit string) ([]client.Object, status.Error)
- type Scope
- type ValueConverter
Constants ¶
const RootScope = Scope(":root")
RootScope is the scope that includes both cluster-scoped and namespace-scoped resource objects. A "root reconciler" can manage resource objects in any namespace (given the appropriate RBAC permissions).
Any Scope that is not the RootScope is assumed to be the name of a namespace.
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 ReconcilerNameFromScope ¶ added in v1.19.0
ReconcilerNameFromScope returns the reconciler name associated with a specific sync scope and sync name.
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.
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) DeclaredCRDs ¶ added in v1.20.0
func (r *Resources) DeclaredCRDs() ([]*v1beta1.CustomResourceDefinition, status.MultiError)
DeclaredCRDs returns the list of CRDs declared in the source.
func (*Resources) DeclaredGVKs ¶ added in v1.15.1
func (r *Resources) DeclaredGVKs() (map[schema.GroupVersionKind]struct{}, string)
DeclaredGVKs returns the set of all GroupVersionKind found in the source, along with the source commit.
func (*Resources) DeclaredObjects ¶ added in v1.15.1
DeclaredObjects returns all resource objects declared in the source, along with the source commit.
func (*Resources) DeclaredUnstructureds ¶ added in v1.15.1
func (r *Resources) DeclaredUnstructureds() ([]*unstructured.Unstructured, string)
DeclaredUnstructureds returns all resource objects declared in the source, along with the source commit.
func (*Resources) Get ¶
func (r *Resources) Get(id core.ID) (*unstructured.Unstructured, string, 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.
func ScopeFromSyncNamespace ¶ added in v1.19.0
ScopeFromSyncNamespace returns the scope associated with a specific namespace.
This is possible because: - RepoSyncs are NOT allowed in the "config-management-system" namespace. - RootSyncs are ONLY allowed in the "config-management-system" namespace.
func (Scope) SyncKind ¶ added in v1.19.0
SyncKind returns the resource kind associated with this Scope.
func (Scope) SyncNamespace ¶ added in v1.19.0
SyncNamespace returns the namespace associated with this Scope.
This is possible because: - RepoSyncs are NOT allowed in the "config-management-system" namespace. - RootSyncs are ONLY allowed in the "config-management-system" namespace.
type ValueConverter ¶
type ValueConverter struct {
// contains filtered or unexported fields
}
ValueConverter converts a runtime.Object into a TypedValue.
func NewValueConverter ¶
func NewValueConverter(dc discovery.OpenAPISchemaInterface) (*ValueConverter, error)
NewValueConverter returns a ValueConverter initialized with the given discovery client.
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.