mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +00:00
Merge pull request #22530 from mwielgus/rcconfig
Auto commit by PR queue bot
This commit is contained in:
commit
1b64d6b3fd
@ -270,6 +270,11 @@ type RCConfig struct {
|
||||
|
||||
// Ports to declare in the container (map of name to containerPort).
|
||||
Ports map[string]int
|
||||
// Ports to declare in the container as host and container ports.
|
||||
HostPorts map[string]int
|
||||
|
||||
Volumes []api.Volume
|
||||
VolumeMounts []api.VolumeMount
|
||||
|
||||
// Pointer to a list of pods; if non-nil, will be set to a list of pods
|
||||
// created by this RC by RunRC.
|
||||
@ -1780,6 +1785,12 @@ func (config *RCConfig) applyTo(template *api.PodTemplateSpec) {
|
||||
c.Ports = append(c.Ports, api.ContainerPort{Name: k, ContainerPort: v})
|
||||
}
|
||||
}
|
||||
if config.HostPorts != nil {
|
||||
for k, v := range config.HostPorts {
|
||||
c := &template.Spec.Containers[0]
|
||||
c.Ports = append(c.Ports, api.ContainerPort{Name: k, ContainerPort: v, HostPort: v})
|
||||
}
|
||||
}
|
||||
if config.CpuLimit > 0 || config.MemLimit > 0 {
|
||||
template.Spec.Containers[0].Resources.Limits = api.ResourceList{}
|
||||
}
|
||||
@ -1798,6 +1809,12 @@ func (config *RCConfig) applyTo(template *api.PodTemplateSpec) {
|
||||
if config.MemRequest > 0 {
|
||||
template.Spec.Containers[0].Resources.Requests[api.ResourceMemory] = *resource.NewQuantity(config.MemRequest, resource.DecimalSI)
|
||||
}
|
||||
if len(config.Volumes) > 0 {
|
||||
template.Spec.Volumes = config.Volumes
|
||||
}
|
||||
if len(config.VolumeMounts) > 0 {
|
||||
template.Spec.Containers[0].VolumeMounts = config.VolumeMounts
|
||||
}
|
||||
}
|
||||
|
||||
func (config *RCConfig) start() error {
|
||||
|
Loading…
Reference in New Issue
Block a user