-
Notifications
You must be signed in to change notification settings - Fork 19
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
Generate informational header at top of YAML file. #71
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Thanks Michael
@@ -489,6 +495,82 @@ func GenerateYAMLs(image string, app *protos.AppConfig, depId string, cfg *KubeC | |||
return nil | |||
} | |||
|
|||
// header returns the informational header at the top of a generated YAML file. | |||
func header(app *protos.AppConfig, cfg *KubeConfig, depId, filename string) (string, error) { | |||
header := template.Must(template.New("header").Parse(`# This file was generated by "weaver kube" version {{.ToolVersion}} for the following |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking whether long term we should also provide more k8s stuff. E.g., for every deployment, stuff like cpu/memory request/limit, env variables set for the pods, min/max #replicas, volume mounts. Maybe for HPA, which rules apply. If someone takes a quick look at the header can get a good understanding of the high-level things that would happen if they deploy the yaml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good idea to me! I'll do this in a future PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Robert!
@@ -489,6 +495,82 @@ func GenerateYAMLs(image string, app *protos.AppConfig, depId string, cfg *KubeC | |||
return nil | |||
} | |||
|
|||
// header returns the informational header at the top of a generated YAML file. | |||
func header(app *protos.AppConfig, cfg *KubeConfig, depId, filename string) (string, error) { | |||
header := template.Must(template.New("header").Parse(`# This file was generated by "weaver kube" version {{.ToolVersion}} for the following |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good idea to me! I'll do this in a future PR.
This PR changes `weaver kube deploy` to add an informational header at the top of every generated YAML file. It looks like this: # This file was generated by "weaver kube" version (devel) for the following # application: # # app: collatz # version: 79f011d4 # components: # - github.com/ServiceWeaver/weaver/Main # - github.com/ServiceWeaver/weaver/examples/collatz/Even # - github.com/ServiceWeaver/weaver/examples/collatz/Odd # listeners: # - collatz # # This file contains the following resources: # # 1. A Deployment for every group of components. # 2. A HorizontalPodAutoscaler for every Deployment. # 3. A Service for every listener. # 4. Some Roles and RoleBindings to configure permissions. # # To deploy these resources, run: # # kubectl apply -f /tmp/kube_79f011d4.yaml # # To view the deployed resources, run: # # # kubectl delete all --selector=version=79f011d4 ...
# This file was generated by "weaver kube" version (devel) for the following # application: # # app: collatz # version: 8edb402a # components groups: # - # - github.com/ServiceWeaver/weaver/Main # - # - github.com/ServiceWeaver/weaver/examples/collatz/Even # - github.com/ServiceWeaver/weaver/examples/collatz/Odd # listeners: # - collatz (github.com/ServiceWeaver/weaver/Main) # # This file contains the following resources: # # 1. A Deployment for every group of components. # 2. A HorizontalPodAutoscaler for every Deployment. # 3. A Service for every listener. # 4. Some Roles and RoleBindings to configure permissions. # # To deploy these resources, run: # # kubectl apply -f /tmp/kube_8edb402a.yaml # # To view the deployed resources, run: # # kubectl get all --selector=version=8edb402a # # To delete the resources, run: # # kubectl delete all --selector=version=8edb402a
This PR changes
weaver kube deploy
to add an informational header at the top of every generated YAML file. It looks like this: