@@ -26,7 +26,6 @@ import (
2626 "reflect"
2727
2828 "github.com/arangodb/kube-arangodb/pkg/util"
29- "github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
3029 "github.com/pkg/errors"
3130 "k8s.io/api/core/v1"
3231)
@@ -55,13 +54,13 @@ type DeploymentSpec struct {
5554 ImagePullPolicy * v1.PullPolicy `json:"imagePullPolicy,omitempty"`
5655 DowntimeAllowed * bool `json:"downtimeAllowed,omitempty"`
5756 DisableIPv6 * bool `json:"disableIPv6,omitempty"`
58- LicenseKey * string `json:"licenseKey,omitempty"`
5957
6058 ExternalAccess ExternalAccessSpec `json:"externalAccess"`
6159 RocksDB RocksDBSpec `json:"rocksdb"`
6260 Authentication AuthenticationSpec `json:"auth"`
6361 TLS TLSSpec `json:"tls"`
6462 Sync SyncSpec `json:"sync"`
63+ License LicenseSpec `json:"license"`
6564
6665 Single ServerGroupSpec `json:"single"`
6766 Agents ServerGroupSpec `json:"agents"`
@@ -126,20 +125,6 @@ func (s DeploymentSpec) IsAuthenticated() bool {
126125 return s .Authentication .IsAuthenticated ()
127126}
128127
129- // HasLicenseKey returns true if a license key secret name was set
130- func (s DeploymentSpec ) HasLicenseKey () bool {
131- return s .LicenseKey != nil
132- }
133-
134- // GetLicenseKey returns the license key if set. Empty string otherwise.
135- func (s DeploymentSpec ) GetLicenseKey () string {
136- if s .HasLicenseKey () {
137- return * s .LicenseKey
138- }
139-
140- return ""
141- }
142-
143128// IsSecure returns true when SSL is enabled
144129func (s DeploymentSpec ) IsSecure () bool {
145130 return s .TLS .IsSecure ()
@@ -220,9 +205,7 @@ func (s *DeploymentSpec) SetDefaultsFrom(source DeploymentSpec) {
220205 if s .DisableIPv6 == nil {
221206 s .DisableIPv6 = util .NewBoolOrNil (source .DisableIPv6 )
222207 }
223- if s .LicenseKey == nil {
224- s .LicenseKey = util .NewStringOrNil (source .LicenseKey )
225- }
208+ s .License .SetDefaultsFrom (source .License )
226209 s .ExternalAccess .SetDefaultsFrom (source .ExternalAccess )
227210 s .RocksDB .SetDefaultsFrom (source .RocksDB )
228211 s .Authentication .SetDefaultsFrom (source .Authentication )
@@ -291,10 +274,8 @@ func (s *DeploymentSpec) Validate() error {
291274 if err := s .Chaos .Validate (); err != nil {
292275 return maskAny (errors .Wrap (err , "spec.chaos" ))
293276 }
294- if s .HasLicenseKey () {
295- if err := k8sutil .ValidateResourceName (s .GetLicenseKey ()); err != nil {
296- return maskAny (errors .Wrap (err , "spec.licenseKey" ))
297- }
277+ if err := s .License .Validate (); err != nil {
278+ return maskAny (errors .Wrap (err , "spec.licenseKey" ))
298279 }
299280 return nil
300281}
0 commit comments