Skip to content

Commit f554db9

Browse files
Rename GetInstallation/GetNetworkingPullSecrets and standardize variable names (tigera#4616)
These function names and variable names are leftovers from when the Installation resource was called "Network". Rename the functions to GetInstallationSpec and GetInstallationPullSecrets to match what they actually return, and standardize all callers to use `installationSpec` as the variable name instead of the inconsistent mix of `network`, `install`, `instl`, `instance`, and `installation` that existed before. Also fix a couple of stale "network" references in log messages and comments in the gatewayapi and monitor controllers.
1 parent 9647ed2 commit f554db9

31 files changed

Lines changed: 134 additions & 134 deletions

pkg/controller/apiserver/apiserver_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ func (r *ReconcileAPIServer) Reconcile(ctx context.Context, request reconcile.Re
284284
}
285285

286286
// Query for the installation object.
287-
_, installationSpec, err := utils.GetInstallation(context.Background(), r.client)
287+
_, installationSpec, err := utils.GetInstallationSpec(context.Background(), r.client)
288288
if err != nil {
289289
if errors.IsNotFound(err) {
290290
r.status.SetDegraded(operatorv1.ResourceNotFound, "Installation not found", err, reqLogger)
@@ -323,7 +323,7 @@ func (r *ReconcileAPIServer) Reconcile(ctx context.Context, request reconcile.Re
323323

324324
certificateManager.AddToStatusManager(r.status, render.APIServerNamespace)
325325

326-
pullSecrets, err := utils.GetNetworkingPullSecrets(installationSpec, r.client)
326+
pullSecrets, err := utils.GetInstallationPullSecrets(installationSpec, r.client)
327327
if err != nil {
328328
r.status.SetDegraded(operatorv1.ResourceReadError, "Error retrieving pull secrets", err, reqLogger)
329329
return reconcile.Result{}, err

pkg/controller/applicationlayer/applicationlayer_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func (r *ReconcileApplicationLayer) Reconcile(ctx context.Context, request recon
219219
return reconcile.Result{}, err
220220
}
221221

222-
variant, installation, err := utils.GetInstallation(ctx, r.client)
222+
variant, installationSpec, err := utils.GetInstallationSpec(ctx, r.client)
223223
if err != nil {
224224
if apierrors.IsNotFound(err) {
225225
r.status.SetDegraded(operatorv1.ResourceNotFound, "Installation not found", err, reqLogger)
@@ -234,7 +234,7 @@ func (r *ReconcileApplicationLayer) Reconcile(ctx context.Context, request recon
234234
return reconcile.Result{}, nil
235235
}
236236

237-
pullSecrets, err := utils.GetNetworkingPullSecrets(installation, r.client)
237+
pullSecrets, err := utils.GetInstallationPullSecrets(installationSpec, r.client)
238238
if err != nil {
239239
r.status.SetDegraded(operatorv1.ResourceReadError, "Error retrieving pull secrets", err, reqLogger)
240240
return reconcile.Result{}, err
@@ -267,7 +267,7 @@ func (r *ReconcileApplicationLayer) Reconcile(ctx context.Context, request recon
267267
lcSpec := instance.Spec.LogCollection
268268
config := &applicationlayer.Config{
269269
PullSecrets: pullSecrets,
270-
Installation: installation,
270+
Installation: installationSpec,
271271
OsType: rmeta.OSTypeLinux,
272272
PerHostWAFEnabled: r.isWAFEnabled(&instance.Spec),
273273
PerHostLogsEnabled: r.isLogsCollectionEnabled(&instance.Spec),

pkg/controller/authentication/authentication_controller.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func (r *ReconcileAuthentication) Reconcile(ctx context.Context, request reconci
230230
}
231231

232232
// Query for the installation object.
233-
variant, install, err := utils.GetInstallation(context.Background(), r.client)
233+
variant, installationSpec, err := utils.GetInstallationSpec(context.Background(), r.client)
234234
if err != nil {
235235
if errors.IsNotFound(err) {
236236
r.status.SetDegraded(oprv1.ResourceNotFound, "Installation not found", err, reqLogger)
@@ -273,7 +273,7 @@ func (r *ReconcileAuthentication) Reconcile(ctx context.Context, request reconci
273273
}
274274

275275
// Secret used for TLS between dex and other components.
276-
certificateManager, err := certificatemanager.Create(r.client, install, r.clusterDomain, common.OperatorNamespace())
276+
certificateManager, err := certificatemanager.Create(r.client, installationSpec, r.clusterDomain, common.OperatorNamespace())
277277
if err != nil {
278278
r.status.SetDegraded(oprv1.ResourceCreateError, "Unable to create the Tigera CA", err, reqLogger)
279279
return reconcile.Result{}, err
@@ -299,7 +299,7 @@ func (r *ReconcileAuthentication) Reconcile(ctx context.Context, request reconci
299299
return reconcile.Result{}, err
300300
}
301301

302-
pullSecrets, err := utils.GetNetworkingPullSecrets(install, r.client)
302+
pullSecrets, err := utils.GetInstallationPullSecrets(installationSpec, r.client)
303303
if err != nil {
304304
r.status.SetDegraded(oprv1.ResourceReadError, "Error retrieving pull secrets", err, reqLogger)
305305
return reconcile.Result{}, err
@@ -380,15 +380,15 @@ func (r *ReconcileAuthentication) Reconcile(ctx context.Context, request reconci
380380
enableDex := utils.DexEnabled(authentication)
381381

382382
// DexConfig adds convenience methods around dex related objects in k8s and can be used to configure Dex.
383-
dexCfg := render.NewDexConfig(install.CertificateManagement, authentication, idpSecret, secretProviderClass, r.clusterDomain)
383+
dexCfg := render.NewDexConfig(installationSpec.CertificateManagement, authentication, idpSecret, secretProviderClass, r.clusterDomain)
384384

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

388388
dexComponentCfg := &render.DexComponentConfiguration{
389389
PullSecrets: pullSecrets,
390390
OpenShift: r.provider.IsOpenShift(),
391-
Installation: install,
391+
Installation: installationSpec,
392392
DexConfig: dexCfg,
393393
ClusterDomain: r.clusterDomain,
394394
DeleteDex: !enableDex,

pkg/controller/clusterconnection/clusterconnection_controller.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func (r *ReconcileConnection) Reconcile(ctx context.Context, request reconcile.R
206206
reqLogger.V(2).Info("Reconciling the management cluster connection")
207207
result := reconcile.Result{}
208208

209-
variant, instl, err := utils.GetInstallation(ctx, r.cli)
209+
variant, installationSpec, err := utils.GetInstallationSpec(ctx, r.cli)
210210
if err != nil {
211211
return result, err
212212
}
@@ -265,13 +265,13 @@ func (r *ReconcileConnection) Reconcile(ctx context.Context, request reconcile.R
265265
return reconcile.Result{RequeueAfter: utils.StandardRetry}, nil
266266
}
267267

268-
if err = validate(managementClusterConnection, instl.Variant); err != nil {
268+
if err = validate(managementClusterConnection, installationSpec.Variant); err != nil {
269269
r.status.SetDegraded(operatorv1.ResourceValidationError, "ManagementClusterConnection.Spec.Impersonation must be unset when Installation.Spec.Variant = Calico", err, reqLogger)
270270
return reconcile.Result{}, err
271271
}
272272

273273
preDefaultPatchFrom := client.MergeFrom(managementClusterConnection.DeepCopy())
274-
fillDefaults(managementClusterConnection, instl.Variant)
274+
fillDefaults(managementClusterConnection, installationSpec.Variant)
275275
if err = r.cli.Patch(ctx, managementClusterConnection, preDefaultPatchFrom); err != nil {
276276
r.status.SetDegraded(operatorv1.ResourceUpdateError, err.Error(), err, reqLogger)
277277
}
@@ -283,7 +283,7 @@ func (r *ReconcileConnection) Reconcile(ctx context.Context, request reconcile.R
283283

284284
log.V(2).Info("Loaded ManagementClusterConnection config", "config", managementClusterConnection)
285285

286-
certificateManager, err := certificatemanager.Create(r.cli, instl, r.clusterDomain, common.OperatorNamespace(), certificatemanager.WithLogger(reqLogger))
286+
certificateManager, err := certificatemanager.Create(r.cli, installationSpec, r.clusterDomain, common.OperatorNamespace(), certificatemanager.WithLogger(reqLogger))
287287
if err != nil {
288288
r.status.SetDegraded(operatorv1.ResourceCreateError, "Unable to create the Tigera CA", err, reqLogger)
289289
return reconcile.Result{}, err
@@ -317,7 +317,7 @@ func (r *ReconcileConnection) Reconcile(ctx context.Context, request reconcile.R
317317
trustedBundle.AddCertificates(guardianKeyPair)
318318
}
319319

320-
pullSecrets, err := utils.GetNetworkingPullSecrets(instl, r.cli)
320+
pullSecrets, err := utils.GetInstallationPullSecrets(installationSpec, r.cli)
321321
if err != nil {
322322
r.status.SetDegraded(operatorv1.ResourceReadError, "Error retrieving pull secrets", err, reqLogger)
323323
return result, err
@@ -450,7 +450,7 @@ func (r *ReconcileConnection) Reconcile(ctx context.Context, request reconcile.R
450450
TunnelCAType: managementClusterConnection.Spec.TLS.CA,
451451
PullSecrets: pullSecrets,
452452
OpenShift: r.provider.IsOpenShift(),
453-
Installation: instl,
453+
Installation: installationSpec,
454454
TunnelSecret: tunnelSecret,
455455
TrustedCertBundle: trustedBundle,
456456
ManagementClusterConnection: managementClusterConnection,

pkg/controller/compliance/compliance_controller.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ func (r *ReconcileCompliance) Reconcile(ctx context.Context, request reconcile.R
284284
}
285285

286286
// Query for the installation object.
287-
variant, network, err := utils.GetInstallation(ctx, r.client)
287+
variant, installationSpec, err := utils.GetInstallationSpec(ctx, r.client)
288288
if err != nil {
289289
if errors.IsNotFound(err) {
290290
r.status.SetDegraded(operatorv1.ResourceNotFound, "Installation not found", err, reqLogger)
@@ -294,7 +294,7 @@ func (r *ReconcileCompliance) Reconcile(ctx context.Context, request reconcile.R
294294
return reconcile.Result{}, err
295295
}
296296

297-
pullSecrets, err := utils.GetNetworkingPullSecrets(network, r.client)
297+
pullSecrets, err := utils.GetInstallationPullSecrets(installationSpec, r.client)
298298
if err != nil {
299299
r.status.SetDegraded(operatorv1.ResourceReadError, "Failed to retrieve pull secrets", err, reqLogger)
300300
return reconcile.Result{}, err
@@ -322,7 +322,7 @@ func (r *ReconcileCompliance) Reconcile(ctx context.Context, request reconcile.R
322322

323323
opts = append(opts, certificatemanager.WithTenant(tenant), certificatemanager.WithLogger(reqLogger))
324324

325-
certificateManager, err := certificatemanager.Create(r.client, network, r.opts.ClusterDomain, helper.TruthNamespace(), opts...)
325+
certificateManager, err := certificatemanager.Create(r.client, installationSpec, r.opts.ClusterDomain, helper.TruthNamespace(), opts...)
326326
if err != nil {
327327
r.status.SetDegraded(operatorv1.ResourceCreateError, "Unable to create the Tigera CA", err, reqLogger)
328328
return reconcile.Result{}, err
@@ -433,7 +433,7 @@ func (r *ReconcileCompliance) Reconcile(ctx context.Context, request reconcile.R
433433

434434
setUp := render.NewSetup(&render.SetUpConfiguration{
435435
OpenShift: r.opts.DetectedProvider.IsOpenShift(),
436-
Installation: network,
436+
Installation: installationSpec,
437437
PullSecrets: pullSecrets,
438438
Namespace: helper.InstallNamespace(),
439439
PSS: render.PSSPrivileged,
@@ -444,7 +444,7 @@ func (r *ReconcileCompliance) Reconcile(ctx context.Context, request reconcile.R
444444
openshift := r.opts.DetectedProvider.IsOpenShift()
445445
complianceCfg := &render.ComplianceConfiguration{
446446
TrustedBundle: trustedBundle,
447-
Installation: network,
447+
Installation: installationSpec,
448448
ServerKeyPair: complianceServerKeyPair,
449449
ControllerKeyPair: controllerKeyPair.Interface,
450450
BenchmarkerKeyPair: benchmarkerKeyPair.Interface,

pkg/controller/egressgateway/egressgateway_controller.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ func (r *ReconcileEgressGateway) Reconcile(ctx context.Context, request reconcil
241241
return reconcile.Result{RequeueAfter: utils.StandardRetry}, nil
242242
}
243243

244-
variant, installation, err := utils.GetInstallation(ctx, r.client)
244+
variant, installationSpec, err := utils.GetInstallationSpec(ctx, r.client)
245245
if err != nil {
246246
if errors.IsNotFound(err) {
247247
reqLogger.Error(err, "Installation not found")
@@ -285,7 +285,7 @@ func (r *ReconcileEgressGateway) Reconcile(ctx context.Context, request reconcil
285285
return reconcile.Result{RequeueAfter: utils.StandardRetry}, nil
286286
}
287287

288-
pullSecrets, err := utils.GetNetworkingPullSecrets(installation, r.client)
288+
pullSecrets, err := utils.GetInstallationPullSecrets(installationSpec, r.client)
289289
if err != nil {
290290
reqLogger.Error(err, "Error retrieving pull secrets")
291291
r.status.SetDegraded(operatorv1.ResourceReadError, "Error retrieving pull secrets", err, reqLogger)
@@ -315,7 +315,7 @@ func (r *ReconcileEgressGateway) Reconcile(ctx context.Context, request reconcil
315315
// Reconcile all the EGWs
316316
var errMsgs []string
317317
for _, egw := range egwsToReconcile {
318-
err = r.reconcileEgressGateway(ctx, &egw, reqLogger, variant, fc, pullSecrets, installation, namespaceAndNames)
318+
err = r.reconcileEgressGateway(ctx, &egw, reqLogger, variant, fc, pullSecrets, installationSpec, namespaceAndNames)
319319
if err != nil {
320320
reqLogger.Error(err, "Error reconciling egress gateway")
321321
errMsgs = append(errMsgs, err.Error())
@@ -342,11 +342,11 @@ func (r *ReconcileEgressGateway) Reconcile(ctx context.Context, request reconcil
342342

343343
func (r *ReconcileEgressGateway) reconcileEgressGateway(ctx context.Context, egw *operatorv1.EgressGateway, reqLogger logr.Logger,
344344
variant operatorv1.ProductVariant, fc *v3.FelixConfiguration, pullSecrets []*v1.Secret,
345-
installation *operatorv1.InstallationSpec, namespaceAndNames []string,
345+
installationSpec *operatorv1.InstallationSpec, namespaceAndNames []string,
346346
) error {
347347
preDefaultPatchFrom := client.MergeFrom(egw.DeepCopy())
348348
// update the EGW resource with default values.
349-
fillDefaults(egw, installation)
349+
fillDefaults(egw, installationSpec)
350350
// Validate the EGW resource.
351351
err := validateEgressGateway(ctx, r.client, egw)
352352
if err != nil {
@@ -384,7 +384,7 @@ func (r *ReconcileEgressGateway) reconcileEgressGateway(ctx context.Context, egw
384384

385385
config := &egressgateway.Config{
386386
PullSecrets: pullSecrets,
387-
Installation: installation,
387+
Installation: installationSpec,
388388
OSType: rmeta.OSTypeLinux,
389389
EgressGW: egw,
390390
VXLANPort: egwVXLANPort,
@@ -511,7 +511,7 @@ func getOpenShiftSCC(ctx context.Context, cli client.Client) (*ocsv1.SecurityCon
511511
}
512512

513513
// fillDefaults sets the default values of the EGW resource.
514-
func fillDefaults(egw *operatorv1.EgressGateway, installation *operatorv1.InstallationSpec) {
514+
func fillDefaults(egw *operatorv1.EgressGateway, installationSpec *operatorv1.InstallationSpec) {
515515
defaultAWSNativeIP := operatorv1.NativeIPDisabled
516516

517517
// Default value of Native IP is Disabled.
@@ -550,7 +550,7 @@ func fillDefaults(egw *operatorv1.EgressGateway, installation *operatorv1.Instal
550550
},
551551
},
552552
}
553-
switch installation.KubernetesProvider {
553+
switch installationSpec.KubernetesProvider {
554554
case operatorv1.ProviderAKS:
555555
defAffinity.NodeAffinity = &v1.NodeAffinity{
556556
RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{

pkg/controller/gatewayapi/gatewayapi_controller.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ func Add(mgr manager.Manager, opts options.ControllerOptions) error {
8585
}
8686

8787
if err = utils.AddInstallationWatch(c); err != nil {
88-
log.V(5).Info("Failed to create network watch", "err", err)
89-
return fmt.Errorf("gatewayapi-controller failed to watch Tigera network resource: %w", err)
88+
log.V(5).Info("Failed to create Installation watch", "err", err)
89+
return fmt.Errorf("gatewayapi-controller failed to watch Installation resource: %w", err)
9090
}
9191

9292
// Perform periodic reconciliation. This acts as a backstop to catch reconcile issues,
@@ -182,7 +182,7 @@ func (r *ReconcileGatewayAPI) Reconcile(ctx context.Context, request reconcile.R
182182
defer r.status.SetMetaData(&gatewayAPI.ObjectMeta)
183183

184184
// Get the Installation, for private registry and pull secret config.
185-
variant, installation, err := utils.GetInstallation(ctx, r.client)
185+
variant, installationSpec, err := utils.GetInstallationSpec(ctx, r.client)
186186
if err != nil {
187187
if errors.IsNotFound(err) {
188188
r.status.SetDegraded(operatorv1.ResourceNotFound, "Installation not found", err, reqLogger)
@@ -213,7 +213,7 @@ func (r *ReconcileGatewayAPI) Reconcile(ctx context.Context, request reconcile.R
213213
// not already exist and cannot be installed. The "optional" set is everything else that we
214214
// would ideally install, to provide more options to our users; but this controller will
215215
// only warn if any of those cannot be installed (and do not already exist).
216-
essentialCRDs, optionalCRDs := gatewayapi.GatewayAPICRDs(installation.KubernetesProvider)
216+
essentialCRDs, optionalCRDs := gatewayapi.GatewayAPICRDs(installationSpec.KubernetesProvider)
217217
handler := r.newComponentHandler(log, r.client, r.scheme, nil)
218218
if gatewayAPI.Spec.CRDManagement == nil || *gatewayAPI.Spec.CRDManagement == operatorv1.CRDManagementPreferExisting {
219219
handler.SetCreateOnly()
@@ -262,7 +262,7 @@ func (r *ReconcileGatewayAPI) Reconcile(ctx context.Context, request reconcile.R
262262
reqLogger.Info("Could not render all optional GatewayAPI CRDs", "err", err)
263263
}
264264

265-
pullSecrets, err := utils.GetNetworkingPullSecrets(installation, r.client)
265+
pullSecrets, err := utils.GetInstallationPullSecrets(installationSpec, r.client)
266266
if err != nil {
267267
r.status.SetDegraded(operatorv1.ResourceReadError, "Error retrieving pull secrets", err, reqLogger)
268268
return reconcile.Result{}, err
@@ -275,7 +275,7 @@ func (r *ReconcileGatewayAPI) Reconcile(ctx context.Context, request reconcile.R
275275
}
276276

277277
gatewayConfig := &gatewayapi.GatewayAPIImplementationConfig{
278-
Installation: installation,
278+
Installation: installationSpec,
279279
PullSecrets: pullSecrets,
280280
GatewayAPI: gatewayAPI,
281281
CustomEnvoyProxies: make(map[string]*envoyapi.EnvoyProxy),

pkg/controller/goldmane/controller.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (
168168
// SetMetaData in the TigeraStatus such as observedGenerations.
169169
defer r.status.SetMetaData(&goldmaneCR.ObjectMeta)
170170

171-
variant, installation, err := utils.GetInstallation(ctx, r.cli)
171+
variant, installationSpec, err := utils.GetInstallationSpec(ctx, r.cli)
172172
if err != nil {
173173
return reconcile.Result{}, err
174-
} else if installation == nil {
174+
} else if installationSpec == nil {
175175
return reconcile.Result{}, nil
176176
}
177177

@@ -181,13 +181,13 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (
181181
return reconcile.Result{}, err
182182
}
183183

184-
pullSecrets, err := utils.GetNetworkingPullSecrets(installation, r.cli)
184+
pullSecrets, err := utils.GetInstallationPullSecrets(installationSpec, r.cli)
185185
if err != nil {
186186
r.status.SetDegraded(operatorv1.ResourceReadError, "Error retrieving pull secrets", err, reqLogger)
187187
return reconcile.Result{}, err
188188
}
189189

190-
certificateManager, err := certificatemanager.Create(r.cli, installation, r.clusterDomain, common.OperatorNamespace())
190+
certificateManager, err := certificatemanager.Create(r.cli, installationSpec, r.clusterDomain, common.OperatorNamespace())
191191
if err != nil {
192192
r.status.SetDegraded(operatorv1.ResourceCreateError, "Unable to create the certificate manager", err, reqLogger)
193193
return reconcile.Result{}, err
@@ -233,7 +233,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (
233233
cfg := &goldmane.Configuration{
234234
PullSecrets: pullSecrets,
235235
OpenShift: r.provider.IsOpenShift(),
236-
Installation: installation,
236+
Installation: installationSpec,
237237
TrustedCertBundle: trustedBundle,
238238
GoldmaneServerKeyPair: keyPair,
239239
ManagementClusterConnection: mgmtClusterConnectionCR,

pkg/controller/installation/core_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ func (r *ReconcileInstallation) Reconcile(ctx context.Context, request reconcile
10181018
}
10191019

10201020
// Query for pull secrets in operator namespace
1021-
pullSecrets, err := utils.GetNetworkingPullSecrets(&instance.Spec, r.client)
1021+
pullSecrets, err := utils.GetInstallationPullSecrets(&instance.Spec, r.client)
10221022
if err != nil {
10231023
r.status.SetDegraded(operatorv1.ResourceReadError, "Error retrieving pull secrets", err, reqLogger)
10241024
return reconcile.Result{}, err

0 commit comments

Comments
 (0)