-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add CRD Changes and Feature Flag for chain policy (#3880)
* Define and add CRD changes for new fleetautoscaler chain policy * Adds `ScheduledAutoscaler` feature gate
- Loading branch information
1 parent
31ed93e
commit a1a031c
Showing
6 changed files
with
245 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
--- | ||
# Copyright 2024 Google LLC All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# | ||
# [Stage:Dev] | ||
# [FeatureFlag:ScheduledAutoscaler] | ||
# Example of a FleetAutoscaler - this is used to scale a Fleet based on a schedule. | ||
# | ||
|
||
# | ||
# For a full reference and details: https://agones.dev/site/docs/reference/fleetautoscaler/ | ||
# | ||
apiVersion: autoscaling.agones.dev/v1 | ||
kind: FleetAutoscaler | ||
metadata: | ||
name: chain-fleet-autoscaler | ||
spec: | ||
policy: | ||
# Chain based policy for autoscaling. | ||
type: Chain | ||
chain: | ||
# Id of chain entry. If not set, the Id will be defaulted to the index of the entry within the chain. | ||
- id: "weekday" | ||
type: Schedule # Schedule based condition. | ||
schedule: | ||
between: | ||
# The policy becomes eligible for application starting on Feb 20, 2024 at 4:04 PM EST. If not set, the policy will immediately be eligible for application. | ||
start: "2024-02-20T16:04:04-05:00" | ||
# The policy becomes ineligible for application on Feb 23, 2024 at 4:04 PM EST. If not set, the policy will always be eligible for application (after the start time). | ||
end: "2024-02-23T16:04:04-05:00" | ||
activePeriod: | ||
# Timezone to be used for the startCron field. Defaults to UTC if not set. | ||
timezone: "America/New_York" | ||
# Start applying the policy everyday at 1:00 AM EST. If not set, the policy will always be applied in the .between window. | ||
# (Only eligible starting on Feb 20, 2024 at 4:04 PM). | ||
startCron: "0 1 * * 0" | ||
# Only apply the policy for 5 hours. If not set, the duration will be defaulted to always/indefinite. | ||
duration: "5h" | ||
# Policy to be applied during the activePeriod. Required. | ||
policy: | ||
type: Buffer | ||
buffer: | ||
bufferSize: 50 | ||
minReplicas: 100 | ||
maxReplicas: 2000 | ||
# Id of chain entry. If not set, the Id will be defaulted to the index of the entry within the chain list. | ||
- id: "weekend" | ||
type: Schedule | ||
schedule: | ||
between: | ||
# The policy becomes eligible for application starting on Feb 24, 2024 at 4:05 PM EST. If not set, the policy will immediately be eligible for application. | ||
start: "2024-02-24T16:04:05-05:00" | ||
# The policy becomes ineligible for application starting on Feb 26, 2024 at 4:05 PM EST. If not set, the policy will always be eligible for application (after the start time). | ||
end: "2024-02-26T16:04:05-05:00" | ||
activePeriod: | ||
# Timezone to be used for the startCron field. Defaults to UTC if not set. | ||
timezone: "America/New_York" | ||
# Start applying the policy everyday at 1:00 AM EST. If not set, the policy will always be applied in the .between window. | ||
# (Only eligible starting on Feb 24, 2024 at 4:05 PM EST) | ||
startCron: "0 1 * * 0" | ||
# Only apply the policy for 7 hours. If not set the duration will be defaulted to always/indefinite. | ||
duration: "7h" | ||
# Policy to be applied during the activePeriod. Required. | ||
policy: | ||
type: Counter | ||
counter: | ||
key: rooms | ||
bufferSize: 10 | ||
minCapacity: 500 | ||
maxCapacity: 1000 | ||
# Id of chain entry. If not set, the Id will be defaulted to the index of the entry within the chain list. | ||
- id: "default" | ||
# Policy will always be applied when no other policy is applicable. Required. | ||
policy: | ||
type: Buffer | ||
buffer: | ||
bufferSize: 5 | ||
minReplicas: 100 | ||
maxReplicas: 2000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 146 additions & 0 deletions
146
install/helm/agones/templates/crds/_fleetautoscalerpolicy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
# Copyright 2024 Google LLC All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- | ||
{{/* schema for a fleet autoscaler policy */}} | ||
{{- define "fleetautoscaler.policy" }} | ||
policy: | ||
type: object | ||
required: | ||
- type | ||
properties: | ||
type: | ||
type: string | ||
enum: | ||
- Buffer | ||
- Webhook | ||
- Counter | ||
- List | ||
{{- if .includeChainPolicy }} | ||
- Chain | ||
{{- end }} | ||
buffer: | ||
type: object | ||
nullable: true | ||
required: | ||
- maxReplicas | ||
properties: | ||
minReplicas: | ||
type: integer | ||
minimum: 0 | ||
maxReplicas: | ||
type: integer | ||
minimum: 1 | ||
bufferSize: | ||
x-kubernetes-int-or-string: true | ||
anyOf: | ||
- type: integer | ||
- type: string | ||
webhook: | ||
type: object | ||
nullable: true | ||
properties: | ||
url: | ||
type: string | ||
service: | ||
type: object | ||
required: | ||
- namespace | ||
- name | ||
properties: | ||
namespace: | ||
type: string | ||
name: | ||
type: string | ||
path: | ||
type: string | ||
port: | ||
type: integer | ||
caBundle: | ||
type: string | ||
format: byte | ||
counter: | ||
type: object | ||
nullable: true | ||
required: | ||
- key | ||
- bufferSize | ||
- maxCapacity | ||
properties: | ||
key: # The name of the Counter. | ||
type: string | ||
minCapacity: # Minimum aggregate counter capacity that can be provided by this FleetAutoscaler. If not specified, the actual minimum capacity will be bufferSize. | ||
type: integer | ||
minimum: 0 | ||
maxCapacity: # Maximum aggregate counter capacity that can be provided by this FleetAutoscaler. Required. | ||
type: integer | ||
minimum: 1 | ||
bufferSize: # Size of a buffer of counted items that are available in the Fleet (available capacity). It can be specified either in absolute (i.e. 5) or percentage format (i.e. 5%). | ||
x-kubernetes-int-or-string: true | ||
anyOf: | ||
- type: integer | ||
- type: string | ||
list: | ||
type: object | ||
nullable: true | ||
required: | ||
- key | ||
- bufferSize | ||
- maxCapacity | ||
properties: | ||
key: # The name of the List. | ||
type: string | ||
minCapacity: # Minimum aggregate list capacity that can be provided by this FleetAutoscaler. If not specified, the actual minimum capacity will be bufferSize. | ||
type: integer | ||
minimum: 0 | ||
maxCapacity: # Maximum aggregate list capacity that can be provided by this FleetAutoscaler. Required. | ||
type: integer | ||
minimum: 1 | ||
bufferSize: # Size of a buffer based on the list capacity that is available over the current aggregate list length in the Fleet. It can be specified either in absolute (i.e. 5) or percentage format (i.e. 5%). | ||
x-kubernetes-int-or-string: true | ||
anyOf: | ||
- type: integer | ||
- type: string | ||
{{- if .includeChainPolicy }} | ||
chain: | ||
type: array | ||
nullable: true | ||
items: | ||
type: object | ||
nullable: true | ||
required: | ||
- policy | ||
properties: | ||
id: # The Id of a chain entry. | ||
type: string | ||
schedule: # Defines when the policy is applied. | ||
type: object | ||
properties: | ||
between: | ||
type: object | ||
start: # Defines when to start evaluating the active period, must conform to RFC3339. | ||
type: string | ||
end: # Defines when to stop evaluating the active period, must conform to RFC3339. | ||
type: string | ||
activePeriod: | ||
type: object | ||
timezone: # Timezone to be used for the startCron field, must conform with the IANA Time Zone database (e.g. America/New_York). | ||
type: string | ||
startCron: # Cron expression defining when to start applying the policy. All TZ/CRON_TZ specification within startCron will be rejected, please use the timezone field above to specify a timezone. Must conform with UNIX CRON syntax. | ||
type: string | ||
duration: # The length of time the policy should be applied for (e.g. 2h45m). | ||
type: string | ||
{{- include "fleetautoscaler.policy" (dict "includeChainPolicy" false) | indent 12 }} # Defines which policy to apply during the active period. Required. | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters