Skip to main content
Version: 2.13.0

Configure Events

This topic describes the configuration of an event during which the pods are scaled as per the pre-configured settings.

Configuration Parameters

ParameterParameter TypeDescriptionRequired
apiVersionStringThe 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
kindStringThe name of a particular object schema. The value must be EventConfig.Mandatory
metadataObjectThe metadata describes parameters (names and types) and attributes that have been applied.Mandatory
specObjectThe specification of the desired state of an object.Mandatory
statusObjectThis object provides the details of the event condition, progress, and service configuration.Mandatory

Metadata Parameters

ParameterParameter TypeDescriptionRequired
nameStringThe application namespace.Mandatory

Spec Parameters

ParameterParameter TypeDescriptionRequired
eventNameStringThe name of the upcoming event.Mandatory
eventStartTimestampStringThe event start time.Mandatory
eventEndTimestampStringThe event end time.Mandatory
applicationConfigNameStringThe name of the applicationConfig created. This binds the services in the applicationConfig with this event.Mandatory
scalingRatioConfigNameStringThe name of the scalingRatioConfig created. This binds the scaling ratios of services with this event.Mandatory
scalingConfigurationObjectThe scalingRatio description parameters.Mandatory
cooldownConfigurationObjectThe cooldownDuration description parameters.Mandatory
destinationContextsListThe 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

ParameterParameter TypeDescriptionRequired
minScalingFactorStringThe 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
maxScalingFactorStringThe 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

ParameterParameter TypeDescriptionRequired
cooldownDurationStringThe 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

ParameterParameter TypeDescriptionRequired
conditionsObjectThis 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
eventProgressStatusObjectThis object provides the status and progress of the event.Not Applicable
serviceConfigsObjectThis object provides the details of the service configuration of the event.Not Applicable

Conditions Parameters

ParameterParameter TypeDescriptionRequired
lastTransitionTimeAlphaNumericThe time when the last condition state changed.Not Applicable
statusBooleanThe status indicates if the state is in condition or not.Not Applicable
typeStringThe 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

ParameterParameter TypeDescriptionRequired
eventStatusStringThis parameter provides the event status.Not Applicable

Event Service Configuration Parameters

ParameterParameter TypeDescriptionRequired
kindStringThis parameter indicates the nature of the object. The value must be ScaledObject.Not Applicable
nameStringThis is the name of the scaled object.Not Applicable
originalMaxStringThe original maximum value of the scaled object.Not Applicable
originalMaxStringThe 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