@@ -37,6 +37,7 @@ import (
3737 "github.com/arangodb/kube-arangodb/pkg/deployment/resources"
3838 "github.com/arangodb/kube-arangodb/pkg/handlers/utils"
3939 "github.com/arangodb/kube-arangodb/pkg/logging"
40+ "github.com/arangodb/kube-arangodb/pkg/util"
4041 "github.com/arangodb/kube-arangodb/pkg/util/arangod"
4142 "github.com/arangodb/kube-arangodb/pkg/util/constants"
4243 "github.com/arangodb/kube-arangodb/pkg/util/errors"
@@ -66,7 +67,7 @@ type ContainerIdentity struct {
6667// ArangoDIdentity helps to resolve the ArangoD identity, e.g.: image ID, version of the entrypoint.
6768type ArangoDIdentity struct {
6869 interfaces.ContainerCreator
69- License api. LicenseSpec
70+ License * string
7071 ipAddress string
7172}
7273
@@ -214,6 +215,16 @@ func (ib *imagesBuilder) fetchArangoDBImageIDAndVersion(ctx context.Context, cac
214215 return false , nil
215216 }
216217
218+ // Find license
219+ var license * string
220+ if s := ib .Spec .License ; s .HasSecretName () {
221+ if secret , ok := cachedStatus .Secret ().V1 ().GetSimple (s .GetSecretName ()); ok {
222+ if _ , ok := secret .Data [constants .SecretKeyToken ]; ok {
223+ license = util .NewString (s .GetSecretName ())
224+ }
225+ }
226+ }
227+
217228 imagePod := ImageUpdatePod {
218229 spec : ib .Spec ,
219230 apiObject : ib .APIObject ,
@@ -223,7 +234,7 @@ func (ib *imagesBuilder) fetchArangoDBImageIDAndVersion(ctx context.Context, cac
223234 image : image ,
224235 imagePullPolicy : ib .Spec .GetImagePullPolicy (),
225236 },
226- License : ib . Spec . License ,
237+ License : license ,
227238 ipAddress : ib .Spec .GetListenAddr (),
228239 },
229240 }
@@ -443,9 +454,10 @@ func (a *ArangoDIdentity) GetArgs() ([]string, error) {
443454func (a * ArangoDIdentity ) GetEnvs () []core.EnvVar {
444455 env := make ([]core.EnvVar , 0 )
445456
446- if a .License .HasSecretName () {
457+ // Add advanced check for license
458+ if l := a .License ; l != nil {
447459 env = append (env , k8sutil .CreateEnvSecretKeySelector (constants .EnvArangoLicenseKey ,
448- a . License . GetSecretName () , constants .SecretKeyToken ))
460+ * l , constants .SecretKeyToken ))
449461 }
450462
451463 if len (env ) > 0 {
0 commit comments