Add foot comments
@@ -26,7 +26,8 @@ import (
)
// headComments is the mapping of field names to desired comments.
-var headComments = map[string]string{
+var (
+ headComments = map[string]string{
"resources": `
Resources define where you application's Kubernetes resources come from. These
@@ -58,6 +59,51 @@ Reference: https://docs.stormforge.io/reference/application/v1alpha1/#objective
`,
}
+ footComments = map[string]string{
+
+ "resources": `Only one of the below is necessary
+- github.com/thestormforge/examples/postgres/application # URL example
+- kubernetes: # In cluster resource example
+ # You can use 'namespaces:' to list specific namespaces
+ namespaceSelector: stormforge.io/app=postgres-example
+ # If you omit 'types:' it defaults to deployments and stateful sets
+ types:
+ - deployments
+ # The default selector of "" matches everything
+ selector: component=postgres
+- helm: # Helm example
+ repo: https://charts.bitnami.com/bitnami
+ chart: nginx
+ version: 8.5.4`,
+
+ "parameters": `- containerResources:
+ selector: component=postgres # Filters to only discover container resources (memory and CPU) for the specified labels
+- replicas:
+ selector: component=postgres # Filters to only discover replicas for the specified labels`,
+
+ "scenarios": `- name: cyberMonday # StormForge Performance Test example
+ stormforger:
+ testCaseFile: foobar.js # You can alternatively specify just the test case name if you provide the access token
+- name: just-another-tuesday # Locust example
+ locust:
+ locustfile: foobar.py # Can be local or a URL`,
+
+ "objectives": `- goals:
+ # StormForger Metrics: https://github.com/thestormforge/optimize-trials/tree/main/stormforger
+ # Locust Metrics: https://github.com/thestormforge/optimize-trials/tree/main/locust
+ - name: cost-gcp # Also "cost", "cost-aws"
+ requests:
+ selector: component=postgres #Specifies where to collect metrics from
+ weights:
+ memory: 4 # Enables customization of cost weights.
+ - name: p95
+ latency: p95
+ max: 10000 # Specifies a metric constraint that you do not want your results to go above. This example ensures only results with p95 latency below 1000ms are returned.
+ - latency: p99
+ optimize: false # Reports on the metric while not explicitly optimizing for them`,
+ }
+)
+
// DocumentationFilter looks for Application instances and attempts to annotate them
// with comments that might help people finish writing their app.yaml.
type DocumentationFilter struct {
@@ -152,24 +198,11 @@ func missingRequiredContent(key string, required map[string]string) []*yaml.Node
Tag: yaml.NodeTagString,
Value: req,
HeadComment: headComments[req],
- })
-
- // Add an empty value
- switch req {
- case "parameters":
- result = append(result, &yaml.Node{
- Kind: yaml.MappingNode,
- Style: yaml.FoldedStyle,
- Tag: yaml.NodeTagMap,
- })
-
- default:
- result = append(result, &yaml.Node{
+ }, &yaml.Node{
Kind: yaml.SequenceNode,
Style: yaml.FoldedStyle,
- Tag: yaml.NodeTagSeq,
+ FootComment: footComments[req],
})
- }
return result
}
