Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade turndownschedules CRD to apiextensions v1 #44

Merged
merged 1 commit into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ $ kubectl get pods -l app=cluster-turndown -n turndown
Cluster Turndown uses a Kubernetes Custom Resource Definition to create schedules. There is an example resource located at `artifacts/example-schedule.yaml`:

```yaml
apiVersion: kubecost.k8s.io/v1alpha1
apiVersion: kubecost.com/v1alpha1
kind: TurndownSchedule
metadata:
name: example-schedule
finalizers:
- "finalizer.kubecost.k8s.io"
- "finalizer.kubecost.com"
spec:
start: 2020-03-12T00:00:00Z
end: 2020-03-12T12:00:00Z
Expand Down Expand Up @@ -201,19 +201,19 @@ Details regarding the status of the turndown schedule can be found by outputting
```bash
$ kubectl get tds example-schedule -o yaml

apiVersion: kubecost.k8s.io/v1alpha1
apiVersion: kubecost.com/v1alpha1
kind: TurndownSchedule
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"kubecost.k8s.io/v1alpha1","kind":"TurndownSchedule","metadata":{"annotations":{},"finalizers":["finalizer.kubecost.k8s.io"],"name":"example-schedule"},"spec":{"end":"2020-03-17T00:35:00Z","repeat":"daily","start":"2020-03-17T00:20:00Z"}}
{"apiVersion":"kubecost.com/v1alpha1","kind":"TurndownSchedule","metadata":{"annotations":{},"finalizers":["finalizer.kubecost.com"],"name":"example-schedule"},"spec":{"end":"2020-03-17T00:35:00Z","repeat":"daily","start":"2020-03-17T00:20:00Z"}}
creationTimestamp: "2020-03-17T00:18:39Z"
finalizers:
- finalizer.kubecost.k8s.io
- finalizer.kubecost.com
generation: 1
name: example-schedule
resourceVersion: "33573"
selfLink: /apis/kubecost.k8s.io/v1alpha1/turndownschedules/example-schedule
selfLink: /apis/kubecost.com/v1alpha1/turndownschedules/example-schedule
uid: d9b16aed-67e4-11ea-b591-42010a8e0075
spec:
end: "2020-03-17T00:35:00Z"
Expand Down
70 changes: 37 additions & 33 deletions artifacts/cluster-turndown-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ metadata:
app: cluster-turndown
rules:
- apiGroups:
- kubecost.k8s.io
- kubecost.com
resources:
- turndownschedules
- turndownschedules/status
Expand Down Expand Up @@ -204,13 +204,12 @@ spec:
secretName: cluster-turndown-service-key
---
# TurndownSchedule Custom Resource Definition for persistence
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: turndownschedules.kubecost.k8s.io
name: turndownschedules.kubecost.com
spec:
group: kubecost.k8s.io
version: v1alpha1
group: kubecost.com
names:
kind: TurndownSchedule
singular: turndownschedule
Expand All @@ -219,33 +218,38 @@ spec:
- td
- tds
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
spec:
versions:
- name: v1alpha1
served: true
storage: true
subresources:
status: {}
schema:
openAPIV3Schema:
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
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
6 changes: 3 additions & 3 deletions artifacts/example-schedule.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: kubecost.k8s.io/v1alpha1
apiVersion: kubecost.com/v1alpha1
kind: TurndownSchedule
metadata:
name: example-schedule
finalizers:
- "finalizer.kubecost.k8s.io"
- "finalizer.kubecost.com"
spec:
start: 2020-03-12T00:00:00Z
end: 2020-03-12T12:00:00Z
repeat: daily
repeat: daily
69 changes: 36 additions & 33 deletions artifacts/turndown-schedule-definition.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: turndownschedules.kubecost.k8s.io
name: turndownschedules.kubecost.com
spec:
group: kubecost.k8s.io
version: v1alpha1
group: kubecost.com
names:
kind: TurndownSchedule
singular: turndownschedule
Expand All @@ -13,34 +12,38 @@ spec:
- td
- tds
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
type: object
properties:
spec:
versions:
- name: v1alpha1
served: true
storage: true
subresources:
status: {}
schema:
openAPIV3Schema:
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
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
2 changes: 1 addition & 1 deletion pkg/apis/turndownschedule/register.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package turndownschedule

const (
GroupName = "kubecost.k8s.io"
GroupName = "kubecost.com"
)
2 changes: 1 addition & 1 deletion pkg/apis/turndownschedule/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// +k8s:deepcopy-gen=package,register
// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true
// +groupName=kubecost.k8s.io
// +groupName=kubecost.com

// Package v1alpha1 is the v1alpha1 version of the API.
package v1alpha1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/generated/informers/externalversions/generic.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/turndown/schedulecontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const (
// due to an existing turndown schedule.
ErrAlreadyScheduled = "ErrAlreadyScheduled"

TurndownScheduleFinalizer = "finalizer.kubecost.k8s.io"
TurndownScheduleFinalizer = "finalizer.kubecost.com"

ScheduleStateSuccess = "ScheduleSuccess"
ScheduleStateFailed = "ScheduleFailed"
Expand Down