mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +00:00
Merge pull request #110779 from jbartosik/extend-e2e-framework-helpers
Add parameter to set SecurityContext for containers in tests
This commit is contained in:
commit
f0417ac850
@ -183,8 +183,11 @@ type RCConfig struct {
|
|||||||
|
|
||||||
ServiceAccountTokenProjections int
|
ServiceAccountTokenProjections int
|
||||||
|
|
||||||
//Additional containers to run in the pod
|
// Additional containers to run in the pod
|
||||||
AdditionalContainers []v1.Container
|
AdditionalContainers []v1.Container
|
||||||
|
|
||||||
|
// Security context for created pods
|
||||||
|
SecurityContext *v1.SecurityContext
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rc *RCConfig) RCConfigLog(fmt string, args ...interface{}) {
|
func (rc *RCConfig) RCConfigLog(fmt string, args ...interface{}) {
|
||||||
@ -335,11 +338,12 @@ func (config *DeploymentConfig) create() error {
|
|||||||
TerminationGracePeriodSeconds: config.getTerminationGracePeriodSeconds(nil),
|
TerminationGracePeriodSeconds: config.getTerminationGracePeriodSeconds(nil),
|
||||||
Containers: []v1.Container{
|
Containers: []v1.Container{
|
||||||
{
|
{
|
||||||
Name: config.Name,
|
Name: config.Name,
|
||||||
Image: config.Image,
|
Image: config.Image,
|
||||||
Command: config.Command,
|
Command: config.Command,
|
||||||
Ports: []v1.ContainerPort{{ContainerPort: 80}},
|
Ports: []v1.ContainerPort{{ContainerPort: 80}},
|
||||||
Lifecycle: config.Lifecycle,
|
Lifecycle: config.Lifecycle,
|
||||||
|
SecurityContext: config.SecurityContext,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -421,11 +425,12 @@ func (config *ReplicaSetConfig) create() error {
|
|||||||
TerminationGracePeriodSeconds: config.getTerminationGracePeriodSeconds(nil),
|
TerminationGracePeriodSeconds: config.getTerminationGracePeriodSeconds(nil),
|
||||||
Containers: []v1.Container{
|
Containers: []v1.Container{
|
||||||
{
|
{
|
||||||
Name: config.Name,
|
Name: config.Name,
|
||||||
Image: config.Image,
|
Image: config.Image,
|
||||||
Command: config.Command,
|
Command: config.Command,
|
||||||
Ports: []v1.ContainerPort{{ContainerPort: 80}},
|
Ports: []v1.ContainerPort{{ContainerPort: 80}},
|
||||||
Lifecycle: config.Lifecycle,
|
Lifecycle: config.Lifecycle,
|
||||||
|
SecurityContext: config.SecurityContext,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -499,10 +504,11 @@ func (config *JobConfig) create() error {
|
|||||||
TerminationGracePeriodSeconds: config.getTerminationGracePeriodSeconds(nil),
|
TerminationGracePeriodSeconds: config.getTerminationGracePeriodSeconds(nil),
|
||||||
Containers: []v1.Container{
|
Containers: []v1.Container{
|
||||||
{
|
{
|
||||||
Name: config.Name,
|
Name: config.Name,
|
||||||
Image: config.Image,
|
Image: config.Image,
|
||||||
Command: config.Command,
|
Command: config.Command,
|
||||||
Lifecycle: config.Lifecycle,
|
Lifecycle: config.Lifecycle,
|
||||||
|
SecurityContext: config.SecurityContext,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
RestartPolicy: v1.RestartPolicyOnFailure,
|
RestartPolicy: v1.RestartPolicyOnFailure,
|
||||||
@ -612,12 +618,13 @@ func (config *RCConfig) create() error {
|
|||||||
Affinity: config.Affinity,
|
Affinity: config.Affinity,
|
||||||
Containers: []v1.Container{
|
Containers: []v1.Container{
|
||||||
{
|
{
|
||||||
Name: config.Name,
|
Name: config.Name,
|
||||||
Image: config.Image,
|
Image: config.Image,
|
||||||
Command: config.Command,
|
Command: config.Command,
|
||||||
Ports: []v1.ContainerPort{{ContainerPort: 80}},
|
Ports: []v1.ContainerPort{{ContainerPort: 80}},
|
||||||
ReadinessProbe: config.ReadinessProbe,
|
ReadinessProbe: config.ReadinessProbe,
|
||||||
Lifecycle: config.Lifecycle,
|
Lifecycle: config.Lifecycle,
|
||||||
|
SecurityContext: config.SecurityContext,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
DNSPolicy: *config.DNSPolicy,
|
DNSPolicy: *config.DNSPolicy,
|
||||||
|
Loading…
Reference in New Issue
Block a user