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
9 changes: 8 additions & 1 deletion backend/cmd/headlamp.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ const (
type clientConfig struct {
Clusters []Cluster `json:"clusters"`
IsDynamicClusterEnabled bool `json:"isDynamicClusterEnabled"`
PrometheusEndpoint string `json:"prometheusEndpoint"`
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PrometheusEndpoint is now part of the /config response, but it doesn’t appear to be populated anywhere in the backend config parsing (no flags/env mapping found) and the frontend doesn’t reference prometheusEndpoint. If this field isn’t intentionally being introduced as part of this feature, consider removing it from clientConfig to avoid expanding the API surface with an always-empty value; otherwise ensure it’s properly configured and consumed.

Suggested change
PrometheusEndpoint string `json:"prometheusEndpoint"`

Copilot uses AI. Check for mistakes.
FiltersWarningsOnly bool `json:"filtersWarningsOnly"`
}

type OauthConfig struct {
Expand Down Expand Up @@ -1750,7 +1752,12 @@ func parseClusterFromKubeConfig(kubeConfigs []string) ([]Cluster, []error) {
func (c *HeadlampConfig) getConfig(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")

clientConfig := clientConfig{c.getClusters(), c.EnableDynamicClusters}
clientConfig := clientConfig{
Clusters: c.getClusters(),
IsDynamicClusterEnabled: c.EnableDynamicClusters,
PrometheusEndpoint: c.PrometheusEndpoint,
FiltersWarningsOnly: c.FiltersWarningsOnly,
}

if err := json.NewEncoder(w).Encode(&clientConfig); err != nil {
logger.Log(logger.LevelError, nil, err, "encoding config")
Expand Down
7 changes: 6 additions & 1 deletion backend/cmd/stateless.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,12 @@ func (c *HeadlampConfig) parseKubeConfig(w http.ResponseWriter, r *http.Request)
return
}

clientConfig := clientConfig{contexts, c.EnableDynamicClusters}
clientConfig := clientConfig{
Clusters: contexts,
IsDynamicClusterEnabled: c.EnableDynamicClusters,
PrometheusEndpoint: c.PrometheusEndpoint,
FiltersWarningsOnly: c.FiltersWarningsOnly,
}

if err := json.NewEncoder(w).Encode(&clientConfig); err != nil {
logger.Log(logger.LevelError, nil, err, "encoding config")
Expand Down
3 changes: 3 additions & 0 deletions backend/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ type Config struct {
UseOTLPHTTP *bool `koanf:"use-otlp-http"`
StdoutTraceEnabled *bool `koanf:"stdout-trace-enabled"`
SamplingRate *float64 `koanf:"sampling-rate"`
// FiltersWarningsOnly is the default state of the events filter (true = only warnings, false = all events).
FiltersWarningsOnly bool `koanf:"filters-warnings-only"`
Comment on lines +85 to +86
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FiltersWarningsOnly is added to the parsed Config and exposed as a CLI flag, but it also needs to be mapped into the runtime headlampconfig.HeadlampCFG (the struct used by /config via c.FiltersWarningsOnly). Currently the HeadlampCFG builder (in backend/cmd/server.go) does not set this field, so the value from flags/env will never reach the API response. Please wire conf.FiltersWarningsOnly into the HeadlampCFG construction so the frontend can receive the configured default.

Copilot uses AI. Check for mistakes.
// TLS config
TLSCertPath string `koanf:"tls-cert-path"`
TLSKeyPath string `koanf:"tls-key-path"`
Expand Down Expand Up @@ -448,6 +450,7 @@ func addGeneralFlags(f *flag.FlagSet) {
f.Uint("port", defaultPort, "Port to listen from")
f.String("proxy-urls", "", "Allow proxy requests to specified URLs")
f.Bool("enable-helm", false, "Enable Helm operations")
f.Bool("filters-warnings-only", true, "Whether to filter events by warnings only by default")
}

func addOIDCFlags(f *flag.FlagSet) {
Expand Down
2 changes: 2 additions & 0 deletions backend/pkg/headlampconfig/headlampConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ type HeadlampCFG struct {
TLSCertPath string
TLSKeyPath string
SessionTTL int
PrometheusEndpoint string
FiltersWarningsOnly bool
}
1 change: 1 addition & 0 deletions charts/headlamp/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ spec:
{{- with .Values.config.tlsKeyPath }}
- "-tls-key-path={{ . }}"
{{- end }}
- "-filters-warnings-only={{ .Values.config.events.warningsOnly }}"
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This argument directly renders .Values.config.events.warningsOnly without a default/with guard. If a user overrides config without the new events subtree (or sets it to {}), Helm can render <no value> here, producing an invalid -filters-warnings-only=<no value> flag and failing startup. Use default true (or conditionally emit the arg) to make the template robust.

Copilot uses AI. Check for mistakes.
{{- with .Values.config.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ spec:
- "-oidc-validator-client-id=$(OIDC_VALIDATOR_CLIENT_ID)"
# Check if validatorIssuerURL is non empty either from env or oidc.config
- "-oidc-validator-idp-issuer-url=$(OIDC_VALIDATOR_ISSUER_URL)"
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
1 change: 1 addition & 0 deletions charts/headlamp/tests/expected_templates/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ spec:
- "-plugins-dir=/headlamp/plugins"
- "-session-ttl=86400"
# Check if externalSecret is disabled
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
1 change: 1 addition & 0 deletions charts/headlamp/tests/expected_templates/extra-args.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ spec:
- "-plugins-dir=/headlamp/plugins"
- "-session-ttl=86400"
# Check if externalSecret is disabled
- "-filters-warnings-only=true"
- -insecure-ssl
ports:
- name: http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ spec:
- "-plugins-dir=/headlamp/plugins"
- "-session-ttl=86400"
# Check if externalSecret is disabled
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ spec:
- "-plugins-dir=/headlamp/plugins"
- "-session-ttl=86400"
# Check if externalSecret is disabled
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ spec:
- "-plugins-dir=/headlamp/plugins"
- "-session-ttl=86400"
# Check if externalSecret is disabled
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ spec:
- "-session-ttl=86400"
# Check if externalSecret is disabled
- "-me-user-info-url=$(ME_USER_INFO_URL)"
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ spec:
- "-session-ttl=86400"
# Check if externalSecret is disabled
- "-me-user-info-url=$(ME_USER_INFO_URL)"
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ spec:
- "-oidc-idp-issuer-url=$(OIDC_ISSUER_URL)"
# Check if scopes are non empty either from env or oidc.config
- "-oidc-scopes=$(OIDC_SCOPES)"
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ spec:
- "-plugins-dir=/headlamp/plugins"
- "-session-ttl=86400"
# Check if externalSecret is disabled
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ spec:
- "-oidc-idp-issuer-url=$(OIDC_ISSUER_URL)"
# Check if scopes are non empty either from env or oidc.config
- "-oidc-scopes=$(OIDC_SCOPES)"
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ spec:
- "-oidc-idp-issuer-url=$(OIDC_ISSUER_URL)"
# Check if scopes are non empty either from env or oidc.config
- "-oidc-scopes=$(OIDC_SCOPES)"
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ spec:
- "-oidc-idp-issuer-url=$(OIDC_ISSUER_URL)"
# Check if scopes are non empty either from env or oidc.config
- "-oidc-scopes=$(OIDC_SCOPES)"
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ spec:
- "-oidc-idp-issuer-url=$(OIDC_ISSUER_URL)"
# Check if scopes are non empty either from env or oidc.config
- "-oidc-scopes=$(OIDC_SCOPES)"
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ spec:
- "-oidc-client-secret=$(OIDC_CLIENT_SECRET)"
- "-oidc-idp-issuer-url=$(OIDC_ISSUER_URL)"
- "-oidc-scopes=$(OIDC_SCOPES)"
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
1 change: 1 addition & 0 deletions charts/headlamp/tests/expected_templates/oidc-pkce.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ spec:
# Check if scopes are non empty either from env or oidc.config
- "-oidc-scopes=$(OIDC_SCOPES)"
- "-oidc-use-pkce=$(OIDC_USE_PKCE)"
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ spec:
- "-oidc-validator-idp-issuer-url=$(OIDC_VALIDATOR_ISSUER_URL)"
# Check if useAccessToken is non false either from env or oidc.config
- "-oidc-use-access-token=$(OIDC_USE_ACCESS_TOKEN)"
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ spec:
- "-plugins-dir=/headlamp/plugins"
- "-session-ttl=86400"
# Check if externalSecret is disabled
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ spec:
- "-plugins-dir=/headlamp/plugins"
- "-session-ttl=86400"
# Check if externalSecret is disabled
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
1 change: 1 addition & 0 deletions charts/headlamp/tests/expected_templates/tls-added.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ spec:
# Check if externalSecret is disabled
- "-tls-cert-path=/headlamp-cert/headlamp-ca.crt"
- "-tls-key-path=/headlamp-cert/headlamp-tls.key"
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ spec:
- "-plugins-dir=/headlamp/plugins"
- "-session-ttl=86400"
# Check if externalSecret is disabled
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ spec:
- "-plugins-dir=/headlamp/plugins"
- "-session-ttl=86400"
# Check if externalSecret is disabled
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ spec:
- "-plugins-dir=/headlamp/plugins"
- "-session-ttl=86400"
# Check if externalSecret is disabled
- "-filters-warnings-only=true"
ports:
- name: http
containerPort: 4466
Expand Down
22 changes: 9 additions & 13 deletions charts/headlamp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ config:
baseURL: ""
# -- session token TTL in seconds (default is 24 hours)
sessionTTL: 86400
events:
# -- Whether to filter events by warnings only by default
warningsOnly: true
oidc:
# Option 1:
# @param config.oidc.secret - OIDC secret configuration
Expand Down Expand Up @@ -161,8 +164,7 @@ podLabels: {}
hostUsers: true

# -- Headlamp pod's Security Context
podSecurityContext:
{}
podSecurityContext: {}
# fsGroup: 2000

# -- Headlamp containers Security Context
Expand All @@ -184,7 +186,6 @@ securityContext:
# drop:
# - ALL


service:
# -- Annotations to add to the service
annotations: {}
Expand All @@ -211,8 +212,7 @@ persistentVolumeClaim:
# -- Enable Persistent Volume Claim
enabled: false
# -- Annotations to add to the persistent volume claim (if enabled)
annotations:
{}
annotations: {}
# -- accessModes for the persistent volume claim, eg: ReadWriteOnce, ReadOnlyMany, ReadWriteMany etc.
accessModes: []
# -- size of the persistent volume claim, eg: 10Gi. Required if enabled is true.
Expand All @@ -228,8 +228,7 @@ ingress:
# -- Enable ingress controller resource
enabled: false
# -- Annotations for Ingress resource
annotations:
{}
annotations: {}
# kubernetes.io/tls-acme: "true"

# -- Additional labels to add to the Ingress resource
Expand All @@ -242,8 +241,7 @@ ingress:

# -- Hostname(s) for the Ingress resource
# Please refer to https://kubernetes.io/docs/reference/kubernetes-api/service-resources/ingress-v1/#IngressSpec for more information.
hosts:
[]
hosts: []
# - host: chart-example.local
# paths:
# - path: /
Expand Down Expand Up @@ -288,8 +286,7 @@ httpRoute:
# port: 80

# -- CPU/Memory resource requests/limits
resources:
{}
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
Expand Down Expand Up @@ -353,8 +350,7 @@ pluginsManager:
# cpu: "1000m"
# memory: "4096Mi"
# If omitted, the plugin manager will inherit the global securityContext
securityContext:
{}
securityContext: {}
# runAsUser: 1001
# runAsNonRoot: true
# allowPrivilegeEscalation: false
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/cluster/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ export default function Overview() {

function EventsSection() {
const EVENT_WARNING_SWITCH_FILTER_STORAGE_KEY = 'EVENT_WARNING_SWITCH_FILTER_STORAGE_KEY';
const EVENT_WARNING_SWITCH_DEFAULT = true;
const filtersWarningsOnly = useTypedSelector(state => state.config.filtersWarningsOnly);
const EVENT_WARNING_SWITCH_DEFAULT = filtersWarningsOnly;
const { t } = useTranslation(['translation', 'glossary']);
const location = useLocation();
const queryParams = new URLSearchParams(location.search);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const makeStore = () => {
'cluster-a': { name: 'cluster-a' },
'cluster-b': { name: 'cluster-b' },
} as any,
filtersWarningsOnly: true,
settings: {
tableRowsPerPageOptions: [15, 25, 50],
timezone: 'UTC',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const makeStore = () => {
'cluster-a': { name: 'cluster-a' },
'cluster-b': { name: 'cluster-b' },
} as any,
filtersWarningsOnly: true,
settings: {
tableRowsPerPageOptions: [15, 25, 50],
timezone: 'UTC',
Expand Down
13 changes: 12 additions & 1 deletion frontend/src/redux/configSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export interface ConfigState {
allClusters: {
[clusterName: string]: Cluster;
} | null;
/**
* Whether to filter events by warnings only by default.
*/
filtersWarningsOnly: boolean;
/**
* Settings is a map of settings names to settings values.
*/
Expand Down Expand Up @@ -71,6 +75,7 @@ export const initialState: ConfigState = {
clusters: null,
statelessClusters: null,
allClusters: null,
filtersWarningsOnly: true,
settings: {
tableRowsPerPageOptions:
storedSettings.tableRowsPerPageOptions || defaultTableRowsPerPageOptions,
Expand All @@ -89,8 +94,14 @@ const configSlice = createSlice({
* @param state - The current state.
* @param action - The payload action containing the config.
*/
setConfig(state, action: PayloadAction<{ clusters: ConfigState['clusters'] }>) {
setConfig(
state,
action: PayloadAction<{ clusters: ConfigState['clusters']; filtersWarningsOnly?: boolean }>
) {
state.clusters = action.payload.clusters;
if (action.payload.filtersWarningsOnly !== undefined) {
state.filtersWarningsOnly = action.payload.filtersWarningsOnly;
}
},
Comment on lines 97 to 105
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setConfig now requires filtersWarningsOnly, but multiple call sites dispatch setConfig({ clusters }) (e.g. auth chooser) and unit tests also call it without this field. This will break TypeScript builds/tests, and the !== undefined guard is currently inconsistent with the payload type. Make filtersWarningsOnly optional in the action payload (or accept a broader partial config payload) and keep the default in initialState when it’s omitted; update the reducer tests accordingly.

Copilot uses AI. Check for mistakes.
/**
* Save the config. To both the store, and localStorage.
Expand Down
Loading