Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add message for users to redownload their kubeconfig #274

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

haardikdharma10
Copy link
Contributor

Description

This PR adds functionality to prompt user to redownload their kubeconfig if their cluster is more than 1 year old.

@@ -132,6 +133,27 @@ var apikeySaveCmd = &cobra.Command{
config.SaveConfig()
}

if config.Current.Clusters == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic should be in the config.go file while CLI is reading/loading the config

config.Current.Clusters = make(map[string]bool)
for _, cluster := range clusters.Items {
config.Current.Clusters[cluster.ID] = true
if time.Since(cluster.BuiltAt) > (365 * 24 * time.Hour) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a time.Year, if not you can use time.Day *365 but more importantly, we have to check if it's divisible by the year in which cluster was built.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants