Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions pkg/operator/controller/gatewayclass/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const (

type extraIstioConfig struct {
proxyConfig *configv1.Proxy
infraConfig *configv1.Infrastructure
}

var log = logf.Logger.WithName(controllerName)
Expand Down Expand Up @@ -245,6 +246,12 @@ func NewUnmanaged(mgr manager.Manager, config Config) (controller.Controller, er
}
}

// Watch the cluster infrastructure config in case the infrastructure
// topology changes.
if err := c.Watch(source.Kind[client.Object](operatorCache, &configv1.Infrastructure{}, reconciler.enqueueRequestForSomeGatewayClass())); err != nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question here is, if you change Sail Operator parameter will it reflect on Pilot config?
Also, in case this parameter is also used for Gateway replica deployment, will Sail reconcile all the gateways and HPA?

(Giving some thoughts for test)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

answering myself:
the change of HPA parameter from pilot does not impact on the GatewayClass, it needs its own definition from spec.infrastructure.paramRefs

return nil, err
}

gatewayClassController = c
return c, nil
}
Expand Down Expand Up @@ -418,6 +425,11 @@ func (r *reconciler) reconcileWithOLM(ctx context.Context, request reconcile.Req
log.Info("reconciling with OLM", "request", request)
var errs []error

var infraConfig configv1.Infrastructure
if err := r.cache.Get(ctx, types.NamespacedName{Name: "cluster"}, &infraConfig); err != nil {
return reconcile.Result{}, err
}

gatewayclass := &gatewayapiv1.GatewayClass{}
if err := r.cache.Get(ctx, request.NamespacedName, gatewayclass); err != nil {
if errors.IsNotFound(err) {
Expand Down Expand Up @@ -466,7 +478,12 @@ func (r *reconciler) reconcileWithOLM(ctx context.Context, request reconcile.Req
if v, ok := gatewayclass.Annotations[istioVersionOverrideAnnotationKey]; ok {
istioVersion = v
}
if _, _, err := r.ensureIstioOLM(ctx, gatewayclass, istioVersion); err != nil {
var gatewayclasses gatewayapiv1.GatewayClassList
if err := r.cache.List(ctx, &gatewayclasses, client.MatchingFields{operatorcontroller.GatewayClassIndexFieldName: operatorcontroller.OpenShiftGatewayClassControllerName}); err != nil {
return reconcile.Result{}, err
}

if _, _, err := r.ensureIstioOLM(ctx, gatewayclass, istioVersion, gatewayclasses.Items, &infraConfig); err != nil {
errs = append(errs, err)
} else {
// The OSSM operator installs the istios.sailoperator.io CRD.
Expand All @@ -492,6 +509,11 @@ func (r *reconciler) reconcileWithOLM(ctx context.Context, request reconcile.Req
func (r *reconciler) reconcileWithSailLibrary(ctx context.Context, request reconcile.Request) (reconcile.Result, error) {
log.Info("reconciling with sail library", "request", request)

var infraConfig configv1.Infrastructure
if err := r.cache.Get(ctx, types.NamespacedName{Name: "cluster"}, &infraConfig); err != nil {
return reconcile.Result{}, err
}

gatewayClass := &gatewayapiv1.GatewayClass{}
if err := r.cache.Get(ctx, request.NamespacedName, gatewayClass); err != nil {
if errors.IsNotFound(err) {
Expand Down Expand Up @@ -528,7 +550,12 @@ func (r *reconciler) reconcileWithSailLibrary(ctx context.Context, request recon
istioVersion = v
}

if err := r.ensureIstio(ctx, istioVersion); err != nil {
var gatewayclasses gatewayapiv1.GatewayClassList
if err := r.cache.List(ctx, &gatewayclasses, client.MatchingFields{operatorcontroller.GatewayClassIndexFieldName: operatorcontroller.OpenShiftGatewayClassControllerName}); err != nil {
return reconcile.Result{}, err
}

if err := r.ensureIstio(ctx, istioVersion, gatewayclasses.Items, &infraConfig); err != nil {
log.Error(err, "failed to ensure Istio")
errs = append(errs, err)
}
Expand Down
Loading