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

Add seperate fields for configuring autoscaler scale-up and scale-down #441

Merged
merged 8 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
17 changes: 16 additions & 1 deletion api/v1alpha2/agentpool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,29 @@ type AgentDeploymentAutoscaling struct {
//+optional
//+kubebuilder:default:=300
CooldownPeriodSeconds *int32 `json:"cooldownPeriodSeconds,omitempty"`

// CoolDownPeriod configures the period to wait between scaling up and scaling down
//+optional
CooldownPeriod *AgentDeploymentAutoscalingCooldownPeriod `json:"cooldownPeriod,omitempty"`
}

// AgentDeploymentAutoscalingCooldownPeriod configures the period to wait between scaling up and scaling down
type AgentDeploymentAutoscalingCooldownPeriod struct {
// ScaleUpSeconds is the time to wait before scaling up.
//+optional
ScaleUpSeconds *int32 `json:"scaleUpSeconds,omitempty"`

// ScaleDownSeconds is the time to wait before scaling down.
//+optional
ScaleDownSeconds *int32 `json:"scaleDownSeconds,omitempty"`
}

type AgentDeployment struct {
Replicas *int32 `json:"replicas,omitempty"`
Spec *v1.PodSpec `json:"spec,omitempty"`
}

// AgentPoolSpec defines the desired stak get ste of AgentPool.
// AgentPoolSpec defines the desired state of AgentPool.
type AgentPoolSpec struct {
// Agent Pool name.
// More information:
Expand Down
31 changes: 31 additions & 0 deletions api/v1alpha2/zz_generated.deepcopy.go

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

7,038 changes: 3,725 additions & 3,313 deletions charts/terraform-cloud-operator/crds/app.terraform.io_agentpools.yaml

Large diffs are not rendered by default.

83 changes: 30 additions & 53 deletions charts/terraform-cloud-operator/crds/app.terraform.io_modules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.11.3
creationTimestamp: null
name: modules.app.terraform.io
spec:
group: app.terraform.io
Expand All @@ -27,26 +28,18 @@ spec:
name: v1alpha2
schema:
openAPIV3Schema:
description: |-
Module is the Schema for the modules API
Module implements the API-driven Run Workflow
More information:
- https://developer.hashicorp.com/terraform/cloud-docs/run/api
description: 'Module is the Schema for the modules API Module implements the
API-driven Run Workflow More information: - https://developer.hashicorp.com/terraform/cloud-docs/run/api'
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
Expand All @@ -55,18 +48,15 @@ spec:
properties:
destroyOnDeletion:
default: false
description: |-
Specify whether or not to execute a Destroy run when the object is deleted from the Kubernetes.
Default: `false`.
description: 'Specify whether or not to execute a Destroy run when
the object is deleted from the Kubernetes. Default: `false`.'
type: boolean
module:
description: Module source and version to execute.
properties:
source:
description: |-
Non local Terraform module source.
More information:
- https://developer.hashicorp.com/terraform/language/modules/sources
description: 'Non local Terraform module source. More information:
- https://developer.hashicorp.com/terraform/language/modules/sources'
minLength: 1
type: string
version:
Expand All @@ -78,16 +68,13 @@ spec:
type: object
name:
default: this
description: |-
Name of the module that will be uploaded and executed.
Default: `this`.
description: 'Name of the module that will be uploaded and executed.
Default: `this`.'
minLength: 1
type: string
organization:
description: |-
Organization name where the Workspace will be created.
More information:
- https://developer.hashicorp.com/terraform/cloud-docs/users-teams-organizations/organizations
description: 'Organization name where the Workspace will be created.
More information: - https://developer.hashicorp.com/terraform/cloud-docs/users-teams-organizations/organizations'
minLength: 1
type: string
outputs:
Expand All @@ -103,19 +90,18 @@ spec:
type: string
sensitive:
default: false
description: |-
Specify whether or not the output is sensitive.
Default: `false`.
description: 'Specify whether or not the output is sensitive.
Default: `false`.'
type: boolean
required:
- name
type: object
minItems: 1
type: array
restartedAt:
description: |-
Allows executing a new Run without changing any Workspace or Module attributes.
Example: kubectl patch <KIND> <NAME> --type=merge --patch '{"spec": {"restartedAt": "'\`date -u -Iseconds\`'"}}'
description: 'Allows executing a new Run without changing any Workspace
or Module attributes. Example: kubectl patch <KIND> <NAME> --type=merge
--patch ''{"spec": {"restartedAt": "''\`date -u -Iseconds\`''"}}'''
minLength: 1
type: string
token:
Expand All @@ -129,10 +115,8 @@ spec:
a valid secret key.
type: string
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
optional:
description: Specify whether the Secret or its key must be
Expand Down Expand Up @@ -164,9 +148,7 @@ spec:
description: Workspace to execute the module.
properties:
id:
description: |-
Module Workspace ID.
Must match pattern: `^ws-[a-zA-Z0-9]+$`
description: 'Module Workspace ID. Must match pattern: `^ws-[a-zA-Z0-9]+$`'
pattern: ^ws-[a-zA-Z0-9]+$
type: string
name:
Expand All @@ -184,11 +166,9 @@ spec:
description: ModuleStatus defines the observed state of Module.
properties:
configurationVersion:
description: |-
A configuration version is a resource used to reference the uploaded configuration files.
More information:
- https://developer.hashicorp.com/terraform/cloud-docs/api-docs/configuration-versions
- https://developer.hashicorp.com/terraform/cloud-docs/run/api
description: 'A configuration version is a resource used to reference
the uploaded configuration files. More information: - https://developer.hashicorp.com/terraform/cloud-docs/api-docs/configuration-versions
- https://developer.hashicorp.com/terraform/cloud-docs/run/api'
properties:
id:
description: Configuration Version ID.
Expand Down Expand Up @@ -217,10 +197,7 @@ spec:
- runID
type: object
run:
description: |-
Workspace Runs status.
More information:
- https://developer.hashicorp.com/terraform/cloud-docs/run/states
description: 'Workspace Runs status. More information: - https://developer.hashicorp.com/terraform/cloud-docs/run/states'
properties:
configurationVersion:
description: The configuration version of this run.
Expand Down
Loading
Loading