@@ -55,7 +55,6 @@ import (
5555 "k8s.io/apimachinery/pkg/runtime"
5656 "k8s.io/apimachinery/pkg/types"
5757 "k8s.io/apimachinery/pkg/util/intstr"
58- "k8s.io/apimachinery/pkg/util/rand"
5958 "k8s.io/client-go/kubernetes"
6059 "k8s.io/utils/ptr"
6160 ctrl "sigs.k8s.io/controller-runtime"
@@ -1188,18 +1187,24 @@ func (r *HorizonReconciler) ensureHorizonSecret(
11881187 }
11891188 if k8s_errors .IsNotFound (err ) || ! validateHorizonSecret (scrt ) {
11901189 Log .Info ("Creating Horizon Secret" )
1190+
1191+ secretKey , err := util .GeneratePassword (50 )
1192+ if err != nil {
1193+ return fmt .Errorf ("generating Horizon SECRET_KEY: %w" , err )
1194+ }
1195+
11911196 // Create k8s secret to store Horizon Secret
11921197 tmpl := []util.Template {
11931198 {
11941199 Name : horizon .ServiceName ,
11951200 Namespace : instance .Namespace ,
11961201 Type : util .TemplateTypeNone ,
1197- CustomData : map [string ]string {"horizon-secret" : rand . String ( 10 ) },
1202+ CustomData : map [string ]string {"horizon-secret" : secretKey },
11981203 Labels : Labels ,
11991204 },
12001205 }
12011206
1202- err : = oko_secret .EnsureSecrets (ctx , h , instance , tmpl , envVars )
1207+ err = oko_secret .EnsureSecrets (ctx , h , instance , tmpl , envVars )
12031208 if err != nil {
12041209 return err
12051210 }
0 commit comments