Skip to content
Open
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
5 changes: 4 additions & 1 deletion pkg/render/windows.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 @@ -218,6 +218,7 @@ func (c *windowsComponent) cniEnvVars() []corev1.EnvVar {

envVars := []corev1.EnvVar{
{Name: "SLEEP", Value: "false"},
{Name: "CNI_PLUGIN_TYPE", Value: string(c.cfg.Installation.CNI.Type)},
{Name: "CNI_BIN_DIR", Value: "/host/opt/cni/bin"},
{Name: "CNI_CONF_NAME", Value: "10-calico.conflist"},
{Name: "CNI_NET_DIR", Value: cniNetDir},
Expand Down Expand Up @@ -412,6 +413,7 @@ func (c *windowsComponent) windowsVolumes() []corev1.Volume {
func (c *windowsComponent) uninstallEnvVars() []corev1.EnvVar {
envVars := []corev1.EnvVar{
{Name: "SLEEP", Value: "false"},
{Name: "CNI_PLUGIN_TYPE", Value: string(c.cfg.Installation.CNI.Type)},
{Name: "CNI_BIN_DIR", Value: "/host/opt/cni/bin"},
{Name: "CNI_CONF_NAME", Value: "10-calico.conflist"},
{Name: "CNI_NET_DIR", Value: "/host/etc/cni/net.d"},
Expand Down Expand Up @@ -539,6 +541,7 @@ func (c *windowsComponent) windowsEnvVars() []corev1.EnvVar {
}

windowsEnv := []corev1.EnvVar{
{Name: "CNI_PLUGIN_TYPE", Value: string(c.cfg.Installation.CNI.Type)},
{Name: "DATASTORE_TYPE", Value: "kubernetes"},
{Name: "WAIT_FOR_DATASTORE", Value: "true"},
{Name: "CLUSTER_TYPE", Value: clusterType},
Expand Down
17 changes: 17 additions & 0 deletions pkg/render/windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ var _ = Describe("Windows rendering tests", func() {

// Verify env
expectedNodeEnv := []corev1.EnvVar{
{Name: "CNI_PLUGIN_TYPE", Value: "Calico"},
{Name: "DATASTORE_TYPE", Value: "kubernetes"},
{Name: "WAIT_FOR_DATASTORE", Value: "true"},
{Name: "CALICO_MANAGE_CNI", Value: "true"},
Expand Down Expand Up @@ -457,6 +458,7 @@ var _ = Describe("Windows rendering tests", func() {

expectedCNIEnv := []corev1.EnvVar{
{Name: "SLEEP", Value: "false"},
{Name: "CNI_PLUGIN_TYPE", Value: "Calico"},
{Name: "CNI_BIN_DIR", Value: "/host/opt/cni/bin"},
{Name: "CNI_CONF_NAME", Value: "10-calico.conflist"},
{Name: "CNI_NET_DIR", Value: "/etc/cni/net.d"},
Expand Down Expand Up @@ -489,6 +491,7 @@ var _ = Describe("Windows rendering tests", func() {

expectedUninstallEnv := []corev1.EnvVar{
{Name: "SLEEP", Value: "false"},
{Name: "CNI_PLUGIN_TYPE", Value: "Calico"},
{Name: "CNI_BIN_DIR", Value: "/host/opt/cni/bin"},
{Name: "CNI_CONF_NAME", Value: "10-calico.conflist"},
{Name: "CNI_NET_DIR", Value: "/host/etc/cni/net.d"},
Expand Down Expand Up @@ -853,6 +856,7 @@ var _ = Describe("Windows rendering tests", func() {

// Verify env
expectedNodeEnv := []corev1.EnvVar{
{Name: "CNI_PLUGIN_TYPE", Value: "Calico"},
{Name: "DATASTORE_TYPE", Value: "kubernetes"},
{Name: "WAIT_FOR_DATASTORE", Value: "true"},
{Name: "CALICO_MANAGE_CNI", Value: "true"},
Expand Down Expand Up @@ -935,6 +939,7 @@ var _ = Describe("Windows rendering tests", func() {

expectedCNIEnv := []corev1.EnvVar{
{Name: "SLEEP", Value: "false"},
{Name: "CNI_PLUGIN_TYPE", Value: "Calico"},
{Name: "CNI_BIN_DIR", Value: "/host/opt/cni/bin"},
{Name: "CNI_CONF_NAME", Value: "10-calico.conflist"},
{Name: "CNI_NET_DIR", Value: "/etc/cni/net.d"},
Expand Down Expand Up @@ -967,6 +972,7 @@ var _ = Describe("Windows rendering tests", func() {

expectedUninstallEnv := []corev1.EnvVar{
{Name: "SLEEP", Value: "false"},
{Name: "CNI_PLUGIN_TYPE", Value: "Calico"},
{Name: "CNI_BIN_DIR", Value: "/host/opt/cni/bin"},
{Name: "CNI_CONF_NAME", Value: "10-calico.conflist"},
{Name: "CNI_NET_DIR", Value: "/host/etc/cni/net.d"},
Expand Down Expand Up @@ -1177,6 +1183,7 @@ var _ = Describe("Windows rendering tests", func() {

// Verify env
expectedNodeEnv := []corev1.EnvVar{
{Name: "CNI_PLUGIN_TYPE", Value: "Calico"},
{Name: "DATASTORE_TYPE", Value: "kubernetes"},
{Name: "WAIT_FOR_DATASTORE", Value: "true"},
{Name: "CALICO_MANAGE_CNI", Value: "true"},
Expand Down Expand Up @@ -1226,6 +1233,7 @@ var _ = Describe("Windows rendering tests", func() {

expectedCNIEnv := []corev1.EnvVar{
{Name: "SLEEP", Value: "false"},
{Name: "CNI_PLUGIN_TYPE", Value: "Calico"},
{Name: "CNI_BIN_DIR", Value: "/host/opt/cni/bin"},
{Name: "CNI_CONF_NAME", Value: "10-calico.conflist"},
{Name: "CNI_NET_DIR", Value: "/etc/cni/net.d"},
Expand Down Expand Up @@ -1259,6 +1267,7 @@ var _ = Describe("Windows rendering tests", func() {

expectedUninstallEnv := []corev1.EnvVar{
{Name: "SLEEP", Value: "false"},
{Name: "CNI_PLUGIN_TYPE", Value: "Calico"},
{Name: "CNI_BIN_DIR", Value: "/host/opt/cni/bin"},
{Name: "CNI_CONF_NAME", Value: "10-calico.conflist"},
{Name: "CNI_NET_DIR", Value: "/host/etc/cni/net.d"},
Expand Down Expand Up @@ -1377,6 +1386,7 @@ var _ = Describe("Windows rendering tests", func() {

// Verify env
expectedNodeEnv := []corev1.EnvVar{
{Name: "CNI_PLUGIN_TYPE", Value: "AmazonVPC"},
{Name: "DATASTORE_TYPE", Value: "kubernetes"},
{Name: "WAIT_FOR_DATASTORE", Value: "true"},
{Name: "CALICO_NETWORKING_BACKEND", Value: "none"},
Expand Down Expand Up @@ -1515,6 +1525,7 @@ var _ = Describe("Windows rendering tests", func() {

// Verify env
expectedEnvs := []corev1.EnvVar{
{Name: "CNI_PLUGIN_TYPE", Value: string(cni)},
{Name: "CALICO_NETWORKING_BACKEND", Value: "none"},
{Name: "FELIX_DEFAULTENDPOINTTOHOSTACTION", Value: "ACCEPT"},
}
Expand Down Expand Up @@ -1621,6 +1632,7 @@ var _ = Describe("Windows rendering tests", func() {
Expect(ds.Spec.Template.Spec.Volumes).To(ConsistOf(expectedVols))

expectedNodeEnv := []corev1.EnvVar{
{Name: "CNI_PLUGIN_TYPE", Value: "Calico"},
{Name: "DATASTORE_TYPE", Value: "kubernetes"},
{Name: "WAIT_FOR_DATASTORE", Value: "true"},
{Name: "CALICO_MANAGE_CNI", Value: "true"},
Expand Down Expand Up @@ -1763,6 +1775,7 @@ var _ = Describe("Windows rendering tests", func() {

expectedNodeEnv := []corev1.EnvVar{
// Default envvars.
{Name: "CNI_PLUGIN_TYPE", Value: "Calico"},
{Name: "DATASTORE_TYPE", Value: "kubernetes"},
{Name: "WAIT_FOR_DATASTORE", Value: "true"},
{Name: "CALICO_MANAGE_CNI", Value: "true"},
Expand Down Expand Up @@ -1918,6 +1931,7 @@ var _ = Describe("Windows rendering tests", func() {

expectedNodeEnv := []corev1.EnvVar{
// Default envvars.
{Name: "CNI_PLUGIN_TYPE", Value: "Calico"},
{Name: "DATASTORE_TYPE", Value: "kubernetes"},
{Name: "WAIT_FOR_DATASTORE", Value: "true"},
{Name: "CALICO_MANAGE_CNI", Value: "true"},
Expand Down Expand Up @@ -2441,6 +2455,7 @@ var _ = Describe("Windows rendering tests", func() {

// Verify env
expectedNodeEnv := []corev1.EnvVar{
{Name: "CNI_PLUGIN_TYPE", Value: "Calico"},
{Name: "DATASTORE_TYPE", Value: "kubernetes"},
{Name: "WAIT_FOR_DATASTORE", Value: "true"},
{Name: "CALICO_NETWORKING_BACKEND", Value: "none"},
Expand Down Expand Up @@ -2484,6 +2499,7 @@ var _ = Describe("Windows rendering tests", func() {

expectedCNIEnv := []corev1.EnvVar{
{Name: "SLEEP", Value: "false"},
{Name: "CNI_PLUGIN_TYPE", Value: "Calico"},
{Name: "CNI_BIN_DIR", Value: "/host/opt/cni/bin"},
{Name: "CNI_CONF_NAME", Value: "10-calico.conflist"},
{Name: "CNI_NET_DIR", Value: "/etc/cni/net.d"},
Expand Down Expand Up @@ -2516,6 +2532,7 @@ var _ = Describe("Windows rendering tests", func() {

expectedUninstallEnv := []corev1.EnvVar{
{Name: "SLEEP", Value: "false"},
{Name: "CNI_PLUGIN_TYPE", Value: "Calico"},
{Name: "CNI_BIN_DIR", Value: "/host/opt/cni/bin"},
{Name: "CNI_CONF_NAME", Value: "10-calico.conflist"},
{Name: "CNI_NET_DIR", Value: "/host/etc/cni/net.d"},
Expand Down