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
26 changes: 16 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,9 @@ load-container-images: ./test/load_images_on_kind_cluster.sh $(IMAGE_TARS)
deploy-crds: kubectl
@export KUBECONFIG=$(KIND_KUBECONFIG) && \
$(BINDIR)/kubectl create -f pkg/crds/operator/ && \
$(BINDIR)/kubectl apply -f pkg/crds/calico/ && \
$(BINDIR)/kubectl apply -f pkg/crds/enterprise/ && \
$(BINDIR)/kubectl apply -f deploy/crds/elastic/elasticsearch-crd.yaml && \
$(BINDIR)/kubectl apply -f deploy/crds/elastic/kibana-crd.yaml && \
$(BINDIR)/kubectl apply -f pkg/crds/calico/v1.crd.projectcalico.org/ && \
$(BINDIR)/kubectl apply -f pkg/crds/enterprise/v1.crd.projectcalico.org/ && \
$(BINDIR)/kubectl apply -f pkg/crds/enterprise/01-crd-eck-bundle.yaml && \
$(BINDIR)/kubectl create -f deploy/crds/prometheus

create-tigera-operator-namespace: kubectl
Expand Down Expand Up @@ -708,7 +707,8 @@ define prep_local_crds
$(eval product := $(1))
rm -rf pkg/crds/$(product)
rm -rf .crds/$(product)
mkdir -p pkg/crds/$(product)
mkdir -p pkg/crds/$(product)/v1.crd.projectcalico.org/
mkdir -p pkg/crds/$(product)/v3.projectcalico.org/
mkdir -p .crds/$(product)
endef

Expand All @@ -722,15 +722,20 @@ define fetch_crds
@echo "Fetching $(dir) CRDs from $(project) branch $(branch)"
git -C .crds/$(dir) clone --depth 1 --branch $(branch) --single-branch git@github.com:$(project).git ./
endef
define copy_crds
define copy_v1_crds
$(eval dir := $(1))
$(eval product := $(2))
@cp $(dir)/libcalico-go/config/crd/* pkg/crds/$(product)/ && echo "Copied $(product) CRDs"
@cp $(dir)/libcalico-go/config/crd/* pkg/crds/$(product)/v1.crd.projectcalico.org/ && echo "Copied $(product) CRDs"
endef
define copy_v3_crds
$(eval dir := $(1))
$(eval product := $(2))
@cp $(dir)/api/config/crd/* pkg/crds/$(product)/v3.projectcalico.org/ && echo "Copied $(product) CRDs"
endef
define copy_eck_crds
$(eval dir := $(1))
$(eval product := $(2))
@cp $(dir)/charts/tigera-operator/crds/eck/* pkg/crds/$(product)/ && echo "Copied $(product) ECK CRDs"
@cp $(dir)/charts/crd.projectcalico.org.v1/templates/eck/* pkg/crds/$(product)/ && echo "Copied $(product) ECK CRDs"
endef

.PHONY: read-libcalico-version read-libcalico-enterprise-version
Expand All @@ -748,7 +753,8 @@ read-libcalico-calico-version:
if [ -z "$(CALICO_BRANCH)" ]; then echo "libcalico branch not defined"; exit 1; fi

update-calico-crds: fetch-calico-crds
$(call copy_crds, $(CALICO_CRDS_DIR),"calico")
$(call copy_v1_crds, $(CALICO_CRDS_DIR),"calico")
$(call copy_v3_crds, $(CALICO_CRDS_DIR),"calico")

prepare-for-calico-crds:
$(call prep_local_crds,"calico")
Expand All @@ -766,7 +772,7 @@ read-libcalico-enterprise-version:
if [ -z "$(CALICO_ENTERPRISE_BRANCH)" ]; then echo "libcalico enterprise branch not defined"; exit 1; fi

update-enterprise-crds: fetch-enterprise-crds
$(call copy_crds,$(ENTERPRISE_CRDS_DIR),"enterprise")
$(call copy_v1_crds,$(ENTERPRISE_CRDS_DIR),"enterprise")
$(call copy_eck_crds,$(ENTERPRISE_CRDS_DIR),"enterprise")

prepare-for-enterprise-crds:
Expand Down
21 changes: 16 additions & 5 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,12 @@ func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(apiextensions.AddToScheme(scheme))
utilruntime.Must(operatortigeraiov1.AddToScheme(scheme))
utilruntime.Must(apis.AddToScheme(scheme))
}

func printVersion() {
log.Info(fmt.Sprintf("Version: %v", version.VERSION))
log.Info(fmt.Sprintf("Go Version: %s", goruntime.Version()))
log.Info(fmt.Sprintf("Go OS/Arch: %s/%s", goruntime.GOOS, goruntime.GOARCH))
// TODO: Add this back if we can
// log.Info(fmt.Sprintf("Version of operator-sdk: %v", sdkVersion.Version))
}

func main() {
Expand Down Expand Up @@ -146,6 +143,7 @@ If a value other than 'all' is specified, the first CRD with a prefix of the spe
fmt.Println("Enterprise:", components.EnterpriseRelease)
os.Exit(0)
}

if printImages != "" {
var cmpnts []components.Component
if strings.ToLower(printImages) == "list" {
Expand All @@ -166,6 +164,7 @@ If a value other than 'all' is specified, the first CRD with a prefix of the spe
}
os.Exit(0)
}

if printCalicoCRDs != "" {
if err := showCRDs(operatortigeraiov1.Calico, printCalicoCRDs); err != nil {
fmt.Println(err)
Expand Down Expand Up @@ -211,6 +210,15 @@ If a value other than 'all' is specified, the first CRD with a prefix of the spe
os.Exit(1)
}

v3CRDs, err := apis.UseV3CRDS(cs)
if err != nil {
log.Error(err, "Failed to determine CRD version to use")
os.Exit(1)
}

// Add the Calico API to the scheme, now that we know which backing CRD version to use.
utilruntime.Must(apis.AddToScheme(scheme, v3CRDs))

// Because we only run this as a job that is set up by the operator, it should not be
// launched except by an operator that is the active operator. So we do not need to
// check that we're the active operator before running the AWS SG setup.
Expand Down Expand Up @@ -280,7 +288,9 @@ If a value other than 'all' is specified, the first CRD with a prefix of the spe
// If configured to manage CRDs, do a preliminary install of them here. The Installation controller
// will reconcile them as well, but we need to make sure they are installed before we start the rest of the controllers.
if bootstrapCRDs || manageCRDs {
if err := crds.Ensure(mgr.GetClient(), variant); err != nil {
setupLog.WithValues("v3", v3CRDs).Info("Ensuring CRDs are installed")

if err := crds.Ensure(mgr.GetClient(), variant, v3CRDs, setupLog); err != nil {
setupLog.Error(err, "Failed to ensure CRDs are created")
os.Exit(1)
}
Expand Down Expand Up @@ -443,6 +453,7 @@ If a value other than 'all' is specified, the first CRD with a prefix of the spe
K8sClientset: clientset,
MultiTenant: multiTenant,
ElasticExternal: utils.UseExternalElastic(bootConfig),
UseV3CRDs: v3CRDs,
}

// Before we start any controllers, make sure our options are valid.
Expand Down Expand Up @@ -520,7 +531,7 @@ func metricsAddr() string {

func showCRDs(variant operatortigeraiov1.ProductVariant, outputType string) error {
first := true
for _, v := range crds.GetCRDs(variant) {
for _, v := range crds.GetCRDs(variant, os.Getenv("CALICO_API_GROUP") == "projectcalico.org/v3") {
if outputType != "all" {
if !strings.HasPrefix(v.Name, outputType) {
continue
Expand Down
2 changes: 1 addition & 1 deletion config/calico_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: master
components:
libcalico-go:
version: master
version: casey-v3-crds
typha:
version: master
node:
Expand Down
1 change: 0 additions & 1 deletion git-hooks/files-to-skip
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
api/v1/zz_generated.deepcopy.go
pkg/apis/crd.projectcalico.org/v1/zz_generated.deepcopy.go
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ require (
github.com/openshift/api v0.0.0-20260122154241-80c3fbc164d6
github.com/openshift/library-go v0.0.0-20260121132910-dc3a1c884c04
github.com/pkg/errors v0.9.1
github.com/projectcalico/api v0.0.0-20250916150628-d4009e4d7c50
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.88.0
github.com/r3labs/diff/v2 v2.15.1
github.com/sirupsen/logrus v1.9.4
github.com/snowzach/rotatefilehook v0.0.0-20220211133110-53752135082d
github.com/stretchr/testify v1.11.1
github.com/tigera/api v0.0.0-20260115201458-bce624761bbd
github.com/tigera/api v0.0.0-20260131232301-9cd5ef33622f
github.com/tigera/operator/api v0.0.0-20260120220012-4a3f8a7d8399
github.com/urfave/cli/v3 v3.6.2
go.uber.org/zap v1.27.1
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,6 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/poy/onpar v1.1.2 h1:QaNrNiZx0+Nar5dLgTVp5mXkyoVFIbepjyEoGSnhbAY=
github.com/poy/onpar v1.1.2/go.mod h1:6X8FLNoxyr9kkmnlqpK6LSoiOtrO6MICtWwEuWkLjzg=
github.com/projectcalico/api v0.0.0-20250916150628-d4009e4d7c50 h1:uawQ+eFENhBbwlOy0ooDwnzVWN2KP6X//GuJMXauyew=
github.com/projectcalico/api v0.0.0-20250916150628-d4009e4d7c50/go.mod h1:bUD5LQaKzGNl93fq+RcBH4CyzfIGoeq/xIRH/IxaGwI=
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.88.0 h1:eKVckm/elKIvnNKQAO9WXxBOudphxpkZmT9+bevtvDo=
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.88.0/go.mod h1:IJwk1oNs212afqGbNnE84GAB95OHtJR/BuI1rKESiYk=
github.com/prometheus/client_golang v1.23.0 h1:ust4zpdl9r4trLY/gSjlm07PuiBq2ynaXXlptpfy8Uc=
Expand Down Expand Up @@ -419,8 +417,8 @@ github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
github.com/tigera/api v0.0.0-20260115201458-bce624761bbd h1:F0fbust3k5972J78YBz9xvsifP8WIsG/+aC8RBAHT6I=
github.com/tigera/api v0.0.0-20260115201458-bce624761bbd/go.mod h1:iwTu4rNSqc5QhfZJovB4d/zC3YIf7v55BO01Q0JBf2Q=
github.com/tigera/api v0.0.0-20260131232301-9cd5ef33622f h1:kvsv9htGZBL8L4j+SRjy4iwCM4iVcEEo9RuMQ+o1CgA=
github.com/tigera/api v0.0.0-20260131232301-9cd5ef33622f/go.mod h1:bxcXRBfeRHbx80vBXAg8ivbN/y6seqMm2MPhgbWoShc=
github.com/urfave/cli/v3 v3.6.2 h1:lQuqiPrZ1cIz8hz+HcrG0TNZFxU70dPZ3Yl+pSrH9A8=
github.com/urfave/cli/v3 v3.6.2/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso=
github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zdEY=
Expand Down
2 changes: 1 addition & 1 deletion hack/release/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func TestGenerateReleaseNotes(t *testing.T) {
cmpNormalizeDateOpt := cmp.Transformer("NormalizeDates", func(s string) string {
return dateRegex.ReplaceAllString(s, "DD MMM YYYY")
})
want := `27 Nov 2025
want := `27 Nov 2026

#### Included Calico versions

Expand Down
8 changes: 4 additions & 4 deletions pkg/active/active_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021-2024 Tigera, Inc. All rights reserved.
// Copyright (c) 2021-2026 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,13 +37,12 @@ var _ = Describe("test active pkg", func() {
c client.Client
ctx context.Context
scheme *runtime.Scheme
//log logr.Logger
)

BeforeEach(func() {
// Create a Kubernetes client.
scheme = runtime.NewScheme()
err := apis.AddToScheme(scheme)
err := apis.AddToScheme(scheme, false)
Expect(err).NotTo(HaveOccurred())

Expect(corev1.SchemeBuilder.AddToScheme(scheme)).ShouldNot(HaveOccurred())
Expand All @@ -52,14 +51,15 @@ var _ = Describe("test active pkg", func() {

c = ctrlrfake.DefaultFakeClientBuilder(scheme).Build()
ctx = context.Background()
//log = logf.Log.WithName("active-test-logger")
})

Context("GetActiveConfigMap", func() {
It("should not error with no ConfigMap", func() {
cm, err := GetActiveConfigMap(c)
Expect(err).To(BeNil())
Expect(cm).To(BeNil())
})

It("should retrieve ConfigMap", func() {
dataMap := map[string]string{"test-key": "test-data"}
Expect(c.Create(ctx, &corev1.ConfigMap{
Expand Down
48 changes: 0 additions & 48 deletions pkg/apis/addtoscheme_operator_v1.go

This file was deleted.

58 changes: 0 additions & 58 deletions pkg/apis/apis.go

This file was deleted.

Loading
Loading