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.
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.
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 v1alpha1 . | Mandatory |
kind | String | The name of a particular object schema. The value must be ApplicationConfig . | 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 application configuration's current state. This object is system-generated. | Not Applicable |
Metadata Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
name | String | The application configuration name. | Mandatory |
Spec Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
argocdApplicationRef | Object | The user defined ArgoCD application reference. | Mandatory. Required only with auto detection. |
applicationDetails | Object | This 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
Parameter | Parameter Type | Description | Required |
---|---|---|---|
gitConfiguration | Object | This 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. |
serviceConfigs | Object | This 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
The arogcdReference
object that is used with auto detection contains only name
and namspace
parameters.
Parameter | Parameter Type | Description | Required |
---|---|---|---|
branch | String | The 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. |
path | String | The 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. |
repository | URL | The URL of the GitHub repository. | Mandatory. Not required if Argo CD application reference is set as it is automatically detected by the Event Agent. |
secretRef | Object | The 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. |
name | String | The name of the application. | Mandatory. Not required if Argo CD application reference is set as it is automatically detected by the Event Agent. |
namespace | String | The namespace of the application. | Mandatory. Not required if Argo CD application reference is set as it is automatically detected by the Event Agent. |
minReplicasCustomKey | String | This 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. |
maxReplicasCustomKey | String | This 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. |
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. Not required if Argo CD application reference is set as it is automatically detected by the Event Agent. |
gitProvider | String | The provider for Git services. The value can be bitbuket or github . The default value is github . | Optional |
Service Configuration Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
name | String | The name of the application's microservice. | Not required if Argo CD application reference is set as it is automatically detected by the Event Agent. |
isRootNode | Boolean | It 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. |
gitConfiguration | Object | The 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
Parameter | Parameter Type | Description | Required |
---|---|---|---|
name | String | The name of the secret. | Mandatory |
namespace | String | The namespace of the secret. | Mandatory |
serviceConfigs Git Configuration Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
repository | String | The 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. |
branch | String | The 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. |
scaledObjectConfig | Object | This 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
Parameter | Parameter Type | Description | Required |
---|---|---|---|
name | String | The 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. |
path | String | The 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
Parameter | Parameter Type | Description | Required |
---|---|---|---|
kind | String | The name of a particular object schema for a given microservice. The value must be helm-values . | Mandatory |
name | String | Add the deployment name of the application. The service name must match the service-name in the scaling ratio configuration. | Mandatory |
Status 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 |
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 |
Create the Application Configuration with Auto Detection
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.
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.
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.
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