Add knative serving v1alpha1 to generate CRD command
This commit adds the ability to generate a knative serving definition from the Function Store or a stack.yaml file with a basic definition including: namespace, name, env-vars and image. Tested with Istio on Packet.net using figlet. Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
48
schema/knative/v1alpha1/serving.go
Normal file
48
schema/knative/v1alpha1/serving.go
Normal file
@@ -0,0 +1,48 @@
|
||||
// Copyright (c) OpenFaaS Author(s) 2019. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import "github.com/openfaas/faas-cli/schema"
|
||||
|
||||
const APIVersionLatest = "serving.knative.dev/v1alpha1"
|
||||
|
||||
//ServingSpec describe characteristics of the object
|
||||
type ServingSpec struct {
|
||||
RunLatest ServingSpecRunLatest `yaml:"runLatest"`
|
||||
}
|
||||
|
||||
type ServingSpecRunLatest struct {
|
||||
Configuration ServingSpecRunLatestConfiguration `yaml:"configuration"`
|
||||
}
|
||||
type ServingSpecRunLatestConfiguration struct {
|
||||
RevisionTemplate ServingSpecRunLatestConfigurationRevisionTemplate `yaml:"revisionTemplate"`
|
||||
}
|
||||
|
||||
type ServingSpecRunLatestConfigurationRevisionTemplate struct {
|
||||
Spec ServingSpecRunLatestConfigurationRevisionTemplateSpec `yaml:"spec"`
|
||||
}
|
||||
|
||||
type ServingSpecRunLatestConfigurationRevisionTemplateSpec struct {
|
||||
Container ServingSpecRunLatestConfigurationRevisionTemplateSpecContainer `yaml:"container"`
|
||||
}
|
||||
|
||||
type ServingSpecRunLatestConfigurationRevisionTemplateSpecContainer struct {
|
||||
Image string `yaml:"image"`
|
||||
Env []EnvPair `yaml:"env,omitempty"`
|
||||
}
|
||||
|
||||
type EnvPair struct {
|
||||
Name string `yaml:"name"`
|
||||
Value string `yaml:"value"`
|
||||
}
|
||||
|
||||
//ServingCRD root level YAML definition for the object
|
||||
type ServingCRD struct {
|
||||
//APIVersion CRD API version
|
||||
APIVersion string `yaml:"apiVersion"`
|
||||
//Kind kind of the object
|
||||
Kind string `yaml:"kind"`
|
||||
Metadata schema.Metadata `yaml:"metadata"`
|
||||
Spec ServingSpec `yaml:"spec"`
|
||||
}
|
||||
Reference in New Issue
Block a user