|
1 |
| -// Copyright (c) 2020-2024 Tigera, Inc. All rights reserved. |
| 1 | +// Copyright (c) 2025 Tigera, Inc. All rights reserved. |
2 | 2 |
|
3 | 3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
4 | 4 | // you may not use this file except in compliance with the License.
|
@@ -376,33 +376,30 @@ func (r *ReconcileAPIServer) Reconcile(ctx context.Context, request reconcile.Re
|
376 | 376 | return reconcile.Result{}, err
|
377 | 377 | }
|
378 | 378 |
|
379 |
| - if authenticationCR != nil && authenticationCR.Status.State != operatorv1.TigeraStatusReady { |
380 |
| - r.status.SetDegraded(operatorv1.ResourceNotReady, |
381 |
| - fmt.Sprintf("Authentication is not ready authenticationCR status: %s", authenticationCR.Status.State), |
382 |
| - nil, reqLogger) |
383 |
| - return reconcile.Result{}, nil |
384 |
| - } else if authenticationCR != nil && !utils.IsDexDisabled(authenticationCR) { |
385 |
| - // Do not include DEX TLS Secret Name if authentication CR does not have type Dex |
386 |
| - secret := render.DexTLSSecretName |
387 |
| - certificate, err := certificateManager.GetCertificate(r.client, secret, common.OperatorNamespace()) |
| 379 | + if authenticationCR != nil && authenticationCR.Status.State == operatorv1.TigeraStatusReady { |
| 380 | + if !utils.IsDexDisabled(authenticationCR) { |
| 381 | + // Do not include DEX TLS Secret Name if authentication CR does not have type Dex |
| 382 | + secret := render.DexTLSSecretName |
| 383 | + certificate, err := certificateManager.GetCertificate(r.client, secret, common.OperatorNamespace()) |
| 384 | + if err != nil { |
| 385 | + r.status.SetDegraded(operatorv1.CertificateError, fmt.Sprintf("Failed to retrieve %s", secret), |
| 386 | + err, reqLogger) |
| 387 | + return reconcile.Result{}, err |
| 388 | + } else if certificate == nil { |
| 389 | + reqLogger.Info(fmt.Sprintf("Waiting for secret '%s' to become available", secret)) |
| 390 | + r.status.SetDegraded(operatorv1.ResourceNotReady, |
| 391 | + fmt.Sprintf("Waiting for secret '%s' to become available", secret), |
| 392 | + nil, reqLogger) |
| 393 | + return reconcile.Result{}, nil |
| 394 | + } |
| 395 | + trustedBundle.AddCertificates(certificate) |
| 396 | + } |
| 397 | + |
| 398 | + keyValidatorConfig, err = utils.GetKeyValidatorConfig(ctx, r.client, authenticationCR, r.clusterDomain) |
388 | 399 | if err != nil {
|
389 |
| - r.status.SetDegraded(operatorv1.CertificateError, fmt.Sprintf("Failed to retrieve %s", secret), |
390 |
| - err, reqLogger) |
| 400 | + r.status.SetDegraded(operatorv1.ResourceReadError, "Failed to get KeyValidator Config", err, reqLogger) |
391 | 401 | return reconcile.Result{}, err
|
392 |
| - } else if certificate == nil { |
393 |
| - reqLogger.Info(fmt.Sprintf("Waiting for secret '%s' to become available", secret)) |
394 |
| - r.status.SetDegraded(operatorv1.ResourceNotReady, |
395 |
| - fmt.Sprintf("Waiting for secret '%s' to become available", secret), |
396 |
| - nil, reqLogger) |
397 |
| - return reconcile.Result{}, nil |
398 | 402 | }
|
399 |
| - trustedBundle.AddCertificates(certificate) |
400 |
| - } |
401 |
| - |
402 |
| - keyValidatorConfig, err = utils.GetKeyValidatorConfig(ctx, r.client, authenticationCR, r.clusterDomain) |
403 |
| - if err != nil { |
404 |
| - r.status.SetDegraded(operatorv1.ResourceReadError, "Failed to get KeyValidator Config", err, reqLogger) |
405 |
| - return reconcile.Result{}, err |
406 | 403 | }
|
407 | 404 | }
|
408 | 405 |
|
|
0 commit comments