mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	Merge pull request #94727 from mlevesquedion/fix/avoid-logging-kubeadm-tokens-before-deleting-them
kubeadm: Avoid logging token in RunDeleteTokens
This commit is contained in:
		@@ -420,13 +420,13 @@ func RunDeleteTokens(out io.Writer, client clientset.Interface, tokenIDsOrTokens
 | 
				
			|||||||
	for _, tokenIDOrToken := range tokenIDsOrTokens {
 | 
						for _, tokenIDOrToken := range tokenIDsOrTokens {
 | 
				
			||||||
		// Assume this is a token id and try to parse it
 | 
							// Assume this is a token id and try to parse it
 | 
				
			||||||
		tokenID := tokenIDOrToken
 | 
							tokenID := tokenIDOrToken
 | 
				
			||||||
		klog.V(1).Infof("[token] parsing token %q", tokenIDOrToken)
 | 
							klog.V(1).Info("[token] parsing token")
 | 
				
			||||||
		if !bootstraputil.IsValidBootstrapTokenID(tokenIDOrToken) {
 | 
							if !bootstraputil.IsValidBootstrapTokenID(tokenIDOrToken) {
 | 
				
			||||||
			// Okay, the full token with both id and secret was probably passed. Parse it and extract the ID only
 | 
								// Okay, the full token with both id and secret was probably passed. Parse it and extract the ID only
 | 
				
			||||||
			bts, err := kubeadmapiv1beta2.NewBootstrapTokenString(tokenIDOrToken)
 | 
								bts, err := kubeadmapiv1beta2.NewBootstrapTokenString(tokenIDOrToken)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				return errors.Errorf("given token %q didn't match pattern %q or %q",
 | 
									return errors.Errorf("given token didn't match pattern %q or %q",
 | 
				
			||||||
					tokenIDOrToken, bootstrapapi.BootstrapTokenIDPattern, bootstrapapi.BootstrapTokenIDPattern)
 | 
										bootstrapapi.BootstrapTokenIDPattern, bootstrapapi.BootstrapTokenIDPattern)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			tokenID = bts.ID
 | 
								tokenID = bts.ID
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user