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

Upgrade uses new helm repo #1069

Merged
merged 38 commits into from Nov 19, 2021
Merged

Upgrade uses new helm repo #1069

merged 38 commits into from Nov 19, 2021

Conversation

foot
Copy link
Contributor

@foot foot commented Nov 12, 2021

This switches from installing the weave-gitops-enterprise profile from a git-repository using pctl to installing from a helmrepository!

  • Adds support for --dry-run
  • Adds support for --set capi.cluster.name=foo
  • Configures an interval for the helmrelease so changes are re-applied
  • Auto set clusterName from env
  • Auto set repoURL from --app-config-url

@sarataha sarataha added the type/enhancement New feature or request label Nov 12, 2021
@sarataha sarataha marked this pull request as ready for review November 15, 2021 10:03
Copy link
Contributor Author

@foot foot left a comment

Choose a reason for hiding this comment

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

Looking 🔥 !

Excited about all the cleanup.

Some polish that would be really neat

  • ask for --profile-version=v0.0.14 flag that we could set the helmrelease version to
  • Set the values.config.cluster.name in the helm release to cname var.
  • Set the values.config.capi.repositoryURL to --app-config-url

🤔

🙌

Comment on lines 230 to 234
if uv.GitRepository == "" {
gitRepositoryNameNamespace := fmt.Sprintf("%s/%s", uv.Namespace, strings.TrimSuffix(filepath.Base(repoUrlString), ".git"))
fmt.Fprintf(w, "Deriving name of GitRepository Resource as %v\n", gitRepositoryNameNamespace)
uv.GitRepository = gitRepositoryNameNamespace
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we can remove this now as it was only important for profiles.

  • also rm the ensureGitRepositoryResource and getGitRepositoryNamespaceAndName too

Copy link
Contributor

Choose a reason for hiding this comment

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

👌 makes sense 🙏

providerClient := internal.NewGitProviderClient(os.Stdout, os.LookupEnv, auth.NewAuthCLIHandler, log)

gitClient, gitProvider, err := factory.GetGitClients(ctx, providerClient, services.GitConfigParams{
URL: upgradeCmdFlags.RepoURL,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice, I think this is simpler to do it as a flag instead of reading from the gitconfig.
Maybe we rename this flag to --app-config-url to be consistent w/ gitops install --app-config-url.

And we can remove the code that tries to automatically figure this out ( repoUrlString, err := gitClient.GetRemoteUrl(".", uv.Remote)).

I don't think we need RepoOrgAndName anymore either so we can get rid of the whole buildUpgradeConfigs probably. 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you very much Simon 🙏 I will add the suggest changes 👍

"repositoryURL": "%s"
}
}
}`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can do a literal here to avoid the decode w/ something like this (made a little demo 🎉 )

https://play.golang.org/p/iFTT9sE9FIx

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you very much Simon, that looks much better than using strings too 👍. I tried to do it with nested map[string]interface{} as well but it doesn't look very readable 😅

Copy link
Contributor Author

@foot foot left a comment

Choose a reason for hiding this comment

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

Looking great! So nice to have --set here. 🔥 well done :)

We had some feedback around flags. Could we remove all the ones we don't use anymore..

  • Remote
  • ConfigMap
  • Out (?)
  • Maybe others?

and make sure the other ones are the similar to add app / install as possible?

@foot foot requested a review from sarataha November 19, 2021 09:59
Copy link
Contributor

@sarataha sarataha left a comment

Choose a reason for hiding this comment

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

Great work! 🥇 🙌

@foot foot merged commit 06bdae3 into main Nov 19, 2021
@foot foot deleted the upgrade-uses-new-helm-repo branch November 19, 2021 10:48
joshri pushed a commit that referenced this pull request Nov 19, 2021
This switches from installing the weave-gitops-enterprise profile from a git-repository using pctl to installing from a helmrepository!

Adds support for --dry-run
Adds support for --set capi.cluster.name=foo
Configures an interval for the helmrelease so changes are re-applied
Auto set clusterName from env
Auto set repoURL from --app-config-url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team/pesto type/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants