Skip to content

Commit

Permalink
Use new DR license field (#637)
Browse files Browse the repository at this point in the history
* Use new DR license field
  • Loading branch information
sgalsaleh authored May 25, 2024
1 parent dbb2c35 commit 05d3907
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARCH := $(shell uname -m)
APP_NAME = embedded-cluster
ADMIN_CONSOLE_CHART_URL = oci://registry.replicated.com/library
ADMIN_CONSOLE_CHART_NAME = admin-console
ADMIN_CONSOLE_CHART_VERSION = 1.109.5
ADMIN_CONSOLE_CHART_VERSION = 1.109.6
ADMIN_CONSOLE_IMAGE_OVERRIDE =
ADMIN_CONSOLE_MIGRATIONS_IMAGE_OVERRIDE =
EMBEDDED_OPERATOR_CHART_URL = oci://registry.replicated.com/library
Expand Down
2 changes: 1 addition & 1 deletion e2e/scripts/unsupported-overrides.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
name: embedded-cluster-operator
namespace: embedded-cluster
order: 2
version: 0.30.1
version: 0.32.2
- chartname: oci://registry.replicated.com/library/admin-console
name: admin-console
namespace: kotsadm
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ require (
github.com/jedib0t/go-pretty v4.3.0+incompatible
github.com/k0sproject/dig v0.2.0
github.com/k0sproject/k0s v1.29.5-0.20240418091920-5421d2dc4754
github.com/replicatedhq/embedded-cluster-kinds v1.2.1
github.com/replicatedhq/embedded-cluster-operator v0.31.1
github.com/replicatedhq/embedded-cluster-kinds v1.2.2
github.com/replicatedhq/embedded-cluster-operator v0.31.2
github.com/replicatedhq/embedded-cluster-utils v1.0.0
github.com/replicatedhq/kotskinds v0.0.0-20230724164735-f83482cc9cfe
github.com/replicatedhq/kotskinds v0.0.0-20240523174825-f4d441adb453
github.com/replicatedhq/troubleshoot v0.92.1
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.9.0
Expand Down Expand Up @@ -72,7 +72,7 @@ require (
)

require (
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
Expand Down Expand Up @@ -147,7 +147,7 @@ require (
gopkg.in/macaroon.v2 v2.1.0 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
k8s.io/apiextensions-apiserver v0.30.0 // indirect
k8s.io/client-go v0.30.0 // indirect
k8s.io/client-go v0.30.1 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
k8s.io/utils v0.0.0-20231121161247-cf03d44ff3cf
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ github.com/ohler55/ojg v1.22.0/go.mod h1:gQhDVpQLqrmnd2eqGAvJtn+NfKoYJbe/A4Sj3/V
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo/v2 v2.17.2 h1:7eMhcy3GimbsA3hEnVKdw/PQM9XN9krpKVXsZdph0/g=
github.com/onsi/ginkgo/v2 v2.17.2/go.mod h1:nP2DPOQoNsQmsVyv5rDA8JkXQoCs6goXIvr/PRJ1eCc=
github.com/onsi/ginkgo/v2 v2.17.3 h1:oJcvKpIb7/8uLpDDtnQuf18xVnwKp8DTD7DQ6gTd/MU=
github.com/onsi/ginkgo/v2 v2.17.3/go.mod h1:nP2DPOQoNsQmsVyv5rDA8JkXQoCs6goXIvr/PRJ1eCc=
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
Expand Down Expand Up @@ -251,14 +251,14 @@ github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lne
github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY=
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
github.com/replicatedhq/embedded-cluster-kinds v1.2.1 h1:iKRzBVMm4Gc8cbe7pL8D7WR8CXhfec2G7c4ygNSQINM=
github.com/replicatedhq/embedded-cluster-kinds v1.2.1/go.mod h1:QvjFYlRZnXC/szgEqTepB5DoU8v3O+mdxmJi0EoqDGY=
github.com/replicatedhq/embedded-cluster-operator v0.31.1 h1:BD7QwSjjbZYZCpWkVu46spakz+I8UcyiOSIjXRSCNiE=
github.com/replicatedhq/embedded-cluster-operator v0.31.1/go.mod h1:/lvWQrf6zfMLyWYtIN2X1VroiDxNh75ShtgdlKmCa74=
github.com/replicatedhq/embedded-cluster-kinds v1.2.2 h1:KW9fSCTt4xr3MpcCQpgwHcwmZp+mz7uA2JOVR+2TD9Q=
github.com/replicatedhq/embedded-cluster-kinds v1.2.2/go.mod h1:NIwwkFGoNHIxx+5mHRihvQU6RqZ/xt/A5RzaHpBh2ZY=
github.com/replicatedhq/embedded-cluster-operator v0.31.2 h1:2tKn/ec0SoCNym8jUGnfUn1EuvqU5D1rBrk2aWZwcA0=
github.com/replicatedhq/embedded-cluster-operator v0.31.2/go.mod h1:X5qVNdTGZjgGqRPK7UIMw7z72nSzdYPbgsMYHPPUwME=
github.com/replicatedhq/embedded-cluster-utils v1.0.0 h1:Axdni1nYfl5zeOP9g5U79yvN8cRdClyU6hz0wV1Hmdc=
github.com/replicatedhq/embedded-cluster-utils v1.0.0/go.mod h1:4JmMC2CwMCLxq05GEW3XSPPVotqyamAF/omrbB3pH+c=
github.com/replicatedhq/kotskinds v0.0.0-20230724164735-f83482cc9cfe h1:3AJInd06UxzqHmgy8+24CPsT2tYSE0zToJZyuX9q+MA=
github.com/replicatedhq/kotskinds v0.0.0-20230724164735-f83482cc9cfe/go.mod h1:QjhIUu3+OmHZ09u09j3FCoTt8F3BYtQglS+OLmftu9I=
github.com/replicatedhq/kotskinds v0.0.0-20240523174825-f4d441adb453 h1:g8CQQ9R4gjIdoHuBX1LN1hmF3Omq2JfA040JfpfNVC8=
github.com/replicatedhq/kotskinds v0.0.0-20240523174825-f4d441adb453/go.mod h1:QjhIUu3+OmHZ09u09j3FCoTt8F3BYtQglS+OLmftu9I=
github.com/replicatedhq/troubleshoot v0.92.1 h1:TjO/NGM/TZRim2chVbW2mGbVbyOZ/qV8KBeApJwdqUc=
github.com/replicatedhq/troubleshoot v0.92.1/go.mod h1:aPdpP2+V8HCHt3V6ozdeAcMAifzOQqN1siQ5Pc5XY0w=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
Expand Down Expand Up @@ -491,8 +491,8 @@ k8s.io/apiextensions-apiserver v0.30.0 h1:jcZFKMqnICJfRxTgnC4E+Hpcq8UEhT8B2lhBcQ
k8s.io/apiextensions-apiserver v0.30.0/go.mod h1:N9ogQFGcrbWqAY9p2mUAL5mGxsLqwgtUce127VtRX5Y=
k8s.io/apimachinery v0.30.1 h1:ZQStsEfo4n65yAdlGTfP/uSHMQSoYzU/oeEbkmF7P2U=
k8s.io/apimachinery v0.30.1/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
k8s.io/client-go v0.30.0 h1:sB1AGGlhY/o7KCyCEQ0bPWzYDL0pwOZO4vAtTSh/gJQ=
k8s.io/client-go v0.30.0/go.mod h1:g7li5O5256qe6TYdAMyX/otJqMhIiGgTapdLchhmOaY=
k8s.io/client-go v0.30.1 h1:uC/Ir6A3R46wdkgCV3vbLyNOYyCJ8oZnjtJGKfytl/Q=
k8s.io/client-go v0.30.1/go.mod h1:wrAqLNs2trwiCH/wxxmT/x3hKVH9PuV0GGW0oDoHVqc=
k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=
k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag=
Expand Down
6 changes: 3 additions & 3 deletions pkg/addons/applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ func (a *Applier) load() ([]AddOn, error) {
}
addons = append(addons, embedoperator)

snapshotsEnabled, err := helpers.SnapshotsEnabled(a.licenseFile)
disasterRecoveryEnabled, err := helpers.DisasterRecoveryEnabled(a.licenseFile)
if err != nil {
return nil, fmt.Errorf("unable to check if snapshots are enabled: %w", err)
return nil, fmt.Errorf("unable to check if disaster recovery is enabled: %w", err)
}
vel, err := velero.New(defaults.VeleroNamespace, snapshotsEnabled, a.proxyEnv)
vel, err := velero.New(defaults.VeleroNamespace, disasterRecoveryEnabled, a.proxyEnv)
if err != nil {
return nil, fmt.Errorf("unable to create velero addon: %w", err)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/addons/embeddedclusteroperator/embeddedclusteroperator.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (e *EmbeddedClusterOperator) Outro(ctx context.Context, cli client.Client)
EndUserK0sConfigOverrides: euOverrides,
BinaryName: defaults.BinaryName(),
LicenseInfo: &embeddedclusterv1beta1.LicenseInfo{
IsSnapshotSupported: licenseSnapshotSupported(license),
IsDisasterRecoverySupported: licenseDisasterRecoverySupported(license),
},
},
}
Expand All @@ -236,9 +236,9 @@ func New(endUserConfig *embeddedclusterv1beta1.Config, licenseFile string, airga
}, nil
}

func licenseSnapshotSupported(license *kotsv1beta1.License) bool {
func licenseDisasterRecoverySupported(license *kotsv1beta1.License) bool {
if license == nil {
return false
}
return license.Spec.IsSnapshotSupported
return license.Spec.IsDisasterRecoverySupported
}
6 changes: 3 additions & 3 deletions pkg/helpers/snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
)

func SnapshotsEnabled(licenseFile string) (bool, error) {
func DisasterRecoveryEnabled(licenseFile string) (bool, error) {
if licenseFile == "" {
return false, nil
}
Expand All @@ -14,8 +14,8 @@ func SnapshotsEnabled(licenseFile string) (bool, error) {
return false, fmt.Errorf("failed to parse license: %w", err)
}

// if the license does not have snapshots enabled, return false
if !lic.Spec.IsSnapshotSupported {
// if the license does not have disaster recovery enabled, return false
if !lic.Spec.IsDisasterRecoverySupported {
return false, nil
}

Expand Down

0 comments on commit 05d3907

Please sign in to comment.