feature

package
v2.12.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	YamlSeparator = "(?m)^---[ \t]*$"
)

Variables

View Source
var EmptyFeaturesHandler = &FeaturesHandler{
	features:          []*Feature{},
	featuresProviders: []FeaturesProvider{},
}

EmptyFeaturesHandler is noop handler so that we can avoid nil checks in the code and safely call Apply/Delete methods.

Functions

func CreateFeature

func CreateFeature(name string) *usingFeaturesHandler

CreateFeature creates a new feature builder with the given name.

func CreateRawManifestFrom added in v2.9.0

func CreateRawManifestFrom(fsys fs.FS, path string) *rawManifest

func CreateTemplateManifestFrom added in v2.9.0

func CreateTemplateManifestFrom(fsys fs.FS, path string) *templateManifest

func GenerateSelfSignedCertificateAsSecret

func GenerateSelfSignedCertificateAsSecret(addr string, objectMeta metav1.ObjectMeta) (*corev1.Secret, error)

func OwnedBy added in v2.10.0

func OwnedBy(f *Feature) cluster.MetaOptions

func ReplaceChar

func ReplaceChar(s string, oldChar, newChar string) string

Types

type Action

type Action func(feature *Feature) error

Action is a func type which can be used for different purposes while having access to Feature struct.

func CreateNamespaceIfNotExists added in v2.7.0

func CreateNamespaceIfNotExists(namespace string) Action

CreateNamespaceIfNotExists will create a namespace with the given name if it does not exist yet. It does not set ownership nor apply extra metadata to the existing namespace.

func EnsureOperatorIsInstalled added in v2.9.0

func EnsureOperatorIsInstalled(operatorName string) Action

func WaitForPodsToBeReady

func WaitForPodsToBeReady(namespace string) Action

func WaitForResourceToBeCreated

func WaitForResourceToBeCreated(namespace string, gvk schema.GroupVersionKind) Action

type Feature

type Feature struct {
	Name    string
	Spec    *Spec
	Enabled bool
	Managed bool
	Tracker *featurev1.FeatureTracker

	Client client.Client

	Log logr.Logger
	// contains filtered or unexported fields
}

func (*Feature) Apply

func (f *Feature) Apply() error

func (*Feature) ApplyManifest added in v2.8.0

func (f *Feature) ApplyManifest(path string) error

func (*Feature) AsOwnerReference added in v2.7.0

func (f *Feature) AsOwnerReference() metav1.OwnerReference

func (*Feature) Cleanup

func (f *Feature) Cleanup() error

func (*Feature) CreateSelfSignedCertificate added in v2.7.0

func (f *Feature) CreateSelfSignedCertificate(secretName string, certificateType infrav1.CertType, domain, namespace string) error

type FeaturesHandler added in v2.7.0

type FeaturesHandler struct {
	*v1.DSCInitializationSpec
	// contains filtered or unexported fields
}

FeaturesHandler coordinates feature creations and removal from within controllers.

func ClusterFeaturesHandler added in v2.7.0

func ClusterFeaturesHandler(dsci *v1.DSCInitialization, def ...FeaturesProvider) *FeaturesHandler

func ComponentFeaturesHandler added in v2.7.0

func ComponentFeaturesHandler(componentName string, spec *v1.DSCInitializationSpec, def ...FeaturesProvider) *FeaturesHandler

func (*FeaturesHandler) Apply added in v2.7.0

func (fh *FeaturesHandler) Apply() error

func (*FeaturesHandler) Delete added in v2.7.0

func (fh *FeaturesHandler) Delete() error

Delete executes registered clean-up tasks in the opposite order they were initiated (following a stack structure). For instance, this allows for the undoing patches before its deletion. This approach assumes that Features are either instantiated in the correct sequence or are self-contained.

type FeaturesProvider added in v2.7.0

type FeaturesProvider func(handler *FeaturesHandler) error

FeaturesProvider is a function which allow to define list of features and couple them with the given initializer.

type HandlerWithReporter added in v2.10.1

type HandlerWithReporter[T client.Object] struct {
	// contains filtered or unexported fields
}

HandlerWithReporter is a wrapper around FeaturesHandler and status.Reporter It is intended apply features related to a given resource capabilities and report its status using custom reporter.

func NewHandlerWithReporter added in v2.10.1

func NewHandlerWithReporter[T client.Object](handler *FeaturesHandler, reporter *status.Reporter[T]) *HandlerWithReporter[T]

func (HandlerWithReporter[T]) Apply added in v2.10.1

func (h HandlerWithReporter[T]) Apply() error

func (HandlerWithReporter[T]) Delete added in v2.10.1

func (h HandlerWithReporter[T]) Delete() error

type Manifest added in v2.9.0

type Manifest interface {
	// Process allows any arbitrary struct to be passed and used while processing the content of the manifest.
	Process(data any) ([]*unstructured.Unstructured, error)
	// MarkAsManaged sets all non-patch objects to be managed/reconciled by setting the annotation.
	MarkAsManaged(objects []*unstructured.Unstructured)
}

type MissingOperatorError added in v2.10.1

type MissingOperatorError struct {
	// contains filtered or unexported fields
}

func NewMissingOperatorError added in v2.10.1

func NewMissingOperatorError(operatorName string, err error) *MissingOperatorError

func (*MissingOperatorError) Error added in v2.10.1

func (e *MissingOperatorError) Error() string

func (*MissingOperatorError) Unwrap added in v2.10.1

func (e *MissingOperatorError) Unwrap() error

type OAuth

type OAuth struct {
	AuthzEndpoint,
	TokenEndpoint,
	Route,
	Port,
	ClientSecret,
	Hmac string
}

type Spec

type Spec struct {
	*infrav1.ServiceMeshSpec
	Serving                  *infrav1.ServingSpec
	AuthProviderName         string
	OAuth                    OAuth
	AppNamespace             string
	TargetNamespace          string
	Domain                   string
	KnativeCertificateSecret string
	KnativeIngressDomain     string
	Source                   *featurev1.Source
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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