Documentation
¶
Index ¶
- Variables
- type APICallbacks
- type APICallbacksOption
- type APISecretClient
- type AsyncTracker
- type AsyncTrackerOption
- type CallbackFn
- type CallbackProvider
- type Connector
- type ESSOptions
- type NoForkAsyncConnector
- type NoForkAsyncOption
- func WithNoForkAsyncCallbackProvider(ac CallbackProvider) NoForkAsyncOption
- func WithNoForkAsyncConnectorEventHandler(e *handler.EventHandler) NoForkAsyncOption
- func WithNoForkAsyncLogger(l logging.Logger) NoForkAsyncOption
- func WithNoForkAsyncManagementPolicies(isManagementPoliciesEnabled bool) NoForkAsyncOption
- func WithNoForkAsyncMetricRecorder(r *metrics.MetricRecorder) NoForkAsyncOption
- type NoForkConnector
- type NoForkFinalizer
- type NoForkOption
- type OperationTrackerStore
- type Option
- type Options
- type ProviderSharer
- type Resource
- type Store
- type TrackerCleaner
- type Workspace
Constants ¶
This section is empty.
Variables ¶
var Base64DecodeFunc = function.New(&function.Spec{ Params: []function.Parameter{ { Name: "str", Type: cty.String, AllowMarked: true, }, }, Type: function.StaticReturnType(cty.String), Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { str, strMarks := args[0].Unmark() s := str.AsString() sDec, err := base64.StdEncoding.DecodeString(s) if err != nil { return cty.UnknownVal(cty.String), fmt.Errorf("failed to decode base64 data %s", s) } if !utf8.Valid(sDec) { log.Printf("[DEBUG] the result of decoding the provided string is not valid UTF-8: %s", s) return cty.UnknownVal(cty.String), fmt.Errorf("the result of decoding the provided string is not valid UTF-8") } return cty.StringVal(string(sDec)).WithMarks(strMarks), nil }, })
var Base64EncodeFunc = function.New(&function.Spec{ Params: []function.Parameter{ { Name: "str", Type: cty.String, }, }, Type: function.StaticReturnType(cty.String), Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { return cty.StringVal(base64.StdEncoding.EncodeToString([]byte(args[0].AsString()))), nil }, })
Functions ¶
This section is empty.
Types ¶
type APICallbacks ¶
type APICallbacks struct {
// contains filtered or unexported fields
}
APICallbacks providers callbacks that work on API resources.
func NewAPICallbacks ¶
func NewAPICallbacks(m ctrl.Manager, of xpresource.ManagedKind, opts ...APICallbacksOption) *APICallbacks
NewAPICallbacks returns a new APICallbacks.
func (*APICallbacks) Create ¶
func (ac *APICallbacks) Create(name string) terraform.CallbackFn
Create makes sure the error is saved in async operation condition.
func (*APICallbacks) Destroy ¶
func (ac *APICallbacks) Destroy(name string) terraform.CallbackFn
Destroy makes sure the error is saved in async operation condition.
func (*APICallbacks) Update ¶
func (ac *APICallbacks) Update(name string) terraform.CallbackFn
Update makes sure the error is saved in async operation condition.
type APICallbacksOption ¶
type APICallbacksOption func(callbacks *APICallbacks)
APICallbacksOption represents a configurable option for the APICallbacks
func WithEventHandler ¶
func WithEventHandler(e *handler.EventHandler) APICallbacksOption
WithEventHandler sets the EventHandler for the APICallbacks so that the APICallbacks instance can requeue reconcile requests in the context of the asynchronous operations.
func WithStatusUpdates ¶
func WithStatusUpdates(enabled bool) APICallbacksOption
WithStatusUpdates sets whether the LastAsyncOperation status condition is enabled. If set to false, APICallbacks will not use the LastAsyncOperation status condition for reporting ongoing async operations or errors. Error conditions will still be reported as usual in the `Synced` status condition.
type APISecretClient ¶
type APISecretClient struct {
// contains filtered or unexported fields
}
APISecretClient is a client for getting k8s secrets
func (*APISecretClient) GetSecretData ¶
func (a *APISecretClient) GetSecretData(ctx context.Context, ref *xpv1.SecretReference) (map[string][]byte, error)
GetSecretData gets and returns data for the referenced secret
func (*APISecretClient) GetSecretValue ¶
func (a *APISecretClient) GetSecretValue(ctx context.Context, sel xpv1.SecretKeySelector) ([]byte, error)
GetSecretValue gets and returns value for key of the referenced secret
type AsyncTracker ¶
type AsyncTracker struct {
LastOperation *terraform.Operation
// contains filtered or unexported fields
}
func NewAsyncTracker ¶
func NewAsyncTracker(opts ...AsyncTrackerOption) *AsyncTracker
func (*AsyncTracker) GetTfID ¶
func (a *AsyncTracker) GetTfID() string
func (*AsyncTracker) GetTfState ¶
func (a *AsyncTracker) GetTfState() *tfsdk.InstanceState
func (*AsyncTracker) HasState ¶
func (a *AsyncTracker) HasState() bool
func (*AsyncTracker) IsDeleted ¶
func (a *AsyncTracker) IsDeleted() bool
IsDeleted returns whether the associated external resource has logically been deleted.
func (*AsyncTracker) SetDeleted ¶
func (a *AsyncTracker) SetDeleted(deleted bool)
SetDeleted sets the logical deletion status of the associated external resource.
func (*AsyncTracker) SetTfState ¶
func (a *AsyncTracker) SetTfState(state *tfsdk.InstanceState)
type AsyncTrackerOption ¶
type AsyncTrackerOption func(manager *AsyncTracker)
func WithAsyncTrackerLogger ¶
func WithAsyncTrackerLogger(l logging.Logger) AsyncTrackerOption
WithAsyncTrackerLogger sets the logger of AsyncTracker.
type CallbackProvider ¶
type CallbackProvider interface {
Create(name string) terraform.CallbackFn
Update(name string) terraform.CallbackFn
Destroy(name string) terraform.CallbackFn
}
CallbackProvider provides functions that can be called with the result of async operations.
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
Connector initializes the external client with credentials and other configuration parameters.
func NewConnector ¶
func NewConnector(kube client.Client, ws Store, sf terraform.SetupFn, cfg *config.Resource, opts ...Option) *Connector
NewConnector returns a new Connector object.
func (*Connector) Connect ¶
func (c *Connector) Connect(ctx context.Context, mg xpresource.Managed) (managed.ExternalClient, error)
Connect makes sure the underlying client is ready to issue requests to the provider API.
type ESSOptions ¶
ESSOptions for External Secret Stores.
type NoForkAsyncConnector ¶
type NoForkAsyncConnector struct {
*NoForkConnector
// contains filtered or unexported fields
}
func NewNoForkAsyncConnector ¶
func NewNoForkAsyncConnector(kube client.Client, ots *OperationTrackerStore, sf terraform.SetupFn, cfg *config.Resource, opts ...NoForkAsyncOption) *NoForkAsyncConnector
func (*NoForkAsyncConnector) Connect ¶
func (c *NoForkAsyncConnector) Connect(ctx context.Context, mg xpresource.Managed) (managed.ExternalClient, error)
type NoForkAsyncOption ¶
type NoForkAsyncOption func(connector *NoForkAsyncConnector)
func WithNoForkAsyncCallbackProvider ¶
func WithNoForkAsyncCallbackProvider(ac CallbackProvider) NoForkAsyncOption
WithNoForkAsyncCallbackProvider configures the controller to use async variant of the functions of the Terraform client and run given callbacks once those operations are completed.
func WithNoForkAsyncConnectorEventHandler ¶
func WithNoForkAsyncConnectorEventHandler(e *handler.EventHandler) NoForkAsyncOption
WithNoForkAsyncConnectorEventHandler configures the EventHandler so that the no-fork external clients can requeue reconciliation requests.
func WithNoForkAsyncLogger ¶
func WithNoForkAsyncLogger(l logging.Logger) NoForkAsyncOption
WithNoForkAsyncLogger configures a logger for the NoForkAsyncConnector.
func WithNoForkAsyncManagementPolicies ¶
func WithNoForkAsyncManagementPolicies(isManagementPoliciesEnabled bool) NoForkAsyncOption
WithNoForkAsyncManagementPolicies configures whether the client should handle management policies.
func WithNoForkAsyncMetricRecorder ¶
func WithNoForkAsyncMetricRecorder(r *metrics.MetricRecorder) NoForkAsyncOption
WithNoForkAsyncMetricRecorder configures a metrics.MetricRecorder for the NoForkAsyncConnector.
type NoForkConnector ¶
type NoForkConnector struct {
// contains filtered or unexported fields
}
func NewNoForkConnector ¶
func NewNoForkConnector(kube client.Client, sf terraform.SetupFn, cfg *config.Resource, ots *OperationTrackerStore, opts ...NoForkOption) *NoForkConnector
func (*NoForkConnector) Connect ¶
func (c *NoForkConnector) Connect(ctx context.Context, mg xpresource.Managed) (managed.ExternalClient, error)
type NoForkFinalizer ¶
type NoForkFinalizer struct {
xpresource.Finalizer
OperationStore TrackerCleaner
}
NoForkFinalizer removes the operation tracker from the workspace store and only then calls RemoveFinalizer of the underlying Finalizer.
func NewNoForkFinalizer ¶
func NewNoForkFinalizer(tc TrackerCleaner, af xpresource.Finalizer) *NoForkFinalizer
NewNoForkFinalizer returns a new NoForkFinalizer.
func (*NoForkFinalizer) AddFinalizer ¶
func (nf *NoForkFinalizer) AddFinalizer(ctx context.Context, obj xpresource.Object) error
AddFinalizer to the supplied Managed resource.
func (*NoForkFinalizer) RemoveFinalizer ¶
func (nf *NoForkFinalizer) RemoveFinalizer(ctx context.Context, obj xpresource.Object) error
RemoveFinalizer removes the workspace from workspace store before removing the finalizer.
type NoForkOption ¶
type NoForkOption func(connector *NoForkConnector)
NoForkOption allows you to configure NoForkConnector.
func WithNoForkLogger ¶
func WithNoForkLogger(l logging.Logger) NoForkOption
WithNoForkLogger configures a logger for the NoForkConnector.
func WithNoForkManagementPolicies ¶
func WithNoForkManagementPolicies(isManagementPoliciesEnabled bool) NoForkOption
WithNoForkManagementPolicies configures whether the client should handle management policies.
func WithNoForkMetricRecorder ¶
func WithNoForkMetricRecorder(r *metrics.MetricRecorder) NoForkOption
WithNoForkMetricRecorder configures a metrics.MetricRecorder for the NoForkConnector.
type OperationTrackerStore ¶
type OperationTrackerStore struct {
// contains filtered or unexported fields
}
func NewOperationStore ¶
func NewOperationStore(l logging.Logger) *OperationTrackerStore
func (*OperationTrackerStore) RemoveTracker ¶
func (ops *OperationTrackerStore) RemoveTracker(obj xpresource.Object) error
func (*OperationTrackerStore) Tracker ¶
func (ops *OperationTrackerStore) Tracker(tr resource.Terraformed) *AsyncTracker
type Option ¶
type Option func(*Connector)
Option allows you to configure Connector.
func WithCallbackProvider ¶
func WithCallbackProvider(ac CallbackProvider) Option
WithCallbackProvider configures the controller to use async variant of the functions of the Terraform client and run given callbacks once those operations are completed.
func WithConnectorEventHandler ¶
func WithConnectorEventHandler(e *handler.EventHandler) Option
WithConnectorEventHandler configures the EventHandler so that the external clients can requeue reconciliation requests.
func WithLogger ¶
WithLogger configures a logger for the Connector.
type Options ¶
type Options struct {
controller.Options
// Provider contains all resource configurations of the provider which can
// be used to pick the related one. Since the selection is done in runtime,
// we need to pass everything and generated code will pick the one.
Provider *config.Provider
// WorkspaceStore will be used to pick/initialize the workspace the specific CR
// instance should use.
WorkspaceStore *terraform.WorkspaceStore
OperationTrackerStore *OperationTrackerStore
// SetupFn contains the provider-specific initialization logic, such as
// preparing the auth token for Terraform CLI.
SetupFn terraform.SetupFn
// SecretStoreConfigGVK is the GroupVersionKind for the Secret StoreConfig
// resource. Setting this enables External Secret Stores for the controller
// by adding connection.DetailsManager as a ConnectionPublisher.
SecretStoreConfigGVK *schema.GroupVersionKind
// ESSOptions for External Secret Stores.
ESSOptions *ESSOptions
// PollJitter adds the specified jitter to the configured reconcile period
// of the up-to-date resources in managed.Reconciler.
PollJitter time.Duration
}
Options contains incriminating options for a given Upjet controller instance.
type ProviderSharer ¶
type ProviderSharer interface {
}
ProviderSharer shares a native provider process with the receiver.
type Resource ¶
type Resource interface {
Apply(ctx context.Context, s *tf.InstanceState, d *tf.InstanceDiff, meta interface{}) (*tf.InstanceState, diag.Diagnostics)
RefreshWithoutUpgrade(ctx context.Context, s *tf.InstanceState, meta interface{}) (*tf.InstanceState, diag.Diagnostics)
}
type Store ¶
type Store interface {
Workspace(ctx context.Context, c resource.SecretClient, tr resource.Terraformed, ts terraform.Setup, cfg *config.Resource) (*terraform.Workspace, error)
}
Store is where we can get access to the Terraform workspace of given resource.
type TrackerCleaner ¶
type TrackerCleaner interface {
RemoveTracker(obj xpresource.Object) error
}
TrackerCleaner is the interface that the no-fork finalizer needs to work with.
type Workspace ¶
type Workspace interface {
ApplyAsync(terraform.CallbackFn) error
Apply(context.Context) (terraform.ApplyResult, error)
DestroyAsync(terraform.CallbackFn) error
Destroy(context.Context) error
Refresh(context.Context) (terraform.RefreshResult, error)
Import(context.Context, resource.Terraformed) (terraform.ImportResult, error)
Plan(context.Context) (terraform.PlanResult, error)
}
Workspace is the set of methods that are needed for the controller to work.