Skip to content
Draft
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
9 changes: 6 additions & 3 deletions pkg/components/combined.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ import (
operatorv1 "github.com/tigera/operator/api/v1"
)

// CalicoBinaryPath is the absolute path to the combined "calico" binary inside the calico/calico image.
// Components deployed from the combined image invoke this binary via Command / probe exec.
const CalicoBinaryPath = "/usr/bin/calico"
// CalicoBinaryPath is the command used to invoke the combined "calico" binary inside
// the calico/calico image. Bare command so it resolves via PATH, which keeps us
// agnostic to where the binary actually lives — both the legacy Dockerfile build
// (/usr/bin/calico) and the ko-built image (/ko-app/calico) put the containing
// directory on PATH.
const CalicoBinaryPath = "calico"

// CombinedCalicoImage returns the combined calico/calico Component for the given installation.
// The right Component is selected based on the installation variant (Calico OSS vs. Calico Enterprise)
Expand Down
2 changes: 1 addition & 1 deletion pkg/render/apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1932,7 +1932,7 @@ var _ = Describe("API server rendering tests (Calico)", func() {
Expect(d.Spec.Template.Spec.Containers[0].Image).To(Equal(
fmt.Sprintf("testregistry.com/%s%s:%s", components.CalicoImagePath, components.ComponentCalico.Image, components.ComponentCalico.Version),
))
Expect(d.Spec.Template.Spec.Containers[0].Command).To(Equal([]string{"/usr/bin/calico", "component", "apiserver"}))
Expect(d.Spec.Template.Spec.Containers[0].Command).To(Equal([]string{"calico", "component", "apiserver"}))

expectedArgs := []string{
"--secure-port=5443",
Expand Down
2 changes: 1 addition & 1 deletion pkg/render/csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (c *csiComponent) csiContainers() []corev1.Container {
registrarContainer := corev1.Container{
Name: CSIRegistrarContainerName,
Image: c.csiRegistrarImage,
Command: []string{"/usr/bin/csi-node-driver-registrar"},
Command: []string{"csi-node-driver-registrar"},
Args: []string{
"--v=5",
"--csi-address=$(ADDRESS)",
Expand Down
6 changes: 3 additions & 3 deletions pkg/render/goldmane/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ var _ = Describe("ComponentRendering", func() {
{
Name: goldmane.GoldmaneContainerName,
Image: "quay.io/calico/calico:master",
Command: []string{"/usr/bin/calico", "component", "goldmane"},
Command: []string{"calico", "component", "goldmane"},
Env: []corev1.EnvVar{
{Name: "LOG_LEVEL", Value: "INFO"},
{Name: "PORT", Value: "7443"},
Expand All @@ -155,13 +155,13 @@ var _ = Describe("ComponentRendering", func() {
SecurityContext: securitycontext.NewNonRootContext(),
ReadinessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{Exec: &corev1.ExecAction{
Command: []string{"/usr/bin/calico", "health", fmt.Sprintf("--port=%d", goldmane.GoldmaneHealthPort), "--type=readiness"},
Command: []string{"calico", "health", fmt.Sprintf("--port=%d", goldmane.GoldmaneHealthPort), "--type=readiness"},
}},
PeriodSeconds: 10,
},
LivenessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{Exec: &corev1.ExecAction{
Command: []string{"/usr/bin/calico", "health", fmt.Sprintf("--port=%d", goldmane.GoldmaneHealthPort), "--type=liveness"},
Command: []string{"calico", "health", fmt.Sprintf("--port=%d", goldmane.GoldmaneHealthPort), "--type=liveness"},
}},
PeriodSeconds: 10,
},
Expand Down
6 changes: 3 additions & 3 deletions pkg/render/kubecontrollers/kube-controllers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ var _ = Describe("kube-controllers rendering tests", func() {
))

// Verify command and probes use the combined image entrypoint with generic health check.
Expect(ds.Spec.Template.Spec.Containers[0].Command).To(Equal([]string{"/usr/bin/calico", "component", "kube-controllers", "--health-port=9440"}))
Expect(ds.Spec.Template.Spec.Containers[0].ReadinessProbe.Exec.Command).To(Equal([]string{"/usr/bin/calico", "health", "--port=9440", "--type=readiness"}))
Expect(ds.Spec.Template.Spec.Containers[0].LivenessProbe.Exec.Command).To(Equal([]string{"/usr/bin/calico", "health", "--port=9440", "--type=liveness"}))
Expect(ds.Spec.Template.Spec.Containers[0].Command).To(Equal([]string{"calico", "component", "kube-controllers", "--health-port=9440"}))
Expect(ds.Spec.Template.Spec.Containers[0].ReadinessProbe.Exec.Command).To(Equal([]string{"calico", "health", "--port=9440", "--type=readiness"}))
Expect(ds.Spec.Template.Spec.Containers[0].LivenessProbe.Exec.Command).To(Equal([]string{"calico", "health", "--port=9440", "--type=liveness"}))

// Verify env
expectedEnv := []corev1.EnvVar{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ var _ = Describe("Elasticsearch metrics", func() {
Containers: []corev1.Container{{
Name: ElasticsearchMetricsName,
Image: "testregistry.com/tigera/calico@testdigest",
Command: []string{"/usr/bin/calico", "component", "elasticsearch-metrics"},
Command: []string{"calico", "component", "elasticsearch-metrics"},
Args: []string{
"--es.uri=https://$(ELASTIC_USERNAME):$(ELASTIC_PASSWORD)@$(ELASTIC_HOST):$(ELASTIC_PORT)",
"--es.all", "--es.indices", "--es.indices_settings", "--es.shards", "--es.cluster_settings",
Expand Down
4 changes: 2 additions & 2 deletions pkg/render/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ var _ = Describe("Tigera Secure Manager rendering tests", func() {
Expect(dashboard.VolumeMounts[1].MountPath).To(Equal(fmt.Sprintf("/%s", render.ManagerInternalTLSSecretName)))

Expect(dashboard.ReadinessProbe).NotTo(BeNil())
Expect(dashboard.ReadinessProbe.ProbeHandler.Exec.Command).To(Equal([]string{"/usr/bin/calico", "component", "dashboards", "ready"}))
Expect(dashboard.ReadinessProbe.ProbeHandler.Exec.Command).To(Equal([]string{"calico", "component", "dashboards", "ready"}))
Expect(dashboard.LivenessProbe).NotTo(BeNil())
Expect(dashboard.LivenessProbe.ProbeHandler.Exec.Command).To(Equal([]string{"/usr/bin/calico", "component", "dashboards", "ready"}))
Expect(dashboard.LivenessProbe.ProbeHandler.Exec.Command).To(Equal([]string{"calico", "component", "dashboards", "ready"}))

Expect(dashboard.SecurityContext).NotTo(BeNil())
Expect(*dashboard.SecurityContext.AllowPrivilegeEscalation).To(BeFalse())
Expand Down
14 changes: 7 additions & 7 deletions pkg/render/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3320,11 +3320,11 @@ func verifyProbesAndLifecycle(ds *appsv1.DaemonSet, isOpenshift, isEnterprise bo
var expectedReadinessCmd []string
switch {
case !bgp:
expectedReadinessCmd = []string{"/usr/bin/calico", "component", "node", "health", "--felix-ready"}
expectedReadinessCmd = []string{"calico", "component", "node", "health", "--felix-ready"}
case bgp && isEnterprise:
expectedReadinessCmd = []string{"/usr/bin/calico", "component", "node", "health", "--bird-ready", "--felix-ready", "--bgp-metrics-ready"}
expectedReadinessCmd = []string{"calico", "component", "node", "health", "--bird-ready", "--felix-ready", "--bgp-metrics-ready"}
case bgp:
expectedReadinessCmd = []string{"/usr/bin/calico", "component", "node", "health", "--bird-ready", "--felix-ready"}
expectedReadinessCmd = []string{"calico", "component", "node", "health", "--bird-ready", "--felix-ready"}
}
expectedReadiness.ProbeHandler = corev1.ProbeHandler{Exec: &corev1.ExecAction{Command: expectedReadinessCmd}}

Expand All @@ -3333,7 +3333,7 @@ func verifyProbesAndLifecycle(ds *appsv1.DaemonSet, isOpenshift, isEnterprise bo

expectedLifecycle := &corev1.Lifecycle{
PreStop: &corev1.LifecycleHandler{Exec: &corev1.ExecAction{
Command: []string{"/usr/bin/calico", "component", "node", "shutdown"},
Command: []string{"calico", "component", "node", "shutdown"},
}},
}
ExpectWithOffset(1, ds.Spec.Template.Spec.Containers[0].Lifecycle).To(Equal(expectedLifecycle))
Expand Down Expand Up @@ -3411,7 +3411,7 @@ func verifyInitContainers(ds *appsv1.DaemonSet, instance *operatorv1.Installatio
cniImage = fmt.Sprintf("%s%s%s:%s", components.TigeraRegistry, components.TigeraImagePath, components.ComponentTigeraCalico.Image, components.ComponentTigeraCalico.Version)
}
Expect(cniContainer.Image).To(Equal(cniImage))
Expect(cniContainer.Command).To(Equal([]string{"/usr/bin/calico", "component", "cni", "install"}))
Expect(cniContainer.Command).To(Equal([]string{"calico", "component", "cni", "install"}))
Expect(*cniContainer.SecurityContext.AllowPrivilegeEscalation).To(BeTrue())
Expect(*cniContainer.SecurityContext.Privileged).To(BeTrue())
Expect(*cniContainer.SecurityContext.RunAsGroup).To(BeEquivalentTo(0))
Expand Down Expand Up @@ -3471,7 +3471,7 @@ func verifyInitContainers(ds *appsv1.DaemonSet, instance *operatorv1.Installatio
Expect(ebpfBootstrap.Image).To(Equal(ebpfImage))
if instance.CalicoNetwork != nil {
bpf := instance.CalicoNetwork.LinuxDataplane != nil && *instance.CalicoNetwork.LinuxDataplane == operatorv1.LinuxDataplaneBPF
expectedEbpfCmd := []string{"/usr/bin/calico", "component", "node", "init"}
expectedEbpfCmd := []string{"calico", "component", "node", "init"}
if !bpf {
expectedEbpfCmd = append(expectedEbpfCmd, "--best-effort")
}
Expand Down Expand Up @@ -3503,7 +3503,7 @@ func verifyInitContainers(ds *appsv1.DaemonSet, instance *operatorv1.Installatio
} else {
Expect(flexvolContainer.Image).To(Equal(fmt.Sprintf("quay.io/%s%s:%s", components.CalicoImagePath, components.ComponentCalico.Image, components.ComponentCalico.Version)))
}
Expect(flexvolContainer.Command).To(Equal([]string{"/usr/bin/calico", "component", "flexvol", "install", "--target", "/host/driver/uds"}))
Expect(flexvolContainer.Command).To(Equal([]string{"calico", "component", "flexvol", "install", "--target", "/host/driver/uds"}))

Expect(*flexvolContainer.SecurityContext.AllowPrivilegeEscalation).To(BeTrue())
Expect(*flexvolContainer.SecurityContext.Privileged).To(BeTrue())
Expand Down
2 changes: 1 addition & 1 deletion pkg/render/webhooks/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ var _ = Describe("Webhooks rendering tests", func() {
components.CalicoImagePath,
components.ComponentCalico.Image,
components.ComponentCalico.Version)))
Expect(dep.Spec.Template.Spec.Containers[0].Command).To(Equal([]string{"/usr/bin/calico", "component", "webhooks"}))
Expect(dep.Spec.Template.Spec.Containers[0].Command).To(Equal([]string{"calico", "component", "webhooks"}))

// Verify the ClusterRole includes expected rules.
cr := rtest.GetResource(resources, webhooks.WebhooksName, "", "rbac.authorization.k8s.io", "v1", "ClusterRole").(*rbacv1.ClusterRole)
Expand Down
2 changes: 1 addition & 1 deletion pkg/render/whisker/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ var _ = Describe("ComponentRendering", func() {
{
Name: whisker.WhiskerBackendContainerName,
Image: "quay.io/calico/calico:master",
Command: []string{"/usr/bin/calico", "component", "whisker-backend"},
Command: []string{"calico", "component", "whisker-backend"},
Env: []corev1.EnvVar{
{Name: "LOG_LEVEL", Value: "INFO"},
{Name: "PORT", Value: "3002"},
Expand Down
Loading