Skip to content

Commit

Permalink
chore(cloud run): Move launchstage config and ingress config to separ…
Browse files Browse the repository at this point in the history
…ate functions
  • Loading branch information
mahad-akhter committed Nov 17, 2023
1 parent 746859d commit c011dbc
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions internal/providers/gcp/cloudrun/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,8 @@ func (r *Resource) GetServiceTemplate(ctx context.Context, wl *Workload) *runpb.
// this can be done at a common location if the container definition turns out to be same for all resources

revisionTemplate := r.GetRevisionTemplate(ctx, wl)

launchStageConfig := r.Config["launch_stage"].(string)
launchStage := api.LaunchStage(api.LaunchStage_value[launchStageConfig])

ingressConfig := r.Config["ingress"].(string)
ingress := runpb.IngressTraffic(runpb.IngressTraffic_value[ingressConfig])
launchStage := r.GetLaunchStageConfig(ctx)
ingress := r.GetIngressConfig(ctx)

service := &runpb.Service{
Template: revisionTemplate,
Expand All @@ -248,6 +244,20 @@ func (r *Resource) GetServiceTemplate(ctx context.Context, wl *Workload) *runpb.
return service
}

func (r *Resource) GetLaunchStageConfig(ctx context.Context) api.LaunchStage {
launchStageConfig := r.Config["launch_stage"].(string)
launchStage := api.LaunchStage(api.LaunchStage_value[launchStageConfig])

return launchStage
}

func (r *Resource) GetIngressConfig(ctx context.Context) runpb.IngressTraffic {
ingressConfig := r.Config["ingress"].(string)
ingress := runpb.IngressTraffic(runpb.IngressTraffic_value[ingressConfig])

return ingress
}

func (r *Resource) GetRevisionTemplate(ctx context.Context, wl *Workload) *runpb.RevisionTemplate {

templateConfig := r.Config["template"].(map[string]interface{})
Expand Down

0 comments on commit c011dbc

Please sign in to comment.