You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update addon template documentation to better describe variable usage
- Add detailed explanation of built-in vs customized variables
- Provide comprehensive examples of using AddOnDeploymentConfig variables
- Include step-by-step guide for defining and using customized variables
- Add variable naming conventions and validation rules
- Explain variable precedence order
- Include practical examples for different environments (dev/prod)
- Add common use cases for variables
Fixes#495
Signed-off-by: zhujian <[email protected]>
name: cluster1-specific-config # Override with cluster-specific config
1328
+
namespace: cluster1
1329
+
```
1330
+
1331
+
This allows you to have different variable values for different clusters while using the same addon template.
1332
+
1333
+
#### Variable naming and validation
1334
+
1335
+
When defining customized variables in AddOnDeploymentConfig, please note:
1336
+
1337
+
* **Variable names** must follow the pattern `^[a-zA-Z_][_a-zA-Z0-9]*$` (start with letter or underscore, followed by letters, numbers, or underscores)
1338
+
* **Variable names** are case-sensitive and have a maximum length of 255 characters
1339
+
* **Variable values** have a maximum length of 1024 characters
1340
+
* **Variable names** should be descriptive and follow naming conventions (e.g., `LOG_LEVEL`, `IMAGE_TAG`, `REPLICA_COUNT`)
1341
+
1342
+
#### Variable precedence
1343
+
1344
+
Variables are resolved in the following order (later values override earlier ones):
2. Variables from the default AddOnDeploymentConfig (referenced in ClusterManagementAddOn)
1348
+
3. Variables from cluster-specific AddOnDeploymentConfig (referenced in ManagedClusterAddOn)
1349
+
4. Built-in constant parameters (e.g., `CLUSTER_NAME`) - these cannot be overridden
1350
+
1351
+
#### Common use cases for variables
1352
+
1353
+
* **Image configuration**: Use variables like `IMAGE_TAG`, `IMAGE_REGISTRY` to customize container images
1354
+
* **Resource configuration**: Use variables like `REPLICA_COUNT`, `CPU_LIMIT`, `MEMORY_LIMIT` for resource settings
1355
+
* **Environment-specific settings**: Use variables like `LOG_LEVEL`, `DEBUG_MODE`, `ENVIRONMENT` for different environments
1356
+
* **Feature flags**: Use variables like `ENABLE_FEATURE_X`, `USE_TLS` to enable/disable features
1357
+
1358
+
#### Complete example: Using variables for different environments
1359
+
1360
+
Here's a complete example showing how to use variables to deploy the same addon with different configurations for development and production environments:
With this setup, the same AddOnTemplate will be rendered differently for each environment, with appropriate log levels, replica counts, and image tags.
1213
1435
1214
1436
### Using kubeconfig/certificates in the addon agent Deployment
0 commit comments