Fix #15243 Set AutomountServiceAccountToken to false
podman does not use any service account token, so we set the automount flag to false in podman generate kube. Signed-off-by: François Poirotte <clicky@erebot.net>
This commit is contained in:
		
							parent
							
								
									9ab6449e36
								
							
						
					
					
						commit
						71978b0a0c
					
				|  | @ -470,6 +470,8 @@ func newPodObject(podName string, annotations map[string]string, initCtrs, conta | ||||||
| 	} | 	} | ||||||
| 	// Set enableServiceLinks to false as podman doesn't use the service port environment variables
 | 	// Set enableServiceLinks to false as podman doesn't use the service port environment variables
 | ||||||
| 	enableServiceLinks := false | 	enableServiceLinks := false | ||||||
|  | 	// Set automountServiceAccountToken to false as podman doesn't use service account tokens
 | ||||||
|  | 	automountServiceAccountToken := false | ||||||
| 	ps := v1.PodSpec{ | 	ps := v1.PodSpec{ | ||||||
| 		Containers:                   containers, | 		Containers:                   containers, | ||||||
| 		Hostname:                     hostname, | 		Hostname:                     hostname, | ||||||
|  | @ -477,6 +479,7 @@ func newPodObject(podName string, annotations map[string]string, initCtrs, conta | ||||||
| 		InitContainers:               initCtrs, | 		InitContainers:               initCtrs, | ||||||
| 		Volumes:                      volumes, | 		Volumes:                      volumes, | ||||||
| 		EnableServiceLinks:           &enableServiceLinks, | 		EnableServiceLinks:           &enableServiceLinks, | ||||||
|  | 		AutomountServiceAccountToken: &automountServiceAccountToken, | ||||||
| 	} | 	} | ||||||
| 	if dnsOptions != nil && (len(dnsOptions.Nameservers)+len(dnsOptions.Searches)+len(dnsOptions.Options) > 0) { | 	if dnsOptions != nil && (len(dnsOptions.Nameservers)+len(dnsOptions.Searches)+len(dnsOptions.Options) > 0) { | ||||||
| 		ps.DNSConfig = dnsOptions | 		ps.DNSConfig = dnsOptions | ||||||
|  |  | ||||||
|  | @ -73,6 +73,8 @@ var _ = Describe("Podman generate kube", func() { | ||||||
| 		Expect(pod).To(HaveField("Name", "top-pod")) | 		Expect(pod).To(HaveField("Name", "top-pod")) | ||||||
| 		enableServiceLinks := false | 		enableServiceLinks := false | ||||||
| 		Expect(pod.Spec).To(HaveField("EnableServiceLinks", &enableServiceLinks)) | 		Expect(pod.Spec).To(HaveField("EnableServiceLinks", &enableServiceLinks)) | ||||||
|  | 		automountServiceAccountToken := false | ||||||
|  | 		Expect(pod.Spec).To(HaveField("AutomountServiceAccountToken", &automountServiceAccountToken)) | ||||||
| 
 | 
 | ||||||
| 		numContainers := 0 | 		numContainers := 0 | ||||||
| 		for range pod.Spec.Containers { | 		for range pod.Spec.Containers { | ||||||
|  | @ -169,6 +171,8 @@ var _ = Describe("Podman generate kube", func() { | ||||||
| 		Expect(pod.Spec).To(HaveField("HostNetwork", false)) | 		Expect(pod.Spec).To(HaveField("HostNetwork", false)) | ||||||
| 		enableServiceLinks := false | 		enableServiceLinks := false | ||||||
| 		Expect(pod.Spec).To(HaveField("EnableServiceLinks", &enableServiceLinks)) | 		Expect(pod.Spec).To(HaveField("EnableServiceLinks", &enableServiceLinks)) | ||||||
|  | 		automountServiceAccountToken := false | ||||||
|  | 		Expect(pod.Spec).To(HaveField("AutomountServiceAccountToken", &automountServiceAccountToken)) | ||||||
| 
 | 
 | ||||||
| 		numContainers := 0 | 		numContainers := 0 | ||||||
| 		for range pod.Spec.Containers { | 		for range pod.Spec.Containers { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue