Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/controller/installation/core_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ func (r *ReconcileInstallation) Reconcile(ctx context.Context, request reconcile
return reconcile.Result{}, err
}

calicoVersion := r.ext.ProductVersion()
calicoVersion := r.ext.ProductVersion(&instance.Spec)

ci := controller.Inputs{
RenderInputs: render.Inputs{
Expand Down
9 changes: 6 additions & 3 deletions pkg/enterprise/installation/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,12 @@ func collectProcessPathEnabled(lc *operatorv1.LogCollector) bool {
*lc.Spec.CollectProcessPath == operatorv1.CollectProcessPathEnable
}

// Validate rejects installation config Calico Enterprise does not support.
// ProductVersion is the Calico Enterprise release the operator reports in status.
func (e *Extension) ProductVersion() string {
// ProductVersion is the release the operator reports in status. The Enterprise
// operator also manages Calico variant installs, during migration.
func (e *Extension) ProductVersion(install *operatorv1.InstallationSpec) string {
if !install.Variant.IsEnterprise() {
return components.CalicoRelease
}
return components.EnterpriseRelease
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/extensions/extensions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var _ = Describe("the zero value Extensions", func() {
It("runs the base behavior for every controller", func() {
var e extensions.Extensions

Expect(e.Installation().ProductVersion()).NotTo(BeEmpty())
Expect(e.Installation().ProductVersion(&operatorv1.InstallationSpec{})).NotTo(BeEmpty())
Expect(e.Installation().KubeControllersImage()).To(BeNil())
Expect(e.Windows().Watches(nil)).NotTo(HaveOccurred())

Expand Down
7 changes: 4 additions & 3 deletions pkg/extensions/installation.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ type InstallationExtension interface {
// it changed fc. It runs before Felix defaulting persists.
DefaultFelixConfiguration(install *operatorv1.InstallationSpec, fc *v3.FelixConfiguration) (bool, error)

// ProductVersion is the version the operator writes to the Installation status.
ProductVersion() string
// ProductVersion is the version the operator writes to the Installation status
// for the variant the given spec installs.
ProductVersion(install *operatorv1.InstallationSpec) string

// KubeControllersImage overrides the image kube-controllers runs, or nil to run
// the variant's combined calico image. Calico Cloud is the only caller.
Expand All @@ -69,7 +70,7 @@ func (noopInstallation) DefaultFelixConfiguration(*operatorv1.InstallationSpec,
return false, nil
}

func (noopInstallation) ProductVersion() string {
func (noopInstallation) ProductVersion(*operatorv1.InstallationSpec) string {
return components.CalicoRelease
}

Expand Down