types

package
v2.23.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(rr *ReconciliationRequest) ([]byte, error)

func HashStr

func HashStr(rr *ReconciliationRequest) (string, error)

Types

type ManifestInfo

type ManifestInfo struct {
	Path       string
	ContextDir string
	SourcePath string
}

func (ManifestInfo) String

func (mi ManifestInfo) String() string

type ReconciliationRequest

type ReconciliationRequest struct {
	*odhClient.Client

	Manager   *manager.Manager
	Instance  common.PlatformObject
	DSCI      *dsciv1.DSCInitialization
	Release   cluster.Release
	Manifests []ManifestInfo

	//
	// TODO: unify templates and resources.
	//
	// Unfortunately, the kustomize APIs do not yet support a FileSystem that is
	// backed by golang's fs.Fs so it is not simple to have a single abstraction
	// for both the manifests types.
	//
	// it would be nice to have a structure like:
	//
	// struct {
	//   FS  fs.FS
	//   URI net.URL
	// }
	//
	// where the URI could be something like:
	// - kustomize:///path/to/overlay
	// - template:///path/to/resource.tmpl.yaml
	//
	// and use the scheme as discriminator for the rendering engine
	//
	Templates []TemplateInfo
	Resources []unstructured.Unstructured

	// TODO: this has been added to reduce GC work and only run when
	//       resources have been generated. It should be removed and
	//       replaced with a better way of describing resources and
	//       their origin
	Generated bool
}

func (*ReconciliationRequest) AddResources

func (rr *ReconciliationRequest) AddResources(values ...client.Object) error

AddResources adds one or more resources to the ReconciliationRequest's Resources slice. Each provided client.Object is normalized by ensuring it has the appropriate GVK and is converted into an unstructured.Unstructured format before being appended to the list.

func (*ReconciliationRequest) ForEachResource

func (rr *ReconciliationRequest) ForEachResource(fn func(*unstructured.Unstructured) (bool, error)) error

ForEachResource iterates over each resource in the ReconciliationRequest's Resources slice, invoking the provided function `fn` for each resource. The function `fn` takes a pointer to an unstructured.Unstructured object and returns a boolean and an error.

The iteration stops early if:

  • `fn` returns an error.
  • `fn` returns `true` as the first return value (`stop`).

func (*ReconciliationRequest) RemoveResources

func (rr *ReconciliationRequest) RemoveResources(predicate func(*unstructured.Unstructured) bool) error

RemoveResources removes resources from the ReconciliationRequest's Resources slice based on a provided predicate function. The predicate determines whether a resource should be removed.

Parameters:

  • predicate: A function that takes a pointer to an unstructured.Unstructured object and returns a boolean indicating whether the resource should be removed.

type ResourceObject

type ResourceObject interface {
	client.Object
	common.WithStatus
}

type TemplateInfo

type TemplateInfo struct {
	FS   fs.FS
	Path string
}

type WithLogger

type WithLogger interface {
	GetLogger() logr.Logger
}

Jump to

Keyboard shortcuts

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