Skip to content

Commit

Permalink
delete env SYSTEM_NAMESPACE FROM operator.
Browse files Browse the repository at this point in the history
  • Loading branch information
liangyuanpeng committed Aug 17, 2024
1 parent 38890cd commit 45c199d
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import (

"sigs.k8s.io/karpenter/pkg/cloudprovider"
"sigs.k8s.io/karpenter/pkg/events"
"sigs.k8s.io/karpenter/pkg/utils/env"

"sigs.k8s.io/karpenter/pkg/metrics"

Expand Down Expand Up @@ -113,22 +112,6 @@ type Operator struct {
func NewOperator() (context.Context, *Operator) {
// Root Context
ctx := signals.NewContext()
sysnsKey := "SYSTEM_NAMESPACE"
systemNamespace := env.WithDefaultString(sysnsKey, "")
if systemNamespace == "" {
panic(fmt.Sprintf(`The environment variable %q is not set
If this is a process running on Kubernetes, then it should be using the downward
API to initialize this variable via:
env:
- name: %s
valueFrom:
fieldRef:
fieldPath: metadata.namespace
`, sysnsKey, sysnsKey))
}
ctx = knativeinjection.WithNamespaceScope(ctx, systemNamespace)

// Options
ctx = injection.WithOptionsOrDie(ctx, options.Injectables...)
Expand Down Expand Up @@ -169,7 +152,6 @@ func NewOperator() (context.Context, *Operator) {
LeaderElection: !options.FromContext(ctx).DisableLeaderElection,
LeaderElectionID: "karpenter-leader-election",
LeaderElectionResourceLock: resourcelock.LeasesResourceLock,
LeaderElectionNamespace: systemNamespace,
LeaderElectionReleaseOnCancel: true,
Metrics: server.Options{
BindAddress: fmt.Sprintf(":%d", options.FromContext(ctx).MetricsPort),
Expand Down

0 comments on commit 45c199d

Please sign in to comment.