Skip to content
This repository was archived by the owner on Sep 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: golangci-lint
on:
push:
branches:
- main
pull_request:

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22.1'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: latest

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
#
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
# The location of the configuration file can be changed by using `--config=`
# args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true, then all caching functionality will be completely disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true, then the action won't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true, then the action won't cache or restore ~/.cache/go-build.
# skip-build-cache: true

# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
# install-mode: "goinstall"
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ Thank you very much, for supporting me 🚀
## Usage
### Requirements:

I am currently working on a preparing step, so you don't have two worry.\
But for now, the following needs to be done manually:

#### Get the *frigg* cli:
Get the binary using go:
```
Expand All @@ -60,14 +57,6 @@ or download the binary at the releasepage:\

Homebrew is on the way.

#### Install the recommended tools:

Just run:\
`frigg prepare`

All Tools we need, will be installed into the tools Directory under\
`~/.frigg/tools`

#### Start the deployment:

While everything gets bootstrapped and provisioned, the Frigg CLI \
Expand Down
85 changes: 35 additions & 50 deletions cmd/frigg/bootstrap/capd-controller/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,22 @@ package cluster

import (
"fmt"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/clusterapi"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/argocdWorkload"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/cni"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/cnibootstrap"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/mgmtArgocdApps"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/mgmtArgocdEvents"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/mgmtArgocdRollouts"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/mgmtArgocdWorkflows"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/mgmtArgohub"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/mgmtVault"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/reporender"
"github.com/PatrickLaabs/frigg/internal/capi_controller"
"github.com/PatrickLaabs/frigg/internal/clusterapi"
"github.com/PatrickLaabs/frigg/internal/directories"
"github.com/PatrickLaabs/frigg/internal/generate"
"github.com/PatrickLaabs/frigg/internal/helmchart"
"github.com/PatrickLaabs/frigg/internal/kubeconfig"
"github.com/PatrickLaabs/frigg/internal/postbootstrap"
"github.com/PatrickLaabs/frigg/internal/prepare"
"github.com/PatrickLaabs/frigg/internal/reporender"
"github.com/PatrickLaabs/frigg/internal/runtime"
"github.com/PatrickLaabs/frigg/pkg/capi_controller"
"github.com/PatrickLaabs/frigg/pkg/controllerdir"
"github.com/PatrickLaabs/frigg/pkg/kubeconfig"
"github.com/PatrickLaabs/frigg/pkg/postbootstrap"
"github.com/PatrickLaabs/frigg/pkg/sshkey"
"github.com/PatrickLaabs/frigg/pkg/statuscheck"
"github.com/PatrickLaabs/frigg/pkg/tmpl/helmchartsproxies"
"github.com/PatrickLaabs/frigg/pkg/tmpl/kindconfig"
"github.com/PatrickLaabs/frigg/pkg/tmpl/mgmtmanifestgen"
"github.com/PatrickLaabs/frigg/pkg/toolsdir"
"github.com/PatrickLaabs/frigg/pkg/vars"
"github.com/PatrickLaabs/frigg/pkg/wait"
"github.com/PatrickLaabs/frigg/pkg/workdir"
"github.com/PatrickLaabs/frigg/internal/sshkey"
"github.com/PatrickLaabs/frigg/internal/statuscheck"

"github.com/PatrickLaabs/frigg/internal/vars"
"github.com/PatrickLaabs/frigg/internal/wait"

"github.com/fatih/color"
"io"
"os"
Expand Down Expand Up @@ -135,21 +126,21 @@ func runE(logger log.Logger, streams cmd.IOStreams, flags *flagpole) error {
os.Getenv("GITHUB_MAIL")
}

// Create working directory named .frigg inside the users homedirectory.
workdir.CreateDir()
// Creating Working, tools and controllers directories
directories.Create()

// Creates the Frigg Tools dir
toolsdir.FriggWorkingDir()

// Creates the Frigg controllers dir
controllerdir.FriggControllerDir()
// Preparing the CLIs for Frigg
prepare.Tools()

// Generating kind-config
kindconfig.KindConfigGen()
generate.KindConfigGen()

// Generating SSH Key pair
sshkey.KeypairGen()

// Generating clusterctl config
generate.ClusterctlConfig()

// Generates the Manifests for the ClusterAPI Controllers
println(color.GreenString("Generating CAPI Controller Manifests.."))
capi_controller.BootstrapProviderGen()
Expand All @@ -160,17 +151,17 @@ func runE(logger log.Logger, streams cmd.IOStreams, flags *flagpole) error {

// Generating HelmChartProxies
println(color.GreenString("Generating Helm Chart Proxy Manifests.."))
helmchartsproxies.Cni()
helmchartsproxies.Vault()
helmchartsproxies.ArgoCDWorkloadClusters()
helmchartsproxies.ArgoWorkflows()
helmchartsproxies.ArgoRollouts()
helmchartsproxies.ArgoEvents()
helmchartsproxies.MgmtArgoCD()
helmchartsproxies.MgmtArgoApps()
generate.Cni()
generate.Vault()
generate.ArgoCDWorkloadClusters()
generate.ArgoWorkflows()
generate.ArgoRollouts()
generate.ArgoEvents()
generate.MgmtArgoCD()
generate.MgmtArgoApps()

// Generates a manifest for the management cluster, named frigg-mgmt-cluster
mgmtmanifestgen.Gen()
generate.MgmtManifest()

provider := cluster.NewProvider(
cluster.ProviderWithLogger(logger),
Expand Down Expand Up @@ -222,6 +213,7 @@ func runE(logger log.Logger, streams cmd.IOStreams, flags *flagpole) error {

// Installs capi components on the bootstrap cluster.
println(color.YellowString("Applying ClusterAPI Controllers"))
wait.Wait(10 * time.Second)
clusterapi.ApplyCoreProvider()
clusterapi.ApplyBootstrapProv()
clusterapi.ApplyControlPlaneProv()
Expand All @@ -236,7 +228,7 @@ func runE(logger log.Logger, streams cmd.IOStreams, flags *flagpole) error {
// Installs a CNI solution helm chart proxy to the bootstrapcluster
// This is needed, to make the worker nodes ready and complete the bootstrap deployment
println(color.YellowString("Applying CNI"))
cnibootstrap.Installation()
helmchart.InstallOnBootstrap()

// Applies the frigg-mgmt-cluster manifest to the bootstrap cluster
// to create the first 'real' management cluster
Expand Down Expand Up @@ -306,14 +298,7 @@ func runE(logger log.Logger, streams cmd.IOStreams, flags *flagpole) error {
clusterapi.ApplyArgoSecretMgmt()

// Installs the HelmChartProxies onto the mgmt-cluster
argocdWorkload.Installation()
cni.Installation()
mgmtArgocdApps.Installation()
mgmtArgocdEvents.Installation()
mgmtArgocdRollouts.Installation()
mgmtArgocdWorkflows.Installation()
mgmtArgohub.Installation()
mgmtVault.Installation()
helmchart.InstallOnMgmt()

// Moves the capi components from the bootstrap cluster to the frigg-mgmt-cluster
wait.Wait(15 * time.Second)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package workloadcluster

import (
"fmt"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/clusterapi"
"github.com/PatrickLaabs/frigg/pkg/kubeconfig"
"github.com/PatrickLaabs/frigg/pkg/statuscheck"
"github.com/PatrickLaabs/frigg/pkg/tmpl/workloadmanifestgen"
"github.com/PatrickLaabs/frigg/pkg/wait"
"github.com/PatrickLaabs/frigg/internal/clusterapi"
"github.com/PatrickLaabs/frigg/internal/generate"
"github.com/PatrickLaabs/frigg/internal/kubeconfig"
"github.com/PatrickLaabs/frigg/internal/statuscheck"
"github.com/PatrickLaabs/frigg/internal/wait"
"github.com/fatih/color"
"github.com/spf13/cobra"
"time"
Expand All @@ -25,7 +25,7 @@ func NewCommand() *cobra.Command {
// Generates a workload-cluster manifest
// Modifies the manifest of the workload cluster, to add the helmchart labels to it
wait.Wait(5 * time.Second)
workloadmanifestgen.Gen()
generate.WorkloadManifest()

// Applies the workload cluster manifest to the frigg-mgmt-cluster
wait.Wait(5 * time.Second)
Expand Down
75 changes: 31 additions & 44 deletions cmd/frigg/bootstrap/capd/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,19 @@ package cluster

import (
"fmt"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/clusterapi"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/argocdWorkload"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/cni"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/cnibootstrap"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/mgmtArgocdApps"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/mgmtArgocdEvents"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/mgmtArgocdRollouts"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/mgmtArgocdWorkflows"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/mgmtArgohub"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/helmchartproxies/mgmtVault"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/reporender"
"github.com/PatrickLaabs/frigg/internal/clusterapi"
"github.com/PatrickLaabs/frigg/internal/directories"
"github.com/PatrickLaabs/frigg/internal/generate"
"github.com/PatrickLaabs/frigg/internal/helmchart"
"github.com/PatrickLaabs/frigg/internal/kubeconfig"
"github.com/PatrickLaabs/frigg/internal/postbootstrap"
"github.com/PatrickLaabs/frigg/internal/prepare"
"github.com/PatrickLaabs/frigg/internal/reporender"
"github.com/PatrickLaabs/frigg/internal/runtime"
"github.com/PatrickLaabs/frigg/pkg/kubeconfig"
"github.com/PatrickLaabs/frigg/pkg/postbootstrap"
"github.com/PatrickLaabs/frigg/pkg/sshkey"
"github.com/PatrickLaabs/frigg/pkg/statuscheck"
"github.com/PatrickLaabs/frigg/pkg/tmpl/clusterctlconfig"
"github.com/PatrickLaabs/frigg/pkg/tmpl/helmchartsproxies"
"github.com/PatrickLaabs/frigg/pkg/tmpl/kindconfig"
"github.com/PatrickLaabs/frigg/pkg/tmpl/mgmtmanifestgen"
"github.com/PatrickLaabs/frigg/pkg/vars"
"github.com/PatrickLaabs/frigg/pkg/wait"
"github.com/PatrickLaabs/frigg/pkg/workdir"
"github.com/PatrickLaabs/frigg/internal/sshkey"
"github.com/PatrickLaabs/frigg/internal/statuscheck"
"github.com/PatrickLaabs/frigg/internal/vars"
"github.com/PatrickLaabs/frigg/internal/wait"
"github.com/fatih/color"
"io"
"os"
Expand Down Expand Up @@ -133,30 +123,34 @@ func runE(logger log.Logger, streams cmd.IOStreams, flags *flagpole) error {
os.Getenv("GITHUB_MAIL")
}

// Create working directory named .frigg inside the users homedirectory.
workdir.CreateDir()
// Creating Working, tools and controllers directories
directories.Create()

// Preparing the CLIs for Frigg
prepare.Tools()

// Generating kind-config
kindconfig.KindConfigGen()
generate.KindConfigGen()

// Generating SSH Key pair
sshkey.KeypairGen()

// Generating clusterctl config
clusterctlconfig.ClusterctlConfigGen()
generate.ClusterctlConfig()

// Generating HelmChartProxies
helmchartsproxies.Cni()
helmchartsproxies.Vault()
helmchartsproxies.ArgoCDWorkloadClusters()
helmchartsproxies.ArgoWorkflows()
helmchartsproxies.ArgoRollouts()
helmchartsproxies.ArgoEvents()
helmchartsproxies.MgmtArgoCD()
helmchartsproxies.MgmtArgoApps()
println(color.GreenString("Generating Helm Chart Proxy Manifests.."))
generate.Cni()
generate.Vault()
generate.ArgoCDWorkloadClusters()
generate.ArgoWorkflows()
generate.ArgoRollouts()
generate.ArgoEvents()
generate.MgmtArgoCD()
generate.MgmtArgoApps()

// Generates a manifest for the management cluster, named frigg-mgmt-cluster
mgmtmanifestgen.Gen()
generate.MgmtManifest()

provider := cluster.NewProvider(
cluster.ProviderWithLogger(logger),
Expand Down Expand Up @@ -196,7 +190,7 @@ func runE(logger log.Logger, streams cmd.IOStreams, flags *flagpole) error {

// Installs a CNI solution helm chart proxy to the bootstrapcluster
// This is needed, to make the worker nodes ready and complete the bootstrap deployment
cnibootstrap.Installation()
helmchart.InstallOnBootstrap()

// Applies the frigg-mgmt-cluster manifest to the bootstrap cluster
// to create the first 'real' management cluster
Expand Down Expand Up @@ -241,14 +235,7 @@ func runE(logger log.Logger, streams cmd.IOStreams, flags *flagpole) error {
clusterapi.ApplyArgoSecretMgmt()

// Installs the HelmChartProxies onto the mgmt-cluster
argocdWorkload.Installation()
cni.Installation()
mgmtArgocdApps.Installation()
mgmtArgocdEvents.Installation()
mgmtArgocdRollouts.Installation()
mgmtArgocdWorkflows.Installation()
mgmtArgohub.Installation()
mgmtVault.Installation()
helmchart.InstallOnMgmt()

// Moves the capi components from the bootstrap cluster to the frigg-mgmt-cluster
wait.Wait(15 * time.Second)
Expand Down
12 changes: 6 additions & 6 deletions cmd/frigg/bootstrap/capd/workloadcluster/workloadcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package workloadcluster

import (
"fmt"
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap/commons/clusterapi"
"github.com/PatrickLaabs/frigg/pkg/kubeconfig"
"github.com/PatrickLaabs/frigg/pkg/statuscheck"
"github.com/PatrickLaabs/frigg/pkg/tmpl/workloadmanifestgen"
"github.com/PatrickLaabs/frigg/pkg/wait"
"github.com/PatrickLaabs/frigg/internal/clusterapi"
"github.com/PatrickLaabs/frigg/internal/generate"
"github.com/PatrickLaabs/frigg/internal/kubeconfig"
"github.com/PatrickLaabs/frigg/internal/statuscheck"
"github.com/PatrickLaabs/frigg/internal/wait"
"github.com/fatih/color"
"github.com/spf13/cobra"
"time"
Expand All @@ -25,7 +25,7 @@ func NewCommand() *cobra.Command {
// Generates a workload-cluster manifest
// Modifies the manifest of the workload cluster, to add the helmchart labels to it
wait.Wait(5 * time.Second)
workloadmanifestgen.Gen()
generate.WorkloadManifest()

// Applies the workload cluster manifest to the frigg-mgmt-cluster
wait.Wait(5 * time.Second)
Expand Down
Loading