Skip to content

Commit 2cd27b7

Browse files
authored
Merge pull request #7 from bigcommerce/cci
CodeClimate + OSS prep
2 parents e147898 + 4998bb7 commit 2cd27b7

10 files changed

Lines changed: 274 additions & 74 deletions

File tree

.circleci/config.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,59 @@
11
version: 2.1
22

3+
#################################################################################
4+
# Orbs
5+
#################################################################################
36
orbs:
47
ci: bigcommerce/internal@volatile
8+
code-climate: bigcommerce/internal-codeclimate@volatile
59

10+
#################################################################################
11+
# Executors
12+
#################################################################################
613
executors:
714
go:
815
docker:
916
- image: cimg/go:1.17
1017
environment:
1118
DOCKER_API_VERSION: 1.39
1219

20+
#################################################################################
21+
# Jobs
22+
#################################################################################
23+
job_defaults: &job_defaults
24+
executor: go
25+
working_directory: /home/circleci/go/src/github.com/bigcommerce/bonvoy
26+
1327
jobs:
1428
test-unit:
15-
executor: go
29+
<<: *job_defaults
1630
steps:
1731
- ci/pre-setup
32+
- code-climate/setup
1833
- run: make deps test-unit
34+
- code-climate/after-build:
35+
coverage-format: 'gocov'
1936
test:
20-
executor: go
37+
<<: *job_defaults
2138
steps:
2239
- ci/pre-setup
2340
- run: make deps test
2441
build:
25-
executor: go
42+
<<: *job_defaults
2643
steps:
2744
- ci/pre-setup
2845
- run: make deps build
2946

47+
#################################################################################
48+
# Workflows
49+
#################################################################################
3050
workflows:
3151
version: 2
3252
full:
3353
jobs:
3454
- test-unit
3555
- test
36-
- build
56+
- build:
57+
requires:
58+
- test
59+
- test-unit

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## What? Why?
2+
3+
4+
## How was it tested?

CODE_OF_CONDUCT.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at engineering@bigcommerce.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Contributing to bonvoy
2+
3+
## Pull Requests
4+
5+
First ensure that your feature isn't already being developed or considered (see open PRs and issues).
6+
If it is, please consider contributing to those initiatives.
7+
8+
All PRs require test coverage to be accepted when applicable.
9+
10+
## Issues / Bugs
11+
12+
* Please include a clear, specific title and replicable description.
13+
14+
* Please include your environment, OS, and any exceptions/backtraces that occur. The more
15+
information that is given, the more likely we can debug and fix the issue.
16+
17+
**If you find a security bug, please do not post as an issue. Send directly to security@bigcommerce.com
18+
instead.**
19+
20+
## Other Ways to Contribute
21+
22+
* Consider contributing to bonvoy documentation on the wiki, reporting bugs, contributing to test coverage,
23+
or helping spread the word about bonvoy.
24+
25+
* Contribute directly to Consul or Nomad! This helps bonvoy and all other initiatives.
26+
27+
Thank you again for your interest in contributing to bonvoy!

LICENSE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
Copyright (c) 2021-present, BigCommerce Pty. Ltd. All rights reserved
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
5+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
6+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
7+
persons to whom the Software is furnished to do so, subject to the following conditions:
8+
9+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
10+
Software.
11+
12+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
15+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test:
2020
@gotest -v $$(go list ./... | grep -v vendor/) -tags=integration
2121

2222
test-unit:
23-
@gotest $$(go list ./... | grep -v vendor/)
23+
@gotest -v -coverprofile=c.out $$(go list ./... | grep -v vendor/)
2424

2525
build-linux:
2626
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ${OBJECT}-linux-amd64

README.md

Lines changed: 135 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Bonvoy
22

3-
[![CircleCI](https://circleci.com/gh/bigcommerce/bonvoy/tree/main.svg?style=svg&circle-token=df991e7eb7eb4c38c2ece44f81cc259d6d9a8929)](https://circleci.com/gh/bigcommerce/bonvoy/tree/main)
3+
[![CircleCI](https://circleci.com/gh/bigcommerce/bonvoy/tree/main.svg?style=svg&circle-token=df991e7eb7eb4c38c2ece44f81cc259d6d9a8929)](https://circleci.com/gh/bigcommerce/bonvoy/tree/main) [![Maintainability](https://api.codeclimate.com/v1/badges/63e2c2eb1a4e00d269e2/maintainability)](https://codeclimate.com/repos/61f18cc93e634f01a300d78c/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/63e2c2eb1a4e00d269e2/test_coverage)](https://codeclimate.com/repos/61f18cc93e634f01a300d78c/test_coverage)
44

55
A simple go CLI tool to perform various tasks against Envoy sidecars in a Consul
66
Connect and Nomad environment.
77

8-
Supports Consul 1.10+, Nomad 1.1.3+, and Envoy 1.18+.
8+
Supports Consul 1.10+, Nomad 1.1.3+, and Envoy 1.18+. Requires DOCKER_API_VERSION 1.39.
99

1010
## Usage
1111

@@ -18,55 +18,178 @@ All commands have the ability to output in JSON format with: `-o json`
1818

1919
List all listeners:
2020
```bash
21-
bonvoy listeners list auth-grpc
21+
$ bonvoy listeners list products-grpc
22+
23+
Listeners for products-grpc Envoy (PID 14013)
24+
--------------------------------------------------------------------------
25+
NAME | ADDRESS
26+
-----------------------------------+-----------------
27+
envoy_metrics_listener | 0.0.0.0:1239
28+
public_listener:0.0.0.0:22904 | 0.0.0.0:22904
29+
product-variants:127.0.0.1:8003 | 127.0.0.1:8003
30+
product-options:127.0.0.1:8004 | 127.0.0.1:8004
2231
```
2332

2433
### Clusters
2534

2635
List all clusters for a sidecar:
2736
```bash
28-
bonvoy clusters list auth-grpc
37+
$ bonvoy clusters list products-grpc
38+
39+
products-grpc.default.int-us-east1.internal.asdf1234.consul
40+
------------------------------------------------------------------------------------------------------------
41+
Outlier: Success Rate | -1 | Outlier: Success Rate Ejection | -1
42+
| | Threshold |
43+
Outlier: Local Origin - | -1 | Outlier: Local Origin | -1
44+
Success Rate | | - Success Rate Ejection |
45+
| | Threshold |
46+
Default Priority - Max | 2048 | Default Priority - Max Retries | 3
47+
Connections | | |
48+
Default Priority - Max Pending | 1024 | Default Priority - Max | 1024
49+
Requests | | Requests |
50+
High Priority - Max | 1024 | High Priority - Max Retries | 3
51+
Connections | | |
52+
High Priority - Max Pending | 1024 | High Priority - Max Requests | 1024
53+
Requests | | |
54+
55+
---------------------
56+
- Cluster Instances -
57+
---------------------
58+
HOST | CX ACTIVE | CX FAILED | CX TOTAL | REQ ACTIVE | REQ TIMEOUT | REQ SUCCESS | REQ ERROR | REQ TOTAL | SUCCESS RATE | LOCAL SUCCESS RATE | HEALTH FLAGS | REGION | ZONE | SUBZONE | CANARY
59+
----------------+-----------+-----------+----------+------------+-------------+-------------+-----------+-----------+--------------+--------------------+--------------+--------+------+---------+---------
60+
1.2.3.4:23837 | 1 | 0 | 1 | 0 | 0 | 23436077 | 0 | 23436077 | -1.0 | -1.0 | healthy | | | | false
61+
1.2.3.5:23910 | 1 | 0 | 1 | 0 | 0 | 23613685 | 0 | 23613685 | -1.0 | -1.0 | healthy | | | | false
62+
1.2.3.6:23011 | 1 | 0 | 1 | 0 | 0 | 54314043 | 0 | 54314043 | -1.0 | -1.0 | healthy | | | | false
2963
```
3064

3165
### Certificates
3266

3367
List all certificates:
68+
3469
```bash
35-
bonvoy certificates list auth-grpc
70+
$ bonvoy certificates list products-grpc
71+
72+
----------------------------------------------------------------------------
73+
products-grpc Envoy (PID 14013)
74+
----------------------------------------------------------------------------
75+
Certificate Chains:
76+
SAN | SERIAL # | PATH | VALID FROM | EXPIRATION TIME | DAYS UNTIL EXPIRATION
77+
------------------------------------------------------------------------+----------+----------+----------------------+----------------------+------------------------
78+
spiffe://asdf1234.consul/ns/default/dc/int-us-east1/svc/products-grpc | 17d220e0 | <inline> | 2022-01-24T22:56:46Z | 2022-01-27T22:56:46Z | 1
79+
spiffe://asdf1234.consul/ns/default/dc/int-us-east1/svc/products-grpc | 17d220e0 | <inline> | 2022-01-24T22:56:46Z | 2022-01-27T22:56:46Z | 1
80+
spiffe://asdf1234.consul/ns/default/dc/int-us-east1/svc/products-grpc | 17d220e0 | <inline> | 2022-01-24T22:56:46Z | 2022-01-27T22:56:46Z | 1
81+
82+
CA Certificates:
83+
SAN | SERIAL # | PATH | VALID FROM | EXPIRATION TIME | DAYS UNTIL EXPIRATION
84+
---------------------------+----------+----------+----------------------+----------------------+------------------------
85+
spiffe://asdf1234.consul | 17ce3503 | <inline> | 2020-07-20T16:05:55Z | 2030-07-20T16:05:55Z | 3096
86+
spiffe://asdf1234.consul | 17ce3503 | <inline> | 2020-07-20T16:05:55Z | 2030-07-20T16:05:55Z | 3096
87+
spiffe://asdf1234.consul | 17ce3503 | <inline> | 2020-07-20T16:05:55Z | 2030-07-20T16:05:55Z | 3096
88+
3689
```
3790

3891
List all expired certificates as compared to the Consul Agent:
3992
```bash
40-
bonvoy certificates expired auth-grpc
93+
$ bonvoy certificates expired products-grpc
94+
95+
SERVICE | PID | ENVOY EXPIRY | DAYS LEFT | CONSUL LEAF EXPIRY | RESTARTED
96+
----------+-----+--------------+-----------+--------------------+------------
4197
```
4298

4399
Or show all certs expired on a host:
44100
```bash
45-
bonvoy certificates expired all
101+
$ bonvoy certificates expired all
102+
103+
SERVICE | PID | ENVOY EXPIRY | DAYS LEFT | CONSUL LEAF EXPIRY | RESTARTED
104+
----------+-----+--------------+-----------+--------------------+------------
46105
```
47106

48107
### Config
49108

50109
Dump the config:
51110
```bash
52-
bonvoy config dump auth-grpc
111+
$ bonvoy config dump products-grpc
112+
113+
# configuration dumped here in JSON format
53114
```
54115

55116
### Server
56117

57118
Output server information:
58119
```bash
59-
bonvoy server info auth-grpc
120+
$ bonvoy server info products-grpc
121+
122+
----------------------
123+
- Server Information -
124+
----------------------
125+
Service | products-grpc
126+
Envoy Pid | 14013
127+
Version | asdf/1.22.0/Clean/RELEASE/BoringSSL
128+
Hot Restart Version | disabled
129+
State | LIVE
130+
Uptime | 1115062s
131+
132+
--------------------
133+
- Node Information -
134+
--------------------
135+
Node ID | _nomad-task-asdf-group-products-grpc-sidecar-proxy
136+
Node Cluster | products-grpc
137+
User Agent | envoy
138+
Envoy Version | 1.22.0
139+
Namespace | default
140+
141+
------------------------
142+
- Command Line Options -
143+
------------------------
144+
Concurrency | 24
145+
Mode | Serve
146+
Log Level | info
147+
Component Log Level |
148+
Log Format | [%Y-%m-%d %T.%e][%t][%l][%n]
149+
| [%g:%#] %v
150+
Drain Strategy | Gradual
151+
Drain Time | 100s
152+
Config Path | /path/to/envoy_bootstrap.json
153+
Parent Shutdown Time | 200s
60154
```
61155
62156
Show server memory statistics:
63157
```bash
64-
bonvoy server memory auth-grpc
158+
$ bonvoy server memory products-grpc
159+
160+
----------------------
161+
- Server Memory Info -
162+
----------------------
163+
Service | products-grpc
164+
Envoy Pid | 14013
165+
Allocated | 16349720
166+
Heap Size | 41943040
167+
Page Heap (Unmapped) | 0
168+
Page Heap (Free) | 3317760
169+
Total Physical Bytes | 43894086
170+
Total Thread Cache | 20066256
65171
```
66172
67173
### Logging
68174
69175
Set the log level for a sidecar:
70176
```bash
71-
bonvoy log level auth-grpc -l debug
72-
```
177+
$ bonvoy log level products-grpc -l debug
178+
```
179+
180+
## License
181+
182+
Copyright (c) 2021-present, BigCommerce Pty. Ltd. All rights reserved
183+
184+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
185+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
186+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
187+
persons to whom the Software is furnished to do so, subject to the following conditions:
188+
189+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
190+
Software.
191+
192+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
193+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
194+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
195+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)