Documentation
¶
Overview ¶
Package controller contains the Kubernetes controllers for managing Watcher components
Index ¶
- Constants
- Variables
- func GenerateConfigsGeneric(ctx context.Context, helper *helper.Helper, instance client.Object, ...) error
- func GetLastAppliedTopologyRef(t topologyHandler, ns string) *topologyv1.TopoRef
- type Manageable
- type Reconciler
- type ReconcilerBase
- type Reconcilers
- type WatcherAPIReconciler
- type WatcherApplierReconciler
- type WatcherDecisionEngineReconciler
- type WatcherReconciler
Constants ¶
const ( // TransportURLSelector is the name of key in the secret created by TransportURL TransportURLSelector = "transport_url" // NotificationURLSelector is the name of key in the secret created by the notification TransportURL NotificationURLSelector = "notification_url" // QuorumQueuesSelector is the name of key in the secret created by TransportURL for quorum queues enablement QuorumQueuesSelector = "quorumqueues" // DatabaseAccount is the name of key in the secret for the name of the Database Acount object DatabaseAccount = "database_account" // DatabaseUsername is the name of key in the secret for the user name used to login to the database DatabaseUsername = "database_username" // DatabasePassword is the name of key in the secret for the password used to login to the database DatabasePassword = "database_password" // DatabaseHostname is the name of key in the secret for the database hostname DatabaseHostname = "database_hostname" // PrometheusHost is the key for the Prometheus host in prometheusSecret PrometheusHost = "host" // PrometheusPort is the key for the Prometheus port in prometheusSecret PrometheusPort = "port" // PrometheusCaCertSecret is the key for the Prometheus CA certificate secret in prometheusSecret PrometheusCaCertSecret = "ca_secret" // PrometheusCaCertKey is the key for the Prometheus CA certificate key in prometheusSecret PrometheusCaCertKey = "ca_key" // WatcherAPILabelPrefix - a unique, service binary specific prefix for the // labels the WatcherAPI controller uses on children objects WatcherAPILabelPrefix = "watcher-api" // WatcherApplierLabelPrefix - a unique, service binary specific prefix for the // labels the WatcherApplier controller uses on children objects WatcherApplierLabelPrefix = "watcher-applier" // WatcherDecisionEngineLabelPrefix - a unique, service binary specific prefix // for the labels the WatcherDecisionEngine controller uses on child objects WatcherDecisionEngineLabelPrefix = "watcher-decision-engine" )
Variables ¶
var ( // ErrSecretFieldNotFound indicates that a required field was not found in a secret ErrSecretFieldNotFound = errors.New("field not found in secret") // ErrMemcachedNotFound indicates that the memcached instance was not found ErrMemcachedNotFound = errors.New("memcached not found") // ErrMemcachedNotReady indicates that the memcached instance is not ready ErrMemcachedNotReady = errors.New("memcached is not ready") // ErrRetrievingSecretData indicates an error retrieving required data from a secret ErrRetrievingSecretData = errors.New("error retrieving required data from secret") // ErrRetrievingNotificationURLSecretData indicates an error retrieving required data from notificationURL secret ErrRetrievingNotificationURLSecretData = errors.New("error retrieving required data from notificationURL secret") // ErrRetrievingTransportURLSecretData indicates an error retrieving required data from transporturl secret ErrRetrievingTransportURLSecretData = errors.New("error retrieving required data from transporturl secret") // ErrRetrievingPrometheusSecretData indicates an error retrieving required data from prometheus secret ErrRetrievingPrometheusSecretData = errors.New("error retrieving required data from prometheus secret") // ErrTransportURLFieldMissing indicates that the TransportURL secret does not have the 'transport_url' field ErrTransportURLFieldMissing = errors.New("the TransportURL secret does not have 'transport_url' field") )
Static error variables for err113 compliance
Functions ¶
func GenerateConfigsGeneric ¶
func GenerateConfigsGeneric( ctx context.Context, helper *helper.Helper, instance client.Object, envVars *map[string]env.Setter, templateParameters map[string]any, customData map[string]string, cmLabels map[string]string, scripts bool, ) error
GenerateConfigsGeneric generates configuration files for watcher components
func GetLastAppliedTopologyRef ¶
func GetLastAppliedTopologyRef(t topologyHandler, ns string) *topologyv1.TopoRef
GetLastAppliedTopologyRef - Returns a TopoRef object that can be passed to the Handle topology logic
Types ¶
type Manageable ¶
Manageable all types that conform to this interface can be setup with a controller-runtime manager.
type Reconciler ¶
type Reconciler interface {
Manageable
SetRequeueTimeout(timeout time.Duration)
}
Reconciler represents a generic interface for all Reconciler objects in watcher
type ReconcilerBase ¶
type ReconcilerBase struct {
Client client.Client
Kclient kubernetes.Interface
Scheme *runtime.Scheme
RequeueTimeout time.Duration
}
ReconcilerBase provides a common set of clients scheme and loggers for all reconcilers.
func NewReconcilerBase ¶
func NewReconcilerBase( mgr ctrl.Manager, kclient kubernetes.Interface, ) ReconcilerBase
NewReconcilerBase constructs a ReconcilerBase given a manager and Kclient.
func (*ReconcilerBase) GetLogger ¶
func (r *ReconcilerBase) GetLogger(ctx context.Context) logr.Logger
GetLogger returns a logger object with a prefix of "controller.name" and additional controller context fields
func (*ReconcilerBase) SetRequeueTimeout ¶
func (r *ReconcilerBase) SetRequeueTimeout(timeout time.Duration)
SetRequeueTimeout overrides the default RequeueTimeout of the Reconciler
type Reconcilers ¶
type Reconcilers struct {
// contains filtered or unexported fields
}
Reconcilers holds all the Reconciler objects of the watcher-operator to allow generic management of them.
func NewReconcilers ¶
func NewReconcilers(mgr ctrl.Manager, kclient *kubernetes.Clientset) *Reconcilers
NewReconcilers constructs all watcher Reconciler objects
func (*Reconcilers) OverrideRequeueTimeout ¶
func (r *Reconcilers) OverrideRequeueTimeout(timeout time.Duration)
OverrideRequeueTimeout overrides the default RequeueTimeout of our reconcilers
type WatcherAPIReconciler ¶
type WatcherAPIReconciler struct {
ReconcilerBase
}
WatcherAPIReconciler reconciles a WatcherAPI object
func (*WatcherAPIReconciler) GetLogger ¶
func (r *WatcherAPIReconciler) GetLogger(ctx context.Context) logr.Logger
GetLogger returns a logger object with a prefix of "controller.name" and additional controller context fields
func (*WatcherAPIReconciler) Reconcile ¶
func (r *WatcherAPIReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, _err error)
Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.
For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.17.3/pkg/reconcile
func (*WatcherAPIReconciler) SetupWithManager ¶
func (r *WatcherAPIReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type WatcherApplierReconciler ¶
type WatcherApplierReconciler struct {
ReconcilerBase
}
WatcherApplierReconciler reconciles a WatcherApplier object
func (*WatcherApplierReconciler) GetLogger ¶
func (r *WatcherApplierReconciler) GetLogger(ctx context.Context) logr.Logger
GetLogger returns a logger object with a prefix of "controller.name" and additional controller context fields
func (*WatcherApplierReconciler) Reconcile ¶
func (r *WatcherApplierReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, _err error)
Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the WatcherApplier object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.
For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.1/pkg/reconcile
func (*WatcherApplierReconciler) SetupWithManager ¶
func (r *WatcherApplierReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type WatcherDecisionEngineReconciler ¶
type WatcherDecisionEngineReconciler struct {
ReconcilerBase
}
WatcherDecisionEngineReconciler reconciles a WatcherDecisionEngine object
func (*WatcherDecisionEngineReconciler) GetLogger ¶
func (r *WatcherDecisionEngineReconciler) GetLogger(ctx context.Context) logr.Logger
GetLogger returns a logger object with a prefix of "controller.name" and additional controller context fields
func (*WatcherDecisionEngineReconciler) Reconcile ¶
func (r *WatcherDecisionEngineReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, _err error)
Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the WatcherDecisionEngine object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.
For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.1/pkg/reconcile
func (*WatcherDecisionEngineReconciler) SetupWithManager ¶
func (r *WatcherDecisionEngineReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type WatcherReconciler ¶
type WatcherReconciler struct {
ReconcilerBase
}
WatcherReconciler reconciles a Watcher object
func (*WatcherReconciler) GetLogger ¶
func (r *WatcherReconciler) GetLogger(ctx context.Context) logr.Logger
GetLogger returns a logger object with a prefix of "controller.name" and additional controller context fields
func (*WatcherReconciler) Reconcile ¶
func (r *WatcherReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, _err error)
Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.
For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.1/pkg/reconcile
func (*WatcherReconciler) SetupWithManager ¶
func (r *WatcherReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.