Configure Events
This topic describes the configuration of an event during which the pods are scaled as per the pre-configured settings.
Configuration Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
apiVersion | String | The Smart Scaler API version. A set of resources that are exposed together, along with the version. The value must be agent.smart-scaler.io/v1alpha1 . | Mandatory |
kind | String | The name of a particular object schema. The value must be EventConfig . | Mandatory |
metadata | Object | The metadata describes parameters (names and types) and attributes that have been applied. | Mandatory |
spec | Object | The specification of the desired state of an object. | Mandatory |
status | Object | This object provides the details of the event condition, progress, and service configuration. | Mandatory |
Metadata Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
name | String | The application namespace. | Mandatory |
Spec Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
eventName | String | The name of the upcoming event. | Mandatory |
eventStartTimestamp | String | The event start time. | Mandatory |
eventEndTimestamp | String | The event end time. | Mandatory |
applicationConfigName | String | The name of the applicationConfig created. This binds the services in the applicationConfig with this event. | Mandatory |
scalingRatioConfigName | String | The name of the scalingRatioConfig created. This binds the scaling ratios of services with this event. | Mandatory |
scalingConfiguration | Object | The scalingRatio description parameters. | Mandatory |
cooldownConfiguration | Object | The cooldownDuration description parameters. | Mandatory |
destinationContexts | List | The list of the names of your kubernetes cluster where each application is deployed. You can use the cluster name added in ArgoCD. | Mandatory only when applications configuration is manually created without depending on ArgoCD. |
Scaling Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
minScalingFactor | String | The minimum scaling factor is a numerical value that defines the lower limit for how much a service or component can be scaled down when autoscaling is triggered. It is often expressed as a percentage or a whole number. | Mandatory |
maxScalingFactor | String | The maximum scaling factor is a numerical value that defines the upper limit for how much a service or component can be scaled up when autoscaling is triggered. It is often expressed as a percentage or a whole number. | Mandatory |
Cooldown Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
cooldownDuration | String | The cooldown duration is a time period during which the auto-scaling system pauses further scaling actions after a scaling event has occurred. It helps prevent rapid and frequent scaling adjustments in response to short-term fluctuations or noise in the traffic. | Mandatory |
Status Configuration Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
conditions | Object | This object provides the conditions that indicate the previous and current state of the application. The last condition should be READY for using the Event Agent. | Not Applicable |
eventProgressStatus | Object | This object provides the status and progress of the event. | Not Applicable |
serviceConfigs | Object | This object provides the details of the service configuration of the event. | Not Applicable |
Conditions Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
lastTransitionTime | AlphaNumeric | The time when the last condition state changed. | Not Applicable |
status | Boolean | The status indicates if the state is in condition or not. | Not Applicable |
type | String | The type indicates the status of the condition. The value must be READY for using Event Agent. The other supported values are PENDING and INVALID . | Not Applicable |
Event Progress Status Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
eventStatus | String | This parameter provides the event status. | Not Applicable |
Event Service Configuration Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
kind | String | This parameter indicates the nature of the object. The value must be ScaledObject . | Not Applicable |
name | String | This is the name of the scaled object. | Not Applicable |
originalMax | String | The original maximum value of the scaled object. | Not Applicable |
originalMax | String | The original minimum value of the scaled object. | Not Applicable |
Create the Event Configuration
Create the event configuration YAML file using the following template.
apiVersion: agent.smart-scaler.io/v1alpha1
kind: EventConfig
metadata:
name: <EVENT_NAME>
spec:
eventName: <EVENT_NAME>
eventStartTimestamp: "<START_TIMESTAMP>"
eventEndTimestamp: "<END_TIMESTAMP>"
applicationConfigName: <APP_CONFIG_NAME> # references applicationConfig CR
scalingRatioConfigName: <SCALING_RATIO_CONFIG_NAME> # references scalingRatioConfig CR
scalingConfiguration:
minScalingFactor: "<MIN_SCALING_FACTOR>"
maxScalingFactor: "<MAX_SCALING_FACTOR>"
cooldownConfiguration:
cooldownDuration: <COOLDOWN_DURATION> # eg. 120s, 1h, 1d
The following is an example event configuration file.
apiVersion: agent.smart-scaler.io/v1alpha1
kind: EventConfig
metadata:
name: black-friday-sale
spec:
eventName: black-friday-sale-2023
eventStartTimestamp: "2023-08-11T08:00:00Z"
eventEndTimestamp: "2023-08-11T10:00:00Z"
applicationConfigName: example-app-config # references applicationConfig CR
scalingRatioConfigName: example-scaling-ratio-config # references scalingRatioConfig CR
scalingConfiguration:
minScalingFactor: "2"
maxScalingFactor: "10"
cooldownConfiguration:
cooldownDuration: 180h # eg. 120s, 1h, 1d
Create the Event Configuration for Multiple Destinations
When the applications are in different clusters than the cluster containing ArgoCD, then you must add destination contexts to indicate which application under a given cluster is an event intended for.
The following configuration is an example of event configuration with destination contexts of applications.
apiVersion: agent.smart-scaler.io/v1alpha1
kind: EventConfig
metadata:
name: thursday-sale
spec:
displayName: ThursdaySale
eventStartTimestamp: "2023-10-27T19:27:00Z"
eventEndTimestamp: "2023-10-27T19:27:30Z"
applicationConfigName: applicationconfig-sample ## references applicationConfig CR
scalingRatioConfigName: scalingratioconfig-sample ## references scalingConfig CR
scalingConfiguration:
minScalingFactor: "10"
maxScalingFactor: "20"
cooldownDuration: 30s # eg. 120s, 1h, 1d
destinationContexts:
- ca-central-1
- us-south-east-2
- us-west-2
Apply the Configuration
After editing the configuration, apply the latest settings using the following command:
kubectl apply -f event-config.yaml -n smart-scaler