declared

package
v1.17.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 23 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 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

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

func ValidateScope

func ValidateScope(s string) error

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

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