Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cleanup some knative const #1571

Closed
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
4 changes: 1 addition & 3 deletions pkg/operator/logging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import (
"go.uber.org/zap/zapcore"
"knative.dev/pkg/changeset"

"knative.dev/pkg/logging/logkey"

"sigs.k8s.io/karpenter/pkg/operator/options"
)

Expand Down Expand Up @@ -84,7 +82,7 @@ func WithCommit(logger *zap.Logger) *zap.Logger {
return logger
}
// Enrich logs with the components git revision.
return logger.With(zap.String(logkey.Commit, revision))
return logger.With(zap.String("commit", revision))
}

type ignoreDebugEventsSink struct {
Expand Down
3 changes: 0 additions & 3 deletions pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import (
"k8s.io/utils/clock"
knativeinjection "knative.dev/pkg/injection"
"knative.dev/pkg/signals"
"knative.dev/pkg/system"
"knative.dev/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -113,7 +112,6 @@ type Operator struct {
func NewOperator() (context.Context, *Operator) {
// Root Context
ctx := signals.NewContext()
ctx = knativeinjection.WithNamespaceScope(ctx, system.Namespace())

// Options
ctx = injection.WithOptionsOrDie(ctx, options.Injectables...)
Expand Down Expand Up @@ -154,7 +152,6 @@ func NewOperator() (context.Context, *Operator) {
LeaderElection: !options.FromContext(ctx).DisableLeaderElection,
LeaderElectionID: "karpenter-leader-election",
LeaderElectionResourceLock: resourcelock.LeasesResourceLock,
LeaderElectionNamespace: system.Namespace(),
LeaderElectionReleaseOnCancel: true,
Metrics: server.Options{
BindAddress: fmt.Sprintf(":%d", options.FromContext(ctx).MetricsPort),
Expand Down
3 changes: 0 additions & 3 deletions pkg/test/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package test
import (
"context"
"log"
"os"
"strings"

"github.com/awslabs/operatorpkg/option"
Expand All @@ -30,7 +29,6 @@ import (
"k8s.io/apimachinery/pkg/util/version"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
"knative.dev/pkg/system"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
Expand Down Expand Up @@ -88,7 +86,6 @@ func NewEnvironment(options ...option.Function[EnvironmentOptions]) *Environment
opts := option.Resolve(options...)
ctx, cancel := context.WithCancel(context.Background())

os.Setenv(system.NamespaceEnvKey, "default")
version := version.MustParseSemantic(strings.Replace(env.WithDefaultString("K8S_VERSION", "1.30.x"), ".x", ".0", -1))
environment := envtest.Environment{Scheme: scheme.Scheme, CRDs: opts.crds}
if version.Minor() >= 21 {
Expand Down
2 changes: 0 additions & 2 deletions test/pkg/environment/common/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import (
. "sigs.k8s.io/karpenter/pkg/utils/testing" //nolint:stylecheck
"sigs.k8s.io/karpenter/test/pkg/debug"

"knative.dev/pkg/system"
controllerruntime "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -77,7 +76,6 @@ func NewEnvironment(t *testing.T) *Environment {
config := NewConfig()
client := NewClient(ctx, config)

lo.Must0(os.Setenv(system.NamespaceEnvKey, "kube-system"))
if val, ok := os.LookupEnv("GIT_REF"); ok {
ctx = context.WithValue(ctx, GitRefContextKey, val)
}
Expand Down
Loading