Compare commits

...

8 Commits

Author SHA1 Message Date
Kubernetes Publisher
df46f7f13b sync(k8s.io/kubernetes) ebb8d6e0fadfc95f3d64ccecc36c8ed2ac9224ef 2017-07-07 20:27:35 +00:00
Chao Xu
684c9f06e8 Kubernetes version v1.7.1-beta.0 file updates
Kubernetes-commit: ebb8d6e0fadfc95f3d64ccecc36c8ed2ac9224ef
2017-07-07 20:27:35 +00:00
Chao Xu
e356aa2e77 Kubernetes version v1.7.0 file updates
Kubernetes-commit: d3ada0119e776222f11ec7945e6d860061339aad
2017-07-07 20:27:35 +00:00
Nikhita Raghunath
d8822e0597 Update CR example in client-go
Remove custom-resources directory from client-go

Add TPR example back

Mention CRD is successor to TPR

Kubernetes-commit: b0504c6bff0ea5f923f935a4844e1eeab0ae5405
2017-07-07 20:27:35 +00:00
Chao Xu
e83269bc2b Kubernetes version v1.7.0-rc.1 file updates
Kubernetes-commit: 6b9ded1649cfb512d4e88570c738aca9f8265639
2017-07-07 20:27:35 +00:00
Seth Jennings
382c391988 include object fieldpath in event key
Kubernetes-commit: dee9955b8c120cdbc8b235ec9278fe8c9fceba2f
2017-07-07 20:27:34 +00:00
Nikhita Raghunath
eddc268ce3 Fix typo in cross-repo link
Kubernetes-commit: ddfd2e0b1498249e0ee5fa710110f9ee4062c36a
2017-07-07 20:27:34 +00:00
Chao Xu
63a56d7439 Kubernetes version v1.7.0-beta.2 file updates
Kubernetes-commit: ceab7f7a6753c20d3be75463b17402fdcea856ba
2017-07-07 20:27:34 +00:00
6 changed files with 20 additions and 13 deletions

View File

@@ -20,9 +20,12 @@ for client-go.
- [**Work queues**](./workqueue): Create a hotloop-free controller with the
rate-limited workqueue and the [informer framework][informer].
- [**Third-party resources (deprecated)**](./third-party-resources-deprecated):
Register a third-party resource type with the API, create/update/query this third-party
type, and write a controller that drives the cluster state based on the changes to
the third-party resources.
- [**Custom Resource Definition (successor of TPR)**](https://git.k8s.io/apiextensions-apiserver/examples/client-go):
Register a custom resource type with the API, create/update/query this custom
type, and write a controller drives the cluster state based on the changes to
type, and write a controller that drives the cluster state based on the changes to
the custom resources.
[informer]: https://godoc.org/k8s.io/client-go/tools/cache#NewInformer

View File

@@ -1,7 +0,0 @@
# Custom Resource Example
**Note:** CustomResourceDefinition is the successor of the deprecated ThirdPartyResource.
For a client-go example using CustomResourceDefinitions, go to
[k8s.io/apiextensions-apiserver/examples/client-go](https://git.k8s.io/apiextentions-apiserver/examples/client-go).

View File

@@ -1 +1 @@
797dc10a0ccd89bec0b29c41613025035ed23a0f
ebb8d6e0fadfc95f3d64ccecc36c8ed2ac9224ef

View File

@@ -39,8 +39,8 @@ var (
// them irrelevant. (Next we'll take it out, which may muck with
// scripts consuming the kubectl version output - but most of
// these should be looking at gitVersion already anyways.)
gitMajor string = "" // major version, always numeric
gitMinor string = "" // minor version, numeric possibly followed by "+"
gitMajor string = "1" // major version, always numeric
gitMinor string = "7+" // minor version, numeric possibly followed by "+"
// semantic version, derived by build scripts (see
// https://github.com/kubernetes/kubernetes/blob/master/docs/design/versioning.md
@@ -51,7 +51,7 @@ var (
// semantic version is a git hash, but the version itself is no
// longer the direct output of "git describe", but a slight
// translation to be semver compliant.
gitVersion string = "v0.0.0-master+$Format:%h$"
gitVersion string = "v1.7.1-beta.0+$Format:%h$"
gitCommit string = "$Format:%H$" // sha1 from git, output of $(git rev-parse HEAD)
gitTreeState string = "not a git tree" // state of git tree, either "clean" or "dirty"

View File

@@ -49,6 +49,7 @@ func getEventKey(event *v1.Event) string {
event.InvolvedObject.Kind,
event.InvolvedObject.Namespace,
event.InvolvedObject.Name,
event.InvolvedObject.FieldPath,
string(event.InvolvedObject.UID),
event.InvolvedObject.APIVersion,
event.Type,

View File

@@ -35,6 +35,7 @@ func makeObjectReference(kind, name, namespace string) v1.ObjectReference {
Namespace: namespace,
UID: "C934D34AFB20242",
APIVersion: "version",
FieldPath: "spec.containers{mycontainer}",
}
}
@@ -171,7 +172,10 @@ func TestEventCorrelator(t *testing.T) {
duplicateEvent := makeEvent("duplicate", "me again", makeObjectReference("Pod", "my-pod", "my-ns"))
uniqueEvent := makeEvent("unique", "snowflake", makeObjectReference("Pod", "my-pod", "my-ns"))
similarEvent := makeEvent("similar", "similar message", makeObjectReference("Pod", "my-pod", "my-ns"))
similarEvent.InvolvedObject.FieldPath = "spec.containers{container1}"
aggregateEvent := makeEvent(similarEvent.Reason, EventAggregatorByReasonMessageFunc(&similarEvent), similarEvent.InvolvedObject)
similarButDifferentContainerEvent := similarEvent
similarButDifferentContainerEvent.InvolvedObject.FieldPath = "spec.containers{container2}"
scenario := map[string]struct {
previousEvents []v1.Event
newEvent v1.Event
@@ -214,6 +218,12 @@ func TestEventCorrelator(t *testing.T) {
expectedEvent: setCount(aggregateEvent, 2),
intervalSeconds: 5,
},
"events-from-different-containers-do-not-aggregate": {
previousEvents: makeEvents(1, similarButDifferentContainerEvent),
newEvent: similarEvent,
expectedEvent: setCount(similarEvent, 1),
intervalSeconds: 5,
},
"similar-events-whose-interval-is-greater-than-aggregate-interval-do-not-aggregate": {
previousEvents: makeSimilarEvents(defaultAggregateMaxEvents-1, similarEvent, similarEvent.Message),
newEvent: similarEvent,