Config Context
A Config Context is used to define global variables that are shared across different environment templates and resource templates. It can be applied to both environment and resource templates.
A Config Context consists of:
- Environment variables
- Files
- Input variables
These elements can be utilized within a single environment or across multiple environments, ensuring consistency and reusability.
Examples of using Config Contexts include:
- Restricting Region Options for a Team: A platform team wants to allow the QA team to spin up instances only in specific regions. To achieve this, the platform team creates a Config Context, defines the allowed regions as Input Variables, and sets the Override Type to "Restricted." This Config Context is then linked to an Environment Template. When creating an environment, the QA team can select from the predefined region options
- Defining Registry Endpoints: A platform team needs to specify the registry endpoint for pulling container images. This can be achieved by setting the endpoint as an Environment Variable within a Config Context
Setting | Description |
---|---|
apiVersion | Rafay’s API version eaas.envmgmt.io/v1 . |
Kind | ConfigContext . |
metadata | - name: Takes the name of the Config Context. - project: The project where this Config Context resides. |
spec -> variables | A list of input variables, should include: - name: Name of the variable. - valueType: One of hcl , json , expression , text . - overrideType: allowed , notallowed , or restricted . - required: true (mandatory) or false (optional). - value: Single value. - sensitive: true means the value is encrypted for storage. |
spec -> files | A list of files, should include: - name: Name or path to the file. - data: Content of the file in base64 encoded format. Note: If sensitive is set to true , use SecretSealer to encrypt data. |
spec -> envs | List of environment variables, should include: - key: Name of the variable. - value: Either plain text or a reference to encrypted data (e.g., sealed://AWS_SECRET_ACCESS_KEY ). Note: For sensitive data, use SecretSealer. |
Sample Config Context spec¶
apiVersion: eaas.envmgmt.io/v1
kind: ConfigContext
metadata:
name: rauto-rafay-creds-config-context-216151
project: defaultproject
spec:
files:
- data: c2VhbGVkOi8vZmlsZXMuMA==
name: opt/rafay/rctl.conf
sensitive: true
secret:
name: file://artifacts/rauto-rafay-creds-config-context-216151/sealed-secret.yaml
variables:
- name: rafay_config_file
value: opt/rafay/rctl.conf
valueType: text
envs:
- key: KEY
sensitive: false
value: 10001
- key: AWS_SECRET_ACCESS_KEY
sensitive: true
value: sealed://AWS_SECRET_ACCESS_KEY
secret:
name: file://artifacts/rauto-aws-config-config-context-65837/sealed-secret.yaml
Note: Config-context can be defined inline as part of Environment and Resource Template configuration as well.