Skip to content

Support Custom Environment Variables in Installation CRD #4475

@nahubha-devops

Description

@nahubha-devops

Summary
Add support for custom environment variables in the Installation CRD to allow setting environment variables like GOMEMLIMIT for calico-node containers.

Problem Statement
Calico-node pods (written in Go) experience unbounded memory growth leading to OOM kills due to Go runtime's garbage collection behavior in containerized environments. The recommended solution is to set GOMEMLIMIT environment variable, but the Tigera Operator Installation CRD does not support adding custom environment variables.

Current Behavior
The Installation CRD only supports name and resources fields for containers
Any manual changes to the calico-node DaemonSet (adding env vars) are immediately reverted by the operator
No way to configure environment variables through FelixConfiguration or other Calico CRDs

Impact
consider if memory set to 500
Calico memory grows from 112Mi to 472-475Mi over time
OOM kills occur when memory limit (500Mi) is reached
3x variance in memory usage between nodes
Pods restart every few months due to memory exhaustion

Proposed Solution
Add an env field to the Installation CRD container specification:

apiVersion: operator.tigera.io/v1
kind: Installation
metadata:
name: default
spec:
calicoNodeDaemonSet:
spec:
template:
spec:
containers:
- name: calico-node
env:
- name: GOMEMLIMIT
value: "400MiB"
resources:
limits:
memory: 500Mi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions