mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Replace glog.Info{f,ln} with fmt.Print{f,ln}
This follows the pattern `kubectl` uses for logging. There are two remaining glog.Infof call that cannot be removed easily. One glog call comes from kubelet validation which calls features.SetFromMap. The other comes from test/e2e during kernel validation. Mostly fixes kubernetes/kubeadm#852 Signed-off-by: Chuck Ha <ha.chuck@gmail.com>
This commit is contained in:
parent
1635393bd1
commit
125f5ac61a
@ -13,6 +13,7 @@ go_library(
|
||||
"//cmd/kubeadm/app/cmd:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/util/flag:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -65,7 +65,6 @@ go_library(
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/duration:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/version:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/util/flag:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
|
||||
"//vendor/k8s.io/client-go/tools/bootstrap/token/api:go_default_library",
|
||||
"//vendor/k8s.io/client-go/tools/bootstrap/token/util:go_default_library",
|
||||
|
@ -22,7 +22,6 @@ import (
|
||||
"github.com/renstrom/dedent"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"k8s.io/apiserver/pkg/util/flag"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade"
|
||||
// Register the kubeadm configuration types because CLI flag generation
|
||||
@ -69,7 +68,6 @@ func NewKubeadmCommand(in io.Reader, out, err io.Writer) *cobra.Command {
|
||||
}
|
||||
|
||||
cmds.ResetFlags()
|
||||
cmds.SetGlobalNormalizationFunc(flag.WarnWordSepNormalizeFunc)
|
||||
|
||||
cmds.AddCommand(NewCmdCompletion(out, ""))
|
||||
cmds.AddCommand(NewCmdConfig(out))
|
||||
|
@ -410,7 +410,7 @@ func (ip *ImagesPull) PullAll() error {
|
||||
if err := ip.puller.Pull(image); err != nil {
|
||||
return fmt.Errorf("failed to pull image %q: %v", image, err)
|
||||
}
|
||||
glog.Infof("[config/images] Pulled %s\n", image)
|
||||
fmt.Printf("[config/images] Pulled %s\n", image)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -251,9 +251,9 @@ func NewInit(cfgPath string, externalcfg *kubeadmapiv1alpha2.MasterConfiguration
|
||||
return nil, err
|
||||
}
|
||||
|
||||
glog.Infof("[init] using Kubernetes version: %s\n", cfg.KubernetesVersion)
|
||||
fmt.Printf("[init] using Kubernetes version: %s\n", cfg.KubernetesVersion)
|
||||
|
||||
glog.Infoln("[preflight] running pre-flight checks")
|
||||
fmt.Println("[preflight] running pre-flight checks")
|
||||
|
||||
if err := preflight.RunInitMasterChecks(utilsexec.New(), cfg, ignorePreflightErrors); err != nil {
|
||||
return nil, err
|
||||
@ -314,7 +314,7 @@ func (i *Init) Run(out io.Writer) error {
|
||||
}
|
||||
|
||||
} else {
|
||||
glog.Infoln("[externalca] the file 'ca.key' was not found, yet all other certificates are present. Using external CA mode - certificates or kubeconfig will not be generated")
|
||||
fmt.Println("[externalca] the file 'ca.key' was not found, yet all other certificates are present. Using external CA mode - certificates or kubeconfig will not be generated")
|
||||
}
|
||||
|
||||
if features.Enabled(i.cfg.FeatureGates, features.Auditing) {
|
||||
@ -433,9 +433,9 @@ func (i *Init) Run(out io.Writer) error {
|
||||
}
|
||||
if !i.skipTokenPrint {
|
||||
if len(tokens) == 1 {
|
||||
glog.Infof("[bootstraptoken] using token: %s\n", tokens[0])
|
||||
fmt.Printf("[bootstraptoken] using token: %s\n", tokens[0])
|
||||
} else if len(tokens) > 1 {
|
||||
glog.Infof("[bootstraptoken] using tokens: %v\n", tokens)
|
||||
fmt.Printf("[bootstraptoken] using tokens: %v\n", tokens)
|
||||
}
|
||||
}
|
||||
|
||||
@ -486,7 +486,7 @@ func (i *Init) Run(out io.Writer) error {
|
||||
if features.Enabled(i.cfg.FeatureGates, features.SelfHosting) {
|
||||
// Temporary control plane is up, now we create our self hosted control
|
||||
// plane components and remove the static manifests:
|
||||
glog.Infoln("[self-hosted] creating self-hosted control plane")
|
||||
fmt.Println("[self-hosted] creating self-hosted control plane")
|
||||
if err := selfhostingphase.CreateSelfHostedControlPlane(manifestDir, kubeConfigDir, i.cfg, client, waiter, i.dryRun); err != nil {
|
||||
return fmt.Errorf("error creating self hosted control plane: %v", err)
|
||||
}
|
||||
@ -554,9 +554,9 @@ func printFilesIfDryRunning(dryRun bool, manifestDir string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
glog.Infof("[dryrun] wrote certificates, kubeconfig files and control plane manifests to the %q directory\n", manifestDir)
|
||||
glog.Infoln("[dryrun] the certificates or kubeconfig files would not be printed due to their sensitive nature")
|
||||
glog.Infof("[dryrun] please examine the %q directory for details about what would be written\n", manifestDir)
|
||||
fmt.Printf("[dryrun] wrote certificates, kubeconfig files and control plane manifests to the %q directory\n", manifestDir)
|
||||
fmt.Println("[dryrun] the certificates or kubeconfig files would not be printed due to their sensitive nature")
|
||||
fmt.Printf("[dryrun] please examine the %q directory for details about what would be written\n", manifestDir)
|
||||
|
||||
// Print the contents of the upgraded manifests and pretend like they were in /etc/kubernetes/manifests
|
||||
files := []dryrunutil.FileToPrint{}
|
||||
@ -587,8 +587,8 @@ func getWaiter(i *Init, client clientset.Interface) apiclient.Waiter {
|
||||
func waitForAPIAndKubelet(waiter apiclient.Waiter) error {
|
||||
errorChan := make(chan error)
|
||||
|
||||
glog.Infof("[init] waiting for the kubelet to boot up the control plane as Static Pods from directory %q \n", kubeadmconstants.GetStaticPodDirectory())
|
||||
glog.Infoln("[init] this might take a minute or longer if the control plane images have to be pulled")
|
||||
fmt.Printf("[init] waiting for the kubelet to boot up the control plane as Static Pods from directory %q \n", kubeadmconstants.GetStaticPodDirectory())
|
||||
fmt.Println("[init] this might take a minute or longer if the control plane images have to be pulled")
|
||||
|
||||
go func(errC chan error, waiter apiclient.Waiter) {
|
||||
// This goroutine can only make kubeadm init fail. If this check succeeds, it won't do anything special
|
||||
|
@ -214,7 +214,7 @@ func NewJoin(cfgPath string, args []string, defaultcfg *kubeadmapiv1alpha2.NodeC
|
||||
return nil, err
|
||||
}
|
||||
|
||||
glog.Infoln("[preflight] running pre-flight checks")
|
||||
fmt.Println("[preflight] running pre-flight checks")
|
||||
|
||||
// Then continue with the others...
|
||||
glog.V(1).Infoln("[preflight] running various checks on all nodes")
|
||||
|
@ -41,7 +41,7 @@ import (
|
||||
|
||||
var (
|
||||
allTokenLongDesc = normalizer.LongDesc(`
|
||||
Bootstrap tokens are used for establishing bidirectional trust between a node joining
|
||||
Bootstrap tokens are used for establishing bidirectional trust between a node joining
|
||||
the cluster and a the master node.
|
||||
|
||||
This command makes all the configurations required to make bootstrap tokens works
|
||||
@ -49,21 +49,21 @@ var (
|
||||
` + cmdutil.AlphaDisclaimer)
|
||||
|
||||
allTokenExamples = normalizer.Examples(`
|
||||
# Makes all the bootstrap token configurations and creates an initial token, functionally
|
||||
# Makes all the bootstrap token configurations and creates an initial token, functionally
|
||||
# equivalent to what generated by kubeadm init.
|
||||
kubeadm alpha phase bootstrap-token all
|
||||
`)
|
||||
|
||||
createTokenLongDesc = normalizer.LongDesc(`
|
||||
Creates a bootstrap token. If no token value is given, kubeadm will generate a random token instead.
|
||||
|
||||
|
||||
Alternatively, you can use kubeadm token.
|
||||
` + cmdutil.AlphaDisclaimer)
|
||||
|
||||
clusterInfoLongDesc = fmt.Sprintf(normalizer.LongDesc(`
|
||||
Uploads the %q ConfigMap in the %q namespace, populating it with cluster information extracted from the
|
||||
given kubeconfig file. The ConfigMap is used for the node bootstrap process in its initial phases,
|
||||
before the client trusts the API server.
|
||||
Uploads the %q ConfigMap in the %q namespace, populating it with cluster information extracted from the
|
||||
given kubeconfig file. The ConfigMap is used for the node bootstrap process in its initial phases,
|
||||
before the client trusts the API server.
|
||||
|
||||
See online documentation about Authenticating with Bootstrap Tokens for more details.
|
||||
`+cmdutil.AlphaDisclaimer), bootstrapapi.ConfigMapClusterInfo, metav1.NamespacePublic)
|
||||
@ -76,10 +76,10 @@ var (
|
||||
` + cmdutil.AlphaDisclaimer)
|
||||
|
||||
nodeAutoApproveLongDesc = normalizer.LongDesc(`
|
||||
Configures RBAC rules to allow the csrapprover controller to automatically approve
|
||||
Configures RBAC rules to allow the csrapprover controller to automatically approve
|
||||
certificate signing requests generated by nodes joining the cluster.
|
||||
It configures also RBAC rules for certificates rotation (with auto approval of new certificates).
|
||||
|
||||
|
||||
See online documentation about TLS bootstrapping for more details.
|
||||
` + cmdutil.AlphaDisclaimer)
|
||||
)
|
||||
@ -320,15 +320,15 @@ func createBootstrapToken(kubeConfigFile string, client clientset.Interface, cfg
|
||||
return err
|
||||
}
|
||||
|
||||
glog.Infoln("[bootstraptoken] bootstrap token created")
|
||||
glog.Infoln("[bootstraptoken] you can now join any number of machines by running:")
|
||||
fmt.Println("[bootstraptoken] bootstrap token created")
|
||||
fmt.Println("[bootstraptoken] you can now join any number of machines by running:")
|
||||
|
||||
if len(internalcfg.BootstrapTokens) > 0 {
|
||||
joinCommand, err := cmdutil.GetJoinCommand(kubeConfigFile, internalcfg.BootstrapTokens[0].Token.String(), skipTokenPrint)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get join command: %v", err)
|
||||
}
|
||||
glog.Infoln(joinCommand)
|
||||
fmt.Println(joinCommand)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ func NewReset(in io.Reader, ignorePreflightErrors sets.String, forceReset bool,
|
||||
}
|
||||
}
|
||||
|
||||
glog.Infoln("[preflight] running pre-flight checks")
|
||||
fmt.Println("[preflight] running pre-flight checks")
|
||||
if err := preflight.RunRootCheckOnly(ignorePreflightErrors); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -130,7 +130,7 @@ func (r *Reset) Run(out io.Writer) error {
|
||||
glog.Warningln("[reset] the kubelet service could not be stopped by kubeadm. Unable to detect a supported init system!")
|
||||
glog.Warningln("[reset] please ensure kubelet is stopped manually")
|
||||
} else {
|
||||
glog.Infoln("[reset] stopping the kubelet service")
|
||||
fmt.Println("[reset] stopping the kubelet service")
|
||||
if err := initSystem.ServiceStop("kubelet"); err != nil {
|
||||
glog.Warningf("[reset] the kubelet service could not be stopped by kubeadm: [%v]\n", err)
|
||||
glog.Warningln("[reset] please ensure kubelet is stopped manually")
|
||||
@ -138,7 +138,7 @@ func (r *Reset) Run(out io.Writer) error {
|
||||
}
|
||||
|
||||
// Try to unmount mounted directories under /var/lib/kubelet in order to be able to remove the /var/lib/kubelet directory later
|
||||
glog.Infof("[reset] unmounting mounted directories in %q\n", "/var/lib/kubelet")
|
||||
fmt.Printf("[reset] unmounting mounted directories in %q\n", "/var/lib/kubelet")
|
||||
umountDirsCmd := "awk '$2 ~ path {print $2}' path=/var/lib/kubelet /proc/mounts | xargs -r umount"
|
||||
|
||||
glog.V(1).Infof("[reset] executing command %q", umountDirsCmd)
|
||||
@ -147,7 +147,7 @@ func (r *Reset) Run(out io.Writer) error {
|
||||
glog.Errorf("[reset] failed to unmount mounted directories in /var/lib/kubelet: %s\n", string(umountOutputBytes))
|
||||
}
|
||||
|
||||
glog.Infoln("[reset] removing kubernetes-managed containers")
|
||||
fmt.Println("[reset] removing kubernetes-managed containers")
|
||||
dockerCheck := preflight.ServiceCheck{Service: "docker", CheckIfActive: true}
|
||||
execer := utilsexec.New()
|
||||
|
||||
@ -163,11 +163,11 @@ func (r *Reset) Run(out io.Writer) error {
|
||||
glog.V(1).Infof("Found one at %s", etcdManifestPath)
|
||||
dirsToClean = append(dirsToClean, "/var/lib/etcd")
|
||||
} else {
|
||||
glog.Infof("[reset] no etcd manifest found in %q. Assuming external etcd\n", etcdManifestPath)
|
||||
fmt.Printf("[reset] no etcd manifest found in %q. Assuming external etcd\n", etcdManifestPath)
|
||||
}
|
||||
|
||||
// Then clean contents from the stateful kubelet, etcd and cni directories
|
||||
glog.Infof("[reset] deleting contents of stateful directories: %v\n", dirsToClean)
|
||||
fmt.Printf("[reset] deleting contents of stateful directories: %v\n", dirsToClean)
|
||||
for _, dir := range dirsToClean {
|
||||
glog.V(1).Infof("[reset] deleting content of %s", dir)
|
||||
cleanDir(dir)
|
||||
@ -198,20 +198,20 @@ func resetWithDocker(execer utilsexec.Interface, dockerCheck preflight.Checker)
|
||||
glog.Errorln("[reset] failed to stop the running containers")
|
||||
}
|
||||
} else {
|
||||
glog.Infoln("[reset] docker doesn't seem to be running. Skipping the removal of running Kubernetes containers")
|
||||
fmt.Println("[reset] docker doesn't seem to be running. Skipping the removal of running Kubernetes containers")
|
||||
}
|
||||
}
|
||||
|
||||
func resetWithCrictl(execer utilsexec.Interface, dockerCheck preflight.Checker, criSocketPath, crictlPath string) {
|
||||
if criSocketPath != "" {
|
||||
glog.Infof("[reset] cleaning up running containers using crictl with socket %s\n", criSocketPath)
|
||||
fmt.Printf("[reset] cleaning up running containers using crictl with socket %s\n", criSocketPath)
|
||||
glog.V(1).Infoln("[reset] listing running pods using crictl")
|
||||
|
||||
params := []string{"-r", criSocketPath, "pods", "--quiet"}
|
||||
glog.V(1).Infof("[reset] Executing command %s %s", crictlPath, strings.Join(params, " "))
|
||||
output, err := execer.Command(crictlPath, params...).CombinedOutput()
|
||||
if err != nil {
|
||||
glog.Infof("[reset] failed to list running pods using crictl: %v. Trying to use docker instead", err)
|
||||
fmt.Printf("[reset] failed to list running pods using crictl: %v. Trying to use docker instead", err)
|
||||
resetWithDocker(execer, dockerCheck)
|
||||
return
|
||||
}
|
||||
@ -224,20 +224,20 @@ func resetWithCrictl(execer utilsexec.Interface, dockerCheck preflight.Checker,
|
||||
params = []string{"-r", criSocketPath, "stopp", s}
|
||||
glog.V(1).Infof("[reset] Executing command %s %s", crictlPath, strings.Join(params, " "))
|
||||
if err := execer.Command(crictlPath, params...).Run(); err != nil {
|
||||
glog.Infof("[reset] failed to stop the running containers using crictl: %v. Trying to use docker instead", err)
|
||||
fmt.Printf("[reset] failed to stop the running containers using crictl: %v. Trying to use docker instead", err)
|
||||
resetWithDocker(execer, dockerCheck)
|
||||
return
|
||||
}
|
||||
params = []string{"-r", criSocketPath, "rmp", s}
|
||||
glog.V(1).Infof("[reset] Executing command %s %s", crictlPath, strings.Join(params, " "))
|
||||
if err := execer.Command(crictlPath, params...).Run(); err != nil {
|
||||
glog.Infof("[reset] failed to remove the running containers using crictl: %v. Trying to use docker instead", err)
|
||||
fmt.Printf("[reset] failed to remove the running containers using crictl: %v. Trying to use docker instead", err)
|
||||
resetWithDocker(execer, dockerCheck)
|
||||
return
|
||||
}
|
||||
}
|
||||
} else {
|
||||
glog.Infoln("[reset] CRI socket path not provided for crictl. Trying to use docker instead")
|
||||
fmt.Println("[reset] CRI socket path not provided for crictl. Trying to use docker instead")
|
||||
resetWithDocker(execer, dockerCheck)
|
||||
}
|
||||
}
|
||||
@ -273,7 +273,7 @@ func resetConfigDir(configPathDir, pkiPathDir string) {
|
||||
filepath.Join(configPathDir, kubeadmconstants.ManifestsSubDirName),
|
||||
pkiPathDir,
|
||||
}
|
||||
glog.Infof("[reset] deleting contents of config directories: %v\n", dirsToClean)
|
||||
fmt.Printf("[reset] deleting contents of config directories: %v\n", dirsToClean)
|
||||
for _, dir := range dirsToClean {
|
||||
if err := cleanDir(dir); err != nil {
|
||||
glog.Errorf("[reset] failed to remove directory: %q [%v]\n", dir, err)
|
||||
@ -287,7 +287,7 @@ func resetConfigDir(configPathDir, pkiPathDir string) {
|
||||
filepath.Join(configPathDir, kubeadmconstants.ControllerManagerKubeConfigFileName),
|
||||
filepath.Join(configPathDir, kubeadmconstants.SchedulerKubeConfigFileName),
|
||||
}
|
||||
glog.Infof("[reset] deleting files: %v\n", filesToClean)
|
||||
fmt.Printf("[reset] deleting files: %v\n", filesToClean)
|
||||
for _, path := range filesToClean {
|
||||
if err := os.RemoveAll(path); err != nil {
|
||||
glog.Errorf("[reset] failed to remove file: %q [%v]\n", path, err)
|
||||
|
@ -197,14 +197,14 @@ func RunApply(flags *applyFlags) error {
|
||||
}
|
||||
|
||||
if flags.dryRun {
|
||||
glog.Infoln("[dryrun] Finished dryrunning successfully!")
|
||||
fmt.Println("[dryrun] Finished dryrunning successfully!")
|
||||
return nil
|
||||
}
|
||||
|
||||
glog.Infoln("")
|
||||
glog.Infof("[upgrade/successful] SUCCESS! Your cluster was upgraded to %q. Enjoy!\n", flags.newK8sVersionStr)
|
||||
glog.Infoln("")
|
||||
glog.Infoln("[upgrade/kubelet] Now that your control plane is upgraded, please proceed with upgrading your kubelets if you haven't already done so.")
|
||||
fmt.Println("")
|
||||
fmt.Printf("[upgrade/successful] SUCCESS! Your cluster was upgraded to %q. Enjoy!\n", flags.newK8sVersionStr)
|
||||
fmt.Println("")
|
||||
fmt.Println("[upgrade/kubelet] Now that your control plane is upgraded, please proceed with upgrading your kubelets if you haven't already done so.")
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -226,7 +226,7 @@ func SetImplicitFlags(flags *applyFlags) error {
|
||||
// EnforceVersionPolicies makes sure that the version the user specified is valid to upgrade to
|
||||
// There are both fatal and skippable (with --force) errors
|
||||
func EnforceVersionPolicies(flags *applyFlags, versionGetter upgrade.VersionGetter) error {
|
||||
glog.Infof("[upgrade/version] You have chosen to change the cluster version to %q\n", flags.newK8sVersionStr)
|
||||
fmt.Printf("[upgrade/version] You have chosen to change the cluster version to %q\n", flags.newK8sVersionStr)
|
||||
|
||||
versionSkewErrs := upgrade.EnforceVersionPolicies(versionGetter, flags.newK8sVersionStr, flags.newK8sVersion, flags.parent.allowExperimentalUpgrades, flags.parent.allowRCUpgrades)
|
||||
if versionSkewErrs != nil {
|
||||
@ -241,7 +241,7 @@ func EnforceVersionPolicies(flags *applyFlags, versionGetter upgrade.VersionGett
|
||||
return fmt.Errorf("The --version argument is invalid due to these errors:\n\n%v\nCan be bypassed if you pass the --force flag", kubeadmutil.FormatErrMsg(versionSkewErrs.Skippable))
|
||||
}
|
||||
// Soft errors found, but --force was specified
|
||||
glog.Infof("[upgrade/version] Found %d potential version compatibility errors but skipping since the --force flag is set: \n\n%v", len(versionSkewErrs.Skippable), kubeadmutil.FormatErrMsg(versionSkewErrs.Skippable))
|
||||
fmt.Printf("[upgrade/version] Found %d potential version compatibility errors but skipping since the --force flag is set: \n\n%v", len(versionSkewErrs.Skippable), kubeadmutil.FormatErrMsg(versionSkewErrs.Skippable))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
_ "github.com/golang/glog"
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
utilflag "k8s.io/apiserver/pkg/util/flag"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd"
|
||||
)
|
||||
|
||||
@ -32,6 +33,7 @@ func Run() error {
|
||||
pflag.CommandLine.MarkHidden("version")
|
||||
pflag.CommandLine.MarkHidden("google-json-key")
|
||||
pflag.CommandLine.MarkHidden("log-flush-frequency")
|
||||
pflag.CommandLine.SetNormalizeFunc(utilflag.WordSepNormalizeFunc)
|
||||
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
|
||||
|
||||
pflag.Set("logtostderr", "true")
|
||||
|
@ -40,7 +40,7 @@ const (
|
||||
// CreateBootstrapConfigMapIfNotExists creates the kube-public ConfigMap if it doesn't exist already
|
||||
func CreateBootstrapConfigMapIfNotExists(client clientset.Interface, file string) error {
|
||||
|
||||
glog.Infof("[bootstraptoken] creating the %q ConfigMap in the %q namespace\n", bootstrapapi.ConfigMapClusterInfo, metav1.NamespacePublic)
|
||||
fmt.Printf("[bootstraptoken] creating the %q ConfigMap in the %q namespace\n", bootstrapapi.ConfigMapClusterInfo, metav1.NamespacePublic)
|
||||
|
||||
glog.V(1).Infoln("[bootstraptoken] loading admin kubeconfig")
|
||||
adminConfig, err := clientcmd.LoadFromFile(file)
|
||||
|
@ -16,7 +16,6 @@ go_library(
|
||||
"//cmd/kubeadm/app/apis/kubeadm:go_default_library",
|
||||
"//cmd/kubeadm/app/constants:go_default_library",
|
||||
"//cmd/kubeadm/app/util/apiclient:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/k8s.io/api/rbac/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
|
||||
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||
package node
|
||||
|
||||
import (
|
||||
"github.com/golang/glog"
|
||||
"fmt"
|
||||
|
||||
rbac "k8s.io/api/rbac/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@ -47,7 +47,7 @@ const (
|
||||
|
||||
// AllowBootstrapTokensToPostCSRs creates RBAC rules in a way the makes Node Bootstrap Tokens able to post CSRs
|
||||
func AllowBootstrapTokensToPostCSRs(client clientset.Interface) error {
|
||||
glog.Infoln("[bootstraptoken] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials")
|
||||
fmt.Println("[bootstraptoken] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials")
|
||||
|
||||
return apiclient.CreateOrUpdateClusterRoleBinding(client, &rbac.ClusterRoleBinding{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
@ -69,7 +69,7 @@ func AllowBootstrapTokensToPostCSRs(client clientset.Interface) error {
|
||||
|
||||
// AutoApproveNodeBootstrapTokens creates RBAC rules in a way that makes Node Bootstrap Tokens' CSR auto-approved by the csrapprover controller
|
||||
func AutoApproveNodeBootstrapTokens(client clientset.Interface) error {
|
||||
glog.Infoln("[bootstraptoken] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token")
|
||||
fmt.Println("[bootstraptoken] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token")
|
||||
|
||||
// Always create this kubeadm-specific binding though
|
||||
return apiclient.CreateOrUpdateClusterRoleBinding(client, &rbac.ClusterRoleBinding{
|
||||
@ -92,7 +92,7 @@ func AutoApproveNodeBootstrapTokens(client clientset.Interface) error {
|
||||
|
||||
// AutoApproveNodeCertificateRotation creates RBAC rules in a way that makes Node certificate rotation CSR auto-approved by the csrapprover controller
|
||||
func AutoApproveNodeCertificateRotation(client clientset.Interface) error {
|
||||
glog.Infoln("[bootstraptoken] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster")
|
||||
fmt.Println("[bootstraptoken] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster")
|
||||
|
||||
return apiclient.CreateOrUpdateClusterRoleBinding(client, &rbac.ClusterRoleBinding{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
|
@ -62,7 +62,7 @@ func CreatePKIAssets(cfg *kubeadmapi.MasterConfiguration) error {
|
||||
}
|
||||
}
|
||||
|
||||
glog.Infof("[certificates] valid certificates and keys now exist in %q\n", cfg.CertificatesDir)
|
||||
fmt.Printf("[certificates] valid certificates and keys now exist in %q\n", cfg.CertificatesDir)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ func createStaticPodFiles(manifestDir string, cfg *kubeadmapi.MasterConfiguratio
|
||||
return fmt.Errorf("failed to create static pod manifest file for %q: %v", componentName, err)
|
||||
}
|
||||
|
||||
glog.Infof("[controlplane] wrote Static Pod manifest for component %s to %q\n", componentName, kubeadmconstants.GetStaticPodFilepath(componentName, manifestDir))
|
||||
fmt.Printf("[controlplane] wrote Static Pod manifest for component %s to %q\n", componentName, kubeadmconstants.GetStaticPodFilepath(componentName, manifestDir))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -28,7 +28,6 @@ go_library(
|
||||
deps = [
|
||||
"//cmd/kubeadm/app/constants:go_default_library",
|
||||
"//cmd/kubeadm/app/util/apiclient:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
|
||||
],
|
||||
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||
package markmaster
|
||||
|
||||
import (
|
||||
"github.com/golang/glog"
|
||||
"fmt"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
@ -28,10 +28,10 @@ import (
|
||||
// MarkMaster taints the master and sets the master label
|
||||
func MarkMaster(client clientset.Interface, masterName string, taints []v1.Taint) error {
|
||||
|
||||
glog.Infof("[markmaster] Marking the node %s as master by adding the label \"%s=''\"\n", masterName, constants.LabelNodeRoleMaster)
|
||||
fmt.Printf("[markmaster] Marking the node %s as master by adding the label \"%s=''\"\n", masterName, constants.LabelNodeRoleMaster)
|
||||
|
||||
if taints != nil && len(taints) > 0 {
|
||||
glog.Infof("[markmaster] Marking the node %s as master by adding the taints %v\n", masterName, taints)
|
||||
fmt.Printf("[markmaster] Marking the node %s as master by adding the taints %v\n", masterName, taints)
|
||||
}
|
||||
|
||||
return apiclient.PatchNode(client, masterName, func(n *v1.Node) {
|
||||
|
@ -128,7 +128,7 @@ func CreateSelfHostedControlPlane(manifestsDir, kubeConfigDir string, cfg *kubea
|
||||
return err
|
||||
}
|
||||
|
||||
glog.Infof("[self-hosted] self-hosted %s ready after %f seconds\n", componentName, time.Since(start).Seconds())
|
||||
fmt.Printf("[self-hosted] self-hosted %s ready after %f seconds\n", componentName, time.Since(start).Seconds())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ go_library(
|
||||
"//cmd/kubeadm/app/constants:go_default_library",
|
||||
"//cmd/kubeadm/app/util:go_default_library",
|
||||
"//cmd/kubeadm/app/util/apiclient:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
|
||||
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||
package uploadconfig
|
||||
|
||||
import (
|
||||
"github.com/golang/glog"
|
||||
"fmt"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@ -34,7 +34,7 @@ import (
|
||||
// UploadConfiguration saves the MasterConfiguration used for later reference (when upgrading for instance)
|
||||
func UploadConfiguration(cfg *kubeadmapi.MasterConfiguration, client clientset.Interface) error {
|
||||
|
||||
glog.Infof("[uploadconfig] storing the configuration used in ConfigMap %q in the %q Namespace\n", kubeadmconstants.MasterConfigurationConfigMap, metav1.NamespaceSystem)
|
||||
fmt.Printf("[uploadconfig] storing the configuration used in ConfigMap %q in the %q Namespace\n", kubeadmconstants.MasterConfigurationConfigMap, metav1.NamespaceSystem)
|
||||
|
||||
// Convert cfg to the external version as that's the only version of the API that can be deserialized later
|
||||
externalcfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||
|
@ -1092,10 +1092,10 @@ func TryStartKubelet(ignorePreflightErrors sets.String) {
|
||||
// If we notice that the kubelet service is inactive, try to start it
|
||||
initSystem, err := initsystem.GetInitSystem()
|
||||
if err != nil {
|
||||
glog.Infoln("[preflight] no supported init system detected, won't ensure kubelet is running.")
|
||||
fmt.Println("[preflight] no supported init system detected, won't ensure kubelet is running.")
|
||||
} else if initSystem.ServiceExists("kubelet") {
|
||||
|
||||
glog.Infoln("[preflight] Activating the kubelet service")
|
||||
fmt.Println("[preflight] Activating the kubelet service")
|
||||
// This runs "systemctl daemon-reload && systemctl restart kubelet"
|
||||
if err := initSystem.ServiceRestart("kubelet"); err != nil {
|
||||
glog.Warningf("[preflight] unable to start the kubelet service: [%v]\n", err)
|
||||
|
Loading…
Reference in New Issue
Block a user