Even with build error, kubectl apply should apply all valid resources

This commit is contained in:
Sean R. Sullivan
2020-04-03 19:50:25 -07:00
parent 5ea2d69ccd
commit 748ad74245
6 changed files with 114 additions and 19 deletions

12
hack/testdata/multi-resource-2.yaml vendored Normal file
View File

@@ -0,0 +1,12 @@
# Simple test that errors should not block apply of valid
# resources. The ConfigMap should successfully apply, while
# the custom resource fails because the CRD is missing.
apiVersion: v1
kind: ConfigMap
metadata:
name: foo
---
apiVersion: example.com/v1
kind: Bogus
metadata:
name: foo

30
hack/testdata/multi-resource-3.yaml vendored Normal file
View File

@@ -0,0 +1,30 @@
# Test failures do not block the apply for valid resources.
# pod-a and pod-c should apply, while POD-B is invalid
# because of the capitialization.
apiVersion: v1
kind: Pod
metadata:
name: pod-a
spec:
containers:
- name: kubernetes-pause
image: k8s.gcr.io/pause:2.0
---
apiVersion: v1
kind: Pod
metadata:
name: POD-B
spec:
containers:
- name: kubernetes-pause
image: k8s.gcr.io/pause:2.0
---
apiVersion: v1
kind: Pod
metadata:
name: pod-c
spec:
containers:
- name: kubernetes-pause
image: k8s.gcr.io/pause:2.0

20
hack/testdata/multi-resource-4.yaml vendored Normal file
View File

@@ -0,0 +1,20 @@
# Tests that initial failures to not block subsequent applies.
# Initial apply for Widget fails, since CRD is not applied yet,
# but the CRD apply should succeed. Subsequent custom resource
# apply of Widget should succeed.
apiVersion: example.com/v1
kind: Widget
metadata:
name: foo
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: widgets.example.com
spec:
group: example.com
version: v1
scope: Namespaced
names:
plural: widgets
kind: Widget