mirror of https://github.com/kubernetes/kops.git
				
				
				
			Node Authorizer Client Fix
- fixing up the client for reboots ... somewhat of a oversight on my part :-) - added the reason to the node denial message
This commit is contained in:
		
							parent
							
								
									0959412fa4
								
							
						
					
					
						commit
						97dc2beb71
					
				|  | @ -51,7 +51,7 @@ func addClientCommand() cli.Command { | ||||||
| 				Name:   "kubeconfig", | 				Name:   "kubeconfig", | ||||||
| 				Usage:  "location to write bootstrap token config `PATH`", | 				Usage:  "location to write bootstrap token config `PATH`", | ||||||
| 				EnvVar: "KUBECONFIG_BOOTSTRAP", | 				EnvVar: "KUBECONFIG_BOOTSTRAP", | ||||||
| 				Value:  "/var/run/kubelet/kubelet-bootstrap.yml", | 				Value:  "/var/lib/kubelet/bootstrap-kubeconfig", | ||||||
| 			}, | 			}, | ||||||
| 			cli.StringFlag{ | 			cli.StringFlag{ | ||||||
| 				Name:   "tls-client-ca", | 				Name:   "tls-client-ca", | ||||||
|  |  | ||||||
|  | @ -43,6 +43,14 @@ func New(config *Config) error { | ||||||
| 		zap.String("kubeconfig", config.KubeConfigPath), | 		zap.String("kubeconfig", config.KubeConfigPath), | ||||||
| 		zap.String("registration-url", config.NodeURL)) | 		zap.String("registration-url", config.NodeURL)) | ||||||
| 
 | 
 | ||||||
|  | 	// @step: if we have a kubecfg already we can skip it
 | ||||||
|  | 	if utils.FileExists(config.KubeConfigPath) { | ||||||
|  | 		utils.Logger.Info("skipping the client authorization as kubecfg found", | ||||||
|  | 			zap.String("kubecfg", config.KubeConfigPath)) | ||||||
|  | 
 | ||||||
|  | 		return nil | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	// @step: create the verifier
 | 	// @step: create the verifier
 | ||||||
| 	verifier, err := newNodeVerifier(config.Authorizer) | 	verifier, err := newNodeVerifier(config.Authorizer) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
|  |  | ||||||
|  | @ -80,7 +80,8 @@ func (n *NodeAuthorizer) authorizeNodeRequest(ctx context.Context, request *Node | ||||||
| 	if !request.IsAllowed() { | 	if !request.IsAllowed() { | ||||||
| 		utils.Logger.Error("the node has been denied authorization", | 		utils.Logger.Error("the node has been denied authorization", | ||||||
| 			zap.String("client", request.Spec.RemoteAddr), | 			zap.String("client", request.Spec.RemoteAddr), | ||||||
| 			zap.String("node", request.Spec.NodeName)) | 			zap.String("node", request.Spec.NodeName), | ||||||
|  | 			zap.String("reason", request.Status.Reason)) | ||||||
| 
 | 
 | ||||||
| 		nodeAuthorizationMetric.WithLabelValues("denied").Inc() | 		nodeAuthorizationMetric.WithLabelValues("denied").Inc() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -100,5 +100,5 @@ func GetNodeAuthorizerImage() string { | ||||||
| 		return v | 		return v | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return "quay.io/gambol99/node-authorizer:v0.0.2@sha256:78c20c69187d3098e196e2b645d0571aeef377adc5cbd89684023ec668306268" | 	return "quay.io/gambol99/node-authorizer:v0.0.3@sha256:bc581658115e71d7a08bd5ca216368432d5b8d501ef70924ebd30627773bc134" | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -150,7 +150,7 @@ func (b *BootstrapChannelBuilder) buildManifest() (*channelsapi.Addons, map[stri | ||||||
| 	if b.cluster.Spec.NodeAuthorization != nil { | 	if b.cluster.Spec.NodeAuthorization != nil { | ||||||
| 		{ | 		{ | ||||||
| 			key := "node-authorizer.addons.k8s.io" | 			key := "node-authorizer.addons.k8s.io" | ||||||
| 			version := "v0.0.2" | 			version := "v0.0.3" | ||||||
| 
 | 
 | ||||||
| 			{ | 			{ | ||||||
| 				location := key + "/k8s-1.10.yaml" | 				location := key + "/k8s-1.10.yaml" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue