-
Notifications
You must be signed in to change notification settings - Fork 78
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
Feat: add watch subcommand to observe specified resource lifecycle #23
Labels
kind/feature
Categorizes issue or PR as related to a new feature
Comments
elliotxx
added
kind/feature
Categorizes issue or PR as related to a new feature
and removed
enhancement
labels
Jun 6, 2022
howieyuen
added
cli
priority/important-longterm
P2, may not be staffed and/or may need multiple releases to complete
labels
Jun 6, 2022
v1: #144
|
admissionregistration.k8s.io/v1
|
apiextensions.k8s.io/v1
|
apps/v1
|
autoscaling/v2
|
batch/v1
|
certificates.k8s.io/v1
|
coordination.k8s.io/v1
|
discovery.k8s.io/v1
|
events.k8s.io/v1
|
flowcontrol.apiserver.k8s.io/v1beta2
|
networking.k8s.io/v1
|
node.k8s.io/v1
|
policy/v1
policy/v1beta1
|
rbac.authorization.k8s.io/v1
|
scheduling.k8s.io/v1
|
storage.k8s.io/v1
|
This was referenced Nov 18, 2022
3 tasks
SparkYuan
changed the title
add watch subcommand to observe specified resource lifecycle
Feat: add watch subcommand to observe specified resource lifecycle
Sep 12, 2023
SparkYuan
removed
the
priority/important-longterm
P2, may not be staffed and/or may need multiple releases to complete
label
Feb 1, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background
The initial requirement of
kusion watch
comes from the fact that after the user successfully creates, modifies or deletes the resource using thekusion apply
, which can monitor the real-time update of the resource, so as to ensure that Spec and Live are ultimately consistent on the Runtime side. Therefore, the operation object of the Watch subcommand is not a single resource, but a single Stack under a certain Project.Kusion has been connected to Kubernetes and Terraform. For k8s resources, client-go provides Watch interface, resource changes that can be obtained in real time; and for the Terraform ecosystem, there is no so-called Live Manifest, and the Terraform side just saves The resource list after the operation is successfully executed, which is equivalent to a cache.
Target
As an alpha feature, the primary purpose is to define the watch workflow. So TF runtime is not include in this time. And there are a few preconditions:
Watch Workflow
The complete workflow can be simplified as 4 stages:
References
kubectl
For k8s, the
--w
flag in the kubectl get command provides the implementation of related capabilities. The Watch behavior of k8s for resources is unterminated, and the object of Watch can only be one resource or one certain type of resource. And formatted output for each resource, defined herepkg/printers/internalversion/printers.go
. The key implementation ofkubectl get -w
is as follows:The
objToPrint
variable in the above code listing is the result of conversion from the API Server according to the specified format, not the YAML output according to the definition of the resource type. k8s defines parsing strategies for different resource types; the following is the table output format of the selected Pod:k8s officially provides 46 resources parsing strategies.
kubespy
kubespy is a tool developed by pulumi two years ago to monitor Kubernetes resources in real time. The
trace
command currently only supports the monitoring of two resources, Deployment and Service. The whole business process is roughly divided into the following 3 steps:DeploymentWatchTable()
uses the uilive framework, which can dynamically refresh the table instead of incrementally; the formatted output of the subsequent kusion watch can be referred it.The text was updated successfully, but these errors were encountered: