Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbolt35 committed Mar 24, 2021
2 parents aacee8a + cd351f3 commit e6e3e51
Show file tree
Hide file tree
Showing 12 changed files with 591 additions and 323 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=1.2.1
VERSION=1.2.2
REGISTRY=gcr.io
PROJECT_ID=kubecost1
APPNAME=cluster-turndown
Expand All @@ -9,7 +9,7 @@ build:
docker build -t ${REGISTRY}/${PROJECT_ID}/${APPNAME}:${VERSION} .

push:
gcloud docker -- push ${REGISTRY}/${PROJECT_ID}/${APPNAME}:${VERSION}
docker push ${REGISTRY}/${PROJECT_ID}/${APPNAME}:${VERSION}

clean:
docker rm -f ${REGISTRY}/${PROJECT_ID}/${APPNAME}:${VERSION} 2> /dev/null || true
Expand Down
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,28 @@ JSON definition of those permissions:
}
```

For EKS clusters, add the following permissions to the above policy for EKS API access:

```
{
"Effect": "Allow",
"Action": [
"eks:ListClusters",
"eks:DescribeCluster",
"eks:DescribeNodegroup",
"eks:ListNodegroups",
"eks:CreateNodegroup",
"eks:UpdateClusterConfig",
"eks:UpdateNodegroupConfig",
"eks:DeleteNodegroup",
"eks:ListTagsForResource",
"eks:TagResource",
"eks:UntagResource"
],
"Resource": "*"
}
```

Create a new file, service-key.json, and use the access key id and secret access key to fill out the following template:


Expand Down Expand Up @@ -153,6 +175,14 @@ To create this schedule, you may modify `example-schedule.yaml` to your desired
$ kubectl apply -f artifacts/example-schedule.yaml
```

Currently, updating a resource is not supported, so if the scheduling of the `example-schedule` fails, you will need to delete the resource via:

```bash
$ kubectl delete tds example-schedule
```

Then make the modifications to the schedule and re-apply.

## Viewing a Turndown Schedule
The `turndownschedule` resource can be listed via `kubectl` as well:

Expand Down Expand Up @@ -234,7 +264,7 @@ If the turndown schedule is cancelled between a turndown and turn up, the turn u
### Limitations
* The internal scheduler only allows one schedule at a time to be used. Any additional schedule resources created will fail (`kubectl get tds -o yaml` will display the status).
* **DO NOT** attempt to `kubectl edit` a turndown schedule. This is currently not supported. Recommended approach for modifying is to delete and then create a new schedule.
* 20-minute minimim time window between start and end of turndown schedule
* 20-minute minimum time window between start and end of turndown schedule

## How it works

Expand Down
2 changes: 1 addition & 1 deletion artifacts/cluster-turndown-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ spec:
spec:
containers:
- name: cluster-turndown
image: gcr.io/kubecost1/cluster-turndown:1.2.1
image: gcr.io/kubecost1/cluster-turndown:1.2.2
volumeMounts:
- name: turndown-keys
mountPath: /var/keys
Expand Down
2 changes: 1 addition & 1 deletion cmd/turndown/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func main() {
// Platform Provider API
clusterProvider, err := cp.NewClusterProvider(kubeClient)
if err != nil {
klog.V(1).Infof("[Error]: Failed to determine provider: %s", err.Error())
klog.V(1).Infof("[Error]: Failed to create ClusterProvider: %s", err.Error())
return
}

Expand Down
44 changes: 32 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
module github.com/kubecost/cluster-turndown

go 1.13
go 1.16

require (
cloud.google.com/go v0.46.3
github.com/aws/aws-sdk-go v1.28.7
github.com/google/uuid v1.1.1
github.com/imdario/mergo v0.3.8 // indirect
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51
google.golang.org/grpc v1.21.1
k8s.io/api v0.0.0-20190913080256-21721929cffa
k8s.io/apimachinery v0.0.0-20190913075812-e119e5e154b6
k8s.io/client-go v0.0.0-20190620085101-78d2af792bab
k8s.io/code-generator v0.17.3
cloud.google.com/go v0.80.0
github.com/aws/aws-sdk-go v1.38.3
github.com/emicklei/go-restful v2.15.0+incompatible // indirect
github.com/go-openapi/spec v0.20.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.2.0
github.com/googleapis/gnostic v0.5.4 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 // indirect
golang.org/x/mod v0.4.2 // indirect
golang.org/x/net v0.0.0-20210324051636-2c4c8ecb7826 // indirect
golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558 // indirect
golang.org/x/sys v0.0.0-20210324051608-47abb6519492 // indirect
golang.org/x/term v0.0.0-20210317153231-de623e64d2a6 // indirect
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
google.golang.org/genproto v0.0.0-20210323160006-e668133fea6a
google.golang.org/grpc v1.36.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/api v0.20.5
k8s.io/apimachinery v0.20.5
k8s.io/client-go v0.20.5
k8s.io/code-generator v0.20.5
k8s.io/gengo v0.0.0-20210203185629-de9496dff47b // indirect
k8s.io/klog v1.0.0
sigs.k8s.io/yaml v1.1.0
k8s.io/klog/v2 v2.8.0 // indirect
k8s.io/kube-openapi v0.0.0-20210323165736-1a6458611d18 // indirect
k8s.io/utils v0.0.0-20210305010621-2afb4311ab10 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.0 // indirect
sigs.k8s.io/yaml v1.2.0
)
Loading

0 comments on commit e6e3e51

Please sign in to comment.