Documentation
¶
Index ¶
- Constants
- Variables
- func FromAPI[S any, T any, P PtrClientObj[T]](t *Translator, target P, source *S) ([]client.Object, error)
- func ToAPI[T any](t *Translator, target *T, source client.Object) error
- type APIExporter
- type APIImporter
- type CRDInfo
- type Dependencies
- type DependencyRepo
- type EncodeDecodeFunc
- type MajorVersion
- type Mapper
- type PtrClientObj
- type Translator
Constants ¶
const ( APIMAppingsAnnotation = "api-mappings" SecretProperySelector = "$.data.#" )
const SetFallbackNamespace = "."
Variables ¶
var ErrNotFound = errors.New("not found")
Functions ¶
func FromAPI ¶
func FromAPI[S any, T any, P PtrClientObj[T]](t *Translator, target P, source *S) ([]client.Object, error)
FromAPI translaters a source API structure into a Kubernetes object
Types ¶
type APIExporter ¶
type APIExporter[T any] interface { ToAPI(t *Translator, target *T) error }
APIExporter can translate itself to an API Object. Use to customize or accelerate translations ad-hoc
type APIImporter ¶
type APIImporter[T any, P PtrClientObj[T]] interface { FromAPI(t *Translator, target P) ([]client.Object, error) }
APIImporter can translate itself into Kubernetes Objects. Use to customize or accelerate translations ad-hoc
type Dependencies ¶
type Dependencies struct {
// contains filtered or unexported fields
}
func NewDependencies ¶
func NewDependencies(mainObj client.Object, objs ...client.Object) *Dependencies
NewDependencies creates a set of Kubernetes client.Objects
func (*Dependencies) Add ¶
func (d *Dependencies) Add(obj client.Object)
Add appends an object to the added list and records it in the general set
func (*Dependencies) Added ¶
func (d *Dependencies) Added() []client.Object
Added dumps an array of all dependencies added to the set after creation
func (*Dependencies) Find ¶
func (d *Dependencies) Find(name, namespace string) client.Object
Find looks for an object within the dependencies by name and namespace
func (*Dependencies) MainObject ¶
func (d *Dependencies) MainObject() client.Object
MainObject retried the main object for this dependecny repository
type DependencyRepo ¶
type EncodeDecodeFunc ¶
type MajorVersion ¶
type MajorVersion struct {
// contains filtered or unexported fields
}
MajorVersion holds the SDK version information
type PtrClientObj ¶
PtrClientObj is a pointer type implementing client.Object
type Translator ¶
type Translator struct {
// contains filtered or unexported fields
}
Translator allows to translate back and forth between a CRD schema version and SDK API structures of a certain version
func NewTranslator ¶
func NewTranslator(crd *apiextensionsv1.CustomResourceDefinition, crdVersion string, majorVersion string, deps DependencyRepo) *Translator
NewTranslator creates a translator for a particular CRD and major version pairs, and with a particular set of known Kubernetes object dependencies.
Given the following example resource:
apiVersion: atlas.generated.mongodb.com/v1 kind: SearchIndex metadata: name: search-index spec: v20250312:
In the above case crdVersion is "v1" and majorVersion is "v20250312".