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

moved token creation and updation to dlite #141

Merged
merged 1 commit into from
Jul 19, 2022
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
10 changes: 2 additions & 8 deletions command/harness/dlite/dlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
var (
taskInterval = 3 * time.Second
taskExecutors = 100
tokenExpiry = 10 * time.Hour
)

type dliteCommand struct {
Expand All @@ -48,15 +47,10 @@ func RegisterDlite(app *kingpin.Application) {

func (c *dliteCommand) startPoller(ctx context.Context, tags []string) error {
r := router.NewRouter(routeMap(c))
// TODO (Vistaar): Set a token updater thread which resets the token
token, err := delegate.Token("audience", "issuer", c.env.Dlite.AccountID, c.env.Dlite.AccountSecret, tokenExpiry)
if err != nil {
return err
}
// Client to interact with the harness server
client := delegate.New(c.env.Dlite.ManagerEndpoint, c.env.Dlite.AccountID, token, true)
client := delegate.New(c.env.Dlite.ManagerEndpoint, c.env.Dlite.AccountID, c.env.Dlite.AccountSecret, true)
p := poller.New(c.env.Dlite.AccountID, c.env.Dlite.AccountSecret, c.env.Dlite.Name, tags, client, r)
err = p.Poll(ctx, taskExecutors, taskInterval)
err := p.Poll(ctx, taskExecutors, taskInterval)
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
github.com/rs/zerolog v1.27.0
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.8.0
github.com/wings-software/dlite v0.0.0-20220713082428-30daf11ecea3
github.com/wings-software/dlite v0.0.0-20220719093617-8d19b41e2aae
golang.org/x/oauth2 v0.0.0-20220630143837-2104d58473e0
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f
google.golang.org/api v0.86.0
Expand All @@ -44,6 +44,7 @@ require (
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
)
Expand Down
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
Expand Down Expand Up @@ -587,6 +589,12 @@ github.com/wings-software/dlite v0.0.0-20220711114449-dd1b413ce340 h1:lomwogCUDV
github.com/wings-software/dlite v0.0.0-20220711114449-dd1b413ce340/go.mod h1:B7pPRpGetrd6Z/cJkN664YDc41tY0BZWgoIsL0hJTXI=
github.com/wings-software/dlite v0.0.0-20220713082428-30daf11ecea3 h1:vDCl3SWvpg1Tq+SyqEMwoUG4d+cMl4OqMDM7HBLzkEM=
github.com/wings-software/dlite v0.0.0-20220713082428-30daf11ecea3/go.mod h1:B7pPRpGetrd6Z/cJkN664YDc41tY0BZWgoIsL0hJTXI=
github.com/wings-software/dlite v0.0.0-20220719092347-03cafc856826 h1:jjE3+8QVB+iOznfdZmxaoZz3zoeHuZJUN2JAxLZc3ug=
github.com/wings-software/dlite v0.0.0-20220719092347-03cafc856826/go.mod h1:Qg4AEQ6ZPsWPcNCM4gDv3qT7y2jLy57CAmUq1doKRJY=
github.com/wings-software/dlite v0.0.0-20220719093237-f8dea8ec887c h1:OpDanvAoKvre2ZpVMlolSMD54/j6D+xJm6jwDBbazaA=
github.com/wings-software/dlite v0.0.0-20220719093237-f8dea8ec887c/go.mod h1:Qg4AEQ6ZPsWPcNCM4gDv3qT7y2jLy57CAmUq1doKRJY=
github.com/wings-software/dlite v0.0.0-20220719093617-8d19b41e2aae h1:iH38Xnnck0eFCI/9lsoT+U8hweuLicHwdnNz+PyJeOM=
github.com/wings-software/dlite v0.0.0-20220719093617-8d19b41e2aae/go.mod h1:Qg4AEQ6ZPsWPcNCM4gDv3qT7y2jLy57CAmUq1doKRJY=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down