Last active
April 16, 2019 23:52
-
-
Save ajohnstone/667e1bd87acc8e0e8351f27534fe7e99 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl proxy & | |
kubectl delete cluster my-cluster --ignore-not-found=true | |
kubectl delete crd cluster --ignore-not-found=true | |
cat <<EOF | kubectl apply -f - | |
apiVersion: apiextensions.k8s.io/v1beta1 | |
kind: CustomResourceDefinition | |
metadata: | |
name: clusters.stable.example.com | |
spec: | |
group: stable.example.com | |
versions: | |
- name: v1 | |
served: true | |
storage: true | |
scope: Namespaced | |
names: | |
plural: clusters | |
singular: cluster | |
kind: cluster | |
shortNames: | |
- ct | |
# subresources describes the subresources for custom resources. | |
subresources: | |
# status enables the status subresource. | |
status: {} | |
--- | |
apiVersion: "stable.example.com/v1" | |
kind: cluster | |
metadata: | |
name: my-cluster | |
spec: | |
image: my-cluster | |
replicas: 3 | |
EOF | |
# Broken due to https://github.com/kubernetes/kubernetes/pull/60902 | |
#kubectl -v 10 patch cluster my-cluster --type merge -p '{"status":{"test":true}}' | |
#kubectl -v 10 patch cluster my-cluster --type merge -p '{"status":{"conditions":[ | |
#{"lastHeartbeatTime":"2019-04-16T23:14:56Z","lastTransitionTime":"2018-09-12T12:55:05Z","message":"kubelet has sufficient memory available","reason":"KubeletHasSufficientMemory","status":"False","type":"MemoryPressure"} | |
#]}}' | |
kubectl get cluster -oyaml | |
echo 'patching' | |
curl -k -v -XPATCH \ | |
-d '{"status":{"test":true}}' \ | |
-H "Accept: application/json" \ | |
-H "Content-Type: application/merge-patch+json" \ | |
-H "User-Agent: kubectl/v1.14.0 (darwin/amd64) kubernetes/641856d" \ | |
'localhost:8001/apis/stable.example.com/v1/namespaces/default/clusters/my-cluster/status' | |
kubectl get cluster -oyaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I0417 00:21:00.809515 12816 round_trippers.go:438] GET https://192.168.99.100:8443/apis/metrics.k8s.io/v1beta1?timeout=32s 503 Service Unavailable in 2 milliseconds | |
I0417 00:21:00.809528 12816 round_trippers.go:444] Response Headers: | |
I0417 00:21:00.809534 12816 round_trippers.go:447] Content-Length: 20 | |
I0417 00:21:00.809538 12816 round_trippers.go:447] Date: Tue, 16 Apr 2019 23:21:00 GMT | |
I0417 00:21:00.809543 12816 round_trippers.go:447] Content-Type: text/plain; charset=utf-8 | |
I0417 00:21:00.809547 12816 round_trippers.go:447] X-Content-Type-Options: nosniff | |
I0417 00:21:00.823718 12816 request.go:942] Response Body: service unavailable | |
I0417 00:21:00.835548 12816 request.go:1145] body was not decodable (unable to check for Status): couldn't get version/kind; json parse error: json: cannot unmarshal string into Go value of type struct { APIVersion string "json:\"apiVersion,omitempty\""; Kind string "json:\"kind,omitempty\"" } | |
I0417 00:21:00.835568 12816 cached_discovery.go:78] skipped caching discovery info due to the server is currently unable to handle the request | |
I0417 00:21:00.836520 12816 round_trippers.go:419] curl -k -v -XGET -H "Accept: application/json" -H "User-Agent: kubectl/v1.14.0 (darwin/amd64) kubernetes/641856d" 'https://192.168.99.100:8443/apis/stable.example.com/v1/namespaces/default/clusters/my-cluster' | |
I0417 00:21:00.839269 12816 round_trippers.go:438] GET https://192.168.99.100:8443/apis/stable.example.com/v1/namespaces/default/clusters/my-cluster 200 OK in 2 milliseconds | |
I0417 00:21:00.839287 12816 round_trippers.go:444] Response Headers: | |
I0417 00:21:00.839293 12816 round_trippers.go:447] Content-Type: application/json | |
I0417 00:21:00.839297 12816 round_trippers.go:447] Content-Length: 633 | |
I0417 00:21:00.839302 12816 round_trippers.go:447] Date: Tue, 16 Apr 2019 23:21:00 GMT | |
I0417 00:21:00.839324 12816 request.go:942] Response Body: {"apiVersion":"stable.example.com/v1","kind":"cluster","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"stable.example.com/v1\",\"kind\":\"cluster\",\"metadata\":{\"annotations\":{},\"name\":\"my-cluster\",\"namespace\":\"default\"},\"spec\":{\"image\":\"my-cluster\",\"replicas\":3}}\n"},"creationTimestamp":"2019-04-16T23:19:52Z","generation":1,"name":"my-cluster","namespace":"default","resourceVersion":"45078","selfLink":"/apis/stable.example.com/v1/namespaces/default/clusters/my-cluster","uid":"233183ff-609e-11e9-8525-080027977e34"},"spec":{"image":"my-cluster","replicas":3}} | |
I0417 00:21:00.839902 12816 request.go:942] Request Body: {"status":{"conditions":[ | |
{"lastHeartbeatTime":"2019-04-16T23:14:56Z","lastTransitionTime":"2018-09-12T12:55:05Z","message":"kubelet has sufficient memory available","reason":"KubeletHasSufficientMemory","status":"False","type":"MemoryPressure"} | |
]}} | |
I0417 00:21:00.839942 12816 round_trippers.go:419] curl -k -v -XPATCH -H "Accept: application/json" -H "Content-Type: application/merge-patch+json" -H "User-Agent: kubectl/v1.14.0 (darwin/amd64) kubernetes/641856d" 'https://192.168.99.100:8443/apis/stable.example.com/v1/namespaces/default/clusters/my-cluster' | |
I0417 00:21:00.843108 12816 round_trippers.go:438] PATCH https://192.168.99.100:8443/apis/stable.example.com/v1/namespaces/default/clusters/my-cluster 200 OK in 3 milliseconds | |
I0417 00:21:00.843130 12816 round_trippers.go:444] Response Headers: | |
I0417 00:21:00.843139 12816 round_trippers.go:447] Content-Type: application/json | |
I0417 00:21:00.843146 12816 round_trippers.go:447] Content-Length: 633 | |
I0417 00:21:00.843153 12816 round_trippers.go:447] Date: Tue, 16 Apr 2019 23:21:00 GMT | |
I0417 00:21:00.843205 12816 request.go:942] Response Body: {"apiVersion":"stable.example.com/v1","kind":"cluster","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"stable.example.com/v1\",\"kind\":\"cluster\",\"metadata\":{\"annotations\":{},\"name\":\"my-cluster\",\"namespace\":\"default\"},\"spec\":{\"image\":\"my-cluster\",\"replicas\":3}}\n"},"creationTimestamp":"2019-04-16T23:19:52Z","generation":1,"name":"my-cluster","namespace":"default","resourceVersion":"45078","selfLink":"/apis/stable.example.com/v1/namespaces/default/clusters/my-cluster","uid":"233183ff-609e-11e9-8525-080027977e34"},"spec":{"image":"my-cluster","replicas":3}} | |
cluster.stable.example.com/my-cluster patched (no change) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment