add --subresource to kubectl apply

This commit is contained in:
David Eads
2024-09-25 17:23:09 -04:00
parent 3582dce115
commit 55ba8b2cbb
3 changed files with 37 additions and 7 deletions

View File

@@ -413,6 +413,10 @@ run_kubectl_server_side_apply_tests() {
kubectl apply --server-side --field-manager=my-field-manager --force-conflicts -f hack/testdata/pod.yaml "${kube_flags[@]:?}"
output_message=$(kubectl get -f hack/testdata/pod.yaml -o=jsonpath='{.metadata.managedFields[*].manager}' "${kube_flags[@]:?}" 2>&1)
kube::test::if_has_string "${output_message}" 'my-field-manager'
# can add pod condition
kubectl apply --server-side --subresource=status --field-manager=my-field-manager -f hack/testdata/pod-apply-status.yaml "${kube_flags[@]:?}"
output_message=$(kubectl get -f hack/testdata/pod.yaml -o=jsonpath='{.status.conditions[*].type}' "${kube_flags[@]:?}" 2>&1)
kube::test::if_has_string "${output_message}" 'example.io/Foo'
# Clean up
kubectl delete pods test-pod "${kube_flags[@]:?}"