Skip to content

Commit

Permalink
Added Vault
Browse files Browse the repository at this point in the history
  • Loading branch information
Shifna12Zarnaz committed Sep 12, 2023
1 parent 4f7527f commit 8066a2f
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 220 deletions.
18 changes: 4 additions & 14 deletions agent/kubviz/k8smetrics_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import (
"k8s.io/client-go/rest"

"fmt"
"github.com/intelops/kubviz/credential"


v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/fields"
_ "k8s.io/client-go/plugin/pkg/client/auth/azure"
Expand Down Expand Up @@ -82,18 +81,9 @@ func main() {
config *rest.Config
clientset *kubernetes.Clientset
)
// connecting with nats ...
var Token string
if (token==""){
cred, err := credential.GetGenericCredential(context.Background(), conf.EntityName, conf.CredIdentifier)
if err != nil {
return
}
Token=cred["nats"]
}else{
Token=token
}
nc, err := nats.Connect(natsurl, nats.Name("K8s Metrics"), nats.Token(Token))


nc, err := nats.Connect(natsurl, nats.Name("K8s Metrics"), nats.Token(token))
checkErr(err)
// creating a jetstream connection using the nats connection
js, err := nc.JetStream()
Expand Down
2 changes: 1 addition & 1 deletion client/pkg/clients/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package clients
import (
"context"
"fmt"
"go/token"

"log"
"time"

Expand Down
110 changes: 52 additions & 58 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,44 @@ module github.com/intelops/kubviz
go 1.19

require (
github.com/ClickHouse/clickhouse-go/v2 v2.10.1
github.com/aquasecurity/trivy v0.43.1
github.com/ClickHouse/clickhouse-go/v2 v2.13.4
github.com/aquasecurity/trivy v0.45.0
github.com/blang/semver v3.5.1+incompatible
github.com/corneliusweig/tabwriter v0.0.0-20190512204542-5f8a091e83b5
github.com/davecgh/go-spew v1.1.1
github.com/docker/docker v24.0.4+incompatible
github.com/docker/docker v24.0.6+incompatible
github.com/genuinetools/reg v0.16.1
github.com/getkin/kin-openapi v0.118.0
github.com/ghodss/yaml v1.0.0
github.com/getkin/kin-openapi v0.120.0
github.com/gin-gonic/gin v1.9.1
github.com/go-co-op/gocron v1.30.1
github.com/go-playground/webhooks/v6 v6.2.0
github.com/google/uuid v1.3.0
github.com/go-co-op/gocron v1.33.1
github.com/go-playground/webhooks/v6 v6.3.0
github.com/google/uuid v1.3.1
github.com/hashicorp/go-version v1.6.0
github.com/intelops/go-common v1.0.19
github.com/kelseyhightower/envconfig v1.4.0
github.com/nats-io/nats.go v1.27.1
github.com/nats-io/nats.go v1.28.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
golang.org/x/term v0.11.0
golang.org/x/term v0.12.0
k8s.io/api v0.28.1
k8s.io/apimachinery v0.28.1
k8s.io/cli-runtime v0.27.3
k8s.io/cli-runtime v0.28.1
k8s.io/client-go v0.28.1
k8s.io/klog/v2 v2.100.1
)

require (
github.com/cenkalti/backoff/v3 v3.0.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/vault/api v1.9.2 // indirect
github.com/hashicorp/vault/api/auth/kubernetes v0.4.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
)

require (
github.com/ClickHouse/ch-go v0.52.1 // indirect
github.com/ClickHouse/ch-go v0.58.2 // indirect
github.com/CycloneDX/cyclonedx-go v0.7.2-0.20230625092137-07e2f29defc3 // indirect
github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/aquasecurity/go-dep-parser v0.0.0-20230626110909-e7ea5097483b // indirect
github.com/aquasecurity/go-dep-parser v0.0.0-20230830122616-841bc0f812c7 // indirect
github.com/aquasecurity/table v1.8.0 // indirect
github.com/aquasecurity/tml v0.6.1 // indirect
github.com/aquasecurity/trivy-db v0.0.0-20230703082116-dc52e83376ce // indirect
github.com/aquasecurity/trivy-kubernetes v0.5.7-0.20230628140707-dae3bdb6ee81 // indirect
github.com/aquasecurity/trivy-db v0.0.0-20230831170347-f732860d4917 // indirect
github.com/aquasecurity/trivy-kubernetes v0.5.7-0.20230830063136-fe986af3f10f // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/cenkalti/backoff/v3 v3.0.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
Expand All @@ -72,60 +54,73 @@ require (
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-faster/city v1.0.1 // indirect
github.com/go-faster/errors v0.6.1 // indirect
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
github.com/go-logr/logr v1.2.4 // 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.3 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/btree v1.1.2 // 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.5.9 // indirect
github.com/google/go-containerregistry v0.15.2 // indirect
github.com/google/go-containerregistry v0.16.1 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/vault/api v1.9.2 // indirect
github.com/hashicorp/vault/api/auth/kubernetes v0.4.1 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/intelops/go-common v1.0.19
github.com/invopop/yaml v0.1.0 // indirect
github.com/invopop/yaml v0.2.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/knqyf263/go-rpm-version v0.0.0-20220614171824-631e686d1075 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/masahiro331/go-xfs-filesystem v0.0.0-20230608043311-a335f4599b70 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nats-io/nats-server/v2 v2.9.19 // indirect
github.com/nats-io/nats-server/v2 v2.9.22 // indirect
github.com/nats-io/nkeys v0.4.4 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc4 // indirect
github.com/package-url/packageurl-go v0.1.1 // indirect
github.com/paulmach/orb v0.9.0 // indirect
github.com/package-url/packageurl-go v0.1.2-0.20230812223828-f8bb31c1f10b // indirect
github.com/paulmach/orb v0.10.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/perimeterx/marshmallow v1.1.4 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/peterhellberg/link v1.0.0 // indirect
github.com/pierrec/lz4/v4 v4.1.17 // indirect
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/samber/lo v1.38.1 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
Expand All @@ -136,21 +131,21 @@ require (
github.com/stretchr/testify v1.8.4 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/goleak v1.2.1 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/zap v1.24.0 // indirect
go.opentelemetry.io/otel v1.17.0 // indirect
go.opentelemetry.io/otel/trace v1.17.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.25.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/oauth2 v0.11.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
Expand All @@ -159,12 +154,11 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.5.0 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.13.2 // indirect
sigs.k8s.io/kustomize/kyaml v0.14.1 // indirect
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit 8066a2f

Please sign in to comment.