Add annotations to revisionTemplate for knative

* Adds metadata to the knative spec in the generation command
* Fixes: #815

Tested by running locally and verifying it matched the request
from @Jeff-Lowrey

faas-cli generate \
  --api=serving.knative.dev/v1alpha1 \
  --annotation sidecar.istio.io/inject=true

This also works when bringing in annotations from the YAML
file.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (OpenFaaS Ltd)
2020-07-01 19:33:55 +01:00
committed by Alex Ellis
parent 462fd90da6
commit defd7e46b3
3 changed files with 27 additions and 4 deletions

View File

@@ -20,7 +20,12 @@ type ServingSpecRunLatestConfiguration struct {
}
type ServingSpecRunLatestConfigurationRevisionTemplate struct {
Spec ServingSpecRunLatestConfigurationRevisionTemplateSpec `yaml:"spec"`
Metadata schema.Metadata `yaml:"metadata"`
Spec ServingSpecRunLatestConfigurationRevisionTemplateSpec `yaml:"spec"`
}
type ServingSpecRunLatestConfigurationRevisionTemplateMetadata struct {
Annotations map[string]string `yaml:"annotations,omitempty"`
}
type ServingSpecRunLatestConfigurationRevisionTemplateSpec struct {

View File

@@ -5,6 +5,7 @@ package schema
// Metadata metadata of the object
type Metadata struct {
Name string `yaml:"name"`
Namespace string `yaml:"namespace,omitempty"`
Name string `yaml:"name,omitempty"`
Namespace string `yaml:"namespace,omitempty"`
Annotations map[string]string `yaml:"annotations,omitempty"`
}