Skip to content

Commit

Permalink
update openapi to v1.21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
natasha41575 committed Aug 10, 2021
1 parent f735d6f commit 38b2b33
Show file tree
Hide file tree
Showing 7 changed files with 11,414 additions and 6,913 deletions.
89 changes: 89 additions & 0 deletions api/krusty/inlinepatch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,92 @@ spec:
name: configmap-in-base
`)
}

func TestPathWithCronJobV1(t *testing.T) {
th := kusttest_test.MakeHarness(t)
th.WriteK(".", `
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- resources.yaml
patches:
- patch: |
apiVersion: batch/v1
kind: CronJob
metadata:
name: test
spec:
jobTemplate:
spec:
template:
spec:
containers:
- name: test
env:
- name: ENV_NEW
value: val_new
target:
kind: CronJob
name: test
`)
th.WriteF("resources.yaml", `
apiVersion: batch/v1
kind: CronJob
metadata:
name: test
spec:
schedule: "5 10 * * 1"
concurrencyPolicy: Forbid
jobTemplate:
spec:
backoffLimit: 3
template:
spec:
restartPolicy: Never
containers:
- name: test
image: bash
command:
- /bin/sh
- -c
- echo "test"
env:
- name: ENV1
value: val1
- name: ENV2
value: val2
- name: ENV3
value: val3`)
m := th.Run(".", th.MakeDefaultOptions())
th.AssertActualEqualsExpected(m, `
apiVersion: batch/v1
kind: CronJob
metadata:
name: test
spec:
concurrencyPolicy: Forbid
jobTemplate:
spec:
backoffLimit: 3
template:
spec:
containers:
- command:
- /bin/sh
- -c
- echo "test"
env:
- name: ENV_NEW
value: val_new
- name: ENV1
value: val1
- name: ENV2
value: val2
- name: ENV3
value: val3
image: bash
name: test
restartPolicy: Never
schedule: 5 10 * * 1
`)
}
6 changes: 3 additions & 3 deletions api/krusty/openapicustomschema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func TestCustomOpenApiFieldBothPathAndVersion(t *testing.T) {
resources:
- mycrd.yaml
openapi:
version: v1.20.4
version: v1.21.2
path: mycrd_schema.json
`+customSchemaPatch)
writeCustomResource(th, "mycrd.yaml")
Expand Down Expand Up @@ -217,7 +217,7 @@ openapi:
resources:
- ../base
openapi:
version: v1.20.4
version: v1.21.2
`+customSchemaPatch)
writeCustomResource(th, "base/mycrd.yaml")
writeTestSchema(th, "base/")
Expand All @@ -235,7 +235,7 @@ spec:
- image: nginx
name: server
`)
assert.Equal(t, "v1204", openapi.GetSchemaVersion())
assert.Equal(t, "v1212", openapi.GetSchemaVersion())
}

func TestCustomOpenAPIFieldFromComponent(t *testing.T) {
Expand Down
7 changes: 5 additions & 2 deletions api/krusty/openapiversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestOpenApiFieldBasicUsage(t *testing.T) {
th := kusttest_test.MakeHarness(t)
th.WriteK(".", `
openapi:
version: v1.20.4
version: v1.21.2
resources:
- deployment.yaml
`)
Expand Down Expand Up @@ -44,7 +44,8 @@ spec:
containers:
- image: whatever
`)
assert.Equal(t, "v1204", openapi.GetSchemaVersion())
assert.Equal(t, "v1212", openapi.GetSchemaVersion())
openapi.ResetOpenAPI()
}

func TestOpenApiFieldNotBuiltin(t *testing.T) {
Expand All @@ -71,6 +72,7 @@ spec:
if err == nil {
t.Fatalf("expected an error")
}
openapi.ResetOpenAPI()
}

func TestOpenApiFieldDefaultVersion(t *testing.T) {
Expand Down Expand Up @@ -104,4 +106,5 @@ spec:
- image: whatever
`)
assert.Equal(t, kubernetesapi.DefaultOpenAPI, openapi.GetSchemaVersion())
openapi.ResetOpenAPI()
}
10 changes: 5 additions & 5 deletions kyaml/openapi/kubernetesapi/openapiinfo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

251 changes: 0 additions & 251 deletions kyaml/openapi/kubernetesapi/v1204/swagger.go

This file was deleted.

249 changes: 249 additions & 0 deletions kyaml/openapi/kubernetesapi/v1212/swagger.go

Large diffs are not rendered by default.

0 comments on commit 38b2b33

Please sign in to comment.