-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ManagedKube/dev-infra
Kubecost - cluster-turndown service
- Loading branch information
Showing
8 changed files
with
319 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
kubernetes/flux/releases/gcp/dev/kubecost/cluster-turndown/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Kubecost Cluster Turndown | ||
=========================== | ||
|
||
Source: https://github.com/kubecost/cluster-turndown | ||
|
||
|
||
# Easy time selector website | ||
This website will help you to easily convert GMT time to your local time. | ||
|
||
[https://www.worldtimebuddy.com/gmt-to-pst-converter](https://www.worldtimebuddy.com/gmt-to-pst-converter) | ||
|
||
|
||
# Turndown usage | ||
|
||
## Get turndown CRDs | ||
|
||
``` | ||
kubectl get turndownschedules | ||
``` | ||
|
||
or | ||
|
||
``` | ||
kubectl get tds | ||
``` |
256 changes: 256 additions & 0 deletions
256
kubernetes/flux/releases/gcp/dev/kubecost/cluster-turndown/cluster-turndown-full.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,256 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: cluster-turndown | ||
namespace: turndown | ||
labels: | ||
app: cluster-turndown | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: cluster-turndown | ||
labels: | ||
app: cluster-turndown | ||
rules: | ||
- apiGroups: | ||
- kubecost.k8s.io | ||
resources: | ||
- turndownschedules | ||
- turndownschedules/status | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- create | ||
- patch | ||
- update | ||
- delete | ||
- apiGroups: | ||
- "" | ||
- events.k8s.io | ||
resources: | ||
- events | ||
verbs: | ||
- create | ||
- patch | ||
- update | ||
- apiGroups: | ||
- '' | ||
resources: | ||
- deployments | ||
- nodes | ||
- pods | ||
- resourcequotas | ||
- replicationcontrollers | ||
- limitranges | ||
- pods/eviction | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- create | ||
- patch | ||
- update | ||
- delete | ||
- apiGroups: | ||
- '' | ||
resources: | ||
- configmaps | ||
- namespaces | ||
- persistentvolumeclaims | ||
- persistentvolumes | ||
- endpoints | ||
- events | ||
- services | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- extensions | ||
resources: | ||
- daemonsets | ||
- deployments | ||
- replicasets | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- create | ||
- patch | ||
- update | ||
- delete | ||
- apiGroups: | ||
- apps | ||
resources: | ||
- statefulsets | ||
- deployments | ||
- daemonsets | ||
- replicasets | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- create | ||
- patch | ||
- update | ||
- delete | ||
- apiGroups: | ||
- batch | ||
resources: | ||
- cronjobs | ||
- jobs | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- create | ||
- patch | ||
- update | ||
- delete | ||
- apiGroups: | ||
- autoscaling | ||
resources: | ||
- horizontalpodautoscalers | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- policy | ||
resources: | ||
- poddisruptionbudgets | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- storage.k8s.io | ||
resources: | ||
- storageclasses | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- events.k8s.io | ||
resources: | ||
- events | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: cluster-turndown | ||
labels: | ||
app: cluster-turndown | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: cluster-turndown | ||
subjects: | ||
- kind: ServiceAccount | ||
name: cluster-turndown | ||
namespace: turndown | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: cluster-turndown | ||
namespace: turndown | ||
spec: | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 1 | ||
maxUnavailable: 1 | ||
type: RollingUpdate | ||
selector: | ||
matchLabels: | ||
app: cluster-turndown | ||
template: | ||
metadata: | ||
namespace: turndown | ||
labels: | ||
app: cluster-turndown | ||
spec: | ||
containers: | ||
- name: cluster-turndown | ||
image: gcr.io/kubecost1/cluster-turndown:v1.0 | ||
volumeMounts: | ||
- name: turndown-keys | ||
mountPath: /var/keys | ||
env: | ||
- name: NODE_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: spec.nodeName | ||
- name: TURNDOWN_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: TURNDOWN_DEPLOYMENT | ||
value: cluster-turndown | ||
- name: GOOGLE_APPLICATION_CREDENTIALS | ||
value: /var/keys/service-key.json | ||
ports: | ||
- name: http-server | ||
containerPort: 9731 | ||
hostPort: 9731 | ||
serviceAccount: cluster-turndown | ||
serviceAccountName: cluster-turndown | ||
volumes: | ||
- name: turndown-keys | ||
secret: | ||
secretName: cluster-turndown-service-key | ||
--- | ||
# TurndownSchedule Custom Resource Definition for persistence | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: turndownschedules.kubecost.k8s.io | ||
spec: | ||
group: kubecost.k8s.io | ||
version: v1alpha1 | ||
names: | ||
kind: TurndownSchedule | ||
singular: turndownschedule | ||
plural: turndownschedules | ||
shortNames: | ||
- td | ||
- tds | ||
scope: Cluster | ||
subresources: | ||
status: {} | ||
validation: | ||
openAPIV3Schema: | ||
properties: | ||
spec: | ||
type: object | ||
properties: | ||
start: | ||
type: string | ||
format: date-time | ||
end: | ||
type: string | ||
format: date-time | ||
repeat: | ||
type: string | ||
enum: [none, daily, weekly] | ||
additionalPrinterColumns: | ||
- name: State | ||
type: string | ||
description: The state of the turndownschedule | ||
JSONPath: .status.state | ||
- name: Next Turndown | ||
type: string | ||
description: The next turndown date-time | ||
JSONPath: .status.nextScaleDownTime | ||
- name: Next Turn Up | ||
type: string | ||
description: The next turn up date-time | ||
JSONPath: .status.nextScaleUpTime |
16 changes: 16 additions & 0 deletions
16
kubernetes/flux/releases/gcp/dev/kubecost/cluster-turndown/cluster-turndown-service-key.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: bitnami.com/v1alpha1 | ||
kind: SealedSecret | ||
metadata: | ||
creationTimestamp: null | ||
name: cluster-turndown-service-key | ||
namespace: turndown | ||
spec: | ||
encryptedData: | ||
sa-managedkube-admin.json: AgAtOrrQNCbQ1tHEPA/tLANBUU6z+oEkaKQfPpPAKE37ZRl3+pqZ/HXduT4vuGEzJmFXqgZV1zx6MyX6SeQCxJLzDXtxsrVGS4OrcYec/cNmIGx68Mw6/AqKBxUQ9dkHB8YSaHcAXBNNxPlKVc/S3UtPparqFG2FJZHm94SN8ZGN/t6yDJZle1CRNfyx4Oo1rhHOSCSWa5EMLCPzmhf35Zondu3Y06w13Z4r2THrpw2Odf8O+BbgmMeEWnp1DodNceSZsGOb4sfNoJ6aNhv+w1FSDCdRzLfOpiLFgbK1f8kPx3hA0MdnLSOda73mDysGwVnB7z+pz4qJckIyHZtkLOAU/lcvO8X1rypV9KAvsxj1WxHdS3PXhS8WZzc2tICXKi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1iJjnfc7K2eBa+owcREmmBsZ7x7//vo3P8oBbVnDOpOpO/BEyJ+VNjZXQZ7M+65rkUtRAzUAIWlvjFn9K1QZ14ANDb/aK6cTlX2/QSGNnM4sdJ3OxdVMEGnrGAgKbW9aVaMqycM4BlajFEhSTbBmiSlJB9ed8K8h+xhmkOdUgMISMcuHNxhWw= | ||
template: | ||
metadata: | ||
creationTimestamp: null | ||
name: cluster-turndown-service-key | ||
namespace: turndown | ||
status: {} | ||
|
12 changes: 12 additions & 0 deletions
12
kubernetes/flux/releases/gcp/dev/kubecost/cluster-turndown/turndown-schedule.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
apiVersion: kubecost.k8s.io/v1alpha1 | ||
kind: TurndownSchedule | ||
metadata: | ||
name: schedule | ||
namespace: turndown | ||
finalizers: | ||
- "finalizer.kubecost.k8s.io" | ||
spec: | ||
start: 2020-03-12T06:00:00Z | ||
end: 2020-03-12T12:00:00Z | ||
repeat: daily |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: turndown | ||
labels: | ||
name: turndown |
2 changes: 1 addition & 1 deletion
2
...lm/flux/flux/environments/dev/values.yaml → ...x/flux/environments/dev-infra/values.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
flux: | ||
git: | ||
url: [email protected]:ManagedKube/kubernetes-common-services.git | ||
branch: structure-update | ||
branch: master | ||
path: "kubernetes/flux/releases/gcp/dev,kubernetes/flux/releases/base-values" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters