Skip to content

Commit

Permalink
Merge pull request #58 from jeroenvermeulen/fix-api-version
Browse files Browse the repository at this point in the history
Updated RBAC and CDR API versions
  • Loading branch information
ericuldall authored Feb 6, 2024
2 parents e21d6b4 + ccaa47f commit 5878052
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 8 deletions.
61 changes: 58 additions & 3 deletions artifacts/kubes/scaling/chart/templates/crd.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,68 @@
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
# name must match the spec fields below, and be in the form: <plural>.<group>
name: scheduledscalers.scaling.k8s.restdev.com
spec:
# group name to use for REST API: /apis/<group>/<version>
group: scaling.k8s.restdev.com
# version name to use for REST API: /apis/<group>/<version>
version: v1alpha1
versions:
# version name to use for REST API: /apis/<group>/<version>
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
description: "ScheduledScaler is the Schema for the scheduled-scaler API"
type: object
properties:
spec:
description: "ScheduledScalerSpec is the specification of a ScheduledScaler"
type: object
properties:
timeZone:
description: "Timezone to use for the cronjob"
type: string
target:
description: "Target to scale"
type: object
properties:
kind:
description: "Kind of the target (InstanceGroup/HorizontalPodAutoscaler)"
type: string
name:
description: "Name of the target resource"
type: string
apiVersion:
description: "API version of the target resource"
type: string
required: ["kind", "name", "apiVersion"]
steps:
description: "List of steps to scale the target resource at a specific time."
type: array
items:
description: "Step to scale the target resource at a specific time."
type: object
properties:
runat:
description: "Cronjob time string (gocron) to run the scaling. Uses Cron Expression Format, https://pkg.go.dev/github.com/robfig/cron#hdr-CRON_Expression_Format"
type: string
pattern: "^(((\\d+|\\d+(-|\\/)\\d+)(,(\\d+|\\d+(-|\\/)\\d+))*|\\*) ){5}((\\d+|\\d+(-|\\/)\\d+)(,(\\d+|\\d+(-|\\/)\\d+))*|\\*)$"
mode:
description: "Type of scaling to run. 'fixed': set replicas to a fixed value, 'range': set replicas to a range"
type: string
pattern: "^(fixed|range)$"
replicas:
description: "Number of replicas to set when mode is 'fixed'"
type: integer
minReplicas:
description: "Minimum number of replicas to set when mode is 'range'"
type: integer
maxReplicas:
description: "Maximum number of replicas to set when mode is 'range'"
type: integer
required: ["runat", "mode"]
required: ["target", "steps"]
# either Namespaced or Cluster
scope: Namespaced
names:
Expand Down
4 changes: 2 additions & 2 deletions artifacts/kubes/scaling/chart/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- if .Values.rbac.create -}}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ template "scheduled-scaler.fullname" . }}
rules:
Expand All @@ -26,7 +26,7 @@ metadata:
name: {{ template "scheduled-scaler.fullname" . }}
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ template "scheduled-scaler.fullname" . }}
Expand Down
61 changes: 58 additions & 3 deletions artifacts/kubes/scaling/crd.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,68 @@
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
# name must match the spec fields below, and be in the form: <plural>.<group>
name: scheduledscalers.scaling.k8s.restdev.com
spec:
# group name to use for REST API: /apis/<group>/<version>
group: scaling.k8s.restdev.com
# version name to use for REST API: /apis/<group>/<version>
version: v1alpha1
versions:
# version name to use for REST API: /apis/<group>/<version>
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
description: "ScheduledScaler is the Schema for the scheduled-scaler API"
type: object
properties:
spec:
description: "ScheduledScalerSpec is the specification of a ScheduledScaler"
type: object
properties:
timeZone:
description: "Timezone to use for the cronjob"
type: string
target:
description: "Target to scale"
type: object
properties:
kind:
description: "Kind of the target (InstanceGroup/HorizontalPodAutoscaler)"
type: string
name:
description: "Name of the target resource"
type: string
apiVersion:
description: "API version of the target resource"
type: string
required: ["kind", "name", "apiVersion"]
steps:
description: "List of steps to scale the target resource at a specific time."
type: array
items:
description: "Step to scale the target resource at a specific time."
type: object
properties:
runat:
description: "Cronjob time string (gocron) to run the scaling. Uses Cron Expression Format, https://pkg.go.dev/github.com/robfig/cron#hdr-CRON_Expression_Format"
type: string
pattern: "^(((\\d+|\\d+(-|\\/)\\d+)(,(\\d+|\\d+(-|\\/)\\d+))*|\\*) ){5}((\\d+|\\d+(-|\\/)\\d+)(,(\\d+|\\d+(-|\\/)\\d+))*|\\*)$"
mode:
description: "Type of scaling to run. 'fixed': set replicas to a fixed value, 'range': set replicas to a range"
type: string
pattern: "^(fixed|range)$"
replicas:
description: "Number of replicas to set when mode is 'fixed'"
type: integer
minReplicas:
description: "Minimum number of replicas to set when mode is 'range'"
type: integer
maxReplicas:
description: "Maximum number of replicas to set when mode is 'range'"
type: integer
required: ["runat", "mode"]
required: ["target", "steps"]
# either Namespaced or Cluster
scope: Namespaced
names:
Expand Down

0 comments on commit 5878052

Please sign in to comment.