Created
December 20, 2019 16:12
-
-
Save liggitt/7fff860915a899c240ffd493c5cf3be1 to your computer and use it in GitHub Desktop.
crd status patch
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
apiVersion: example.com/v1 | |
kind: Scaler | |
metadata: | |
name: foo | |
spec: | |
replicas: 1 |
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
apiVersion: apiextensions.k8s.io/v1 | |
kind: CustomResourceDefinition | |
metadata: | |
name: scalers.example.com | |
spec: | |
group: example.com | |
scope: Namespaced | |
preserveUnknownFields: false | |
versions: | |
- name: v1 | |
storage: true | |
served: true | |
schema: | |
openAPIV3Schema: | |
type: object | |
properties: | |
spec: | |
type: object | |
properties: | |
replicas: | |
type: integer | |
status: | |
type: object | |
properties: | |
selector: | |
type: string | |
replicas: | |
type: integer | |
subresources: | |
status: {} | |
scale: | |
statusReplicasPath: .status.replicas | |
specReplicasPath: .spec.replicas | |
labelSelectorPath: .status.selector | |
names: | |
singular: scaler | |
plural: scalers | |
kind: Scaler | |
listKind: ScalerList |
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 create -f scaler-crd.yaml | |
customresourcedefinition.apiextensions.k8s.io/scalers.example.com created | |
$ kubectl create -f scaler-cr.yaml | |
scaler.example.com/foo created | |
$ curl -s -X PATCH \ | |
-H "Content-Type: application/merge-patch+json" \ | |
--data '{"status":{"selector":"foo"}}' \ | |
http://localhost:8080/apis/example.com/v1/namespaces/default/scalers/foo/status | jq . | |
{ | |
"apiVersion": "example.com/v1", | |
"kind": "Scaler", | |
"metadata": { | |
"creationTimestamp": "2019-12-20T16:10:32Z", | |
"generation": 1, | |
"name": "foo", | |
"namespace": "default", | |
"resourceVersion": "302", | |
"selfLink": "/apis/example.com/v1/namespaces/default/scalers/foo/status", | |
"uid": "b9e2f122-ffd3-4d73-9d51-7932994f8b82" | |
}, | |
"spec": { | |
"replicas": 1 | |
}, | |
"status": { | |
"selector": "foo" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment