Skip to content
Open
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
4 changes: 2 additions & 2 deletions pkg/controller/apiserver/apiserver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func (r *ReconcileAPIServer) Reconcile(ctx context.Context, request reconcile.Re
}

// Query for the installation object.
_, installationSpec, err := utils.GetInstallation(context.Background(), r.client)
variant, installationSpec, err := utils.GetInstallation(context.Background(), r.client)
if err != nil {
if errors.IsNotFound(err) {
r.status.SetDegraded(operatorv1.ResourceNotFound, "Installation not found", err, reqLogger)
Expand Down Expand Up @@ -443,7 +443,7 @@ func (r *ReconcileAPIServer) Reconcile(ctx context.Context, request reconcile.Re
}

// Create a component handler to manage the rendered component.
handler := utils.NewComponentHandler(log, r.client, r.scheme, instance)
handler := utils.NewComponentHandler(log, r.client, r.scheme, instance, &variant)

// Render the desired objects from the CRD and create or update them.
reqLogger.V(3).Info("rendering components")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func (r *ReconcileApplicationLayer) Reconcile(ctx context.Context, request recon
}
component := applicationlayer.ApplicationLayer(config)

ch := utils.NewComponentHandler(log, r.client, r.scheme, instance)
ch := utils.NewComponentHandler(log, r.client, r.scheme, instance, &variant)

if err = imageset.ApplyImageSet(ctx, r.client, variant, component); err != nil {
r.status.SetDegraded(operatorv1.ResourceUpdateError, "Error with images from ImageSet", err, reqLogger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ func (r *ReconcileAuthentication) Reconcile(ctx context.Context, request reconci
dexCfg := render.NewDexConfig(install.CertificateManagement, authentication, idpSecret, secretProviderClass, r.clusterDomain)

// Create a component handler to manage the rendered component.
hlr := utils.NewComponentHandler(log, r.client, r.scheme, authentication)
hlr := utils.NewComponentHandler(log, r.client, r.scheme, authentication, &variant)

dexComponentCfg := &render.DexComponentConfiguration{
PullSecrets: pullSecrets,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func (r *ReconcileConnection) Reconcile(ctx context.Context, request reconcile.R

}

ch := utils.NewComponentHandler(log, r.cli, r.scheme, managementClusterConnection)
ch := utils.NewComponentHandler(log, r.cli, r.scheme, managementClusterConnection, &variant)
guardianCfg := &render.GuardianConfiguration{
URL: managementClusterConnection.Spec.ManagementClusterAddr,
PodProxies: r.resolvedPodProxies,
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/compliance/compliance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ func (r *ReconcileCompliance) Reconcile(ctx context.Context, request reconcile.R
}

// Create a component handler to manage the rendered component.
handler := utils.NewComponentHandler(log, r.client, r.scheme, instance)
handler := utils.NewComponentHandler(log, r.client, r.scheme, instance, &variant)

keyValidatorConfig, err := utils.GetKeyValidatorConfig(ctx, r.client, authenticationCR, r.clusterDomain)
if err != nil {
Expand Down Expand Up @@ -498,7 +498,7 @@ func (r *ReconcileCompliance) Reconcile(ctx context.Context, request reconcile.R
setupHandler := handler
if tenant.MultiTenant() {
// In standard installs, the Compliance CR owns all the objects. For multi-tenant, pull secrets are owned by the Tenant instance.
setupHandler = utils.NewComponentHandler(log, r.client, r.scheme, tenant)
setupHandler = utils.NewComponentHandler(log, r.client, r.scheme, tenant, &variant)
}
if err := setupHandler.CreateOrUpdateOrDelete(ctx, setUp, r.status); err != nil {
r.status.SetDegraded(operatorv1.ResourceUpdateError, "Error creating / updating resource", err, reqLogger)
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/csr/csr_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (r *reconcileCSR) Reconcile(ctx context.Context, request reconcile.Request)
}
}

componentHandler := utils.NewComponentHandler(log, r.client, r.scheme, instance)
componentHandler := utils.NewComponentHandler(log, r.client, r.scheme, instance, &instance.Spec.Variant)
var passthrough render.Component
if needsCSRRole {
// This controller creates the cluster role for any pod in the cluster that requires certificate management.
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/egressgateway/egressgateway_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (r *ReconcileEgressGateway) Reconcile(ctx context.Context, request reconcil
}

// If there are no Egress Gateway resources, return.
ch := utils.NewComponentHandler(log, r.client, r.scheme, nil)
ch := utils.NewComponentHandler(log, r.client, r.scheme, nil, nil)
if len(egws) == 0 {
var objects []client.Object
if r.provider.IsOpenShift() {
Expand Down Expand Up @@ -395,7 +395,7 @@ func (r *ReconcileEgressGateway) reconcileEgressGateway(ctx context.Context, egw
}

component := egressgateway.EgressGateway(config)
ch := utils.NewComponentHandler(log, r.client, r.scheme, egw)
ch := utils.NewComponentHandler(log, r.client, r.scheme, egw, &variant)

if err = imageset.ApplyImageSet(ctx, r.client, variant, component); err != nil {
reqLogger.Error(err, "Error with images from ImageSet")
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/gatewayapi/gatewayapi_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ type ReconcileGatewayAPI struct {
status status.StatusManager
clusterDomain string
multiTenant bool
newComponentHandler func(log logr.Logger, client client.Client, scheme *runtime.Scheme, cr metav1.Object) utils.ComponentHandler
newComponentHandler func(log logr.Logger, client client.Client, scheme *runtime.Scheme, cr metav1.Object, variant *operatorv1.ProductVariant) utils.ComponentHandler
watchEnvoyProxy func(namespacedName operatorv1.NamespacedName) error
watchEnvoyGateway func(namespacedName operatorv1.NamespacedName) error
}
Expand Down Expand Up @@ -214,7 +214,7 @@ func (r *ReconcileGatewayAPI) Reconcile(ctx context.Context, request reconcile.R
// would ideally install, to provide more options to our users; but this controller will
// only warn if any of those cannot be installed (and do not already exist).
essentialCRDs, optionalCRDs := gatewayapi.GatewayAPICRDs(installation.KubernetesProvider)
handler := r.newComponentHandler(log, r.client, r.scheme, nil)
handler := r.newComponentHandler(log, r.client, r.scheme, nil, &variant)
if gatewayAPI.Spec.CRDManagement == nil || *gatewayAPI.Spec.CRDManagement == operatorv1.CRDManagementPreferExisting {
handler.SetCreateOnly()
}
Expand Down Expand Up @@ -416,7 +416,7 @@ func (r *ReconcileGatewayAPI) Reconcile(ctx context.Context, request reconcile.R
return reconcile.Result{}, err
}

err = r.newComponentHandler(log, r.client, r.scheme, gatewayAPI).CreateOrUpdateOrDelete(ctx, nonCRDComponent, r.status)
err = r.newComponentHandler(log, r.client, r.scheme, gatewayAPI, &variant).CreateOrUpdateOrDelete(ctx, nonCRDComponent, r.status)
if err != nil {
r.status.SetDegraded(operatorv1.ResourceCreateError, "Error rendering GatewayAPI resources", err, log)
return reconcile.Result{}, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/gatewayapi/gatewayapi_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ var _ = Describe("Gateway API controller tests", func() {

var fakeComponentHandlers []*fakeComponentHandler

func FakeComponentHandler(log logr.Logger, client client.Client, scheme *runtime.Scheme, cr metav1.Object) utils.ComponentHandler {
func FakeComponentHandler(log logr.Logger, client client.Client, scheme *runtime.Scheme, cr metav1.Object, _ *operatorv1.ProductVariant) utils.ComponentHandler {
h := &fakeComponentHandler{
client: client,
scheme: scheme,
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/goldmane/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (
return reconcile.Result{}, err
}

ch := utils.NewComponentHandler(log, r.cli, r.scheme, goldmaneCR)
ch := utils.NewComponentHandler(log, r.cli, r.scheme, goldmaneCR, &variant)
cfg := &goldmane.Configuration{
PullSecrets: pullSecrets,
OpenShift: r.provider.IsOpenShift(),
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/installation/core_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ type ReconcileInstallation struct {
manageCRDs bool
tierWatchReady *utils.ReadyFlag
// newComponentHandler returns a new component handler. Useful stub for unit testing.
newComponentHandler func(log logr.Logger, client client.Client, scheme *runtime.Scheme, cr metav1.Object) utils.ComponentHandler
newComponentHandler func(log logr.Logger, client client.Client, scheme *runtime.Scheme, cr metav1.Object, variant *operatorv1.ProductVariant) utils.ComponentHandler
}

// getActivePools returns the full set of enabled IP pools in the cluster.
Expand Down Expand Up @@ -1235,7 +1235,7 @@ func (r *ReconcileInstallation) Reconcile(ctx context.Context, request reconcile
}

// Create a component handler to create or update the rendered components.
handler := r.newComponentHandler(log, r.client, r.scheme, instance)
handler := r.newComponentHandler(log, r.client, r.scheme, instance, &instance.Spec.Variant)

// Render namespaces first - this ensures that any other controllers blocked on namespace existence can proceed.
namespaceCfg := &render.NamespaceConfiguration{
Expand Down Expand Up @@ -2109,7 +2109,7 @@ func (r *ReconcileInstallation) updateCRDs(ctx context.Context, variant operator
crdComponent := render.NewPassthrough(crds.ToRuntimeObjects(crds.GetCRDs(variant)...)...)
// Specify nil for the CR so no ownership is put on the CRDs. We do this so removing the
// Installation CR will not remove the CRDs.
handler := r.newComponentHandler(log, r.client, r.scheme, nil)
handler := r.newComponentHandler(log, r.client, r.scheme, nil, &variant)
if err := handler.CreateOrUpdateOrDelete(ctx, crdComponent, nil); err != nil {
r.status.SetDegraded(operatorv1.ResourceUpdateError, "Error creating / updating CRD resource", err, log)
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/installation/core_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2299,7 +2299,7 @@ var _ = Describe("Testing core-controller installation", func() {
enterpriseCRDsExist: true,
migrationChecked: true,
tierWatchReady: ready,
newComponentHandler: func(logr.Logger, client.Client, *runtime.Scheme, metav1.Object) utils.ComponentHandler {
newComponentHandler: func(logr.Logger, client.Client, *runtime.Scheme, metav1.Object, *operator.ProductVariant) utils.ComponentHandler {
return componentHandler
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/installation/windows_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ func (r *ReconcileWindows) Reconcile(ctx context.Context, request reconcile.Requ
}

// Create a component handler to create or update the rendered components.
handler := utils.NewComponentHandler(logw, r.client, r.scheme, instance)
handler := utils.NewComponentHandler(logw, r.client, r.scheme, instance, &instance.Spec.Variant)
if err := handler.CreateOrUpdateOrDelete(ctx, component, nil); err != nil {
r.status.SetDegraded(operatorv1.ResourceUpdateError, "Error creating / updating resource", err, reqLogger)
return reconcile.Result{}, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func (r *ReconcileIntrusionDetection) Reconcile(ctx context.Context, request rec
}

// Create a component handler to manage the rendered component.
handler := utils.NewComponentHandler(log, r.client, r.scheme, instance)
handler := utils.NewComponentHandler(log, r.client, r.scheme, instance, &variant)

// Determine the namespaces to which we must bind the cluster role.
namespaces, err := helper.TenantNamespaces(r.client)
Expand Down Expand Up @@ -567,7 +567,7 @@ func (r *ReconcileIntrusionDetection) Reconcile(ctx context.Context, request rec
setupHandler := handler
if tenant.MultiTenant() {
// In standard installs, the IntrusionDetection CR owns all the objects. For multi-tenant, pull secrets are owned by the Tenant instance.
setupHandler = utils.NewComponentHandler(log, r.client, r.scheme, tenant)
setupHandler = utils.NewComponentHandler(log, r.client, r.scheme, tenant, &variant)
}
if err := setupHandler.CreateOrUpdateOrDelete(ctx, setUp, r.status); err != nil {
r.status.SetDegraded(operatorv1.ResourceUpdateError, "Error creating / updating resource", err, reqLogger)
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/ippool/pool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (
// will remain even though all other Calico resources will be deleted. This is intentional - deleting IP pools requires the Calico API server to be
// running, and we don't want to block the deletion of the Installation on the API server being available, as it introduces too many ways for
// things to go wrong upon deleting the Installation API. Users can manually delete the IP pools if they are no longer needed.
handler := utils.NewComponentHandler(log, r.client, r.scheme, nil)
handler := utils.NewComponentHandler(log, r.client, r.scheme, nil, &installation.Spec.Variant)

passThru := render.NewPassthroughWithLog(log, toCreateOrUpdate...)
if err := handler.CreateOrUpdateOrDelete(ctx, passThru, nil); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/ippool/pool_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ var _ = Describe("IP Pool controller tests", func() {
}
for _, pool := range instance.Spec.CalicoNetwork.IPPools {
Expect(poolsByCIDR).To(HaveKey(pool.CIDR))
Expect(poolsByCIDR[pool.CIDR].Labels).To(Equal(map[string]string{"app.kubernetes.io/managed-by": "tigera-operator"}))
Expect(poolsByCIDR[pool.CIDR].Labels).To(HaveKeyWithValue("app.kubernetes.io/managed-by", "tigera-operator"))
}
})

Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/istio/istio_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (r *ReconcileIstio) Reconcile(ctx context.Context, request reconcile.Reques
essentialCRDs, optionalCRDs := gatewayapi.K8SGatewayAPICRDs(installation.KubernetesProvider)

// Check CRDs are present and only create it if not
handler := utils.NewComponentHandler(log, r, r.scheme, nil)
handler := utils.NewComponentHandler(log, r, r.scheme, nil, nil)
handler.SetCreateOnly()
err = handler.CreateOrUpdateOrDelete(ctx, render.NewPassthrough(essentialCRDs...), nil)
if err != nil && !errors.IsAlreadyExists(err) {
Expand Down Expand Up @@ -232,7 +232,7 @@ func (r *ReconcileIstio) Reconcile(ctx context.Context, request reconcile.Reques
}

// Deploy Istio components, passing the Istio CR for the owner this time.
err = utils.NewComponentHandler(log, r, r.scheme, instance).CreateOrUpdateOrDelete(ctx, istioComponent, r.status)
err = utils.NewComponentHandler(log, r, r.scheme, instance, &variant).CreateOrUpdateOrDelete(ctx, istioComponent, r.status)
if err != nil {
r.status.SetDegraded(operatorv1.ResourceCreateError, "Error rendering Calico Istio resources", err, log)
return reconcile.Result{}, err
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/logcollector/logcollector_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ func (r *ReconcileLogCollector) Reconcile(ctx context.Context, request reconcile
}

// Create a component handler to manage the rendered component.
handler := utils.NewComponentHandler(log, r.client, r.scheme, instance)
handler := utils.NewComponentHandler(log, r.client, r.scheme, instance, &variant)

fluentdCfg := &render.FluentdConfiguration{
LogCollector: instance,
Expand Down Expand Up @@ -683,7 +683,7 @@ func (r *ReconcileLogCollector) Reconcile(ctx context.Context, request reconcile
}

// Create a component handler to manage the rendered component.
handler = utils.NewComponentHandler(log, r.client, r.scheme, instance)
handler = utils.NewComponentHandler(log, r.client, r.scheme, instance, &variant)

if err := handler.CreateOrUpdateOrDelete(ctx, comp, r.status); err != nil {
r.status.SetDegraded(operatorv1.ResourceUpdateError, "Error creating / updating resource", err, reqLogger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ func (d DashboardsSubController) Reconcile(ctx context.Context, request reconcil
// In standard installs, the LogStorage owns the dashboards. For multi-tenant, it's owned by the Tenant instance.
var hdler utils.ComponentHandler
if d.multiTenant {
hdler = utils.NewComponentHandler(reqLogger, d.client, d.scheme, tenant)
hdler = utils.NewComponentHandler(reqLogger, d.client, d.scheme, tenant, &variant)
} else {
hdler = utils.NewComponentHandler(reqLogger, d.client, d.scheme, logStorage)
hdler = utils.NewComponentHandler(reqLogger, d.client, d.scheme, logStorage, &variant)
}
if err := hdler.CreateOrUpdateOrDelete(ctx, dashboardsComponent, d.status); err != nil {
d.status.SetDegraded(operatorv1.ResourceUpdateError, "Error creating / updating / deleting resource", err, reqLogger)
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/logstorage/elastic/elastic_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ func (r *ElasticSubController) Reconcile(ctx context.Context, request reconcile.
return reconcile.Result{}, err
}

hdler := utils.NewComponentHandler(reqLogger, r.client, r.scheme, ls)
hdler := utils.NewComponentHandler(reqLogger, r.client, r.scheme, ls, &variant)

components := []render.Component{
eck.ECK(&eck.Configuration{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (r *ExternalESController) Reconcile(ctx context.Context, request reconcile.
}
r.status.OnCRFound()

_, install, err := utils.GetInstallation(context.Background(), r.client)
variant, install, err := utils.GetInstallation(context.Background(), r.client)
if err != nil {
if errors.IsNotFound(err) {
r.status.SetDegraded(operatorv1.ResourceNotFound, "Installation not found", err, reqLogger)
Expand Down Expand Up @@ -156,7 +156,7 @@ func (r *ExternalESController) Reconcile(ctx context.Context, request reconcile.
flowShards := logstoragecommon.CalculateFlowShards(ls.Spec.Nodes, logstoragecommon.DefaultElasticsearchShards)
clusterConfig := relasticsearch.NewClusterConfig(render.DefaultElasticsearchClusterName, ls.Replicas(), logstoragecommon.DefaultElasticsearchShards, flowShards)

hdler := utils.NewComponentHandler(reqLogger, r.client, r.scheme, ls)
hdler := utils.NewComponentHandler(reqLogger, r.client, r.scheme, ls, &variant)
externalElasticsearch := externalelasticsearch.ExternalElasticsearch(install, clusterConfig, pullSecrets, r.multiTenant)
for _, component := range []render.Component{externalElasticsearch} {
if err := hdler.CreateOrUpdateOrDelete(ctx, component, r.status); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func (r *ESMetricsSubController) Reconcile(ctx context.Context, request reconcil
return reconcile.Result{}, err
}

hdler := utils.NewComponentHandler(reqLogger, r.client, r.scheme, logStorage)
hdler := utils.NewComponentHandler(reqLogger, r.client, r.scheme, logStorage, &variant)

if err = hdler.CreateOrUpdateOrDelete(ctx, esMetricsComponent, r.status); err != nil {
r.status.SetDegraded(operatorv1.ResourceUpdateError, "Error creating / updating resource", err, reqLogger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func (r *LogStorageInitializer) Reconcile(ctx context.Context, request reconcile
r.status.OnCRFound()

// Get Installation resource.
_, install, err := utils.GetInstallation(context.Background(), r.client)
variant, install, err := utils.GetInstallation(context.Background(), r.client)
if err != nil {
if errors.IsNotFound(err) {
r.status.SetDegraded(operatorv1.ResourceNotFound, "Installation not found", err, reqLogger)
Expand Down Expand Up @@ -247,7 +247,7 @@ func (r *LogStorageInitializer) Reconcile(ctx context.Context, request reconcile
}

// Before we can create secrets, we need to ensure the tigera-elasticsearch namespace exists.
hdler := utils.NewComponentHandler(reqLogger, r.client, r.scheme, ls)
hdler := utils.NewComponentHandler(reqLogger, r.client, r.scheme, ls, &variant)
components := []render.Component{render.NewSetup(&render.SetUpConfiguration{
OpenShift: r.provider.IsOpenShift(),
Installation: install,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func (r *ESKubeControllersController) Reconcile(ctx context.Context, request rec
return reconcile.Result{}, err
}

hdler := utils.NewComponentHandler(reqLogger, r.client, r.scheme, logStorage)
hdler := utils.NewComponentHandler(reqLogger, r.client, r.scheme, logStorage, &variant)

// Get the Authentication resource.
authentication, err := utils.GetAuthentication(ctx, r.client)
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/logstorage/linseed/linseed_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,9 @@ func (r *LinseedSubController) Reconcile(ctx context.Context, request reconcile.
// In standard installs, the LogStorage owns Linseed. For multi-tenant, it's owned by the Tenant instance.
var hdler utils.ComponentHandler
if r.multiTenant {
hdler = utils.NewComponentHandler(reqLogger, r.client, r.scheme, tenant)
hdler = utils.NewComponentHandler(reqLogger, r.client, r.scheme, tenant, &variant)
} else {
hdler = utils.NewComponentHandler(reqLogger, r.client, r.scheme, logStorage)
hdler = utils.NewComponentHandler(reqLogger, r.client, r.scheme, logStorage, &variant)
}
for _, component := range []render.Component{setup, linseedComponent} {
if err := hdler.CreateOrUpdateOrDelete(ctx, component, r.status); err != nil {
Expand Down
Loading
Loading