Skip to main content
Version: 2.15.0

Configure an Application

This topic describes the application configuration that contains the GitHub properties and the status related to a specific event. The Event Agent supports configuring an application with or without auto detection.

Configure an Application with Auto Detection

In this approach, you can configure only an application for an event. This approach requires Argo CD reference for the auto detection of application configuration.

Configure Applications without Auto Detection

If your ArgoCD setup is running on a distinct cluster, and you have deployed applications on various other clusters using HELM, it implies that your scaling parameters are not specified directly in Kubernetes manifests. Instead, they are defined in separate HELM values or override files.

You have a separate HELM chart for every application.

In this situation, the auto detection of application configuration does not work. Therefore, you must manually add the application specifics for the event with the details of the destination clusters.

warning

For event scaling with Smart Scaler agent versions 2.9.28 or earlier, each application deployment in a namespace must have its own configured HPA. Without an individual HPA, event scaling fails.

However, starting with Smart Scaler agent versions 2.9.29 and later, event scaling no longer requires an individual HPA for each application deployment.

Configuration Parameters

The parameters are common for application configuration with or without auto detection except for a couple of them.

The following tables describe the configuration parameters set in the application configuration file.

ParameterParameter TypeDescriptionRequired
apiVersionStringThe Smart Scaler API version. A set of resources that are exposed together, along with the version. The value must be v1alpha1.Mandatory
kindStringThe name of a particular object schema. The value must be ApplicationConfig.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 application configuration's current state. This object is system-generated.Not Applicable

Metadata Parameters

ParameterParameter TypeDescriptionRequired
nameStringThe application configuration name.Mandatory

Spec Parameters

ParameterParameter TypeDescriptionRequired
argocdApplicationRefObjectThe user defined ArgoCD application reference.Mandatory. Required only with auto detection.
applicationDetailsObjectThis object contains the Git and service configuration.Mandatory. Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.

Application Parameters

ParameterParameter TypeDescriptionRequired
gitConfigurationObjectThis object contains the Git repository and its credentials.Mandatory. Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.
serviceConfigsObjectThis object contains the microservices information and the scaled object name.Mandatory. Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.

Git Parameters

info

The arogcdReference object that is used with auto detection contains only name and namspace parameters.

ParameterParameter TypeDescriptionRequired
branchStringThe name of the GitHub base branch.Mandatory. Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.
pathStringThe path to the GitHub Kubernetes manifests.Mandatory. Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.
repositoryURLThe URL of the GitHub repository.Mandatory. Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.
secretRefObjectThe secretRef is a reference to a Kubernetes secret that stores Git credentials or other sensitive information required for accessing and interacting with Git repositories.Mandatory. Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.
nameStringThe name of the application.Mandatory. Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.
namespaceStringThe namespace of the application.Mandatory. Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.
minReplicasCustomKeyStringThis is the key defined in your helm values file for minimum replicas for HPA/Keda ScaledObject. The key represents the path to the helm values for minimum replica count.Mandatory. Only applies to configuration without auto detection.
maxReplicasCustomKeyStringThis is the key defined in your helm values file for maximum replicas for HPA/Keda ScaledObject. The key represents the path to the helm values for maximum replica count.Mandatory. Only applies to configuration without auto detection.
destinationContextsListThe list of the names of your kubernetes cluster where each application is deployed. You can use the cluster name added in ArgoCD.Mandatory. Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.
gitProviderStringThe provider for Git services. The value can be bitbuket or github. The default value is github.Optional

Service Configuration Parameters

ParameterParameter TypeDescriptionRequired
nameStringThe name of the application's microservice.Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.
isRootNodeBooleanIt is the entry part of the application. The value is true or false.Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.
gitConfigurationObjectThe user-defined service configuration parameters that you can override the global GitHub configuration.Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.

SecretRef Parameters

ParameterParameter TypeDescriptionRequired
nameStringThe name of the secret.Mandatory
namespaceStringThe namespace of the secret.Mandatory

serviceConfigs Git Configuration Parameters

ParameterParameter TypeDescriptionRequired
repositoryStringThe GitHub repo URL that you can use to override the Global GitHub repo URL.Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.
branchStringThe GitHub branch that you can use to override the Global GitHub base branch.Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.
scaledObjectConfigObjectThis object contains the scaled object configuration for a given microservice.Mandatory. Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.

Scaled Object Parameters for Configuration with Auto Detection

ParameterParameter TypeDescriptionRequired
nameStringThe name of the scaled resource for a given microservice.Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.
pathStringThe path of the scaled resource on GitHub.Not required if Argo CD application reference is set as it is automatically detected by the Event Agent.

Scaled Object Parameters for Manual Configuration without Auto Detection

ParameterParameter TypeDescriptionRequired
kindStringThe name of a particular object schema for a given microservice. The value must be helm-values.Mandatory
nameStringAdd the deployment name of the application. The service name must match the service-name in the scaling ratio configuration.Mandatory

Status 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

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

Create the Application Configuration with Auto Detection

warning

For event scaling with Smart Scaler agent versions 2.9.28 or earlier, each application deployment in a namespace must have its own configured HPA. Without an individual HPA, event scaling fails.

However, starting with Smart Scaler agent versions 2.9.29 and later, event scaling no longer requires an individual HPA for each application deployment.

Create the application configuration YAML file using the following template when you want to provide the ArgoCD reference to get the application details.

apiVersion: agent.smart-scaler.io/v1alpha1
kind: ApplicationConfig
metadata:
name: <CONFIG_NAME>
spec:
argocdApplicationRef:
name: <APPLICATION_NAME>
namespace: <NAMESPACE>

The following is an example application configuration file for a Boutique application deployed through Argo CD.

apiVersion: agent.smart-scaler.io/v1alpha1
kind: ApplicationConfig
metadata:
name: example-app-config
spec:
argocdApplicationRef: # user defined
name: boutique
namespace: argocd

Create the Application Configuration Manually without Auto Detection

Create the application configuration by adding the application's GitHub and service information manually as shown in the example below.

Minimum and Maximum Replica Custom key

The minimum and maximum replica values vary for clusters. So, you must create values file with the replica values to override the corresponding replicas in the base value file.

For example, let us look at the following GitHub folder structure.

alt

The values-edge-ca-central-1.yaml, values-edge-us-south-east-2.yaml, and values-edge-us-west-2.yaml contain the minimum and maximum replicas for the corresponding clusters that overrides the replicas of the values.base.yaml file. You must specify the override file in the path under gitConfiguration as illustrated in the snippet below.

services:
- gitConfiguration:
branch: <TARGET-REVISION>
path: edge/sandbox/values-edge-ca-central-1.yaml # path of the override values file

The minimum and maximum replica values for a given destinationContext (cluster) must be specified in this format: .<object>.minReplicas or .<object>.maxReplicas.

<object> is the defined value that contains both minimum and maximum replicas in the values override file. Let us understand it from the override file below.

alt

The object that contains the replicas is called smartscaler. So, you the value of minReplicasCustomKey is .smartscaler.minReplicas and the value of maxReplicasCustomKey is .smartscaler.minReplicas as illustrated in the snippet below.

     gitConfiguration
...
path: edge/sandbox/values-edge-ca-central-1.yaml # path of the override values file
...
minReplicasCustomKey: ".smartscaler.minReplicas"
maxReplicasCustomKey: ".smartscaler.maxReplicas"

The following is an example application configuration with manually-added details of the applications.

warning

For event scaling with Smart Scaler agent versions 2.9.28 or earlier, each application deployment in a namespace must have its own configured HPA. Without an individual HPA, event scaling fails.

However, starting with Smart Scaler agent versions 2.9.29 and later, event scaling no longer requires an individual HPA for each application deployment.

apiVersion: agent.smart-scaler.io/v1alpha1
kind: ApplicationConfig
metadata:
name: applicationconfig-sample-manual
spec:
applicationDetails:
services:
- gitConfiguration:
branch: <TARGET-REVISION>
path: edge/sandbox/values-edge-ca-central-1.yaml # path of the override values file
repository: <GIT-REPO-URL>
secretRef:
name: git-access-secret
namespace: smart-scaler
minReplicasCustomKey: ".smartscaler.minReplicas"
maxReplicasCustomKey: ".smartscaler.maxReplicas"
destinationContext: ca-central-1 # should match the name of the cluster in event config destinationContexts
gitProvider: bitbucket # The value can be github/bitbucket. The default value is `github`.
scaledObjectConfig:
kind: helm-values
name: nginx # should match the name of the service-name in scaling ratio config
- gitConfiguration:
branch: <TARGET-REVISION>
path: edge/sandbox/values-edge-us-south-east-2.yaml # path of the override values file
repository: <GIT-REPO-URL>
secretRef:
name: git-access-secret
namespace: smart-scaler
minReplicasCustomKey: ".smartscaler.minReplicas"
maxReplicasCustomKey: ".smartscaler.maxReplicas"
destinationContext: us-south-east-2 # should match the name of the cluster in event config destinationContexts
scaledObjectConfig:
kind: helm-values
name: nginx # should match the name of the service-name in scaling ratio config
- gitConfiguration:
branch: <TARGET-REVISION>
path: edge/sandbox/values-edge-us-west-2.yaml # path of the override values file
repository: <GIT-REPO-URL>
secretRef:
name: git-access-secret
namespace: smart-scaler
minReplicasCustomKey: ".smartscaler.minReplicas"
maxReplicasCustomKey: ".smartscaler.maxReplicas"
scaledObjectConfig:
kind: helm-values
name: nginx # should match the name of the service-name in scaling ratio config

Apply the Configuration

After creating (or editing) the configuration, apply the latest settings using the following command:

kubectl  apply -f app-config.yaml -n smart-scaler