Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework cli #68

Merged
merged 36 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
819f117
feat: refactor init command for allowing future improvements
JGiola Jun 3, 2024
aec7a2f
feat: update go to 1.22.4
JGiola Jun 7, 2024
731f52a
refactor: create valid args testing
JGiola Jun 7, 2024
fa278f4
feat: remove exp pagkage in favore of stdlib implementations
JGiola Jun 12, 2024
28fd9f4
style: renamed valid args func in create pkg
JGiola Jun 12, 2024
b4bc2c3
refactor: remove kustomize dependency
JGiola Jun 12, 2024
bc825ab
feat: rewrote apply with new jpl library
JGiola Jun 14, 2024
d1857c4
feat: new validate command structure
JGiola Jun 14, 2024
ea80708
feat: new build command structure
JGiola Jun 14, 2024
f3f56df
docs: update folder structure
JGiola Jun 18, 2024
509c2a3
feat: overhaul of internal packages to new public ones and delete unu…
JGiola Jun 18, 2024
bcd138c
feat: reuse all-groups/bases if no modules/addons in cluster specific…
JGiola Jun 19, 2024
d0afb25
feat: add tests to check custom-resources overwrite
JGiola Jun 19, 2024
dfa2aaa
feat: add missing import of custom-resources for overridden cluster m…
JGiola Jun 19, 2024
606c7f6
fix: custom-resource import location
JGiola Jun 19, 2024
b3fe502
feat: add loggin support in validate command
JGiola Jun 19, 2024
bd30745
style: remove unneded var declaration
JGiola Jun 19, 2024
0d29f68
docs: add godoc comments to private functions
JGiola Jun 19, 2024
732ab22
style: changed to error messages
JGiola Jun 19, 2024
d6c9bbe
feat: add logr injection via context to all commands
JGiola Jun 19, 2024
4d7fbdb
feat: refactor clusterID generation in function
JGiola Jun 19, 2024
56812a9
docs: add godoc comments to private functions
JGiola Jun 19, 2024
2a1d60a
refactor: unify context path validation in function
JGiola Jun 19, 2024
b30b8b0
feat: reworked git package for better testability
JGiola Jun 20, 2024
475593a
refactor: renamed and rearrange code in git package
JGiola Jun 20, 2024
b030550
feat: add tests for sync package
JGiola Jun 20, 2024
095f41d
feat: improved sync test assertions
JGiola Jun 20, 2024
5913d1b
feat: add new assertin to sync package
JGiola Jun 20, 2024
8a68eab
feat: add logging to sync command
JGiola Jun 20, 2024
910973d
refactor: use same function for context paths
JGiola Jun 20, 2024
1438ff0
feat: add logging to apply command
JGiola Jun 20, 2024
6d3db08
feat: add verbosity flag, and test root command
JGiola Jun 20, 2024
8026cd6
feat: latest cleanup
JGiola Jun 20, 2024
347214f
build: update goreleaser version
JGiola Jun 20, 2024
2a281ed
feat: update dependencies
JGiola Jun 20, 2024
85351e2
docs: update CHANGELOG
JGiola Jun 20, 2024
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
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "Go",
"image": "golang:1.22.3",
"image": "golang:1.22.4",
"containerUser": "root",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {},
"ghcr.io/devcontainers/features/go:1": {"version": "none", "golangciLintVersion": "1.59.0"}
"ghcr.io/devcontainers/features/go:1": {"version": "none", "golangciLintVersion": "1.59.1"}
},
"runArgs": [
"--cap-add=SYS_PTRACE",
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ on:
- examples/**

env:
GORELEASER_VERSION: v2.0.0
GORELEASER_VERSION: v2.0.1
GOEXPERIMENT: nocoverageredesign
jobs:
lint:
name: Lint Code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
- cron: 0 5 * * 1 # Run every monday at 5 UTC

env:
GORELEASER_VERSION: v2.0.0
GORELEASER_VERSION: v2.0.1

jobs:
codeql:
Expand Down
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.22.3
1.22.4
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- update go version to 1.22.3
### Changed

- update go version to 1.22.4
- revised all the cli commands to be structured in the same way
- use new version of jpl for streamlined handling of kubernetes resources
- reworked `init` and `sync` commands to work with incomplete folder structure
- mark generated files that will always be overridden by `vab`

## [v0.9.0] - 2023-02-08

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ endif

# Set here the name of the package you want to build
CMDNAME:= vab
BUILD_PATH:= ./cmd/vab
BUILD_PATH:= .
CONFORMANCE_TEST_PATH:= $(PROJECT_DIR)/internal/e2e
IS_LIBRARY:=

Expand Down
16 changes: 10 additions & 6 deletions docs/design/folder-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,20 @@ Here an example of the folders structures:
| ├── cluster-1
| | ├── bases
| | | └── kustomization.yaml
| | ├── traefik
| | | └── patch.yaml
| | ├── calico
| | | └── patch.yaml
| | ├── custom-resources
| | | ├── traefik
| | | | └── patch.yaml
| | | ├── calico
| | | | └── patch.yaml
| | | └── kustomization.yaml
| | └── kustomization.yaml
| └── cluster-2
| ├── bases
| | └── kustomization.yaml
| ├── cilium
| | └── patch-3.yaml
| ├── custom-resources
| | ├── cilium
| | | └── patch-3.yaml
| | └── kustomization.yaml
| └── kustomization.yaml
└── group-2
└── [...]
Expand Down
115 changes: 48 additions & 67 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,113 +1,94 @@
module github.com/mia-platform/vab

go 1.22.3
go 1.22.4

require (
github.com/dchest/uniuri v1.2.0
github.com/MakeNowJust/heredoc/v2 v2.0.1
github.com/go-git/go-billy/v5 v5.5.0
github.com/go-git/go-git/v5 v5.11.0
github.com/mia-platform/jpl v0.1.2
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.28.0
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
gopkg.in/yaml.v3 v3.0.1
k8s.io/apiextensions-apiserver v0.25.3
k8s.io/apimachinery v0.25.3
k8s.io/client-go v0.25.3
sigs.k8s.io/kustomize/api v0.12.1
sigs.k8s.io/kustomize/kustomize/v4 v4.5.7
sigs.k8s.io/kustomize/kyaml v0.13.9
github.com/go-git/go-git/v5 v5.12.0
github.com/go-logr/logr v1.4.2
github.com/go-logr/stdr v1.2.2
github.com/mia-platform/jpl v0.2.0
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0
k8s.io/api v0.28.11
k8s.io/apimachinery v0.28.11
k8s.io/cli-runtime v0.28.11
k8s.io/client-go v0.28.11
sigs.k8s.io/kustomize/api v0.17.2
sigs.k8s.io/kustomize/kyaml v0.17.1
sigs.k8s.io/yaml v1.4.0
)

require (
cloud.google.com/go v0.97.0 // indirect
dario.cat/mergo v1.0.0 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/go-errors/errors v1.0.1 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/skeema/knownhosts v1.2.2 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
golang.org/x/tools v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.16.1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/api v0.25.3 // indirect
k8s.io/cli-runtime v0.25.3 // indirect
k8s.io/klog/v2 v2.70.1 // indirect
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.28.11 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading
Loading