forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate oom watcher not relying on cAdviosr any more, it is part of plan
of removing cAdvisor from k8s. For more informations about this plan, please refer: kubernetes#68522
- Loading branch information
1 parent
6af2e9a
commit b2ce446
Showing
7 changed files
with
167 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = [ | ||
"oom_watcher_linux.go", | ||
"oom_watcher_unsupported.go", | ||
"types.go", | ||
], | ||
importpath = "k8s.io/kubernetes/pkg/kubelet/oom", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//staging/src/k8s.io/api/core/v1:go_default_library", | ||
] + select({ | ||
"@io_bazel_rules_go//go/platform:android": [ | ||
"//staging/src/k8s.io/client-go/tools/record:go_default_library", | ||
], | ||
"@io_bazel_rules_go//go/platform:darwin": [ | ||
"//staging/src/k8s.io/client-go/tools/record:go_default_library", | ||
], | ||
"@io_bazel_rules_go//go/platform:dragonfly": [ | ||
"//staging/src/k8s.io/client-go/tools/record:go_default_library", | ||
], | ||
"@io_bazel_rules_go//go/platform:freebsd": [ | ||
"//staging/src/k8s.io/client-go/tools/record:go_default_library", | ||
], | ||
"@io_bazel_rules_go//go/platform:linux": [ | ||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", | ||
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library", | ||
"//staging/src/k8s.io/client-go/tools/record:go_default_library", | ||
"//vendor/github.com/google/cadvisor/utils/oomparser:go_default_library", | ||
"//vendor/k8s.io/klog:go_default_library", | ||
], | ||
"@io_bazel_rules_go//go/platform:nacl": [ | ||
"//staging/src/k8s.io/client-go/tools/record:go_default_library", | ||
], | ||
"@io_bazel_rules_go//go/platform:netbsd": [ | ||
"//staging/src/k8s.io/client-go/tools/record:go_default_library", | ||
], | ||
"@io_bazel_rules_go//go/platform:openbsd": [ | ||
"//staging/src/k8s.io/client-go/tools/record:go_default_library", | ||
], | ||
"@io_bazel_rules_go//go/platform:plan9": [ | ||
"//staging/src/k8s.io/client-go/tools/record:go_default_library", | ||
], | ||
"@io_bazel_rules_go//go/platform:solaris": [ | ||
"//staging/src/k8s.io/client-go/tools/record:go_default_library", | ||
], | ||
"@io_bazel_rules_go//go/platform:windows": [ | ||
"//staging/src/k8s.io/client-go/tools/record:go_default_library", | ||
], | ||
"//conditions:default": [], | ||
}), | ||
) | ||
|
||
go_test( | ||
name = "go_default_test", | ||
srcs = ["oom_watcher_linux_test.go"], | ||
embed = [":go_default_library"], | ||
deps = select({ | ||
"@io_bazel_rules_go//go/platform:linux": [ | ||
"//staging/src/k8s.io/api/core/v1:go_default_library", | ||
"//staging/src/k8s.io/client-go/tools/record:go_default_library", | ||
"//vendor/github.com/stretchr/testify/assert:go_default_library", | ||
], | ||
"//conditions:default": [], | ||
}), | ||
) | ||
|
||
filegroup( | ||
name = "package-srcs", | ||
srcs = glob(["**"]), | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
filegroup( | ||
name = "all-srcs", | ||
srcs = [":package-srcs"], | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// +build !linux | ||
|
||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package oom | ||
|
||
import ( | ||
"k8s.io/api/core/v1" | ||
"k8s.io/client-go/tools/record" | ||
) | ||
|
||
type oomWatcherUnsupported struct{} | ||
|
||
var _ OOMWatcher = new(oomWatcherUnsupported) | ||
|
||
func NewOOMWatcher(_ record.EventRecorder) OOMWatcher { | ||
return &oomWatcherUnsupported{} | ||
} | ||
|
||
func (ow *oomWatcherUnsupported) Start(_ *v1.ObjectReference) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package oom | ||
|
||
import ( | ||
"k8s.io/api/core/v1" | ||
) | ||
|
||
// OOMWatcher defines the interface of OOM watchers. | ||
type OOMWatcher interface { | ||
Start(ref *v1.ObjectReference) error | ||
} |