Skip to content

Commit

Permalink
Time conversion issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
akgalwas committed Sep 26, 2023
1 parent 73af5b7 commit 8fd892a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ func init() {
//+kubebuilder:scaffold:scheme
}

const defaultExpirationTimeInHours = 7 * 12
const defaultExpirationTimeInHours = 7 * 12 * time.Hour

Check warning on line 55 in cmd/main.go

View workflow job for this annotation

GitHub Actions / lint

time-naming: var defaultExpirationTimeInHours is of type time.Duration; don't use unit-specific suffix "Hours" (revive)

func main() {
var metricsAddr string
var enableLeaderElection bool
var probeAddr string
var gardenerKubeconfigPath string
var gardenerProjectName string
var expirationInHours int64
var expirationInHours time.Duration

Check warning on line 63 in cmd/main.go

View workflow job for this annotation

GitHub Actions / lint

time-naming: var expirationInHours is of type time.Duration; don't use unit-specific suffix "Hours" (revive)

flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
Expand All @@ -69,7 +69,7 @@ func main() {
"Enabling this will ensure there is only one active controller manager.")
flag.StringVar(&gardenerKubeconfigPath, "gardener-kubeconfig-path", "/gardener/kubeconfig/kubeconfig", "Kubeconfig file for Gardener cluster")
flag.StringVar(&gardenerProjectName, "gardener-project-name", "gardener-project", "Name of the Gardener project")
flag.Int64Var(&expirationInHours, "expiration-in-hours", defaultExpirationTimeInHours, "Dynamic kubeconfig expiration time in seconds")
flag.DurationVar(&expirationInHours, "", defaultExpirationTimeInHours, "Dynamic kubeconfig expiration time in hours")

Check failure on line 72 in cmd/main.go

View workflow job for this annotation

GitHub Actions / lint

flagName: empty flag name (gocritic)
opts := zap.Options{
Development: true,
}
Expand Down Expand Up @@ -105,7 +105,7 @@ func main() {
}

gardenerNamespace := fmt.Sprintf("garden-%s", gardenerProjectName)
expirationInSeconds := int64(time.Duration(expirationInHours).Seconds())
expirationInSeconds := int64(expirationInHours.Seconds())
kubeconfigProvider, err := setupKubernetesKubeconfigProvider(gardenerKubeconfigPath, gardenerNamespace, expirationInSeconds)

if err != nil {
Expand Down

0 comments on commit 8fd892a

Please sign in to comment.