Skip to content

Commit a338c20

Browse files
authored
Fix npe in bind address & add kubeconfig (#503)
1 parent f0a6bcb commit a338c20

5 files changed

Lines changed: 20 additions & 1 deletion

File tree

backend/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,9 @@ func (s *Server) GetOIDCProvider(ctx context.Context) (*auth.OIDCServiceProvider
357357
}
358358

359359
func (s *Server) Addr() net.Addr {
360+
if s.WebServer == nil {
361+
return nil
362+
}
360363
return s.WebServer.Addr()
361364
}
362365

cmd/backend/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ func run(ctx context.Context) error {
9898
if err := server.Run(ctx); err != nil {
9999
return err
100100
}
101-
logger.Info("Listening", "address", server.Addr())
101+
if addr := server.Addr(); addr != nil {
102+
logger.Info("Listening", "address", addr)
103+
} else {
104+
logger.Info("Running in backend-only mode (no HTTP frontend)")
105+
}
102106

103107
<-ctx.Done()
104108

deploy/charts/backend/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ See [values.yaml](values.yaml) for the full list of configurable parameters.
2727
| backend.apiexportEndpointSliceName | string | `""` | APIExport EndpointSlice name to watch |
2828
| backend.clusterScopeIsolation | string | `"prefix"` | Cluster-scope isolation mode. Options: none, prefix, namespaced |
2929
| backend.consumerScope | string | `"namespaced"` | Consumer scope. Options: "namespaced" |
30+
| backend.context | string | `""` | The name of the kubeconfig context to use |
3031
| backend.cookieEncryptionKey | string | `""` | Cookie encryption key (base64 encoded). Empty generates random key on each start (not for production!) |
3132
| backend.cookieSigningKey | string | `""` | Cookie signing key (base64 encoded). Empty generates random key on each start (not for production!) |
3233
| backend.externalAddress | string | `""` | External address clients use to reach the backend |
3334
| backend.externalServerName | string | `""` | External server name for TLS SNI |
3435
| backend.extraArgs | list | `[]` | Extra command-line arguments to pass to the backend |
3536
| backend.frontendDisabled | bool | `false` | Disable the frontend UI |
37+
| backend.kubeconfig | string | `""` | Path to a kubeconfig file. Only required if out-of-cluster |
3638
| backend.listenAddress | string | `"0.0.0.0:8080"` | Address the backend listens on |
3739
| backend.loggingLevel | int | `2` | Logging verbosity level |
3840
| backend.multiclusterRuntimeProvider | string | `""` | Multicluster runtime provider (e.g., "kcp") |

deploy/charts/backend/templates/deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ spec:
5858
{{- end }}
5959
args:
6060
- --listen-address={{ .Values.backend.listenAddress }}
61+
{{- if .Values.backend.kubeconfig }}
62+
- --kubeconfig={{ .Values.backend.kubeconfig }}
63+
{{- end }}
64+
{{- if .Values.backend.context }}
65+
- --context={{ .Values.backend.context }}
66+
{{- end }}
6167
{{- if .Values.backend.logLevel }}
6268
- --log-level={{ .Values.backend.logLevel }}
6369
{{- end }}

deploy/charts/backend/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ replicaCount: 1
99
backend:
1010
# -- Address the backend listens on
1111
listenAddress: "0.0.0.0:8080"
12+
# -- Path to a kubeconfig file. Only required if out-of-cluster
13+
kubeconfig: ""
14+
# -- The name of the kubeconfig context to use
15+
context: ""
1216
# -- External address clients use to reach the backend
1317
externalAddress: ""
1418
# -- External server name for TLS SNI

0 commit comments

Comments
 (0)