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

Leader #983

Merged
merged 6 commits into from
Aug 22, 2024
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
4 changes: 1 addition & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ jobs:
env:
CI: false
run: |
go mod tidy
cd hack/migrate
go mod tidy
make -B tidy hack/migrate/go.mod
changed_files=$(git status -s)
[[ -z "$changed_files" ]] || ( git diff && printf "Change is detected in: \n$changed_files\n Did you run 'go mod tidy' before sending the PR?" && exit 1)
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
migrate:
runs-on: ubuntu-latest
env:
migrate_command: cd hack/migrate && go mod tidy && go run main.go --db-url 'postgres://postgres:postgres@localhost:5432/mission-control?sslmode=disable'
migrate_command: make -B tidy hack/migrate/go.mod && cd hack/migrate && go run main.go --db-url 'postgres://postgres:postgres@localhost:5432/mission-control?sslmode=disable'
steps:
- name: Install Go
uses: buildjet/setup-go@v5
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
*.out.json
ginkgo.report
.vscode
nohup.out
*.test
.aider*
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ download-openapi-schemas:
rm -rf tmp


hack/migrate/go.mod: tidy
cp go.mod hack/migrate && \
cd hack/migrate && \
go mod edit -module=github.com/flanksource/duty/hack/generate-schemas && \
go mod edit -require=github.com/flanksource/[email protected] && \
go mod edit -replace=github.com/flanksource/duty=../../ && \
go mod tidy

.PHONY: migrate-test
migrate-test: hack/migrate/go.mod
cd hack/migrate && go run ./main.go

cp-playbook-schema:
cp ../incident-commander/config/schemas/playbook-spec.schema.json schema/

Expand All @@ -75,4 +87,3 @@ fmt_sql:

tidy:
go mod tidy
cd hack/migrate && go mod tidy
13 changes: 13 additions & 0 deletions cache/cache.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package cache

import (
"time"

"github.com/eko/gocache/lib/v4/cache"
gocache_store "github.com/eko/gocache/store/go_cache/v4"
gocache "github.com/patrickmn/go-cache"
)

func NewCache[T any](name string, expiration time.Duration) cache.CacheInterface[T] {
return cache.New[T](gocache_store.NewGoCache(gocache.New(expiration, expiration)))
}
2 changes: 1 addition & 1 deletion context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func (k *Context) KubernetesRestConfig() *rest.Config {
}

func (k *Context) KubernetesDynamicClient() *dutyKubernetes.DynamicClient {
return dutyKubernetes.NewKubeClient(k.KubernetesRestConfig())
return dutyKubernetes.NewKubeClient(k.Kubernetes(), k.KubernetesRestConfig())
}

func (k *Context) WithKubeconfig(input types.EnvVar) (*Context, error) {
Expand Down
2 changes: 1 addition & 1 deletion context/envvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func GetEnvValueFromCache(ctx Context, input types.EnvVar, namespace string) (va
if err != nil {
ctx.Logger.V(3).Infof("lookup failed %s => %s", source, err.Error())
} else if ctx.Logger.IsLevelEnabled(5) {
ctx.Logger.V(5).Infof("lookup %s => %s %s", source, logger.PrintableSecret(value))
ctx.Logger.V(5).Infof("lookup %s => %s", source, logger.PrintableSecret(value))
}

return value, err
Expand Down
2 changes: 2 additions & 0 deletions hack/migrate/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
go.mod
go.sum
206 changes: 0 additions & 206 deletions hack/migrate/go.mod

This file was deleted.

Loading
Loading