Documentation ¶
Index ¶
- Variables
- type ApplyOption
- type Client
- type DynamicClient
- func (client *DynamicClient) Apply(ctx context.Context, obj *unstructured.Unstructured, fieldManager string, ...) (*unstructured.Unstructured, 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) Patch(ctx context.Context, obj *unstructured.Unstructured, fieldManager string, ...) (*unstructured.Unstructured, error)
- func (client *DynamicClient) RESTMapper() meta.RESTMapper
- type ExtendedDynamicClient
- func (e *ExtendedDynamicClient) Apply(ctx context.Context, obj *ExtendedUnstructured, fieldManager string, ...) (*unstructured.Unstructured, 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 (client *ExtendedDynamicClient) Patch(ctx context.Context, obj *ExtendedUnstructured, fieldManager string, ...) (*unstructured.Unstructured, error)
- func (e *ExtendedDynamicClient) RESTMapper() meta.RESTMapper
- type ExtendedUnstructured
- type IgnoreInstruction
- 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 ManifestFieldMetadata
- type ManifestMetadata
- type PatchOption
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 func(*applyOptions)
ApplyOption is a specific configuration used for applying changes to an object.
func DryRunApply ¶
func DryRunApply(value bool) ApplyOption
DryRun indicates that modifications should not be persisted.
func ForceApply ¶
func ForceApply(value bool) ApplyOption
Force indicates that conflicts should not error.
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) (*R, error) // Patch applies partial changes to an object and takes ownership of this object/field. Patch(ctx context.Context, obj *T, fieldManager string, opts ...PatchOption) (*R, 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, ) (*unstructured.Unstructured, 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) Patch ¶
func (client *DynamicClient) Patch( ctx context.Context, obj *unstructured.Unstructured, fieldManager string, opts ...PatchOption, ) (*unstructured.Unstructured, error)
Patch applies partial changes to an object and takes ownership of this object/field.
func (*DynamicClient) RESTMapper ¶
func (client *DynamicClient) RESTMapper() meta.RESTMapper
type ExtendedDynamicClient ¶
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 ¶
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 ¶
func (e *ExtendedDynamicClient) Apply( ctx context.Context, obj *ExtendedUnstructured, fieldManager string, opts ...ApplyOption, ) (*unstructured.Unstructured, error)
func (*ExtendedDynamicClient) Delete ¶
func (e *ExtendedDynamicClient) Delete(ctx context.Context, obj *ExtendedUnstructured) error
func (*ExtendedDynamicClient) DynamicClient ¶
func (e *ExtendedDynamicClient) DynamicClient() *DynamicClient
func (*ExtendedDynamicClient) Get ¶
func (e *ExtendedDynamicClient) Get( ctx context.Context, obj *ExtendedUnstructured, ) (*unstructured.Unstructured, error)
func (*ExtendedDynamicClient) Patch ¶
func (client *ExtendedDynamicClient) Patch( ctx context.Context, obj *ExtendedUnstructured, fieldManager string, opts ...PatchOption, ) (*unstructured.Unstructured, error)
Patch applies partial changes to an object and takes ownership of this object/field.
func (*ExtendedDynamicClient) RESTMapper ¶
func (e *ExtendedDynamicClient) RESTMapper() meta.RESTMapper
type ExtendedUnstructured ¶
type ExtendedUnstructured struct { *unstructured.Unstructured Metadata *ManifestMetadata `json:"-"` }
ExtendedUnstructured enhances Kubernetes Unstructured struct with additional Metadata, like IgnoreAttributes.
type IgnoreInstruction ¶
type IgnoreInstruction int
IgnoreInstruction is an instruction to tell Navecd to ignore fields or structs on certain events when applying Kubernetes Manifests.
const ( // Default. Navecd will enforce the field/struct. None IgnoreInstruction = iota // This tells Navecd to omit the field/struct 'tagged' with this value on a retry ssa patch request. OnConflict )
type InMemoryRESTClientGetter ¶
type InMemoryRESTClientGetter struct { Cfg *rest.Config RestMapper meta.RESTMapper }
InMemoryRESTClientGetter is a Helm RESTClientGetter implementatiion, which caches discovery information in memory and will stay up-to-date if Invalidate is called with regularity.
NOTE: The client will NOT resort to live lookups on cache misses.
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 ¶
type Manifest struct { ID string Dependencies []string Content ExtendedUnstructured }
Manifest represents a Navecd 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 ¶
func (*Manifest) GetDependencies ¶
func (*Manifest) GetNamespace ¶
type ManifestFieldMetadata ¶
type ManifestFieldMetadata struct {
IgnoreInstr IgnoreInstruction
}
ManifestFieldMetadata extends unstructured fields with additional information.
type ManifestMetadata ¶
type ManifestMetadata struct { Field *ManifestFieldMetadata Node map[string]ManifestMetadata List []ManifestMetadata }
ManifestMetadata extends unstructured fields, structs or lists with additional information.
type PatchOption ¶
type PatchOption func(*patchOptions)
PatchOption is a specific configuration used for applying json patch changes to an object.
func PatchType ¶
func PatchType(value types.PatchType) PatchOption