Skip to content

Commit

Permalink
Merge pull request #46 from nikhita/update-aug-18
Browse files Browse the repository at this point in the history
update for final evaluation
  • Loading branch information
nikhita committed Aug 23, 2017
2 parents bb9c331 + f9b0c80 commit 3225510
Show file tree
Hide file tree
Showing 19 changed files with 597 additions and 28 deletions.
116 changes: 88 additions & 28 deletions README.md
Expand Up @@ -65,31 +65,91 @@ Note: I have decided not to write weekly updates as blog posts anymore but to in
+ [GSoC with Kubernetes - Week 2 and 3](https://nikhita.github.io/google-summer-of-code-kubernetes-week2-3-community-bonding)


## Related Pull Requests/Issues

TODO: Add other PRs/issues

+ [#44026](https://github.com/kubernetes/kubernetes/pull/44026) - Preserve int data when unmarshalling for TPR
+ [#44612](https://github.com/kubernetes/kubernetes/pull/44612) - Fix kube-apiserver crash when patching TPR data
+ [#45721](https://github.com/kubernetes/kubernetes/pull/45721) - Add integration tests for kube-apiextensions-server
+ [#45793](https://github.com/kubernetes/kubernetes/pull/45793) - Add plural name for CustomResources example
+ [#46059](https://github.com/kubernetes/kubernetes/pull/46059) - Integration test for kube-apiextensions-server: integers
+ [#46200](https://github.com/kubernetes/kubernetes/pull/46200) - Add integration test for name conflicts
+ [#46585](https://github.com/kubernetes/kubernetes/pull/46585) - [WIP] Add integration test for GC (blocked on [#46000](https://github.com/kubernetes/kubernetes/pull/46000))
+ [#46624](https://github.com/kubernetes/kubernetes/pull/46624) - Add test for advanced CRUD for apiextensions
+ [#47263](https://github.com/kubernetes/kubernetes/pull/47263) - [WIP] apiextensions: validation of CustomResources
+ [#61](https://github.com/kubernetes/gengo/pull/61) - Fix defaulter codegen for recursive types
+ [#3](https://github.com/nikhita/kubernetes/pull/3) - Fix for code generation in kube
+ [#1](https://github.com/caesarxuchao/gengo/pull/1) - Add tests for recursive types in defaulter-gen
+ [#708](https://github.com/kubernetes/community/pull/708) - Proposal: Validation for CustomResources
+ [#47684](https://github.com/kubernetes/kubernetes/pull/47684) - Fix link to apiextensions client-go example
+ [#47748](https://github.com/kubernetes/kubernetes/pull/47748) - Update client-go to point to CR example
+ [#47743](https://github.com/kubernetes/kubernetes/issues/47743) - No examples for CR in client-go
+ [#48076](https://github.com/kubernetes/kubernetes/pull/48076) - Fix error in local-up-cluster
+ [#48114](https://github.com/kubernetes/kubernetes/pull/48114) - Automated cherry pick of #47748
+ [#48389](https://github.com/kubernetes/kubernetes/pull/48389) - Add cleanup section to client-go
+ [#48630](https://github.com/kubernetes/kubernetes/pull/48630) - update vendored gengo
+ [#49307](https://github.com/kubernetes/kubernetes/pull/49307) - fuzzer: remove unreachable code
+ [#49747](https://github.com/kubernetes/kubernetes/pull/49747) - conversion-gen: support recursive types
+ [#50098](https://github.com/kubernetes/kubernetes/pull/50098) - apiextensions: fix data race in storage
+ [#50250](https://github.com/kubernetes/kubernetes/pull/50250) - Automated cherry pick of #50098
## Pull Requests and Issues

The following list is automatically generated using https://github.com/nikhita/github-contrib.

**Repository: kubernetes**

Total Pull Requests Created: 27
1. [kubernetes/kubernetes#50964](https://github.com/kubernetes/kubernetes/pull/50964) - Update Registry interface for deployment and endpoints
2. [kubernetes/kubernetes#50764](https://github.com/kubernetes/kubernetes/pull/50764) - apiextensions: update CRD strategy
3. [kubernetes/kubernetes#50638](https://github.com/kubernetes/kubernetes/pull/50638) - FeatureGate: update comments
4. [kubernetes/kubernetes#50444](https://github.com/kubernetes/kubernetes/pull/50444) - jsonpath: fix comments
5. [kubernetes/kubernetes#50250](https://github.com/kubernetes/kubernetes/pull/50250) - Automated cherry pick of #50098
6. [kubernetes/kubernetes#50098](https://github.com/kubernetes/kubernetes/pull/50098) - apiextensions: fix data race in storage
7. [kubernetes/kubernetes#50085](https://github.com/kubernetes/kubernetes/pull/50085) - fix kube-openapi imports
8. [kubernetes/kubernetes#49747](https://github.com/kubernetes/kubernetes/pull/49747) - conversion-gen: support recursive types
9. [kubernetes/kubernetes#49307](https://github.com/kubernetes/kubernetes/pull/49307) - fuzzer: remove unreachable code
10. [kubernetes/kubernetes#48630](https://github.com/kubernetes/kubernetes/pull/48630) - update vendored gengo
11. [kubernetes/kubernetes#48389](https://github.com/kubernetes/kubernetes/pull/48389) - apiextensions: add cleanup section to client-go
12. [kubernetes/kubernetes#48114](https://github.com/kubernetes/kubernetes/pull/48114) - Automated cherry pick of #47748
13. [kubernetes/kubernetes#48076](https://github.com/kubernetes/kubernetes/pull/48076) - Fix error in local-cluster-up
14. [kubernetes/kubernetes#47748](https://github.com/kubernetes/kubernetes/pull/47748) - Update custom-resources example in client-go
15. [kubernetes/kubernetes#47684](https://github.com/kubernetes/kubernetes/pull/47684) - Fix link to apiextensions client-go example
16. [kubernetes/kubernetes#47263](https://github.com/kubernetes/kubernetes/pull/47263) - apiextensions: validation for customresources
17. [kubernetes/kubernetes#46624](https://github.com/kubernetes/kubernetes/pull/46624) - Add test for advanced CRUD for apiextensions
18. [kubernetes/kubernetes#46585](https://github.com/kubernetes/kubernetes/pull/46585) - [WIP] apiextensions: add integration test for GC
19. [kubernetes/kubernetes#46200](https://github.com/kubernetes/kubernetes/pull/46200) - apiextensions: add integration test for name conflicts
20. [kubernetes/kubernetes#46059](https://github.com/kubernetes/kubernetes/pull/46059) - Integration test for kube-apiextensions-server: integers
21. [kubernetes/kubernetes#45793](https://github.com/kubernetes/kubernetes/pull/45793) - Add plural name for CustomResources example
22. [kubernetes/kubernetes#45721](https://github.com/kubernetes/kubernetes/pull/45721) - Add integration tests for kube-apiextensions-server
23. [kubernetes/kubernetes#44612](https://github.com/kubernetes/kubernetes/pull/44612) - Fix kube-apiserver crash when patching TPR data
24. [kubernetes/kubernetes#44026](https://github.com/kubernetes/kubernetes/pull/44026) - Preserve int data when unmarshalling for TPR
25. [kubernetes/kubernetes#43606](https://github.com/kubernetes/kubernetes/pull/43606) - Improve timeout error message for kubectl delete
26. [kubernetes/kubernetes#43591](https://github.com/kubernetes/kubernetes/pull/43591) - Update `kubectl help` descriptions and examples
27. [kubernetes/kubernetes#43573](https://github.com/kubernetes/kubernetes/pull/43573) - fixed formatting for examples README.md

Total Issues Opened: 4
1. [kubernetes/kubernetes#49811](https://github.com/kubernetes/kubernetes/issues/49811) - api-reference docs don't contain types from staging repos
2. [kubernetes/kubernetes#48675](https://github.com/kubernetes/kubernetes/issues/48675) - Auto-generation by deepcopy is broken
3. [kubernetes/kubernetes#48593](https://github.com/kubernetes/kubernetes/issues/48593) - hack/godep-save.sh pulls down docker/docker/project dir
4. [kubernetes/kubernetes#47743](https://github.com/kubernetes/kubernetes/issues/47743) - No examples for CR in client-go

Total Pull Requests Reviewed: 2
1. [kubernetes/kubernetes#47223](https://github.com/kubernetes/kubernetes/pull/47223) - Fix cross-repo link
2. [kubernetes/kubernetes#46439](https://github.com/kubernetes/kubernetes/pull/46439) - Test finalization for CRs


**Repository: helm**

Total Pull Requests Created: 1
1. [kubernetes/helm#2523](https://github.com/kubernetes/helm/pull/2523) - fix(helm): Fix log import


**Repository: kubernetes.github.io**

Total Pull Requests Created: 2
1. [kubernetes/kubernetes.github.io#4986](https://github.com/kubernetes/kubernetes.github.io/pull/4986) - JSONPath: rename title
2. [kubernetes/kubernetes.github.io#2791](https://github.com/kubernetes/kubernetes.github.io/pull/2791) - Fixed typo


**Repository: test-infra**

Total Issues Opened: 1
1. [kubernetes/test-infra#2787](https://github.com/kubernetes/test-infra/issues/2787) - Prow issue: Keep hitting a flake


**Repository: community**

Total Pull Requests Created: 7
1. [kubernetes/community#913](https://github.com/kubernetes/community/pull/913) - Proposal: SubResources for CustomResources
2. [kubernetes/community#882](https://github.com/kubernetes/community/pull/882) - api-conventions: status subresource updates metadata
3. [kubernetes/community#779](https://github.com/kubernetes/community/pull/779) - Fix link to point to English docs instead of Chinese
4. [kubernetes/community#766](https://github.com/kubernetes/community/pull/766) - Fix minor typos in cherry-picks doc
5. [kubernetes/community#708](https://github.com/kubernetes/community/pull/708) - Proposal: Validation for CustomResources.
6. [kubernetes/community#621](https://github.com/kubernetes/community/pull/621) - Fix link for factory methods of informers
7. [kubernetes/community#448](https://github.com/kubernetes/community/pull/448) - Fix link to contributing instructions


**Repository: client-go**

Total Pull Requests Created: 2
1. [kubernetes/client-go#274](https://github.com/kubernetes/client-go/pull/274) - README: remove non-existent update-staging-client-go.sh
2. [kubernetes/client-go#212](https://github.com/kubernetes/client-go/pull/212) - README: fix script to update staging area


**Repository: gengo**

Total Pull Requests Created: 1
1. [kubernetes/gengo#61](https://github.com/kubernetes/gengo/pull/61) - Fix defaulter-gen for recursive types
22 changes: 22 additions & 0 deletions notes/go-jsonschema-validator-benchmark/go-jsonschema_test.go
@@ -0,0 +1,22 @@
package validator_test

import (
"testing"

"github.com/xeipuuv/gojsonschema"
)

func BenchmarkGoJSONSchema(b *testing.B) {
schemaLoader := gojsonschema.NewReferenceLoader("schema4.json")
documentLoader := gojsonschema.NewReferenceLoader("valid.json")

for i := 0; i < b.N; i++ {
result, err := gojsonschema.Validate(schemaLoader, documentLoader)
if err != nil {
b.Error(err)
}
if !result.Valid() {
b.Errorf("It is invalid!!!")
}
}
}
50 changes: 50 additions & 0 deletions notes/go-jsonschema-validator-benchmark/go-openapi_test.go
@@ -0,0 +1,50 @@
package validator_test

import (
"encoding/json"
"fmt"
"testing"

"io/ioutil"

"github.com/go-openapi/spec"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/validate"
)

type schemaTestT struct {
Description string `json:"description"`
Schema *spec.Schema `json:"schema"`
Tests []struct {
Description string `json:"description"`
Data interface{} `json:"data"`
Valid bool `json:"valid"`
}
}

func TestOpenAPI(t *testing.T) {
file, _ := ioutil.ReadFile("openapi-data.json")
var testDescriptions []schemaTestT
json.Unmarshal(file, &testDescriptions)

for _, testDescription := range testDescriptions {
// Expand the refs
err := spec.ExpandSchema(testDescription.Schema, nil, nil /*new(noopResCache)*/)
if err != nil {
t.Errorf("should expland clearly: %v", err)
}

// create the validator
validator := validate.NewSchemaValidator(testDescription.Schema, nil, "data", strfmt.Default)

// validate against each test
for _, test := range testDescription.Tests {
result := validator.Validate(test.Data)
fmt.Println(test.Data)
if result.AsError() != nil {
t.Error(result.AsError())
}
}

}
}
12 changes: 12 additions & 0 deletions notes/go-jsonschema-validator-benchmark/gojsonschema-benchmark.md
@@ -0,0 +1,12 @@
## Benchmarks

Bechmarks for validation using:
1. go-openapi
2. go-jsonschema

Note: The files in this directory were *not* used for testing. Standard test data for JSON Schema validation was used. However, the JSON files in this directory are provided as examples.

```
BenchmarkOpenAPI-4 5000 240116 ns/op 71790 B/op 649 allocs/op
BenchmarkGoJSONSchema-4 5000 314191 ns/op 66629 B/op 965 allocs/op
```
29 changes: 29 additions & 0 deletions notes/go-jsonschema-validator-benchmark/openapi-data.json
@@ -0,0 +1,29 @@
[
{
"description": "maximum validation",
"schema": {
"$schema": "http: //json-schema.org/draft-04/schema#",
"type": "object",
"description": "This is an example schema",
"required": [
"foo"
],
"properties": {
"foo": {
"description": "Foo is a string",
"type": "string",
"default": "abc"
}
}
},
"tests": [
{
"description": "below the maximum is valid",
"bar": {
"foo": "hello"
},
"valid": true
}
]
}
]
24 changes: 24 additions & 0 deletions notes/go-jsonschema-validator-benchmark/schema.json
@@ -0,0 +1,24 @@
{
"name" : "test",
"type" : "object",
"additionalProperties" : false,
"required" : ["fullName", "age", "zip", "married", "dozen", "dozenOrBakersDozen", "favoriteEvenNumber", "topThreeFavoriteColors", "favoriteSingleDigitWholeNumbers", "favoriteFiveLetterWord", "emailAddresses", "ipAddresses"],
"properties" :
{
"fullName" : { "type" : "string" },
"age" : { "type" : "integer", "minimum" : 0 },
"optionalItem" : { "type" : "string" },
"state" : { "type" : "string" },
"city" : { "type" : "string" },
"zip" : { "type" : "integer", "minimum" : 0, "maximum" : 99999 },
"married" : { "type" : "boolean" },
"dozen" : { "type" : "integer", "minimum" : 12, "maximum" : 12 },
"dozenOrBakersDozen" : { "type" : "integer", "minimum" : 12, "maximum" : 13 },
"favoriteEvenNumber" : { "type" : "integer", "multipleOf" : 2 },
"topThreeFavoriteColors" : { "type" : "array", "minItems" : 3, "maxItems" : 3, "uniqueItems" : true, "items" : { "type" : "string" }},
"favoriteSingleDigitWholeNumbers" : { "type" : "array", "minItems" : 1, "maxItems" : 10, "uniqueItems" : true, "items" : { "type" : "integer", "minimum" : 0, "maximum" : 9 }},
"favoriteFiveLetterWord" : { "type" : "string", "minLength" : 5, "maxLength" : 5 },
"emailAddresses" : { "type" : "array", "minItems" : 1, "uniqueItems" : true, "items" : { "type" : "string", "format" : "email" }},
"ipAddresses" : { "type" : "array", "uniqueItems" : true, "items" : { "type" : "string", "format" : "ipv4" }}
}
}
36 changes: 36 additions & 0 deletions notes/go-jsonschema-validator-benchmark/valid.json
@@ -0,0 +1,36 @@
{
"fullName" : "John Doe",
"age" : 47,
"state" : "Massachusetts",
"city" : "Boston",
"zip" : 16417,
"married" : false,
"dozen" : 12,
"dozenOrBakersDozen" : 13,
"favoriteEvenNumber" : 14,
"topThreeFavoriteColors" : [ "red", "blue", "green" ],
"favoriteSingleDigitWholeNumbers" : [ 7 ],
"favoriteFiveLetterWord" : "coder",
"emailAddresses" :
[
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@letters-in-local.org",
"01234567890@numbers-in-local.net",
"&'*+-./=?^_{}~@other-valid-characters-in-local.net",
"mixed-1234-in-{+^}-local@sld.net",
"one-character-third-level@a.example.com",
"single-character-in-sld@x.org",
"local@dash-in-sld.com",
"letters-in-sld@123.com",
"one-letter-sld@x.org",
"uncommon-tld@sld.museum",
"uncommon-tld@sld.travel",
"uncommon-tld@sld.mobi",
"country-code-tld@sld.uk",
"country-code-tld@sld.rw",
"local@sld.newTLD",
"the-total-length@of-an-entire-address.cannot-be-longer-than-two-hundred-and-fifty-four-characters.and-this-address-is-254-characters-exactly.so-it-should-be-valid.and-im-going-to-add-some-more-words-here.to-increase-the-lenght-blah-blah-blah-blah-bla.org",
"the-character-limit@for-each-part.of-the-domain.is-sixty-three-characters.this-is-exactly-sixty-three-characters-so-it-is-valid-blah-blah.com",
"local@sub.domains.com"
],
"ipAddresses" : [ "127.0.0.1", "24.48.64.2", "192.168.1.1", "209.68.44.3", "2.2.2.2" ]
}

0 comments on commit 3225510

Please sign in to comment.