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

update with v1 api #20

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
134 changes: 134 additions & 0 deletions config/crds/autoscaler_v1_chpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
labels:
controller-tools.k8s.io: "1.0"
name: chpas.autoscalers.postmates.com
spec:
group: autoscalers.postmates.com
# list of versions supported by this CustomResourceDefinition
versions:
- name: v1
# Each version can be enabled/disabled by Served flag.
served: true
# One and only one version must be marked as the storage version.
storage: true
# A schema is required
schema:
openAPIV3Schema:
type: object
properties:
apiVersion:
type: string
kind:
type: string
metadata:
type: object
spec:
properties:
downscaleForbiddenWindowSeconds:
format: int32
maximum: 600
minimum: 1
type: integer
maxReplicas:
format: int32
maximum: 1000
minimum: 1
type: integer
metrics:
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
minReplicas:
format: int32
maximum: 1000
minimum: 1
type: integer
scaleTargetRef:
properties:
apiVersion:
type: string
kind:
type: string
name:
type: string
required:
- kind
- name
type: object
scaleUpLimitFactor:
format: double
maximum: 10
minimum: 1
type: number
scaleUpLimitMinimum:
format: int32
maximum: 20
minimum: 1
type: integer
tolerance:
format: double
maximum: 0.99
minimum: 0.01
type: number
upscaleForbiddenWindowSeconds:
format: int32
maximum: 600
minimum: 1
type: integer
required:
- scaleTargetRef
- maxReplicas
type: object
status:
properties:
conditions:
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
currentMetrics:
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
currentReplicas:
format: int32
type: integer
desiredReplicas:
format: int32
type: integer
lastScaleTime:
format: date-time
type: string
observedGeneration:
format: int64
type: integer
required:
- currentReplicas
- desiredReplicas
- currentMetrics
- conditions
type: object
x-kubernetes-preserve-unknown-fields: true
# The conversion section is introduced in Kubernetes 1.13+ with a default value of
# None conversion (strategy sub-field set to None).
conversion:
# None conversion assumes the same schema for all versions and only sets the apiVersion
# field of custom resources to the proper value
strategy: None
# either Namespaced or Cluster
scope: Namespaced
names:
# plural name to be used in the URL: /apis/<group>/<version>/<plural>
plural: chpas
# singular name to be used as an alias on the CLI and for display
singular: chpa
# kind is normally the CamelCased singular type. Your resource manifests use this.
kind: CHPA
# shortNames allow shorter string to match your resource on the CLI
shortNames:
- ct
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: autoscalers.postmates.com/v1beta1
apiVersion: autoscalers.postmates.com/v1
kind: CHPA
metadata:
labels:
Expand Down
12 changes: 12 additions & 0 deletions deployment/environments/ci/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
image:
tag: stable
name: postmates/configurable-hpa
api_version : "v1"
resources: {}
# Uncomment and set proper value some time ago
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
12 changes: 12 additions & 0 deletions deployment/environments/prod/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
image:
tag: stable
name: postmates/configurable-hpa
api_version : "v1"
resources: {}
# Uncomment and set proper value some time ago
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
12 changes: 12 additions & 0 deletions deployment/environments/stage/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
image:
tag: stable
name: postmates/configurable-hpa
api_version : "v1"
resources: {}
# Uncomment and set proper value some time ago
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
3 changes: 3 additions & 0 deletions deployment/helm/configurable-hpa/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.name }}:{{ .Values.image.tag }}"
env:
- name: api_version
value: {{ .Values.api_version }}
imagePullPolicy: IfNotPresent
resources:
{{ toYaml .Values.resources | indent 12 }}
2 changes: 1 addition & 1 deletion deployment/helm/configurable-hpa/values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
image:
tag: stable
name: postmates/configurable-hpa

api_version : "v1"
resources: {}
# Uncomment and set proper value some time ago
# limits:
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/autoscalers/v1beta1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ package v1beta1
import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/runtime/scheme"
"os"
)

var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: "autoscalers.postmates.com", Version: "v1beta1"}
SchemeGroupVersion = schema.GroupVersion{Group: "autoscalers.postmates.com", Version: os.Getenv("api_version")}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
Expand Down