weave-gitops icon indicating copy to clipboard operation
weave-gitops copied to clipboard

Write bootstrap manifests and dashboard yaml to local system

Open JamWils opened this issue 3 years ago • 0 comments

As a user I want to have the option to bootstrap my cluster after running gitops run for the first time. I would expect to have all "gotk-sync" manifests as well as a kustomization to complete the reconciliation loop.

As a user when I stop running gitops run for the first time I would expect to see a folder titled "weave-gitops" with the dashboard manifests in the folder. When I merge a PR the dashboard will reappear on the cluster.

As a user when I am done using gitops run for the first time I should be able to commit and push my changes to the default branch and see the workloads appear on the cluster. I.e. I have entered gitops mode.

As a user, when bootstrapping I would expect to always default to the origin remote.

Acceptance Criteria

Scenario 1 - Root directory and current working directory are the same

Root directory: /Users/myself/my-repo Current working directory: /Users/myself/my-repo

I run gitops run .:

then the path will be for the bootstrap manifests: /Users/myself/my-repo/clusters/my-cluster

  1. /Users/myself/my-repo/clusters/my-cluster/flux-system/gotk-sync.yaml. The kustomization path would be ./clusters/my-cluster
  2. /Users/myself/my-repo/clusters/my-cluster/flux-system/gotk-components.yaml
  3. /Users/myself/my-repo/clusters/my-cluster/flux-system/kustomization.yaml
  4. /Users/myself/my-repo/clusters/my-cluster/weave-gitops/dashboard.yaml.
  5. /Users/myself/my-repo/clusters/my-cluster/root/sync.yaml
  6. /Users/myself/my-repo/clusters/my-cluster/root/kustomization.yaml. The kustomization path will be .

I run gitops run ./deploy/overlays/dev:

then the path will be for the bootstrap manifests: /Users/myself/my-repo/clusters/my-cluster

  1. /Users/myself/my-repo/clusters/my-cluster/flux-system/gotk-sync.yaml. The kustomization path would be ./clusters/my-cluster
  2. /Users/myself/my-repo/clusters/my-cluster/flux-system/gotk-components.yaml
  3. /Users/myself/my-repo/clusters/my-cluster/flux-system/kustomization.yaml
  4. /Users/myself/my-repo/clusters/my-cluster/weave-gitops/dashboard.yaml.
  5. /Users/myself/my-repo/clusters/my-cluster/deploy-overlays-dev/sync.yaml
  6. /Users/myself/my-repo/clusters/my-cluster/deploy-overlays-dev/kustomization.yaml. The kustomization path will be ./deploy/overlays/dev

Scenario 2 - Different root directory and current working directory

Root directory: /Users/myself/my-repo Current working directory: /Users/myself/my-repo/manifests

I run gitops run .:

  1. /Users/myself/my-repo/manifests/clusters/my-cluster/flux-system/gotk-sync.yaml. The kustomization path would be ./clusters/my-cluster
  2. /Users/myself/my-repo/manifests/clusters/my-cluster/flux-system/gotk-components.yaml
  3. /Users/myself/my-repo/manifests/clusters/my-cluster/flux-system/kustomization.yaml 4.. /Users/myself/my-repo/manifests/clusters/my-cluster/kustomization.yaml. Reference ../../../manifests.
  4. /Users/myself/my-repo/manifests/clusters/my-cluster/weave-gitops/dashboard.yaml.
  5. /Users/myself/my-repo/manifests/kustomization.yaml. ~6. /Users/myself/my-repo/manifests/clusters/my-cluster/manifests/sync.yaml~ ~7. /Users/myself/my-repo/manifests/clusters/my-cluster/manifests/kustomization.yaml. The kustomization path will be ./manifests~

I run gitops run ../deploy/overlays/dev:

... THIS IS NOT DONE

When I run gitops beta run .

then I will have the file path ./gitops/clusters/my-cluster I should see the following yaml files.

When I run gitops beta run ./deploy/overlays/dev

then I will have the file path ./gitops/clusters/my-cluster I should see the following yaml files.

In the file path clusters/my-cluster I should see the following yaml files:

  1. There should be a subdirectory that contains flux-system with the standard flux bootstrap files such as gotk-sync.yaml, gotk-components.yaml, and kustomization.yaml.
  2. There should be in the directory a file weave-gitops.yaml and this should be the file that contains the HelmRelease and HelmRepository for Weave GitOps. This should match the fields and metadata from running the create dashboard command on the CLI.

Reference

sequenceDiagram;
    participant User;
    participant GitOps Run;
    participant Config Repo;
    participant Cluster;
    User ->> Config Repo: Run `git init`;
    User ->> GitOps Run: Run `gitops run`;
    GitOps Run ->> Cluster: Flux controllers and CRDs are installed;
    GitOps Run ->> Config Repo: Manifests for flux-system are saved to disk;
    User ->> GitOps Run: ctrl+c `gitops run`;
    GitOps Run ->> Config Repo: Gets info about repo such as default branch;
    GitOps Run ->> Cluster: Bootstrap Flux
    GitOps Run ->> Cluster: Creates reconciliation loop with Source and Kustomization;
     GitOps Run ->> Config Repo: Current state of the repo is invalid.
    GitOps Run ->> Cluster: Cleanup temporary bucket and workload
    GitOps Run ->> GitOps Run: End process;
    User ->> Config Repo: Push to remote;
    Cluster ->> Config Repo: Pulls files from remote;
    Cluster ->> Cluster: Create workloads based on pulled CRDs;
    User ->> Cluster: The user can see the workloads on the cluster;
    User ->> User: GitOps...alright, alright, alright!

JamWils avatar Aug 19 '22 01:08 JamWils