diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index da15b0fc0..b13913e96 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -21,7 +21,7 @@ assignees: '' **Security disclosures** -If you think you’ve found a potential security issue, please do not post it in the Issues. Instead, please email [Prabhat Sharma](mailto:admin+security@zinclabs.io). +If you think you’ve found a potential security issue, please do not post it in the Issues. Instead, please email [Zinc team](mailto:admin+security@zinclabs.io). --> diff --git a/.goreleaser.yml b/.goreleaser.yml index 638120625..71c565503 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -50,7 +50,7 @@ changelog: - "^test:" dockers: - image_templates: - - public.ecr.aws/h9e2j3o7/zinc:{{ .Version }}-amd64 + - public.ecr.aws/zinclabs/zinc:{{ .Version }}-amd64 use: buildx skip_push: "false" build_flag_templates: @@ -66,7 +66,7 @@ dockers: - web - embed.go - image_templates: - - public.ecr.aws/h9e2j3o7/zinc:{{ .Version }}-arm64 + - public.ecr.aws/zinclabs/zinc:{{ .Version }}-arm64 use: buildx skip_push: "false" build_flag_templates: @@ -82,7 +82,7 @@ dockers: - web - embed.go - image_templates: - - public.ecr.aws/h9e2j3o7/zinc:{{ .Version }}-armv7 + - public.ecr.aws/zinclabs/zinc:{{ .Version }}-armv7 use: buildx skip_push: "false" build_flag_templates: @@ -98,7 +98,7 @@ dockers: - web - embed.go - image_templates: - - public.ecr.aws/h9e2j3o7/zinc:latest-amd64 + - public.ecr.aws/zinclabs/zinc:latest-amd64 use: buildx skip_push: "false" build_flag_templates: @@ -114,7 +114,7 @@ dockers: - web - embed.go - image_templates: - - public.ecr.aws/h9e2j3o7/zinc:latest-arm64 + - public.ecr.aws/zinclabs/zinc:latest-arm64 use: buildx skip_push: "false" build_flag_templates: @@ -130,7 +130,7 @@ dockers: - web - embed.go - image_templates: - - public.ecr.aws/h9e2j3o7/zinc:latest-armv7 + - public.ecr.aws/zinclabs/zinc:latest-armv7 use: buildx skip_push: "false" build_flag_templates: @@ -150,26 +150,26 @@ docker_manifests: # Name template for the manifest. # Defaults to empty. - name_template: public.ecr.aws/h9e2j3o7/zinc:{{ .Version }} + name_template: public.ecr.aws/zinclabs/zinc:{{ .Version }} # Image name templates to be added to this manifest. # Defaults to empty. image_templates: - - public.ecr.aws/h9e2j3o7/zinc:{{ .Version }}-amd64 - - public.ecr.aws/h9e2j3o7/zinc:{{ .Version }}-arm64 - - public.ecr.aws/h9e2j3o7/zinc:{{ .Version }}-armv7 + - public.ecr.aws/zinclabs/zinc:{{ .Version }}-amd64 + - public.ecr.aws/zinclabs/zinc:{{ .Version }}-arm64 + - public.ecr.aws/zinclabs/zinc:{{ .Version }}-armv7 - id: zinc-latest # Name template for the manifest. # Defaults to empty. - name_template: public.ecr.aws/h9e2j3o7/zinc:latest + name_template: public.ecr.aws/zinclabs/zinc:latest # Image name templates to be added to this manifest. # Defaults to empty. image_templates: - - public.ecr.aws/h9e2j3o7/zinc:latest-amd64 - - public.ecr.aws/h9e2j3o7/zinc:latest-arm64 - - public.ecr.aws/h9e2j3o7/zinc:latest-armv7 + - public.ecr.aws/zinclabs/zinc:latest-amd64 + - public.ecr.aws/zinclabs/zinc:latest-arm64 + - public.ecr.aws/zinclabs/zinc:latest-armv7 # https://goreleaser.com/customization/homebrew/ brews: - name: zinc diff --git a/COPYRIGHT b/COPYRIGHT new file mode 100644 index 000000000..a360bc017 --- /dev/null +++ b/COPYRIGHT @@ -0,0 +1,13 @@ +Copyright 2022 Zinc Labs Inc. and Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/buildspec.yml b/buildspec.yml index 5c7ad0082..97c9dcbd2 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -5,7 +5,7 @@ phases: commands: - echo Logging in to Amazon ECR... - - aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/h9e2j3o7 + - aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/zinclabs # Install AWS CLI # - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" # - unzip awscliv2.zip diff --git a/cmd/zinc/main.go b/cmd/zinc/main.go index 4cad332b8..a0fd2fa21 100644 --- a/cmd/zinc/main.go +++ b/cmd/zinc/main.go @@ -1,3 +1,18 @@ +/* Copyright 2022 Zinc Labs Inc. and Contributors +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. + */ + package main import ( @@ -20,15 +35,17 @@ import ( func main() { - /******** initialize sentry **********/ - err := sentry.Init(sentry.ClientOptions{ - Dsn: "https://15b6d9b8be824b44896f32b0234c32b7@o1218932.ingest.sentry.io/6360942", - Release: "zinc@" + v1.Version, - }) - if err != nil { - log.Print("sentry.Init: %s", err) + if zutils.GetEnvToBool("ZINC_SENTRY", "true") { + /******** initialize sentry **********/ + err := sentry.Init(sentry.ClientOptions{ + Dsn: "https://15b6d9b8be824b44896f32b0234c32b7@o1218932.ingest.sentry.io/6360942", + Release: "zinc@" + v1.Version, + }) + if err != nil { + log.Print("sentry.Init: %s", err) + } + /******** sentry initialize complete *******/ } - /******** sentry initialize complete *******/ r := gin.New() // Recovery middleware recovers from any panics and writes a 500 if there was one. @@ -51,7 +68,7 @@ func main() { ctx, cancel := context.WithTimeout(context.Background(), time.Second*60) defer cancel() if err := server.Shutdown(ctx); err != nil { - log.Fatal().Msgf("Server Shutdown:", err) + log.Fatal().Msgf("Server Shutdown: %s", err.Error()) } } else { server.Close() @@ -62,7 +79,7 @@ func main() { if err == http.ErrServerClosed { log.Info().Msgf("Server closed under request") } else { - log.Fatal().Msgf("Server closed unexpect") + log.Fatal().Msgf("Server closed unexpect: %s", err.Error()) } } diff --git a/embed.go b/embed.go index 106445b0b..9ecdcf65a 100644 --- a/embed.go +++ b/embed.go @@ -1,3 +1,18 @@ +/* Copyright 2022 Zinc Labs Inc. and Contributors +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. + */ + package zinc import ( diff --git a/embed_test.go b/embed_test.go index 6158a5276..19e26e27f 100644 --- a/embed_test.go +++ b/embed_test.go @@ -1,3 +1,18 @@ +/* Copyright 2022 Zinc Labs Inc. and Contributors +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. + */ + package zinc import ( diff --git a/go.mod b/go.mod index 2d822bfb5..75ec12595 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/zinclabs/zinc -go 1.18 +go 1.17 require ( github.com/aws/aws-sdk-go-v2/config v1.11.0 @@ -62,14 +62,12 @@ require ( github.com/go-playground/validator/v10 v10.4.1 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.3 // indirect - github.com/google/go-cmp v0.5.7 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/jtolds/gls v4.20.0+incompatible // indirect github.com/klauspost/compress v1.13.5 // indirect github.com/klauspost/cpuid v1.3.1 // indirect - github.com/kr/pretty v0.3.0 // indirect github.com/leodido/go-urn v1.2.0 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect @@ -87,7 +85,6 @@ require ( github.com/segmentio/backo-go v1.0.0 // indirect github.com/sirupsen/logrus v1.8.1 // indirect github.com/smartystreets/assertions v1.2.0 // indirect - github.com/stretchr/testify v1.6.1 // indirect github.com/tklauser/go-sysconf v0.3.9 // indirect github.com/tklauser/numcpus v0.3.0 // indirect github.com/ugorji/go/codec v1.1.7 // indirect diff --git a/helm/zinc/values.yaml b/helm/zinc/values.yaml index 300113653..e9743254e 100644 --- a/helm/zinc/values.yaml +++ b/helm/zinc/values.yaml @@ -3,7 +3,7 @@ # Declare variables to be passed into your templates. image: - repository: public.ecr.aws/prabhat/zinc + repository: public.ecr.aws/h9e2j3o7/zinc pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. tag: "latest" diff --git a/k8s/ingest-fluent-bit.yaml b/k8s/ingest-fluent-bit.yaml new file mode 100644 index 000000000..a0483330e --- /dev/null +++ b/k8s/ingest-fluent-bit.yaml @@ -0,0 +1,116 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: fluent-bit-config + namespace: logging + labels: + k8s-app: fluent-bit +data: + # Configuration files: server, input, filters and output + # ====================================================== + fluent-bit.conf: | + [SERVICE] + Flush 1 + Log_Level info + Daemon off + Parsers_File parsers.conf + HTTP_Server On + HTTP_Listen 0.0.0.0 + HTTP_Port 2020 + + @INCLUDE input-kubernetes.conf + @INCLUDE filter-kubernetes.conf + @INCLUDE output-elasticsearch.conf + + input-kubernetes.conf: | + [INPUT] + Name tail + Tag kube.* + Path /var/log/containers/*.log + Parser docker + DB /var/log/flb_kube.db + Mem_Buf_Limit 5MB + Skip_Long_Lines On + Refresh_Interval 10 + + filter-kubernetes.conf: | + [FILTER] + Name kubernetes + Match kube.* + Kube_URL https://kubernetes.default.svc:443 + Kube_CA_File /var/run/secrets/kubernetes.io/serviceaccount/ca.crt + Kube_Token_File /var/run/secrets/kubernetes.io/serviceaccount/token + Kube_Tag_Prefix kube.var.log.containers. + Merge_Log On + Merge_Log_Key log_processed + K8S-Logging.Parser On + K8S-Logging.Exclude Off + + output-elasticsearch.conf: | + [OUTPUT] + Name es + Match * + Path /es + Host z.zinc.svc.cluster.local + Port 4080 + Generate_ID On + HTTP_User admin + HTTP_Passwd Complexpass#123 + Logstash_Format On + Logstash_Prefix k8s-logs + Logstash_DateFormat %Y.%m.%d + + parsers.conf: | + [PARSER] + Name apache + Format regex + Regex ^(?[^ ]*) [^ ]* (?[^ ]*) \[(?