mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
Merge pull request #8151 from dokku/7204-service-process-types
Allow exposing non-web processes as kubernetes services
This commit is contained in:
@@ -76,6 +76,16 @@ type Formation struct {
|
||||
|
||||
// MaxParallel is the maximum number of processes to start in parallel
|
||||
MaxParallel *int `json:"max_parallel"`
|
||||
|
||||
// Service is a struct that represents how to expose the process to the network
|
||||
// This only applies to non-web processes
|
||||
Service *FormationService `json:"service"`
|
||||
}
|
||||
|
||||
// FormationService is a struct that represents how to expose a process to the network
|
||||
type FormationService struct {
|
||||
// Exposed is whether or not the process is exposed as a service
|
||||
Exposed bool `json:"exposed"`
|
||||
}
|
||||
|
||||
// FormationAutoscaling is a struct that represents the autoscaling configuration for a process from an app.json file
|
||||
|
||||
@@ -64,7 +64,11 @@ spec:
|
||||
{{- if hasKey $config "web" }}
|
||||
env:
|
||||
- name: PORT
|
||||
{{- if eq $processName "web" }}
|
||||
value: "{{ $.Values.global.network.primary_port }}"
|
||||
{{- else }}
|
||||
value: "5000"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
|
||||
@@ -623,6 +623,22 @@ func TriggerSchedulerDeploy(scheduler string, appName string, imageTag string) e
|
||||
}
|
||||
|
||||
sort.Sort(NameSorter(processValues.Web.PortMaps))
|
||||
} else if appJSON.Formation[processType].Service != nil && appJSON.Formation[processType].Service.Exposed {
|
||||
processValues.Web = ProcessWeb{
|
||||
Domains: []ProcessDomains{},
|
||||
PortMaps: []ProcessPortMap{},
|
||||
TLS: ProcessTls{
|
||||
Enabled: false,
|
||||
},
|
||||
}
|
||||
|
||||
processValues.Web.PortMaps = append(processValues.Web.PortMaps, ProcessPortMap{
|
||||
ContainerPort: 5000,
|
||||
HostPort: 5000,
|
||||
Name: "http-5000-5000",
|
||||
Protocol: PortmapProtocol_TCP,
|
||||
Scheme: "http",
|
||||
})
|
||||
}
|
||||
|
||||
values.Processes[processType] = processValues
|
||||
|
||||
Reference in New Issue
Block a user