cleanup of messages

This commit is contained in:
Dan Finneran
2025-02-05 09:24:39 +00:00
parent 81c0b4faf5
commit e1481db95c
6 changed files with 10 additions and 24 deletions

View File

@@ -34,8 +34,7 @@ var kubeKubeadmInit = &cobra.Command{
Short: "kube-vip init",
Long: "The \"init\" subcommand will generate the Kubernetes manifest that will be started by kubeadm through the kubeadm init process",
Run: func(cmd *cobra.Command, args []string) { //nolint TODO
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(logLevel))
initConfig.LoadBalancers = append(initConfig.LoadBalancers, initLoadBalancer)
// TODO - A load of text detailing what's actually happening
err := kubevip.ParseEnvironment(&initConfig)
@@ -75,8 +74,6 @@ var kubeKubeadmJoin = &cobra.Command{
Use: "join",
Short: "kube-vip join",
Run: func(cmd *cobra.Command, args []string) { //nolint TODO
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(logLevel))
initConfig.LoadBalancers = append(initConfig.LoadBalancers, initLoadBalancer)
// TODO - A load of text detailing what's actually happening

View File

@@ -49,9 +49,6 @@ var kubeManifestPod = &cobra.Command{
return
}
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(initConfig.Logging))
// The control plane has a requirement for a VIP being specified
if initConfig.EnableControlPlane && (initConfig.VIP == "" && initConfig.Address == "" && !initConfig.DDNS) {
_ = cmd.Help()
@@ -85,10 +82,6 @@ var kubeManifestDaemon = &cobra.Command{
log.Error("parsing environment", "err", err)
return
}
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(initConfig.Logging))
// The control plane has a requirement for a VIP being specified
if initConfig.EnableControlPlane && (initConfig.VIP == "" && initConfig.Address == "" && !initConfig.DDNS) {
_ = cmd.Help()
@@ -116,8 +109,6 @@ var kubeManifestRbac = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) { //nolint TODO
var err error
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(logLevel))
initConfig.LoadBalancers = append(initConfig.LoadBalancers, initLoadBalancer)
// TODO - A load of text detailing what's actually happening
if err := kubevip.ParseEnvironment(&initConfig); err != nil {

View File

@@ -29,7 +29,7 @@ var inCluster bool
var configMap string
// Configure the level of logging
var logLevel uint32
var logLevel int32
// Provider Config
var providerConfig string
@@ -111,7 +111,7 @@ func init() {
kubeVipCmd.PersistentFlags().StringVarP(&initConfig.Namespace, "namespace", "n", "kube-system", "The namespace for the configmap defined within the cluster")
// Manage logging
kubeVipCmd.PersistentFlags().Uint32Var(&logLevel, "log", 0, "Set the level of logging")
kubeVipCmd.PersistentFlags().Int32Var(&logLevel, "log", 0, "Set the level of logging")
// Service flags
kubeVipService.Flags().StringVarP(&configMap, "configMap", "c", "plndr", "The configuration map defined within the cluster")
@@ -159,6 +159,9 @@ func init() {
kubeVipCmd.AddCommand(kubeVipSample)
kubeVipCmd.AddCommand(kubeVipService)
kubeVipCmd.AddCommand(kubeVipVersion)
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(logLevel))
}
// Execute - starts the command parsing process
@@ -191,8 +194,6 @@ var kubeVipService = &cobra.Command{
Use: "service",
Short: "Start the Virtual IP / Load balancer as a service within a Kubernetes cluster",
Run: func(cmd *cobra.Command, args []string) { //nolint TODO
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(logLevel))
// parse environment variables, these will overwrite anything loaded or flags
err := kubevip.ParseEnvironment(&initConfig)
@@ -257,9 +258,6 @@ var kubeVipManager = &cobra.Command{
}
}
// Set the logging level for all subsequent functions
log.SetLogLoggerLevel(log.Level(initConfig.Logging))
// Welome messages
log.Info("kube-vip.io", "version", Release.Version, "build", Release.Build)

View File

@@ -157,7 +157,7 @@ func (sm *Manager) configureEgress(vipIP, podIP, namespace string, annotations m
serviceCidr = defaultServiceCIDR
}
log.Info("[Egress]", "pod CIDR", podCidr, " service CIDR", serviceCidr, "vip", serviceCidr, "pod", podIP)
log.Info("[Egress]", "podCIDR", podCidr, "serviceCIDR", serviceCidr, "vip", serviceCidr, "pod", podIP)
// checking if all addresses are of the same IP family
if vip.IsIPv4(podIP) != vip.IsIPv4CIDR(podCidr) {

View File

@@ -38,7 +38,7 @@ func (sm *Manager) startServicesWatchForLeaderElection(ctx context.Context) erro
// The startServicesWatchForLeaderElection function will start a services watcher, the
func (sm *Manager) StartServicesLeaderElection(ctx context.Context, service *v1.Service, wg *sync.WaitGroup) error {
serviceLease := fmt.Sprintf("kubevip-%s", service.Name)
log.Info("new leader election", "service", service.Name, "namespace", service.Namespace, "lock name", serviceLease, "host id", sm.config.NodeName)
log.Info("new leader election", "service", service.Name, "namespace", service.Namespace, "lock_name", serviceLease, "host_id", sm.config.NodeName)
// we use the Lease lock type since edits to Leases are less common
// and fewer objects in the cluster watch "all Leases".
lock := &resourcelock.LeaseLock{

View File

@@ -145,7 +145,7 @@ func (ep *endpointsProvider) getProtocol() string {
}
func (sm *Manager) watchEndpoint(ctx context.Context, id string, service *v1.Service, wg *sync.WaitGroup, provider epProvider) error {
log.Info("watching", "provide", provider.getLabel(), "service name", service.Name, "namespace", service.Namespace)
log.Info("watching", "provider", provider.getLabel(), "service_name", service.Name, "namespace", service.Namespace)
// Use a restartable watcher, as this should help in the event of etcd or timeout issues
leaderContext, cancel := context.WithCancel(ctx)
defer cancel()