mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-20 06:31:47 +00:00
Merge pull request #160 from fluxcd/export-fix
Make export work offline
This commit is contained in:
commit
3fbc396bc8
3 changed files with 24 additions and 24 deletions
|
|
@ -113,14 +113,6 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
return fmt.Errorf("path must begin with ./")
|
return fmt.Errorf("path must begin with ./")
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
kubeClient, err := utils.kubeClient(kubeconfig)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if !export {
|
if !export {
|
||||||
logger.Generatef("generating kustomization")
|
logger.Generatef("generating kustomization")
|
||||||
}
|
}
|
||||||
|
|
@ -190,6 +182,14 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
return exportKs(kustomization)
|
return exportKs(kustomization)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
kubeClient, err := utils.kubeClient(kubeconfig)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
logger.Actionf("applying kustomization")
|
logger.Actionf("applying kustomization")
|
||||||
if err := upsertKustomization(ctx, kubeClient, kustomization); err != nil {
|
if err := upsertKustomization(ctx, kubeClient, kustomization); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
|
|
@ -129,14 +129,6 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
return fmt.Errorf("git URL parse failed: %w", err)
|
return fmt.Errorf("git URL parse failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
kubeClient, err := utils.kubeClient(kubeconfig)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
gitRepository := sourcev1.GitRepository{
|
gitRepository := sourcev1.GitRepository{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
|
|
@ -163,6 +155,14 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
return exportGit(gitRepository)
|
return exportGit(gitRepository)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
kubeClient, err := utils.kubeClient(kubeconfig)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
withAuth := false
|
withAuth := false
|
||||||
// TODO(hidde): move all auth prep to separate func?
|
// TODO(hidde): move all auth prep to separate func?
|
||||||
if u.Scheme == "ssh" {
|
if u.Scheme == "ssh" {
|
||||||
|
|
|
||||||
|
|
@ -101,14 +101,6 @@ func createSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
return fmt.Errorf("url parse failed: %w", err)
|
return fmt.Errorf("url parse failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
kubeClient, err := utils.kubeClient(kubeconfig)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
helmRepository := sourcev1.HelmRepository{
|
helmRepository := sourcev1.HelmRepository{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
|
|
@ -126,6 +118,14 @@ func createSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
|
||||||
return exportHelmRepository(helmRepository)
|
return exportHelmRepository(helmRepository)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
kubeClient, err := utils.kubeClient(kubeconfig)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
logger.Generatef("generating source")
|
logger.Generatef("generating source")
|
||||||
|
|
||||||
secret := corev1.Secret{
|
secret := corev1.Secret{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue