feat: added ServerlessConfig to Apps
This commit is contained in:
parent
02856be541
commit
14916c1544
4 changed files with 25 additions and 18 deletions
|
|
@ -531,7 +531,7 @@ func (r *RecreateStrategy) updateApplication(ctx context.Context, action AppActi
|
|||
ImagePath: config.GetImagePath(),
|
||||
AllowServerless: true,
|
||||
DefaultFlavor: v2.Flavor{Name: config.Spec.InfraTemplate[0].FlavorName},
|
||||
ServerlessConfig: struct{}{},
|
||||
ServerlessConfig: v2.ServerlessConfig{},
|
||||
DeploymentManifest: manifestContent,
|
||||
DeploymentGenerator: "kubernetes-basic",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -169,6 +169,13 @@ type Flavor struct {
|
|||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// ServerlessConfig defines serverless deployment configuration
|
||||
type ServerlessConfig struct {
|
||||
MinReplicas int `json:"min_replicas,omitempty"` // number of replicas (at least 1)
|
||||
RAM int `json:"ram,omitempty"` // RAM in MB
|
||||
VCPUs int `json:"vcpus,omitempty"` // Virtual CPUs
|
||||
}
|
||||
|
||||
// SecurityRule defines network access rules
|
||||
type SecurityRule struct {
|
||||
PortRangeMax int `json:"port_range_max"`
|
||||
|
|
@ -180,21 +187,21 @@ type SecurityRule struct {
|
|||
// App represents an application definition
|
||||
type App struct {
|
||||
msg `json:",inline"`
|
||||
Key AppKey `json:"key"`
|
||||
Deployment string `json:"deployment,omitempty"`
|
||||
ImageType string `json:"image_type,omitempty"`
|
||||
ImagePath string `json:"image_path,omitempty"`
|
||||
AccessPorts string `json:"access_ports,omitempty"`
|
||||
AllowServerless bool `json:"allow_serverless,omitempty"`
|
||||
DefaultFlavor Flavor `json:"defaultFlavor,omitempty"`
|
||||
ServerlessConfig interface{} `json:"serverless_config,omitempty"`
|
||||
DeploymentGenerator string `json:"deployment_generator,omitempty"`
|
||||
DeploymentManifest string `json:"deployment_manifest,omitempty"`
|
||||
RequiredOutboundConnections []SecurityRule `json:"required_outbound_connections"`
|
||||
GlobalID string `json:"global_id,omitempty"`
|
||||
CreatedAt string `json:"created_at,omitempty"`
|
||||
UpdatedAt string `json:"updated_at,omitempty"`
|
||||
Fields []string `json:"fields,omitempty"`
|
||||
Key AppKey `json:"key"`
|
||||
Deployment string `json:"deployment,omitempty"`
|
||||
ImageType string `json:"image_type,omitempty"`
|
||||
ImagePath string `json:"image_path,omitempty"`
|
||||
AccessPorts string `json:"access_ports,omitempty"`
|
||||
AllowServerless bool `json:"allow_serverless,omitempty"`
|
||||
DefaultFlavor Flavor `json:"defaultFlavor,omitempty"`
|
||||
ServerlessConfig ServerlessConfig `json:"serverless_config,omitempty"`
|
||||
DeploymentGenerator string `json:"deployment_generator,omitempty"`
|
||||
DeploymentManifest string `json:"deployment_manifest,omitempty"`
|
||||
RequiredOutboundConnections []SecurityRule `json:"required_outbound_connections"`
|
||||
GlobalID string `json:"global_id,omitempty"`
|
||||
CreatedAt string `json:"created_at,omitempty"`
|
||||
UpdatedAt string `json:"updated_at,omitempty"`
|
||||
Fields []string `json:"fields,omitempty"`
|
||||
}
|
||||
|
||||
// AppInstance represents a deployed application instance
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ func runComprehensiveWorkflow(ctx context.Context, c *v2.Client, config Workflow
|
|||
ImageType: "ImageTypeDocker", // field is ignored
|
||||
ImagePath: "https://registry-1.docker.io/library/nginx:latest", // must be set. Even for kubernetes
|
||||
DefaultFlavor: v2.Flavor{Name: config.FlavorName},
|
||||
ServerlessConfig: struct{}{}, // must be set
|
||||
ServerlessConfig: v2.ServerlessConfig{}, // must be set
|
||||
AllowServerless: true, // must be set to true for kubernetes
|
||||
RequiredOutboundConnections: []v2.SecurityRule{
|
||||
{
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ func main() {
|
|||
ImageType: "ImageTypeDocker",
|
||||
ImagePath: "https://registry-1.docker.io/library/nginx:latest",
|
||||
DefaultFlavor: v2.Flavor{Name: "EU.small"},
|
||||
ServerlessConfig: struct{}{},
|
||||
ServerlessConfig: v2.ServerlessConfig{},
|
||||
AllowServerless: false,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue