Documentation ¶
Index ¶
- Constants
- func InvInfoToConfigMap(inv Info) *unstructured.Unstructured
- type Client
- type ClientFactory
- type ClusterClient
- func (r *ClusterClient) Apply(ctx context.Context, inv *unstructured.Unstructured) error
- func (r *ClusterClient) Delete(ctx context.Context, inv *unstructured.Unstructured) error
- func (r *ClusterClient) GetClusterInventory(ctx context.Context, inv Info) (*invv1alpha1.Inventory, error)
- func (r *ClusterClient) GetClusterInventoryInfo(ctx context.Context, inv Info) (*unstructured.Unstructured, error)
- type ClusterClientFactory
- type ConfigMap
- func (r *ConfigMap) GetObject(ctx context.Context, providers map[string]string, ...) (*unstructured.Unstructured, error)
- func (r *ConfigMap) ID() string
- func (r *ConfigMap) Load(ctx context.Context) (*invv1alpha1.Inventory, error)
- func (r *ConfigMap) Name() string
- func (r *ConfigMap) Namespace() string
- func (r *ConfigMap) NamespacedName() string
- type Info
- type Storage
- type ToStorageFunc
- type ToUnstructuredFunc
Constants ¶
const KformSystemNamespace = `
apiVersion: v1
kind: Namespace
metadata:
name: kform-system
`
Variables ¶
This section is empty.
Functions ¶
func InvInfoToConfigMap ¶
func InvInfoToConfigMap(inv Info) *unstructured.Unstructured
Types ¶
type Client ¶
type Client interface { // GetClusterInventory returns the inventory, which consists of the providers with their // resp. configs and the packages with their respective objRefs; // or an error if one occurred. GetClusterInventory(ctx context.Context, invName Info) (*invv1alpha1.Inventory, error) // GetClusterInventoryInfo returns the cluster inventory object. GetClusterInventoryInfo(ctx context.Context, inv Info) (*unstructured.Unstructured, error) Apply(ctx context.Context, inv *unstructured.Unstructured) error Delete(ctx context.Context, inv *unstructured.Unstructured) error }
Client expresses an interface for interacting with objects which store references to objects (inventory objects).
type ClientFactory ¶
ClientFactory is a factory that constructs new Client instances.
type ClusterClient ¶
type ClusterClient struct {
// contains filtered or unexported fields
}
ClusterClient is a implementation of the Client interface.
func NewClient ¶
func NewClient( factory util.Factory, invToStorageFunc ToStorageFunc, invToUnstructuredFunc ToUnstructuredFunc, statusPolicy policy.StatusPolicy) (*ClusterClient, error)
NewClient returns a concrete implementation of the Client interface or an error.
func (*ClusterClient) Apply ¶
func (r *ClusterClient) Apply(ctx context.Context, inv *unstructured.Unstructured) error
getMapping returns the RESTMapping for the provided resource.
func (*ClusterClient) Delete ¶
func (r *ClusterClient) Delete(ctx context.Context, inv *unstructured.Unstructured) error
getMapping returns the RESTMapping for the provided resource.
func (*ClusterClient) GetClusterInventory ¶
func (r *ClusterClient) GetClusterInventory(ctx context.Context, inv Info) (*invv1alpha1.Inventory, error)
func (*ClusterClient) GetClusterInventoryInfo ¶
func (r *ClusterClient) GetClusterInventoryInfo(ctx context.Context, inv Info) (*unstructured.Unstructured, error)
type ClusterClientFactory ¶
type ClusterClientFactory struct {
StatusPolicy policy.StatusPolicy
}
ClusterClientFactory is a factory that creates instances of ClusterClient inventory client.
type ConfigMap ¶
type ConfigMap struct {
// contains filtered or unexported fields
}
ConfigMap wraps a ConfigMap resource and implements the Info/Storage interface.
func (*ConfigMap) GetObject ¶
func (r *ConfigMap) GetObject(ctx context.Context, providers map[string]string, newActuatedResources store.Storer[store.Storer[data.BlockData]]) (*unstructured.Unstructured, error)
GetObject returns the wrapped object (ConfigMap) as a resource.Info or an error if one occurs.
func (*ConfigMap) Load ¶
Load is an Inventory interface function returning the set of object metadata per provider from the wrapped ConfigMap, or an error.
func (*ConfigMap) NamespacedName ¶
type Info ¶
type Info interface { // Namespace of the inventory object. // It should be the value of the field .metadata.namespace. Namespace() string // Name of the inventory object. // It should be the value of the field .metadata.name. Name() string // Combines Namespace and Name as a string NamespacedName() string // ID of the inventory object. ID() string }
Info provides the methods to lookup the inventory object
func WrapInventoryInfoObj ¶
func WrapInventoryInfoObj(inv *unstructured.Unstructured) Info
WrapInventoryInfoObj takes a passed ConfigMap, wraps it with the ConfigMap and upcasts the wrapper as an the Info interface.
type Storage ¶
type Storage interface { // GetObject returns the object that stores the inventory GetObject(ctx context.Context, providers map[string]string, newActuatedResources store.Storer[store.Storer[data.BlockData]]) (*unstructured.Unstructured, error) // Load retrieves the set of object metadata from the inventory object Load(ctx context.Context) (*invv1alpha1.Inventory, error) }
Storage describes methods necessary for an object which can persist the object metadata for pruning and other group operations.
func WrapInventoryObj ¶
func WrapInventoryObj(inv *unstructured.Unstructured) Storage
WrapInventoryObj takes a passed ConfigMap, wraps it with the ConfigMap and upcasts the wrapper as an the Inventory interface.
type ToStorageFunc ¶
type ToStorageFunc func(*unstructured.Unstructured) Storage
ToStorageFunc creates the object which implements the Storage interface from the passed inv object.
type ToUnstructuredFunc ¶
type ToUnstructuredFunc func(Info) *unstructured.Unstructured
ToUnstructuredFunc returns the unstructured object for the given Info.