Skip to content

Commit

Permalink
feat: GCP integration GOS, GAR and GKE
Browse files Browse the repository at this point in the history
This CL introduced GCP support with the following resources:
- GKE clusters
- Object storage buckets
- Artifact registry repositories

Ticket: ENG-1610
  • Loading branch information
benjaminch committed Jan 28, 2024
1 parent 3909e5a commit 1817b59
Show file tree
Hide file tree
Showing 11 changed files with 497 additions and 36 deletions.
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@ Check out our Blog announcement of Pleco: https://www.qovery.com/blog/announceme
- [X] S3 Buckets
- [X] Droplet firewalls
- [X] Unused VPCs
- [X] GCP
- [X] Cloud Storage Buckets
- [ ] Artifact Registry Repositories
- [ ] Kubernetes clusters
- [ ] Load balancers
- [ ] Detached volumes
- [ ] Unused VPCs
- [ ] AZURE
- [ ] GCP

---
## Installation
Expand Down Expand Up @@ -102,6 +108,11 @@ $ export DO_SPACES_KEY=<your_do_api_key_for_spaces>
$ export DO_SPACES_SECRET=<your_do_api_secret_for_spaces>
$ export DO_VOLUME_TIMEOUT=<delay_before_detached_volume_deletion_in_hours_since_creation> # default is 2 hours
```

#### For GCP
```bash
$ export GOOGLE_APPLICATION_CREDENTIALS=<path_to_your_credentials_json_file>
```
---
## Basic command

Expand Down Expand Up @@ -223,3 +234,30 @@ Here are some of the resources you can check:
```bash
pleco start do --level debug -i 240 -a nyc3 -e -r -s -l -b -f -v -y
```

### GCP options
#### Region selector
When pleco's look for expired resources, it will do it by [gcp_regions](https://cloud.google.com/compute/docs/regions-zones?hl=en).

You can set zone(s) with:
```bash
--gcp-regions, -a <region(s)>
```

For example:
```bash
-a europe-west9
```

#### Resources Selector
When pleco is running you have to specify which resources expiration will be checked.

Here are some of the resources you can check:
```bash
--enable-cluster, -e # Enable cluster watch
```

#### Example
```bash
pleco start gcp --level debug -i 240 -a europe-west9 -e -r -o -l -b -s -p -y
```
2 changes: 1 addition & 1 deletion cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var startCmd = &cobra.Command{
log.Infof("Starting Pleco %s", GetCurrentVersion())

if len(args) < 1 {
log.Errorf("The provider is mandatory (aws | scaleway | do)")
log.Errorf("The provider is mandatory (aws | scaleway | do | gcp)")
os.Exit(1)
}

Expand Down
42 changes: 31 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ module github.com/Qovery/pleco
go 1.18

require (
cloud.google.com/go/artifactregistry v1.14.3
cloud.google.com/go/container v1.26.1
cloud.google.com/go/storage v1.30.1
github.com/aws/aws-sdk-go v1.42.23
github.com/digitalocean/godo v1.81.0
github.com/minio/minio-go/v7 v7.0.31
Expand All @@ -11,24 +14,34 @@ require (
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.5.0
github.com/spf13/viper v1.12.0
golang.org/x/net v0.17.0
k8s.io/api v0.23.0
k8s.io/apimachinery v0.23.0
k8s.io/client-go v0.23.0
sigs.k8s.io/aws-iam-authenticator v0.5.3
)

require (
cloud.google.com/go v0.110.8 // indirect
cloud.google.com/go/compute v1.23.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.5 // indirect
cloud.google.com/go/longrunning v0.5.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/go-logr/logr v1.2.0 // indirect
github.com/gofrs/flock v0.7.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.5 // indirect
Expand All @@ -51,19 +64,26 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.3.0 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.149.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.0 // indirect
google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.30.0 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b // indirect
Expand Down
Loading

0 comments on commit 1817b59

Please sign in to comment.