Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subresource #1

Merged
merged 5 commits into from Jul 25, 2023
Merged

subresource #1

merged 5 commits into from Jul 25, 2023

Conversation

phosae
Copy link
Owner

@phosae phosae commented Jul 21, 2023

implements subresource for our Foo

  • get/update foos/config <-> hello.zeng.dev Config
  • get/update foos/status <-> hello.zeng.dev Foo
  • create foos/base64 <-> return base64 formatted content of foo base64 String Obj

@phosae
Copy link
Owner Author

phosae commented Jul 24, 2023

k apply -f ../api/artifacts/samples/hello-foo.yml
kubectl patch fo myfoo --subresource status --patch '{"spec": {"config": {"msg1": "👻"}}, "status": {"phase": "Running"}}'

only the field status will be updated

note: controller with permission foos/status can update object labels, annotations...

@phosae
Copy link
Owner Author

phosae commented Jul 25, 2023

request a base64 from a foo resource returns a transformation.zeng.dev/v1beta1 Base64

base64 subresource is like the token subresource in kube-apiserver, it only supports POST, and return a different kind differ from the main resource

curl -s -X POST -H "Content-Type: application/json" localhost:8001/apis/hello.zeng.dev/v1/namespaces/default/foos/myfoo/base64 -d '{
"apiVersion": "transformation.zeng.dev/v1beta1",
"kind": "Base64",
"spec": {"fieldPath": "spec"}
}' | jq -r .status.output | base64 -d 

@phosae
Copy link
Owner Author

phosae commented Jul 25, 2023

foos/status ↔️ pod/status
foos/config ↔️ deployments/scale
foos/base64 ↔️ serviceaccounts/token

@phosae phosae merged commit eed9312 into master Jul 25, 2023
@phosae phosae deleted the subresource branch July 25, 2023 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant