Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
074affca
Commit
074affca
authored
May 04, 2017
by
Chao Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy interal ObjectReference to k8s.io/metrics
parent
d23c7368
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
5 deletions
+37
-5
types.go
staging/src/k8s.io/metrics/pkg/apis/custom_metrics/types.go
+20
-2
types.go
staging/src/k8s.io/metrics/pkg/apis/metrics/types.go
+17
-3
No files found.
staging/src/k8s.io/metrics/pkg/apis/custom_metrics/types.go
View file @
074affca
...
@@ -19,7 +19,7 @@ package custom_metrics
...
@@ -19,7 +19,7 @@ package custom_metrics
import
(
import
(
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/api/resource"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/
client-go/pkg/api
"
"k8s.io/
apimachinery/pkg/types
"
)
)
// a list of values for a given metric for some set of objects
// a list of values for a given metric for some set of objects
...
@@ -36,7 +36,7 @@ type MetricValue struct {
...
@@ -36,7 +36,7 @@ type MetricValue struct {
metav1
.
TypeMeta
`json:",inline"`
metav1
.
TypeMeta
`json:",inline"`
// a reference to the described object
// a reference to the described object
DescribedObject
api
.
ObjectReference
`json:"describedObject"`
DescribedObject
ObjectReference
`json:"describedObject"`
// the name of the metric
// the name of the metric
MetricName
string
`json:"metricName"`
MetricName
string
`json:"metricName"`
...
@@ -57,3 +57,21 @@ type MetricValue struct {
...
@@ -57,3 +57,21 @@ type MetricValue struct {
// allObjects is a wildcard used to select metrics
// allObjects is a wildcard used to select metrics
// for all objects matching the given label selector
// for all objects matching the given label selector
const
AllObjects
=
"*"
const
AllObjects
=
"*"
// NOTE: ObjectReference is copied from k8s.io/kubernetes/pkg/api/types.go. We
// cannot depend on k8s.io/kubernetes/pkg/api because that creates cyclic
// dependency between k8s.io/metrics and k8s.io/kubernetes. We cannot depend on
// k8s.io/client-go/pkg/api because the package is going to be deprecated soon.
// There is no need to keep it an exact copy. Each repo can define its own
// internal objects.
// ObjectReference contains enough information to let you inspect or modify the referred object.
type
ObjectReference
struct
{
Kind
string
Namespace
string
Name
string
UID
types
.
UID
APIVersion
string
ResourceVersion
string
FieldPath
string
}
staging/src/k8s.io/metrics/pkg/apis/metrics/types.go
View file @
074affca
...
@@ -17,8 +17,8 @@ limitations under the License.
...
@@ -17,8 +17,8 @@ limitations under the License.
package
metrics
package
metrics
import
(
import
(
"k8s.io/apimachinery/pkg/api/resource"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/pkg/api"
)
)
// +genclient=true
// +genclient=true
...
@@ -37,7 +37,7 @@ type NodeMetrics struct {
...
@@ -37,7 +37,7 @@ type NodeMetrics struct {
Window
metav1
.
Duration
Window
metav1
.
Duration
// The memory usage is the memory working set.
// The memory usage is the memory working set.
Usage
api
.
ResourceList
Usage
ResourceList
}
}
// NodeMetricsList is a list of NodeMetrics.
// NodeMetricsList is a list of NodeMetrics.
...
@@ -85,5 +85,19 @@ type ContainerMetrics struct {
...
@@ -85,5 +85,19 @@ type ContainerMetrics struct {
// Container name corresponding to the one from pod.spec.containers.
// Container name corresponding to the one from pod.spec.containers.
Name
string
Name
string
// The memory usage is the memory working set.
// The memory usage is the memory working set.
Usage
api
.
ResourceList
Usage
ResourceList
}
}
// NOTE: ResourceName and ResourceList are copied from
// k8s.io/kubernetes/pkg/api/types.go. We cannot depend on
// k8s.io/kubernetes/pkg/api because that creates cyclic dependency between
// k8s.io/metrics and k8s.io/kubernetes. We cannot depend on
// k8s.io/client-go/pkg/api because the package is going to be deprecated soon.
// There is no need to keep them exact copies. Each repo can define its own
// internal objects.
// ResourceList is a set of (resource name, quantity) pairs.
type
ResourceList
map
[
ResourceName
]
resource
.
Quantity
// ResourceName is the name identifying various resources in a ResourceList.
type
ResourceName
string
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment