mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
update openapi to v1.21.2
This commit is contained in:
@@ -230,3 +230,92 @@ spec:
|
|||||||
name: configmap-in-base
|
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
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ func TestCustomOpenApiFieldBothPathAndVersion(t *testing.T) {
|
|||||||
resources:
|
resources:
|
||||||
- mycrd.yaml
|
- mycrd.yaml
|
||||||
openapi:
|
openapi:
|
||||||
version: v1.20.4
|
version: v1.21.2
|
||||||
path: mycrd_schema.json
|
path: mycrd_schema.json
|
||||||
`+customSchemaPatch)
|
`+customSchemaPatch)
|
||||||
writeCustomResource(th, "mycrd.yaml")
|
writeCustomResource(th, "mycrd.yaml")
|
||||||
@@ -217,7 +217,7 @@ openapi:
|
|||||||
resources:
|
resources:
|
||||||
- ../base
|
- ../base
|
||||||
openapi:
|
openapi:
|
||||||
version: v1.20.4
|
version: v1.21.2
|
||||||
`+customSchemaPatch)
|
`+customSchemaPatch)
|
||||||
writeCustomResource(th, "base/mycrd.yaml")
|
writeCustomResource(th, "base/mycrd.yaml")
|
||||||
writeTestSchema(th, "base/")
|
writeTestSchema(th, "base/")
|
||||||
@@ -235,7 +235,7 @@ spec:
|
|||||||
- image: nginx
|
- image: nginx
|
||||||
name: server
|
name: server
|
||||||
`)
|
`)
|
||||||
assert.Equal(t, "v1204", openapi.GetSchemaVersion())
|
assert.Equal(t, "v1212", openapi.GetSchemaVersion())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCustomOpenAPIFieldFromComponent(t *testing.T) {
|
func TestCustomOpenAPIFieldFromComponent(t *testing.T) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ func TestOpenApiFieldBasicUsage(t *testing.T) {
|
|||||||
th := kusttest_test.MakeHarness(t)
|
th := kusttest_test.MakeHarness(t)
|
||||||
th.WriteK(".", `
|
th.WriteK(".", `
|
||||||
openapi:
|
openapi:
|
||||||
version: v1.20.4
|
version: v1.21.2
|
||||||
resources:
|
resources:
|
||||||
- deployment.yaml
|
- deployment.yaml
|
||||||
`)
|
`)
|
||||||
@@ -44,7 +44,8 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- image: whatever
|
- image: whatever
|
||||||
`)
|
`)
|
||||||
assert.Equal(t, "v1204", openapi.GetSchemaVersion())
|
assert.Equal(t, "v1212", openapi.GetSchemaVersion())
|
||||||
|
openapi.ResetOpenAPI()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOpenApiFieldNotBuiltin(t *testing.T) {
|
func TestOpenApiFieldNotBuiltin(t *testing.T) {
|
||||||
@@ -71,6 +72,7 @@ spec:
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("expected an error")
|
t.Fatalf("expected an error")
|
||||||
}
|
}
|
||||||
|
openapi.ResetOpenAPI()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOpenApiFieldDefaultVersion(t *testing.T) {
|
func TestOpenApiFieldDefaultVersion(t *testing.T) {
|
||||||
@@ -104,4 +106,5 @@ spec:
|
|||||||
- image: whatever
|
- image: whatever
|
||||||
`)
|
`)
|
||||||
assert.Equal(t, kubernetesapi.DefaultOpenAPI, openapi.GetSchemaVersion())
|
assert.Equal(t, kubernetesapi.DefaultOpenAPI, openapi.GetSchemaVersion())
|
||||||
|
openapi.ResetOpenAPI()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,13 +6,13 @@
|
|||||||
package kubernetesapi
|
package kubernetesapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sigs.k8s.io/kustomize/kyaml/openapi/kubernetesapi/v1204"
|
"sigs.k8s.io/kustomize/kyaml/openapi/kubernetesapi/v1212"
|
||||||
)
|
)
|
||||||
|
|
||||||
const Info = "{title:Kubernetes,version:v1.20.4}"
|
const Info = "{title:Kubernetes,version:v1.21.2}"
|
||||||
|
|
||||||
var OpenAPIMustAsset = map[string]func(string) []byte{
|
var OpenAPIMustAsset = map[string]func(string)[]byte{
|
||||||
"v1204": v1204.MustAsset,
|
"v1212": v1212.MustAsset,
|
||||||
}
|
}
|
||||||
|
|
||||||
const DefaultOpenAPI = "v1204"
|
const DefaultOpenAPI = "v1212"
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
249
kyaml/openapi/kubernetesapi/v1212/swagger.go
Normal file
249
kyaml/openapi/kubernetesapi/v1212/swagger.go
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user