Skip to content

Commit

Permalink
chore: refactor code structure and change timer parsing (#28)
Browse files Browse the repository at this point in the history
* chore: move every package in internal folder

* chore: move every package in internal folder

* feat: seperate controllers

* build: copy only api cmd and internal folders

* chore: move imnport to internal

* chore: fix method for slice string flag

* chore: rename cache to storage

* chore: make date human readables

* feat: make ssh known hosts cm name conmfigurable

* chore: use ParseDuration method for timers config

* chore: use ParseDuration method for timers config

* ci: remove setup golang from build and push job

* fix: compare next plan date with now instead of last plan date
  • Loading branch information
spoukke authored Dec 30, 2022
1 parent 4158c89 commit b63de84
Show file tree
Hide file tree
Showing 32 changed files with 300 additions and 342 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Golang
uses: actions/setup-go@v3
with:
go-version: "1.19"

# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
Expand Down
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@ RUN go mod download
# Copy the go source
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY burrito/ burrito/
COPY cmd/ cmd/
COPY runner/ runner/
COPY cache/ cache/
COPY internal/ internal/
COPY webhook/ webhook/
COPY cmd/ cmd/

# Build
# the GOARCH has not a default value to allow the binary be built according to the host where the command
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 0 additions & 33 deletions cache/memory.go

This file was deleted.

55 changes: 0 additions & 55 deletions cache/redis.go

This file was deleted.

53 changes: 0 additions & 53 deletions cache/redis/redis.go

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/controllers/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Copyright © 2022 NAME HERE <EMAIL ADDRESS>
package controllers

import (
"github.com/padok-team/burrito/burrito"
"github.com/padok-team/burrito/internal/burrito"

"github.com/spf13/cobra"
)
Expand Down
7 changes: 6 additions & 1 deletion cmd/controllers/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Copyright © 2022 NAME HERE <EMAIL ADDRESS>
package controllers

import (
"github.com/padok-team/burrito/burrito"
"github.com/padok-team/burrito/internal/burrito"
"github.com/spf13/cobra"
)

Expand All @@ -17,5 +17,10 @@ func buildControllersStartCmd(app *burrito.App) *cobra.Command {
return nil
},
}

cmd.Flags().StringSliceVar(&app.Config.Controller.Types, "types", []string{"layer", "repository"}, "list of controllers to start")

cmd.Flags().StringVar(&app.Config.Controller.Timers.DriftDetection, "drift-detection-period", "20m", "period between two plans. Must end with s, m or h.")

return cmd
}
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Copyright © 2022 NAME HERE <EMAIL ADDRESS>
package cmd

import (
"github.com/padok-team/burrito/burrito"
"github.com/padok-team/burrito/cmd/controllers"
"github.com/padok-team/burrito/cmd/runner"
"github.com/padok-team/burrito/cmd/webhook"
"github.com/padok-team/burrito/internal/burrito"

"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Copyright © 2022 NAME HERE <EMAIL ADDRESS>
package runner

import (
"github.com/padok-team/burrito/burrito"
"github.com/padok-team/burrito/internal/burrito"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 3 additions & 1 deletion cmd/runner/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Copyright © 2022 NAME HERE <EMAIL ADDRESS>
package runner

import (
"github.com/padok-team/burrito/burrito"
"github.com/padok-team/burrito/internal/burrito"
"github.com/spf13/cobra"
)

Expand All @@ -17,5 +17,7 @@ func buildRunnerStartCmd(app *burrito.App) *cobra.Command {
return nil
},
}

cmd.Flags().StringVar(&app.Config.Runner.SSHKnownHostsConfigMapName, "ssh-known-hosts-cm-name", "burrito-ssh-known-hosts", "configmap name to get known hosts file from")
return cmd
}
2 changes: 1 addition & 1 deletion cmd/webhook/start.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package webhook

import (
"github.com/padok-team/burrito/burrito"
"github.com/padok-team/burrito/internal/burrito"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/webhook/webhook.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package webhook

import (
"github.com/padok-team/burrito/burrito"
"github.com/padok-team/burrito/internal/burrito"
"github.com/spf13/cobra"
)

Expand Down
88 changes: 0 additions & 88 deletions controllers/terraformlayer_states.go

This file was deleted.

8 changes: 4 additions & 4 deletions burrito/burrito.go → internal/burrito/burrito.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"io"
"os"

"github.com/padok-team/burrito/burrito/config"
"github.com/padok-team/burrito/controllers"
"github.com/padok-team/burrito/runner"
"github.com/padok-team/burrito/webhook"
"github.com/padok-team/burrito/internal/burrito/config"
"github.com/padok-team/burrito/internal/controllers"
"github.com/padok-team/burrito/internal/runner"
"github.com/padok-team/burrito/internal/webhook"
)

type App struct {
Expand Down
Loading

0 comments on commit b63de84

Please sign in to comment.