mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
Merge pull request #73657 from krmayankk/service-account
add positive ut for service account projection
This commit is contained in:
commit
017d87dd20
@ -6707,6 +6707,33 @@ func TestValidatePod(t *testing.T) {
|
|||||||
DNSPolicy: core.DNSClusterFirst,
|
DNSPolicy: core.DNSClusterFirst,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{ // valid serviceaccount token projected volume with serviceaccount name specified
|
||||||
|
ObjectMeta: metav1.ObjectMeta{Name: "valid-extended", Namespace: "ns"},
|
||||||
|
Spec: core.PodSpec{
|
||||||
|
ServiceAccountName: "some-service-account",
|
||||||
|
Containers: []core.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent", TerminationMessagePolicy: "File"}},
|
||||||
|
RestartPolicy: core.RestartPolicyAlways,
|
||||||
|
DNSPolicy: core.DNSClusterFirst,
|
||||||
|
Volumes: []core.Volume{
|
||||||
|
{
|
||||||
|
Name: "projected-volume",
|
||||||
|
VolumeSource: core.VolumeSource{
|
||||||
|
Projected: &core.ProjectedVolumeSource{
|
||||||
|
Sources: []core.VolumeProjection{
|
||||||
|
{
|
||||||
|
ServiceAccountToken: &core.ServiceAccountTokenProjection{
|
||||||
|
Audience: "foo-audience",
|
||||||
|
ExpirationSeconds: 6000,
|
||||||
|
Path: "foo-path",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, pod := range successCases {
|
for _, pod := range successCases {
|
||||||
if errs := ValidatePod(&pod); len(errs) != 0 {
|
if errs := ValidatePod(&pod); len(errs) != 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user