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
Print out GitSource from config repository on dry-run #1320
Conversation
Added function to convert from Manifest to CommitFile
Removed AssociateCluster method from GitOpsDirectoryWriter
# Conflicts: # pkg/services/gitops/install.go # pkg/services/gitops/install_test.go
# Conflicts: # pkg/services/automation/automation_test.go # pkg/services/automation/cluster_generator.go # pkg/upgrade/upgrade.go
# Conflicts: # cmd/gitops/install/cmd.go # pkg/models/manifest.go # pkg/models/manifest_test.go # pkg/services/auth/auth_test.go # pkg/services/gitopswriter/gitopswriter.go # pkg/services/install/install.go # pkg/services/install/install_test.go
# Conflicts: # pkg/services/gitops/uninstall.go
// This ensures that git operations are done with stored deploy keys instead of a user's local ssh-agent or equivalent. | ||
func (a *authSvc) setupDeployKey(ctx context.Context, name SecretName, targetName string, repo gitproviders.RepoURL) (*ssh.PublicKeys, error) { | ||
func (a *authSvc) SetupDeployKey(ctx context.Context, namespace string, repo gitproviders.RepoURL) (*ssh.PublicKeys, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't this changed in another branch? I have the feeling that some stuff from other branches made it onto this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't tell if there are any other branches with this change. I intentionally changed this 🙂
# Conflicts: # cmd/gitops/install/cmd.go # pkg/services/factory.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a tough time understanding exactly what is happening here, but I assume this was cleanup from the previous refactoring PR @josecordaz ?
Code LGTM
pkg/models/manifest.go
Outdated
return nil, err | ||
} | ||
|
||
sourceManifest, err := GetSourceManifest(ctx, fluxClient, gitProvider, clusterName, namespace, configURL, configBranch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that this manifest isn't being applied on main
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is applied but not by using this function (which is the ideal scenario). That is why I wanted to create this PR.
# Conflicts: # cmd/gitops/install/cmd.go # pkg/models/manifest.go # pkg/models/manifest_test.go # pkg/services/install/install.go # pkg/services/install/install_test.go
# Conflicts: # cmd/gitops/install/cmd.go # pkg/models/manifest_test.go # pkg/services/auth/auth.go # pkg/services/auth/auth_test.go # pkg/services/factory.go
* Make dry-run in install working * write manifests to repo after applying them * Moving gitOpsWriter out of Install * Run raw flux install to get fancy progress logging * Removed creation of namespace as `flux install` already creates it * Removed unused osysClient parameter * Create namespace before creating git clients * Created new repoWriter layer to simplify the code Added function to convert from Manifest to CommitFile * Moving generation of manifests files to models folder. Removed AssociateCluster method from GitOpsDirectoryWriter * Pack all constants in the same place * Removed cluster_generator.go file * Removed unused constants * Added error paths unit tests for installer * Added missing files changes * Fixed lint issues * Added unit tests manifests functions * Added initial code for install success when auto-merge is true * Added rest of code for install success when auto-merge is true * Fix lint issues * Removed old install tests * Remove unused variables * Added success path for install when auto-merge is false * Added missing validate wego installation functionality * Use the right yaml library * Fixed yaml dependency * Added missing keep and source manifests and fixed unit tests * Fixed manifests order in unit tests * Fixed acceptance test "Verify that gitops quits if flux-system namespace is present" * Fixed `install --dry-run` it was printing out raw bytes instead of string Fixed regex on acceptance test * Fixed Kustomize file on unit test * Fixed Kustomize file on unit test * Fixed typo and added specif error matches * Clean up and fixed typo on assertion message * Made some lines more readable * Rename function CreateKustomize to CreateKustomization Co-authored-by: Jordan Pellizzari <jordan@weave.works> * Renamed function from GitopsConfigMap to CreateGitopsConfigMap * Fixed references to old function A function was renamed but their calls were not * Fixed references to old function A function was renamed but their calls were not * Initial work to get token and deploy key right before setting git clients This work could let us use flags to pass in some info like 1.- Secret names(in case they are already in the cluster) 2.- Deploy keys path. In case the user has the deploy key saved in a file 3.- Provider deploy key name. In case the user already has a deploy key in the provider. That we can later save to the cluster as secret. We would need to authenticate the first time to retrieve it. Instantiating git clients separately * Added source flux resource back to dry-run output * Fixed lint issues * Fixed references to old function A function was renamed but their calls were not * Use the right manifests when creating the PR * Fixed unit test it was not generating adding the wego app path to the kustomization of the expected file * Clean up comments * Updated comments * Fixed installer unit tests * Fixed manifests unit tests * Removed commented code * Removed old SetupDeployKey2 function * Fixed lint issue * Fixed install unit tests * Fixed manifests unit tests * Fixed auth unit tests * Removed targetName field as it wasn't used * Fixed auth unit tests * Organize imports on install command * Fixed parameters on install/cmd.go Co-authored-by: Jordan Pellizzari <jordan@weave.works>
Closes:
What changed?
Split up git client instantiation on install
Removed old
targetName
field fromgetGitClients
function as it wasn't usedMoved
GitSource
creation tomodels.BootstrapManifests
as this is the function used in dry-run.Why?
To be able to print out GitSource on dry-run without setting up a deploy key, which is not needed for dry-run.
How did you test it?
Manually, CI
Release notes
Documentation Changes