Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
updating readme, prep for render function of argohub template repo
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickLaabs committed Feb 27, 2024
1 parent c4fc050 commit a70fdd8
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 17 deletions.
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,37 @@ Usage:
frigg [command]
Available Commands:
bootstrap bootstrap
bootstrap bootstrap various clusters on different providers
completion Generate the autocompletion script for the specified shell
create Creates one of [cluster]
delete Deletes one of [cluster]
functests functests
help Help about any command
version Prints the frigg CLI version
```

```
bootstrap
bootstrap various clusters on different providers
Usage:
frigg bootstrap [flags]
frigg bootstrap [command]
Available Commands:
capd capd
capd clusterapi provider docker
capv capv
capz capz
harvester harvester
```

```
Creates local Kubernetes clusters using clusterapi's provider capd (docker)
Usage:
frigg bootstrap capd [flags]
frigg bootstrap capd [command]
Available Commands:
cluster Creates a local Kubernetes cluster
workloadcluster deploy workload cluster
```

## Features
Expand Down
4 changes: 2 additions & 2 deletions cmd/frigg/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ func NewCommand(logger log.Logger, streams cmd.IOStreams) *cobra.Command {
c := &cobra.Command{
Args: cobra.NoArgs,
Use: "bootstrap",
Short: "bootstrap",
Long: "bootstrap",
Short: "bootstrap various clusters on different providers",
Long: "bootstrap various clusters on different providers",
RunE: func(cmd *cobra.Command, args []string) error {
err := cmd.Help()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/frigg/bootstrap/capd/capd.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ func NewCommand(logger log.Logger, streams cmd.IOStreams) *cobra.Command {
c := &cobra.Command{
Args: cobra.NoArgs,
Use: "capd",
Short: "capd",
Long: "capd",
Short: "clusterapi provider docker",
Long: "Creates local Kubernetes clusters using clusterapi's provider capd (docker)",
RunE: func(cmd *cobra.Command, args []string) error {
err := cmd.Help()
if err != nil {
Expand Down
8 changes: 8 additions & 0 deletions cmd/frigg/bootstrap/capd/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ func runE(logger log.Logger, streams cmd.IOStreams, flags *flagpole) error {
fmt.Println("Found Github Username Environment variable. Continuing..")
}

if os.Getenv("GITHUB_USERNAME_EMAIL") == "" {
fmt.Println("Missing Github Username, please set it. Exiting now.")
os.Exit(1)
} else {
os.Getenv("GITHUB_USERNAME_EMAIL")
fmt.Println("Found Github Username Environment variable. Continuing..")
}

// Create working directory named .frigg inside the users homedirectory.
workdir.CreateDir()

Expand Down
71 changes: 71 additions & 0 deletions cmd/frigg/bootstrap/capd/reporender/reporender.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package reporender

import (
"fmt"
"os"
)

// Renders the gitops Repo https://github.com/PatrickLaabs/argo-hub-template
//
// This Repo contains some placeholder strings.
// To be more precise:
// - GITHUB_USER
// - GITHUB_USER_EMAIL

// FullStage combines everything, that is needed, to fully prepare the gitops repo for the end-user
func FullStage() {
fmt.Println("Rendering the gitops template repo")
}

// retrieveEnvs retrieves and reads the os.Env variables needed for further preperation
// GITHUB_USER
// GITHUB_USER_EMAIL
// These Envs are mandatory to run this CLI and will be checked on cluster-creation runtime.
// At this point, they will be available
func retrieveEnvs() (string, string, error) {
// Get GITHUB_USERNAME environment var
var username string
var usermail string

if os.Getenv("GITHUB_USERNAME") == "" {
fmt.Println("Missing Github Username, please set it. Exiting now.")
os.Exit(1)
} else {
username = os.Getenv("GITHUB_USERNAME")
}

if os.Getenv("GITHUB_USER_EMAIL") == "" {
fmt.Println("Missing Github User Email, please set it. Exiting now.")
os.Exit(1)
} else {
usermail = os.Getenv("GITHUB_USER_EMAIL")
}

return username, usermail, nil
}

// gitClone clones the gitops template repo from github, to the local working directory
func gitClone() {

}

// gitConfigs configures the local git repo (user, mail, etc)
func gitConfigs() {}

// replaceStrings replaces the Placeholder strings inside the gitops repo
func replaceStrings() {
username, usermail, err := retrieveEnvs()
if err != nil {
fmt.Println("Error retrieving token:", err)
os.Exit(1)
}

fmt.Println(username)
fmt.Println(usermail)

// we need to look over many files, and have to replace two different kind of Placeholder strings

}

// gitPush pushes the changes to the users github repository
func gitPush() {}
1 change: 1 addition & 0 deletions cmd/frigg/bootstrap/sidero/sidero.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package sidero
6 changes: 2 additions & 4 deletions cmd/frigg/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ package frigg

import (
"github.com/PatrickLaabs/frigg/cmd/frigg/bootstrap"
"github.com/PatrickLaabs/frigg/cmd/frigg/functests"
"io"

"github.com/spf13/cobra"

"github.com/PatrickLaabs/frigg/cmd"
"github.com/PatrickLaabs/frigg/cmd/frigg/create"
"github.com/PatrickLaabs/frigg/cmd/frigg/delete"
"github.com/PatrickLaabs/frigg/cmd/frigg/version"
"github.com/PatrickLaabs/frigg/pkg/log"
Expand Down Expand Up @@ -77,14 +75,14 @@ func NewCommand(logger log.Logger, streams cmd.IOStreams) *cobra.Command {
// add all top level subcommands
//c.AddCommand(build.NewCommand(logger))
//c.AddCommand(completion.NewCommand(streams))
c.AddCommand(create.NewCommand(logger, streams))
//c.AddCommand(create.NewCommand(logger, streams))
c.AddCommand(delete.NewCommand(logger))
//c.AddCommand(export.NewCommand(logger, streams))
//c.AddCommand(get.NewCommand(logger, streams))
c.AddCommand(version.NewCommand(logger, streams))
//c.AddCommand(load.NewCommand(logger))
c.AddCommand(bootstrap.NewCommand(logger, streams))
c.AddCommand(functests.NewCommand(logger, streams))
//c.AddCommand(functests.NewCommand(logger, streams))
return c
}

Expand Down
1 change: 1 addition & 0 deletions docs/providers/capd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
You will need to pass two Environment variables:
- GITHUB_TOKEN
- GITHUB_USERNAME
- GITHUB_USERNAME_EMAIL

Updated on: 27 Feb 2024
3 changes: 2 additions & 1 deletion docs/providers/capd/capd_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ func MakeReadme(filename string) {
body := "## Get started \n\n" +
"You will need to pass two Environment variables: \n" +
"- GITHUB_TOKEN\n" +
"- GITHUB_USERNAME"
"- GITHUB_USERNAME\n" +
"- GITHUB_USERNAME_EMAIL"
footer := "Updated on: " + date
data := fmt.Sprintf("%s\n\n%s\n\n%s", header, body, footer)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/PatrickLaabs/frigg

go 1.22
go 1.22.0

require (
github.com/BurntSushi/toml v1.3.2
Expand Down
4 changes: 2 additions & 2 deletions tmpl/helmchartsproxies/helmchartproxies.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func MgmtArgoCD() {

username, err := retrieveUsername()
if err != nil {
fmt.Println("Error retrieving token:", err)
fmt.Println("Error retrieving github username:", err)
os.Exit(1)
}

Expand Down Expand Up @@ -150,7 +150,7 @@ func retrieveUsername() (string, error) {
var username string

if os.Getenv("GITHUB_USERNAME") == "" {
fmt.Println("Missing Github Token, please set it. Exiting now.")
fmt.Println("Missing Github Username, please set it. Exiting now.")
os.Exit(1)
} else {
username = os.Getenv("GITHUB_USERNAME")
Expand Down

0 comments on commit a70fdd8

Please sign in to comment.