@@ -5,37 +5,26 @@ import (
55
66 "github.com/ViaQ/logerr/v2/kverrors"
77 "github.com/go-logr/logr"
8- apierrors "k8s.io/apimachinery/pkg/api/errors"
98 ctrl "sigs.k8s.io/controller-runtime"
109 "sigs.k8s.io/controller-runtime/pkg/client"
1110
1211 configv1alpha1 "github.com/grafana/tempo-operator/api/config/v1alpha1"
13- v1alpha1 "github.com/grafana/tempo-operator/api/tempo/v1alpha1"
1412 "github.com/grafana/tempo-operator/internal/certrotation"
1513)
1614
1715// CheckCertExpiry handles the case if the TempoStack managed signing CA, client and/or serving
1816// certificates expired. Returns true if any of those expired and an error representing the reason
1917// of expiry.
20- func CheckCertExpiry (ctx context.Context , log logr.Logger , req ctrl.Request , k client.Client , fg configv1alpha1.FeatureGates ) error {
21- ll := log .WithValues ("tempostacks" , req .String (), "event" , "checkCertExpiry" )
22-
23- var stack v1alpha1.TempoStack
24- if err := k .Get (ctx , req .NamespacedName , & stack ); err != nil {
25- if apierrors .IsNotFound (err ) {
26- // maybe the user deleted it before we could react? Either way this isn't an issue
27- ll .Error (err , "could not find the requested tempo tempostacks" , "name" , req .String ())
28- return nil
29- }
30- return kverrors .Wrap (err , "failed to lookup tempostacks" , "name" , req .String ())
31- }
18+ func CheckCertExpiry (controllerName string , ctx context.Context , log logr.Logger , req ctrl.Request , k client.Client ,
19+ fg configv1alpha1.FeatureGates , components map [string ]string ) error {
20+ ll := log .WithValues (controllerName , req .String (), "event" , "checkCertExpiry" )
3221
33- opts , err := GetOptions (ctx , k , req )
22+ opts , err := GetOptions (ctx , k , req , components )
3423 if err != nil {
3524 return kverrors .Wrap (err , "failed to lookup certificates secrets" , "name" , req .String ())
3625 }
3726
38- if optErr := certrotation .ApplyDefaultSettings (& opts , fg .BuiltInCertManagement ); optErr != nil {
27+ if optErr := certrotation .ApplyDefaultSettings (& opts , fg .BuiltInCertManagement , components ); optErr != nil {
3928 ll .Error (optErr , "failed to conform options to build settings" )
4029 return optErr
4130 }
0 commit comments