mirror of https://github.com/kubernetes/kops.git
				
				
				
			Admission Controller Fix
A previous PR https://github.com/kubernetes/kops/pull/5221/ introduced the --enable-admission-plugins for >= 1.10.0 as recommended, it does however cause an issue if you already have AdmissionControl is specified in the Spec as both flags get rendered
This commit is contained in:
		
							parent
							
								
									155eb7cf8e
								
							
						
					
					
						commit
						b62d6df115
					
				|  | @ -36,6 +36,7 @@ import ( | |||
| 	"k8s.io/kops/pkg/kubemanifest" | ||||
| ) | ||||
| 
 | ||||
| // PathAuthnConfig is the path to the custom webhook authentication config
 | ||||
| const PathAuthnConfig = "/etc/kubernetes/authn.config" | ||||
| 
 | ||||
| // KubeAPIServerBuilder install kube-apiserver (just the manifest at the moment)
 | ||||
|  | @ -304,6 +305,21 @@ func (b *KubeAPIServerBuilder) buildPod() (*v1.Pod, error) { | |||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	// @fixup: the admission controller migrated from --admission-control to --enable-admission-plugins, but
 | ||||
| 	// most people will still have c.Spec.KubeAPIServer.AdmissionControl references into their configuration we need
 | ||||
| 	// to fix up. A PR https://github.com/kubernetes/kops/pull/5221/ introduced the issue and since the command line
 | ||||
| 	// flags are mutually exclusive the API refuses to come up.
 | ||||
| 	if b.IsKubernetesGTE("1.10") { | ||||
| 		// @note: note sure if this is the best place to put it, I could place into the validation.go which has the benefit of
 | ||||
| 		// fixing up the manifests itself, but that feels VERY hacky
 | ||||
| 		// @note: it's fine to use AdmissionControl here and it's not populated by the model, thus the only data could have come from the cluster spec
 | ||||
| 		c := b.Cluster.Spec.KubeAPIServer | ||||
| 		if len(c.AdmissionControl) > 0 { | ||||
| 			copy(c.EnableAdmissionPlugins, c.AdmissionControl) | ||||
| 			c.AdmissionControl = []string{} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	// build the kube-apiserver flags for the service
 | ||||
| 	flags, err := flagbuilder.BuildFlagsList(b.Cluster.Spec.KubeAPIServer) | ||||
| 	if err != nil { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue