Documentation
¶
Index ¶
- func DataPlaneWatchBuilder(mgr ctrl.Manager, konnectEnabled bool) *builder.Builder
- type BlueGreenReconciler
- type ClientObjectPointer
- type DataPlaneOwnedResource
- type DataPlaneOwnedResourceFinalizerReconciler
- type DataPlaneOwnedResourcePointer
- type DeepCopier
- type DeploymentBuilder
- func (d *DeploymentBuilder) BuildAndDeploy(ctx context.Context, dataplane *operatorv1beta1.DataPlane, enforceConfig bool, ...) (*appsv1.Deployment, op.Result, error)
- func (d *DeploymentBuilder) WithAdditionalLabels(labels client.MatchingLabels) *DeploymentBuilder
- func (d *DeploymentBuilder) WithClusterCertificate(name string) *DeploymentBuilder
- func (d *DeploymentBuilder) WithDefaultImage(image string) *DeploymentBuilder
- func (d *DeploymentBuilder) WithOpts(opts ...k8sresources.DeploymentOpt) *DeploymentBuilder
- func (d *DeploymentBuilder) WithSecretLabelSelector(key string) *DeploymentBuilder
- type Reconciler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlueGreenReconciler ¶
type BlueGreenReconciler struct {
client.Client
ControllerOptions controller.Options
// DataPlaneController contains the DataPlaneReconciler to which we delegate
// the DataPlane reconciliation when it's not yet ready to accept BlueGreen
// rollout changes or BlueGreen rollout has not been configured.
DataPlaneController reconcile.Reconciler
// ClusterCASecretName contains the name of the Secret that contains the CA
// certificate data which will be used when generating certificates for DataPlane's
// Deployment.
ClusterCASecretName string
// ClusterCASecretName contains the namespace of the Secret that contains the CA
// certificate data which will be used when generating certificates for DataPlane's
// Deployment.
ClusterCASecretNamespace string
SecretLabelSelector string
DefaultImage string
KonnectEnabled bool
CacheSyncTimeout time.Duration
EnforceConfig bool
ValidateDataPlaneImage bool
LoggingMode logging.Mode
}
BlueGreenReconciler reconciles a DataPlane objects for purposes of Blue Green rollouts.
func (*BlueGreenReconciler) Reconcile ¶
Reconcile moves the current state of an object to the intended state.
func (*BlueGreenReconciler) SetupWithManager ¶
SetupWithManager sets up the controller with the Manager.
type ClientObjectPointer ¶
type ClientObjectPointer[T DataPlaneOwnedResource] interface { *T client.Object }
ClientObjectPointer is a type contraint which enforces client.Object interface and holds *T.
type DataPlaneOwnedResource ¶
DataPlaneOwnedResource is a type that represents a Kubernetes resource that is owned by a DataPlane.
type DataPlaneOwnedResourceFinalizerReconciler ¶
type DataPlaneOwnedResourceFinalizerReconciler[T DataPlaneOwnedResource, PT DataPlaneOwnedResourcePointer[T, PT]] struct { Client client.Client LoggingMode logging.Mode Opts controller.Options }
DataPlaneOwnedResourceFinalizerReconciler reconciles DataPlaneOwnedResource objects. It removes the finalizer from the object only when the parent DataPlane is deleted to prevent accidental deletion of the DataPlane owned resources. This is a stop gap solution until we implement proper self-healing for the DataPlane resources, see: https://github.com/kong/kong-operator/issues/1028
func NewDataPlaneOwnedResourceFinalizerReconciler ¶
func NewDataPlaneOwnedResourceFinalizerReconciler[T DataPlaneOwnedResource, PT DataPlaneOwnedResourcePointer[T, PT]]( client client.Client, loggingMode logging.Mode, opts controller.Options, ) *DataPlaneOwnedResourceFinalizerReconciler[T, PT]
NewDataPlaneOwnedResourceFinalizerReconciler returns a new DataPlaneOwnedResourceFinalizerReconciler for a type passed as the first parameter. The PT param is used only to allow inferring the type of the object so that we can write:
NewDataPlaneOwnedResourceFinalizerReconciler(&corev1.Service{}, ...)
instead of repeating the type twice as follows:
NewDataPlaneOwnedResourceFinalizerReconciler[corev1.Service, *corev1.Service](...).
func (DataPlaneOwnedResourceFinalizerReconciler[T, PT]) Reconcile ¶
func (r DataPlaneOwnedResourceFinalizerReconciler[T, PT]) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile reconciles the DataPlaneOwnedResource object.
func (*DataPlaneOwnedResourceFinalizerReconciler[T, PT]) SetupWithManager ¶
func (r *DataPlaneOwnedResourceFinalizerReconciler[T, PT]) SetupWithManager( ctx context.Context, mgr ctrl.Manager, ) error
SetupWithManager sets up the controller with the Manager.
type DataPlaneOwnedResourcePointer ¶
type DataPlaneOwnedResourcePointer[T DataPlaneOwnedResource, PT ClientObjectPointer[T]] interface { // We need DeepCopier part of the type constraint to ensure that we can use // DeepCopy() *T on DataPlaneOwnedResourcePointer objects. DeepCopier[T, PT] // ClientObjectPointer is needed to ensure that we get access to the methods // of T with pointer receivers and to enforce fulfilling the client.Object // interface. ClientObjectPointer[T] }
DataPlaneOwnedResourcePointer is a type that represents a pointer to a DataPlaneOwnedResource that implements client.Object interface. It allows us to use it to create a new instance of the object using DataPlaneOwnedResource type param and cast it in compile time to DataPlaneOwnedResourcePointer. See: https://stackoverflow.com/a/69575720/7958339
type DeepCopier ¶
type DeepCopier[T DataPlaneOwnedResource, PT ClientObjectPointer[T]] interface { DeepCopy() PT }
DeepCopier is a type contraint which allows enforcing DeepCopy() *T method on objects.
type DeploymentBuilder ¶
type DeploymentBuilder struct {
// contains filtered or unexported fields
}
DeploymentBuilder builds a Deployment for a DataPlane.
func NewDeploymentBuilder ¶
func NewDeploymentBuilder(logger logr.Logger, client client.Client) *DeploymentBuilder
NewDeploymentBuilder creates a DeploymentBuilder.
func (*DeploymentBuilder) BuildAndDeploy ¶
func (d *DeploymentBuilder) BuildAndDeploy( ctx context.Context, dataplane *operatorv1beta1.DataPlane, enforceConfig bool, validateDataPlaneImage bool, ) (*appsv1.Deployment, op.Result, error)
BuildAndDeploy builds and deploys a DataPlane Deployment, or reduces Deployments if there are more than one. It returns the Deployment if it created or updated one, or nil if it needed to reduce or did not need to update an existing Deployment.
func (*DeploymentBuilder) WithAdditionalLabels ¶
func (d *DeploymentBuilder) WithAdditionalLabels(labels client.MatchingLabels) *DeploymentBuilder
WithAdditionalLabels configures additional labels for a DeploymentBuilder.
func (*DeploymentBuilder) WithClusterCertificate ¶
func (d *DeploymentBuilder) WithClusterCertificate(name string) *DeploymentBuilder
WithClusterCertificate configures a cluster certificate name for a DeploymentBuilder.
func (*DeploymentBuilder) WithDefaultImage ¶
func (d *DeploymentBuilder) WithDefaultImage(image string) *DeploymentBuilder
WithDefaultImage configures the default image.
func (*DeploymentBuilder) WithOpts ¶
func (d *DeploymentBuilder) WithOpts(opts ...k8sresources.DeploymentOpt) *DeploymentBuilder
WithOpts adds option functions to a DeploymentBuilder.
func (*DeploymentBuilder) WithSecretLabelSelector ¶
func (d *DeploymentBuilder) WithSecretLabelSelector(key string) *DeploymentBuilder
WithSecretLabelSelector sets the label of created `Secret`s to "true" to get the secrets to be reconciled by other controllers.
type Reconciler ¶
type Reconciler struct {
client.Client
ControllerOptions controller.Options
ClusterCASecretName string
ClusterCASecretNamespace string
SecretLabelSelector string
// ConfigMapLabelSelector is the label selector configured at the oprator level.
// When not empty, it is used as the config map label selector of all reconcilers.
ConfigMapLabelSelector string
DefaultImage string
KonnectEnabled bool
EnforceConfig bool
LoggingMode logging.Mode
ValidateDataPlaneImage bool
// contains filtered or unexported fields
}
Reconciler reconciles a DataPlane object
func (*Reconciler) Reconcile ¶
Reconcile moves the current state of an object to the intended state.
func (*Reconciler) SetupWithManager ¶
SetupWithManager sets up the controller with the Manager.