Documentation
¶
Index ¶
- Variables
- type ApplyOption
- type Client
- type DryRun
- type DynamicClient
- func (client *DynamicClient) Apply(ctx context.Context, obj *unstructured.Unstructured, fieldManager string, ...) error
- func (client *DynamicClient) Delete(ctx context.Context, obj *unstructured.Unstructured) error
- func (client *DynamicClient) Get(ctx context.Context, obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
- func (client *DynamicClient) Invalidate() error
- func (client *DynamicClient) RESTMapper() meta.RESTMapper
- type ExtendedDynamicClient
- func (e *ExtendedDynamicClient) Apply(ctx context.Context, obj *ExtendedUnstructured, fieldManager string, ...) error
- func (e *ExtendedDynamicClient) Delete(ctx context.Context, obj *ExtendedUnstructured) error
- func (e *ExtendedDynamicClient) DynamicClient() *DynamicClient
- func (e *ExtendedDynamicClient) Get(ctx context.Context, obj *ExtendedUnstructured) (*unstructured.Unstructured, error)
- func (e *ExtendedDynamicClient) RESTMapper() meta.RESTMapper
- type ExtendedUnstructured
- type Force
- type InMemoryRESTClientGetter
- func (c *InMemoryRESTClientGetter) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
- func (c *InMemoryRESTClientGetter) ToRESTConfig() (*rest.Config, error)
- func (c *InMemoryRESTClientGetter) ToRESTMapper() (meta.RESTMapper, error)
- func (c *InMemoryRESTClientGetter) ToRawKubeConfigLoader() clientcmd.ClientConfig
- type Manifest
- type ManifestAttributeInfo
- type ManifestFieldMetadata
- type ManifestIgnoreAttribute
- type ManifestMetadata
- type ManifestMetadataNode
Constants ¶
This section is empty.
Variables ¶
var (
ErrManifestNoMetadata = errors.New("Helm chart manifest has no metadata")
)
Functions ¶
This section is empty.
Types ¶
type ApplyOption ¶
type ApplyOption interface {
Apply(opts *applyOptions)
}
ApplyOption is a specific configuration used for applying changes to an object.
type Client ¶
type Client[T any, R any] interface { // Apply applies changes to an object through a Server-Side Apply // and takes the ownership of this object. // The object is created when it does not exist. // It errors on conflicts if force is set to false. Apply(ctx context.Context, obj *T, fieldManager string, opts ...ApplyOption) error // Get retrieves the unstructured object from a Kubernetes cluster. Get(ctx context.Context, obj *T) (*R, error) // Delete removes the object from the Kubernetes cluster. Delete(ctx context.Context, obj *T) error // Returns the [meta.RESTMapper] associated with this client. RESTMapper() meta.RESTMapper }
Client connects to a Kubernetes cluster to create, read, update and delete manifests/objects.
type DynamicClient ¶
type DynamicClient struct {
// contains filtered or unexported fields
}
DynamicClient connects to a Kubernetes cluster to create, read, update and delete unstructured manifests/objects.
func NewDynamicClient ¶
func NewDynamicClient(config *rest.Config) (*DynamicClient, error)
NewDynamicClient constructs a new DynamicClient, which connects to a Kubernetes cluster to create, read, update and delete unstructured manifests/objects.
func (*DynamicClient) Apply ¶
func (client *DynamicClient) Apply( ctx context.Context, obj *unstructured.Unstructured, fieldManager string, opts ...ApplyOption, ) error
Apply applies changes to an object through a Server-Side Apply and takes the ownership of this object. The object is created when it does not exist. It errors on conflicts if force is set to false.
func (*DynamicClient) Delete ¶
func (client *DynamicClient) Delete(ctx context.Context, obj *unstructured.Unstructured) error
Delete removes the unstructured object from a Kubernetes cluster. Following fields have to be set on obj: - GVK, Namespace, Name
func (*DynamicClient) Get ¶
func (client *DynamicClient) Get( ctx context.Context, obj *unstructured.Unstructured, ) (*unstructured.Unstructured, error)
Get retrieves the unstructured object from a Kubernetes cluster. Following fields have to be set on obj: - GVK, Name
func (*DynamicClient) Invalidate ¶
func (client *DynamicClient) Invalidate() error
Invalidate resets the internally cached Discovery information and will cause the next mapping request to re-discover.
func (*DynamicClient) RESTMapper ¶
func (client *DynamicClient) RESTMapper() meta.RESTMapper
type ExtendedDynamicClient ¶ added in v0.24.6
type ExtendedDynamicClient struct {
// contains filtered or unexported fields
}
DynamicClient connects to a Kubernetes cluster to create, read, update and delete extended unstructured manifests/objects.
func NewExtendedDynamicClient ¶ added in v0.24.6
func NewExtendedDynamicClient(config *rest.Config) (*ExtendedDynamicClient, error)
NewExtendedDynamicClient constructs a new DynamicClient, which connects to a Kubernetes cluster to create, read, update and delete unstructured manifests/objects.
func (*ExtendedDynamicClient) Apply ¶ added in v0.24.6
func (e *ExtendedDynamicClient) Apply( ctx context.Context, obj *ExtendedUnstructured, fieldManager string, opts ...ApplyOption, ) error
func (*ExtendedDynamicClient) Delete ¶ added in v0.24.6
func (e *ExtendedDynamicClient) Delete(ctx context.Context, obj *ExtendedUnstructured) error
func (*ExtendedDynamicClient) DynamicClient ¶ added in v0.24.6
func (e *ExtendedDynamicClient) DynamicClient() *DynamicClient
func (*ExtendedDynamicClient) Get ¶ added in v0.24.6
func (e *ExtendedDynamicClient) Get( ctx context.Context, obj *ExtendedUnstructured, ) (*unstructured.Unstructured, error)
func (*ExtendedDynamicClient) RESTMapper ¶ added in v0.24.6
func (e *ExtendedDynamicClient) RESTMapper() meta.RESTMapper
type ExtendedUnstructured ¶ added in v0.24.6
type ExtendedUnstructured struct { *unstructured.Unstructured Metadata ManifestMetadata `json:"-"` AttributeInfo ManifestAttributeInfo `json:"-"` }
ExtendedUnstructured enhances Kubernetes Unstructured struct with additional Metadata, like IgnoreAttributes.
type InMemoryRESTClientGetter ¶
type InMemoryRESTClientGetter struct { Cfg *rest.Config RestMapper meta.RESTMapper }
func (*InMemoryRESTClientGetter) ToDiscoveryClient ¶
func (c *InMemoryRESTClientGetter) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
func (*InMemoryRESTClientGetter) ToRESTConfig ¶
func (c *InMemoryRESTClientGetter) ToRESTConfig() (*rest.Config, error)
func (*InMemoryRESTClientGetter) ToRESTMapper ¶
func (c *InMemoryRESTClientGetter) ToRESTMapper() (meta.RESTMapper, error)
func (*InMemoryRESTClientGetter) ToRawKubeConfigLoader ¶
func (c *InMemoryRESTClientGetter) ToRawKubeConfigLoader() clientcmd.ClientConfig
type Manifest ¶ added in v0.24.6
type Manifest struct { ID string Dependencies []string Content ExtendedUnstructured }
Manifest represents a Declcd component with its id, dependencies and content. It is the Go equivalent of the CUE definition the user interacts with. See unstructured.Unstructured for more.
func (*Manifest) GetAPIVersion ¶ added in v0.24.6
func (*Manifest) GetDependencies ¶ added in v0.24.6
func (*Manifest) GetNamespace ¶ added in v0.24.6
type ManifestAttributeInfo ¶ added in v0.24.6
type ManifestAttributeInfo struct {
HasIgnoreConflictAttributes bool
}
type ManifestFieldMetadata ¶ added in v0.24.6
type ManifestFieldMetadata struct {
IgnoreAttr ManifestIgnoreAttribute
}
func (*ManifestFieldMetadata) Metadata ¶ added in v0.24.6
func (v *ManifestFieldMetadata) Metadata() *ManifestFieldMetadata
type ManifestIgnoreAttribute ¶ added in v0.24.6
type ManifestIgnoreAttribute int
ManifestIgnoreAttribute is a CUE build attribute a user can define on a field or declaration to tell Declcd to ignore fields or structs when applying Kubernetes Manifests.
const ( // Default. Declcd will enforce the field/struct. None ManifestIgnoreAttribute = iota // This tells Declcd to omit the field/struct 'tagged' with this value on a retry ssa patch request. OnConflict )
type ManifestMetadata ¶
type ManifestMetadata interface {
Metadata() *ManifestFieldMetadata
}
ManifestMetadata extends unstructured fields with additional information.
type ManifestMetadataNode ¶ added in v0.24.6
type ManifestMetadataNode map[string]ManifestMetadata
func (*ManifestMetadataNode) Metadata ¶ added in v0.24.6
func (s *ManifestMetadataNode) Metadata() *ManifestFieldMetadata