@@ -275,7 +275,10 @@ func (r *RepoSyncReconciler) upsertManagedObjects(ctx context.Context, reconcile
275
275
return fmt .Errorf ("upserting helm config maps: %w" , err )
276
276
}
277
277
278
- containerEnvs := r .populateContainerEnvs (ctx , rs , reconcilerRef .Name )
278
+ containerEnvs , err := r .populateContainerEnvs (ctx , rs , reconcilerRef .Name )
279
+ if err != nil {
280
+ return fmt .Errorf ("populating container environment variables: %w" , err )
281
+ }
279
282
mut := r .mutationsFor (ctx , rs , containerEnvs )
280
283
281
284
// Upsert Namespace reconciler deployment.
@@ -881,7 +884,7 @@ func (r *RepoSyncReconciler) mapObjectToRepoSync(ctx context.Context, obj client
881
884
return requests
882
885
}
883
886
884
- func (r * RepoSyncReconciler ) populateContainerEnvs (ctx context.Context , rs * v1beta1.RepoSync , reconcilerName string ) map [string ][]corev1.EnvVar {
887
+ func (r * RepoSyncReconciler ) populateContainerEnvs (ctx context.Context , rs * v1beta1.RepoSync , reconcilerName string ) ( map [string ][]corev1.EnvVar , error ) {
885
888
result := map [string ][]corev1.EnvVar {
886
889
reconcilermanager .HydrationController : hydrationEnvs (hydrationOptions {
887
890
sourceType : rs .Spec .SourceType ,
@@ -911,9 +914,12 @@ func (r *RepoSyncReconciler) populateContainerEnvs(ctx context.Context, rs *v1be
911
914
webhookEnabled : r .webhookEnabled ,
912
915
}),
913
916
}
917
+
918
+ var err error
919
+
914
920
switch rs .Spec .SourceType {
915
921
case configsync .GitSource :
916
- result [reconcilermanager .GitSync ] = gitSyncEnvs (ctx , options {
922
+ result [reconcilermanager .GitSync ], err = gitSyncEnvs (ctx , options {
917
923
ref : rs .Spec .Git .Revision ,
918
924
branch : rs .Spec .Git .Branch ,
919
925
repo : rs .Spec .Git .Repo ,
@@ -925,6 +931,9 @@ func (r *RepoSyncReconciler) populateContainerEnvs(ctx context.Context, rs *v1be
925
931
caCertSecretRef : v1beta1 .GetSecretName (rs .Spec .Git .CACertSecretRef ),
926
932
knownHost : r .isKnownHostsEnabled (rs .Spec .Git .Auth ),
927
933
})
934
+ if err != nil {
935
+ return nil , err
936
+ }
928
937
if EnableAskpassSidecar (rs .Spec .SourceType , rs .Spec .Git .Auth ) {
929
938
result [reconcilermanager .GCENodeAskpassSidecar ] = gceNodeAskPassSidecarEnvs (rs .Spec .GCPServiceAccountEmail )
930
939
}
@@ -944,7 +953,7 @@ func (r *RepoSyncReconciler) populateContainerEnvs(ctx context.Context, rs *v1be
944
953
caCertSecretRef : v1beta1 .GetSecretName (rs .Spec .Helm .CACertSecretRef ),
945
954
})
946
955
}
947
- return result
956
+ return result , nil
948
957
}
949
958
950
959
// This check surfaces the RepoSync NN length constraint earlier as a validation error.
0 commit comments