Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AWSResource ¶
type AWSResource interface {
// Identifiers returns an AWSResourceIdentifiers object containing various
// identifying information, including the AWS account ID that owns the
// resource, the resource's AWS Resource Name (ARN)
Identifiers() AWSResourceIdentifiers
// Conditions returns the ACK Conditions collection for the AWSResource
Conditions() []*ackv1alpha1.Condition
// IsBeingDeleted returns true if the Kubernetes resource has a non-zero
// deletion timestemp
IsBeingDeleted() bool
// RuntimeObject returns the Kubernetes apimachinery/runtime representation
// of the AWSResource
RuntimeObject() k8srt.Object
// MetaObject returns the Kubernetes apimachinery/apis/meta/v1.Object
// representation of the AWSResource
MetaObject() metav1.Object
// RuntimeMetaObject returns an object that implements both the Kubernetes
// apimachinery/runtime.Object and the Kubernetes
// apimachinery/apis/meta/v1.Object interfaces
RuntimeMetaObject() RuntimeMetaObject
}
AWSResource represents a custom resource object in the Kubernetes API that corresponds to a resource in an AWS service API.
type AWSResourceDescriptor ¶
type AWSResourceDescriptor interface {
// GroupKind returns a Kubernetes metav1.GroupKind struct that describes
// the API Group and Kind of CRs described by the descriptor
GroupKind() *metav1.GroupKind
// EmptyRuntimeObject returns an empty object prototype that may be used in
// apimachinery and k8s client operations
EmptyRuntimeObject() k8srt.Object
// ResourceFromRuntimeObject returns an AWSResource that has been
// initialized with the supplied runtime.Object
ResourceFromRuntimeObject(k8srt.Object) AWSResource
// Equal returns true if the two supplied AWSResources have the same
// content. The underlying types of the two supplied AWSResources should be
// the same. In other words, the Equal() method should be called with the
// same concrete implementing AWSResource type
Equal(AWSResource, AWSResource) bool
// Diff returns a Reporter which provides the difference between two supplied
// AWSResources. The underlying types of the two supplied AWSResources should
// be the same. In other words, the Diff() method should be called with the
// same concrete implementing AWSResource type
Diff(AWSResource, AWSResource) *ackcompare.Reporter
// UpdateCRStatus accepts an AWSResource object and changes the Status
// sub-object of the AWSResource's Kubernetes custom resource (CR) and
// returns whether any changes were made
UpdateCRStatus(AWSResource) (bool, error)
// IsManaged returns true if the supplied AWSResource is under the
// management of an ACK service controller. What this means in practice is
// that the underlying custom resource (CR) in the AWSResource has had a
// resource-specific finalizer associated with it.
IsManaged(AWSResource) bool
// MarkManaged places the supplied resource under the management of ACK.
// What this typically means is that the resource manager will decorate the
// underlying custom resource (CR) with a finalizer that indicates ACK is
// managing the resource and the underlying CR may not be deleted until ACK
// is finished cleaning up any backend AWS service resources associated
// with the CR.
MarkManaged(AWSResource)
// MarkUnmanaged removes the supplied resource from management by ACK.
// What this typically means is that the resource manager will remove a
// finalizer underlying custom resource (CR) that indicates ACK is managing
// the resource. This will allow the Kubernetes API server to delete the
// underlying CR.
MarkUnmanaged(AWSResource)
}
AWSResourceDescriptor provides metadata that describes the Kubernetes metadata associated with an AWSResource, the Kubernetes runtime.Object prototype for that AWSResource, and the relationships between the AWSResource and other AWSResources
type AWSResourceIdentifiers ¶
type AWSResourceIdentifiers interface {
// ARN returns the AWS Resource Name for the backend AWS resource. If nil,
// this means the resource has not yet been created in the backend AWS
// service.
ARN() *ackv1alpha1.AWSResourceName
// OwnerAccountID returns the AWS account identifier in which the
// backend AWS resource resides, or nil if this information is not known
// for the resource
OwnerAccountID() *ackv1alpha1.AWSAccountID
}
AWSResourceIdentifiers has methods that returns common identifying information about a resource
type AWSResourceManager ¶
type AWSResourceManager interface {
// ReadOne returns the currently-observed state of the supplied AWSResource
// in the backend AWS service API.
//
// Implementers should return (nil, ackerrors.NotFound) when the backend
// AWS service API cannot find the resource identified by the supplied
// AWSResource's AWS identifier information.
ReadOne(context.Context, AWSResource) (AWSResource, error)
// Create attempts to create the supplied AWSResource in the backend AWS
// service API, returning an AWSResource representing the newly-created
// resource
Create(context.Context, AWSResource) (AWSResource, error)
// Update attempts to mutate the supplied desired AWSResource in the backend AWS
// service API, returning an AWSResource representing the newly-mutated
// resource.
// Note for specialized logic implementers can check to see how the latest
// observed resource differs from the supplied desired state. The
// higher-level reonciler determines whether or not the desired differs
// from the latest observed and decides whether to call the resource
// manager's Update method
Update(context.Context, AWSResource, AWSResource, *ackcompare.Reporter) (AWSResource, error)
// Delete attempts to destroy the supplied AWSResource in the backend AWS
// service API.
Delete(context.Context, AWSResource) error
// ARNFromName returns an AWS Resource Name from a given string name. This
// is useful for constructing ARNs for APIs that require ARNs in their
// GetAttributes operations but all we have (for new CRs at least) is a
// name for the resource
ARNFromName(string) string
}
AWSResourceManager is responsible for providing a consistent way to perform CRUD+L operations in a backend AWS service API for Kubernetes custom resources (CR) corresponding to those AWS service API resources.
Use an AWSResourceManagerFactory to create an AWSResourceManager for a particular APIResource and AWS account.
type AWSResourceManagerFactory ¶
type AWSResourceManagerFactory interface {
// ResourceDescriptor returns an AWSResourceDescriptor that can be used by
// the upstream controller-runtime to introspect the CRs that the resource
// manager will manage as well as produce Kubernetes runtime object
// prototypes
ResourceDescriptor() AWSResourceDescriptor
// ManagerFor returns an AWSResourceManager that manages AWS resources on
// behalf of a particular AWS account and in a specific AWS region
ManagerFor(
logr.Logger,
*ackmetrics.Metrics,
AWSResourceReconciler,
*session.Session,
ackv1alpha1.AWSAccountID,
ackv1alpha1.AWSRegion,
) (AWSResourceManager, error)
}
AWSResourceManagerFactory returns an AWSResourceManager that can be used to manage AWS resources for a particular AWS account
type AWSResourceReconciler ¶
type AWSResourceReconciler interface {
ctrlreconcile.Reconciler
// GroupKind returns the
// sigs.k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind containing the API
// group and kind reconciled by this reconciler
GroupKind() *metav1.GroupKind
// BindControllerManager sets up the AWSResourceReconciler with an instance
// of an upstream controller-runtime.Manager
BindControllerManager(ctrlrt.Manager) error
// SecretValueFromReference fetches the value of a Secret given a
// SecretReference
SecretValueFromReference(*corev1.SecretReference) (string, error)
}
AWSResourceReconciler is responsible for reconciling the state of a SINGLE KIND of Kubernetes custom resources (CRs) that represent AWS service API resources. It implements the upstream controller-runtime `Reconciler` interface.
The upstream controller-runtime.Manager object ends up managing MULTIPLE controller-runtime.Controller objects (each containing a single AWSResourceReconciler object)s and sharing watch and informer queues across those controllers.