Skip to content

Commit

Permalink
deploy backend svc with entrypoint and command overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
Lou1415926 committed Mar 2, 2021
1 parent 2a1ad22 commit 7ba131a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
52 changes: 27 additions & 25 deletions internal/pkg/deploy/cloudformation/stack/backend_svc.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,37 +67,39 @@ func NewBackendService(mft *manifest.BackendService, env, app string, rc Runtime

// Template returns the CloudFormation template for the backend service.
func (s *BackendService) Template() (string, error) {
desiredCountLambda, err := s.parser.Read(desiredCountGeneratorPath)
if err != nil {
return "", fmt.Errorf("read desired count lambda: %w", err)
}
outputs, err := s.addonsOutputs()
if err != nil {
return "", err
}
sidecars, err := convertSidecar(s.manifest.Sidecars)
if err != nil {
return "", fmt.Errorf("convert the sidecar configuration for service %s: %w", s.name, err)
}
autoscaling, err := convertAutoscaling(&s.manifest.Count.Autoscaling)
if err != nil {
return "", fmt.Errorf("convert the Auto Scaling configuration for service %s: %w", s.name, err)
}
storage, err := convertStorageOpts(s.manifest.Storage)
if err != nil {
return "", fmt.Errorf("convert storage options for service %s: %w", s.name, err)
}
//desiredCountLambda, err := s.parser.Read(desiredCountGeneratorPath)
//if err != nil {
// return "", fmt.Errorf("read desired count lambda: %w", err)
//}
//outputs, err := s.addonsOutputs()
//if err != nil {
// return "", err
//}
//sidecars, err := convertSidecar(s.manifest.Sidecars)
//if err != nil {
// return "", fmt.Errorf("convert the sidecar configuration for service %s: %w", s.name, err)
//}
//autoscaling, err := convertAutoscaling(&s.manifest.Count.Autoscaling)
//if err != nil {
// return "", fmt.Errorf("convert the Auto Scaling configuration for service %s: %w", s.name, err)
//}
//storage, err := convertStorageOpts(s.manifest.Storage)
//if err != nil {
// return "", fmt.Errorf("convert storage options for service %s: %w", s.name, err)
//}
content, err := s.parser.ParseBackendService(template.WorkloadOpts{
Variables: s.manifest.BackendServiceConfig.Variables,
Secrets: s.manifest.BackendServiceConfig.Secrets,
NestedStack: outputs,
Sidecars: sidecars,
Autoscaling: autoscaling,
//NestedStack: outputs,
//Sidecars: sidecars,
//Autoscaling: autoscaling,
HealthCheck: s.manifest.BackendServiceConfig.ImageConfig.HealthCheckOpts(),
LogConfig: convertLogging(s.manifest.Logging),
DesiredCountLambda: desiredCountLambda.String(),
Storage: storage,
//DesiredCountLambda: desiredCountLambda.String(),
//Storage: storage,
Network: convertNetworkConfig(s.manifest.Network),
EntryPoint: s.manifest.EntryPoint.ToStringSlice(),
Command: s.manifest.Command.ToStringSlice(),
})
if err != nil {
return "", fmt.Errorf("parse backend service template: %w", err)
Expand Down
5 changes: 3 additions & 2 deletions internal/pkg/manifest/backend_svc.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ type BackendService struct {
// BackendServiceConfig holds the configuration that can be overriden per environments.
type BackendServiceConfig struct {
ImageConfig imageWithPortAndHealthcheck `yaml:"image,flow"`
TaskConfig `yaml:",inline"`
*Logging `yaml:"logging,flow"`
ImageOverride `yaml:",inline"`
TaskConfig `yaml:",inline"`
*Logging `yaml:"logging,flow"`
Sidecars map[string]*SidecarConfig `yaml:"sidecars"`
Network NetworkConfig `yaml:"network"`
}
Expand Down
1 change: 1 addition & 0 deletions templates/workloads/services/backend/cf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Resources:
{{include "envvars" . | indent 10}}
{{include "secrets" . | indent 10}}
{{include "logconfig" . | indent 10}}
{{include "image-overrides" . | indent 10}}
{{- if .HealthCheck}}
HealthCheck:
Command: {{quoteSlice .HealthCheck.Command | fmtSlice}}
Expand Down

0 comments on commit 7ba131a

Please sign in to comment.