declared

package
v1.19.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package declared contains types and functions for interacting with resource declarations which are parsed from a Git repo.

Index

Constants

View Source
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

func DeleteAllNamespacesError(previous []string) status.Error

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

func IsRootManager(manager string) bool

IsRootManager returns whether the manager is running on a root reconciler.

func ReconcilerNameFromScope added in v1.19.0

func ReconcilerNameFromScope(syncScope Scope, syncName string) string

ReconcilerNameFromScope returns the reconciler name associated with a specific sync scope and sync name.

func ResourceManager

func ResourceManager(scope Scope, rsName string) string

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) 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

func (r *Resources) DeclaredObjects() ([]client.Object, string)

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

Get returns a copy of the resource declaration as read from Git

func (*Resources) Update

func (r *Resources) Update(ctx context.Context, objects []client.Object, commit string) ([]client.Object, status.Error)

Update performs an atomic update on the resource declaration set.

type Scope

type Scope string

Scope defines a distinct (but not necessarily disjoint) area of responsibility for a Reconciler.

func ManagerScopeAndName

func ManagerScopeAndName(manager string) (Scope, string)

ManagerScopeAndName returns the scope and name of the resource manager.

func ScopeFromSyncNamespace added in v1.19.0

func ScopeFromSyncNamespace(syncNamespace string) Scope

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) String added in v1.19.0

func (s Scope) String() string

String returns the scope as a string.

func (Scope) SyncKind added in v1.19.0

func (s Scope) SyncKind() string

SyncKind returns the resource kind associated with this Scope.

func (Scope) SyncNamespace added in v1.19.0

func (s Scope) SyncNamespace() string

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.

func (Scope) Validate added in v1.19.0

func (s Scope) Validate() error

Validate returns an error if the Scope is invalid. Non-root Scopes must be valid DNS subdomains (RFC 1123).

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL