Skip to content

Commit

Permalink
Update turndownschedules CRD for v2 of turndown
Browse files Browse the repository at this point in the history
v2 of turndown changes the namespacing of the turndown resources to match
K8s API policy. See discussion and references in
kubecost/cluster-turndown#44 for more detail.

The new CRD YAML is copied from cluster-turndown v2.0.1
  • Loading branch information
michaelmdresser committed Jun 2, 2022
1 parent 7c3be74 commit 0e90e44
Showing 1 changed file with 28 additions and 78 deletions.
106 changes: 28 additions & 78 deletions cost-analyzer/templates/kubecost-cluster-controller-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ metadata:
app: {{ template "kubecost.clusterControllerName" . }}
rules:
- apiGroups:
- kubecost.k8s.io
- kubecost.com
resources:
- turndownschedules
- turndownschedules/status
Expand Down Expand Up @@ -247,106 +247,56 @@ spec:
app: {{ template "kubecost.clusterControllerName" . }}
---
# TurndownSchedule Custom Resource Definition for persistence
{{- if .Capabilities.APIVersions.Has "apiextensions.k8s.io/v1" }}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: turndownschedules.kubecost.k8s.io
name: turndownschedules.kubecost.com
labels:
{{ include "cost-analyzer.commonLabels" . | nindent 4 }}
spec:
group: kubecost.k8s.io
group: kubecost.com
names:
kind: TurndownSchedule
singular: turndownschedule
plural: turndownschedules
shortNames:
- td
- tds
scope: Cluster
versions:
- name: v1alpha1
served: true
storage: true
subresources:
status: {}
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
start:
start:
type: string
format: date-time
end:
type: string
format: date-time
repeat:
repeat:
type: string
enum: [none, daily, weekly]
subresources:
status: {}
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
names:
kind: TurndownSchedule
singular: turndownschedule
plural: turndownschedules
shortNames:
- td
- tds
scope: Cluster
{{ else }}
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: turndownschedules.kubecost.k8s.io
labels:
{{ include "cost-analyzer.commonLabels" . | nindent 4 }}
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
{{ end -}}

- 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
{{- end }}
{{- end }}

0 comments on commit 0e90e44

Please sign in to comment.