Merge pull request #8151 from dokku/7204-service-process-types

Allow exposing non-web processes as kubernetes services
This commit is contained in:
Jose Diaz-Gonzalez
2025-11-22 20:33:42 -05:00
committed by GitHub
6 changed files with 140 additions and 0 deletions

View File

@@ -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

View 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:

View File

@@ -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