Skip to content

Commit

Permalink
Merge pull request #20 from TencentBlueKing/develop
Browse files Browse the repository at this point in the history
v1.1.0
  • Loading branch information
wklken authored Aug 8, 2022
2 parents daefab7 + c9901e4 commit c33b87e
Show file tree
Hide file tree
Showing 668 changed files with 87,353 additions and 20,175 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ iam-search-engine
*.log

last_sync_time.*
snapshot.json
snapshot.*

.vscode
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:1.18 AS builder

COPY ./ /app
WORKDIR /app

ARG BINARY=iam-search-engine

RUN make build && chmod +x ${BINARY}
RUN mkdir -p /tmp/app/logs
RUN cp ${BINARY} /tmp/app

FROM debian:bullseye-slim
COPY --from=builder /tmp/app /app

CMD ["/app/iam-search-engine", "-c", "/app/config.yaml"]
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.6
1.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ storage:

index:
elasticsearch:
indexName: iam_policy
indexName: iam_policy_v2
addresses:
- http://__BK_IAM_SEARCH_ENGINE_ES7_HOST__:__BK_IAM_SEARCH_ENGINE_ES7_PORT__
username: "__BK_IAM_SEARCH_ENGINE_ES7_USER__"
Expand Down
15 changes: 8 additions & 7 deletions cmd/engine.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-权限中心检索引擎
* (BlueKing-IAM-Search-Engine) available.
* Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Expand Down Expand Up @@ -60,7 +60,6 @@ func Execute() {

// Start ...
func Start() {

fmt.Println("It's IAM Engine")

// init rand
Expand All @@ -78,10 +77,10 @@ func Start() {
fmt.Println(globalConfig)
}

//begin := time.Now()
//log.Info("begin to load all system's policies")
//demo.LoadAllLocalPolicies(&globalConfig.Index)
//log.Info("done all load! tooks:", time.Since(begin))
// begin := time.Now()
// log.Info("begin to load all system's policies")
// demo.LoadAllLocalPolicies(&globalConfig.Index)
// log.Info("done all load! tooks:", time.Since(begin))
// 1. init
initLogger()
// initSentry()
Expand All @@ -92,9 +91,11 @@ func Start() {
initGlobalIndex()
initSuperAppCode()
initRedis()
initRedisKeys()
initCaches()

// NOTE: should be after initRedis
initRmq()

// 2. watch the signal
ctx, cancelFunc := context.WithCancel(context.Background())
go func() {
Expand Down
13 changes: 5 additions & 8 deletions cmd/init.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-权限中心检索引擎
* (BlueKing-IAM-Search-Engine) available.
* Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Expand Down Expand Up @@ -87,7 +87,6 @@ func initSentryEventReport(sentryEnabled bool) {

func initGlobalIndex() {
indexer.InitGlobalIndex(&globalConfig.Index)

}

func initCaches() {
Expand All @@ -102,10 +101,8 @@ func initRedis() {
redis.InitRedisClient(false, &globalConfig.Redis)
}

func initRedisKeys() {
keys := make(map[string]string, len(globalConfig.RedisKeys))
for _, redisKey := range globalConfig.RedisKeys {
keys[redisKey.ID] = redisKey.Key
}
task.InitDeleteQueueKey(keys)
func initRmq() {
log.Info("init RMQ ")
task.InitRmqQueue(globalConfig.Debug)
log.Info("init RMQ success")
}
84 changes: 65 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
module engine

go 1.16
go 1.18

require (
github.com/TencentBlueKing/iam-go-sdk v0.0.5
github.com/TencentBlueKing/gopkg v1.0.9
github.com/TencentBlueKing/iam-go-sdk v0.0.9
github.com/adjust/rmq/v4 v4.0.5
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/cenkalti/backoff/v4 v4.1.2
github.com/elastic/go-elasticsearch/v7 v7.15.1
github.com/getsentry/sentry-go v0.11.0
github.com/gin-gonic/gin v1.7.7
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-playground/validator/v10 v10.9.0
github.com/gin-gonic/gin v1.8.1
github.com/go-playground/validator/v10 v10.11.0
github.com/go-redis/redis/v8 v8.11.4
github.com/gofrs/uuid v4.2.0+incompatible
github.com/golang-jwt/jwt/v4 v4.1.0
github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99 // indirect
github.com/json-iterator/go v1.1.12
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mitchellh/mapstructure v1.4.2
github.com/natefinch/atomic v1.0.1
github.com/onsi/ginkgo v1.16.5
Expand All @@ -26,24 +24,72 @@ require (
github.com/parnurzeal/gorequest v0.2.16
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.2.1
github.com/spf13/viper v1.9.0
github.com/stretchr/testify v1.7.0
github.com/stretchr/testify v1.7.2
github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2
github.com/swaggo/gin-swagger v1.3.3
github.com/swaggo/swag v1.7.6
github.com/ugorji/go v1.2.6 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.19.1
golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 // indirect
golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9 // indirect
go.uber.org/zap v1.21.0
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0
)

require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/goccy/go-json v0.9.10 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pelletier/go-toml/v2 v2.0.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
golang.org/x/net v0.0.0-20220805013720-a33c5aa5df48 // indirect
golang.org/x/sys v0.0.0-20220804214406-8e32c043e418 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/ini.v1 v1.65.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
moul.io/http2curl v1.0.0 // indirect
)
Loading

0 comments on commit c33b87e

Please sign in to comment.