Skip to content

Commit 133e7c6

Browse files
Add CalicoEnterprise variant and deprecate TigeraSecureEnterprise (tigera#4607)
1 parent 39752e0 commit 133e7c6

102 files changed

Lines changed: 358 additions & 345 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/v1/imageset_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022-2024 Tigera, Inc. All rights reserved.
1+
// Copyright (c) 2022-2026 Tigera, Inc. All rights reserved.
22
/*
33
44
Licensed under the Apache License, Version 2.0 (the "License");
@@ -49,7 +49,7 @@ type Image struct {
4949
// ImageSet is used to specify image digests for the images that the operator deploys.
5050
// The name of the ImageSet is expected to be in the format `<variant>-<release>`.
5151
// The `variant` used is `enterprise` if the InstallationSpec Variant is
52-
// `TigeraSecureEnterprise` otherwise it is `calico`.
52+
// `CalicoEnterprise` or `TigeraSecureEnterprise`, otherwise it is `calico`.
5353
// The `release` must match the version of the variant that the operator is built to deploy,
5454
// this version can be obtained by passing the `--version` flag to the operator binary.
5555
type ImageSet struct {

api/v1/installation_types.go

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ type Installation struct {
4747

4848
// InstallationSpec defines configuration for a Calico or Calico Enterprise installation.
4949
type InstallationSpec struct {
50-
// Variant is the product to install - one of Calico or TigeraSecureEnterprise
50+
// Variant is the product to install - one of Calico or CalicoEnterprise.
51+
// TigeraSecureEnterprise is also accepted as a deprecated alias for CalicoEnterprise.
5152
// Default: Calico
5253
// +optional
53-
// +kubebuilder:validation:Enum=Calico;TigeraSecureEnterprise
54+
// +kubebuilder:validation:Enum=Calico;CalicoEnterprise;TigeraSecureEnterprise
5455
Variant ProductVariant `json:"variant,omitempty"`
5556

5657
// Registry is the default Docker registry used for component Docker images.
@@ -460,14 +461,23 @@ func (p Provider) IsKind() bool {
460461

461462
// ProductVariant represents the variant of the product.
462463
//
463-
// One of: Calico, TigeraSecureEnterprise
464+
// One of: Calico, CalicoEnterprise.
465+
// TigeraSecureEnterprise is a deprecated alias for CalicoEnterprise.
464466
type ProductVariant string
465467

466468
var (
467-
Calico ProductVariant = "Calico"
469+
Calico ProductVariant = "Calico"
470+
CalicoEnterprise ProductVariant = "CalicoEnterprise"
471+
472+
// Deprecated: Use CalicoEnterprise instead.
468473
TigeraSecureEnterprise ProductVariant = "TigeraSecureEnterprise"
469474
)
470475

476+
// IsEnterprise returns true if the variant is an enterprise variant (either CalicoEnterprise or TigeraSecureEnterprise).
477+
func (v ProductVariant) IsEnterprise() bool {
478+
return v == CalicoEnterprise || v == TigeraSecureEnterprise
479+
}
480+
471481
// NonPrivilegedType specifies whether Calico runs as permissioned or not
472482
//
473483
// One of: Enabled, Disabled
@@ -982,8 +992,9 @@ type CNISpec struct {
982992

983993
// InstallationStatus defines the observed state of the Calico or Calico Enterprise installation.
984994
type InstallationStatus struct {
985-
// Variant is the most recently observed installed variant - one of Calico or TigeraSecureEnterprise
986-
// +kubebuilder:validation:Enum=Calico;TigeraSecureEnterprise
995+
// Variant is the most recently observed installed variant - one of Calico or CalicoEnterprise.
996+
// TigeraSecureEnterprise is a deprecated alias for CalicoEnterprise.
997+
// +kubebuilder:validation:Enum=Calico;CalicoEnterprise;TigeraSecureEnterprise
987998
Variant ProductVariant `json:"variant,omitempty"`
988999

9891000
// MTU is the most recently observed value for pod network MTU. This may be an explicitly

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ If a value other than 'all' is specified, the first CRD with a prefix of the spe
178178
}
179179

180180
if printEnterpriseCRDs != "" {
181-
if err := showCRDs(operatortigeraiov1.TigeraSecureEnterprise, printEnterpriseCRDs); err != nil {
181+
if err := showCRDs(operatortigeraiov1.CalicoEnterprise, printEnterpriseCRDs); err != nil {
182182
fmt.Println(err)
183183
os.Exit(1)
184184
}

docs/common_tasks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Then, modify the installation CR (e.g., with `kubectl edit installations`) to in
113113

114114
```
115115
spec:
116-
variant: TigeraSecureEnterprise
116+
variant: CalicoEnterprise
117117
imagePullSecrets:
118118
- name: tigera-pull-secret
119119
```

docs/controller-dependency-graph.svg

Lines changed: 1 addition & 1 deletion
Loading

docs/generate-controller-dependency-graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def main():
2727
# This is still a manual process at the moment.
2828
# [APIServer] --> [ClusterConnection]
2929
# [APIServer] -> [Installation]
30-
graph.add_edge(Edge('apiserver', 'clusterconnection', label='TSEE', style='dashed'))
30+
graph.add_edge(Edge('apiserver', 'clusterconnection', label='Enterprise', style='dashed'))
3131
graph.add_edge(Edge('apiserver', 'installation'))
3232
# [ApplicationLayer] -> [Installation]
3333
graph.add_edge(Edge('applicationlayer', 'installation'))

pkg/controller/apiserver/apiserver_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func Add(mgr manager.Manager, opts options.ControllerOptions) error {
104104

105105
if opts.EnterpriseCRDExists {
106106
// Watch for changes to ApplicationLayer
107-
err = c.WatchObject(&operatorv1.ApplicationLayer{ObjectMeta: metav1.ObjectMeta{Name: utils.DefaultTSEEInstanceKey.Name}}, &handler.EnqueueRequestForObject{})
107+
err = c.WatchObject(&operatorv1.ApplicationLayer{ObjectMeta: metav1.ObjectMeta{Name: utils.DefaultEnterpriseInstanceKey.Name}}, &handler.EnqueueRequestForObject{})
108108
if err != nil {
109109
return fmt.Errorf("apiserver-controller failed to watch ApplicationLayer resource: %v", err)
110110
}
@@ -337,7 +337,7 @@ func (r *ReconcileAPIServer) Reconcile(ctx context.Context, request reconcile.Re
337337
var keyValidatorConfig authentication.KeyValidatorConfig
338338
includeV3NetworkPolicy := false
339339

340-
if installationSpec.Variant == operatorv1.TigeraSecureEnterprise {
340+
if installationSpec.Variant.IsEnterprise() {
341341
trustedBundle, err = certificateManager.CreateNamedTrustedBundleFromSecrets(render.APIServerResourceName, r.client,
342342
common.OperatorNamespace(), false)
343343
if err != nil {

pkg/controller/apiserver/apiserver_controller_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ var _ = Describe("apiserver controller tests", func() {
9393
Generation: 2,
9494
},
9595
Status: operatorv1.InstallationStatus{
96-
Variant: operatorv1.TigeraSecureEnterprise,
96+
Variant: operatorv1.CalicoEnterprise,
9797
Computed: &operatorv1.InstallationSpec{},
9898
},
9999
Spec: operatorv1.InstallationSpec{
100100
ControlPlaneReplicas: &replicas,
101-
Variant: operatorv1.TigeraSecureEnterprise,
101+
Variant: operatorv1.CalicoEnterprise,
102102
Registry: "some.registry.org/",
103103
},
104104
}
@@ -468,7 +468,7 @@ var _ = Describe("apiserver controller tests", func() {
468468

469469
It("should create the cert secrets in the correct namespace when migrating from calico to enterprise", func() {
470470
Expect(netv1.SchemeBuilder.AddToScheme(scheme)).ShouldNot(HaveOccurred())
471-
installation.Spec.Variant = operatorv1.TigeraSecureEnterprise
471+
installation.Spec.Variant = operatorv1.CalicoEnterprise
472472
installation.Status.Variant = operatorv1.Calico
473473
Expect(cli.Create(ctx, installation)).To(BeNil())
474474
Expect(cli.Delete(ctx, &v3.Tier{ObjectMeta: metav1.ObjectMeta{Name: "calico-system"}})).NotTo(HaveOccurred())

pkg/controller/applicationlayer/applicationlayer_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ func (r *ReconcileApplicationLayer) Reconcile(ctx context.Context, request recon
229229
return reconcile.Result{}, err
230230
}
231231

232-
if variant != operatorv1.TigeraSecureEnterprise {
233-
r.status.SetDegraded(operatorv1.ResourceNotReady, fmt.Sprintf("Waiting for network to be %s", operatorv1.TigeraSecureEnterprise), nil, reqLogger)
232+
if !variant.IsEnterprise() {
233+
r.status.SetDegraded(operatorv1.ResourceNotReady, "Waiting for network to be an enterprise variant", nil, reqLogger)
234234
return reconcile.Result{}, nil
235235
}
236236

@@ -447,7 +447,7 @@ func (r *ReconcileApplicationLayer) getWAFRulesetConfig(ctx context.Context) (*c
447447
// getApplicationLayer returns the default ApplicationLayer instance.
448448
func getApplicationLayer(ctx context.Context, cli client.Client) (*operatorv1.ApplicationLayer, error) {
449449
instance := &operatorv1.ApplicationLayer{}
450-
err := cli.Get(ctx, utils.DefaultTSEEInstanceKey, instance)
450+
err := cli.Get(ctx, utils.DefaultEnterpriseInstanceKey, instance)
451451
if err != nil {
452452
return nil, err
453453
}

pkg/controller/applicationlayer/applicationlayer_controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ var _ = Describe("Application layer controller tests", func() {
6969
installation = &operatorv1.Installation{
7070
ObjectMeta: metav1.ObjectMeta{Name: "default"},
7171
Spec: operatorv1.InstallationSpec{
72-
Variant: operatorv1.TigeraSecureEnterprise,
72+
Variant: operatorv1.CalicoEnterprise,
7373
Registry: "some.registry.org/",
7474
},
7575
Status: operatorv1.InstallationStatus{
76-
Variant: operatorv1.TigeraSecureEnterprise,
76+
Variant: operatorv1.CalicoEnterprise,
7777
Computed: &operatorv1.InstallationSpec{
7878
Registry: "my-reg",
7979
// The test is provider agnostic.

0 commit comments

Comments
 (0)