Radix Config
In order for Radix to configure your application it needs a configuration file. By default, it is expected to be located in the root of the application repository, has a name radixconfig.yaml
and be in YAML or JSON format - in either case, it must have the .yaml
or .yml
extension (the name and extension should be exactly same as for the file in the GitHub repository). The name of the file and its location in the repository can be different. It can also be changed later on the Radix web-console configuration page for the application. Read more in the monorepo guide.
Radix only reads radixconfig.yaml
from the branch we set as the Config Branch
in the application registration form. If the file is changed in other branches, those changes will be ignored.
The basic format of the file is this; the configuration keys are explained in the Reference section below:
apiVersion: radix.equinor.com/v1
kind: RadixApplication
metadata: ...
spec: ...
You can enable auto-completion and validation for radixconfig.yaml
in your code editor. Read more about it here.
Reference
name
apiVersion: radix.equinor.com/v1
kind: RadixApplication
metadata:
name: myapp
spec:
name
needs to match the name given in when registering an application. Only lowercase characters are allowed. If the name supplied in the configuration contains uppercase characters, a warning will be logged and the name will be automatically converted to lowercase.
build
spec:
build:
useBuildKit: true
useBuildCache: true
secrets:
- SECRET_1
- SECRET_2
variables:
VAR1: val1
CONNECTION_STRING: "Provider=MySQLProv;Data Source=mydb;"
The build
section of the spec contains configuration used during the build process of the components and jobs.
useBuildKit
useBuildKit
- (optional, default false
for backwards compatibility) builds components and jobs using Buildah. This option provides several benefits over the default Radix build engine:
- Secure handling of build secrets.
- Caching support that can reduce build time, see
useBuildCache
. - Use images from protected container registries defined in
privateImageHubs
, in the Dockerfile'sFROM
instructions. - Faster builds due to less steps involved and higher performance nodes.
useBuildKit
is the recommended way to build containers and will be the default in the future.
useBuildCache
useBuildCache
- (optional, defaults to true
) pushes all layers to cache, and uses it in future builds when possible. Requires useBuildKit
to be enabled. Internally Radix sets --cache-to
, --cache-from
and --layers
in Buildah. Read more at Buildahs Documentation
This option can be overridden in the Radix CLI command rx create pipeline-job build-deploy
with an argument --use-build-cache=true|false
and with the checkbox Use Build Cache
in the Radix Web Console.
Refresh Build Cache
There are cases when cache need to be refreshed explicitly:
- When
useBuildCache
istrue
and there are changes in source code's implicit dependencies or external resources, used by the Dockerfile (e.g. components, referenced to external Git repository or service) - When build secrets are changed
In such (or other) cases the build cache can be refreshed within a build
or build-deploy
pipeline job created with the CLI command with the option --refresh-build-cache true
or with the ticked checkbox Refresh Build Cache
in the Radix Web Console.
Make sure you never store secrets or confidential information in any intermediate layer, multistage image, or in your final container image.
secrets
spec:
build:
secrets:
- SECRET_1
- SECRET_2
secrets
- (optional) Defines secrets to be used in Dockerfiles or sub-pipelines. Secrets values must be set in Radix Web Console. build-deploy
jobs will fail if not all secret values are set.
- When an option
useBuildKit: false
, to ensure that multiline build secrets are handled correct by the build, all build secrets are passed asARG
-s during container build, base-64 encoded (they need to be decoded before use). - When an option
useBuildKit: true
, build secrets are not available asARG
-s during container build, but they can be mounted as files. Secret values are not base-64 encoded in these files.
Read the build secrets guide to see how to use build secrets in a Dockerfile.
subPipeline
subPipeline
- (optional, available only in sub-pipelines) configuration of sub-pipeline options.
variables
spec:
build:
subPipeline:
variables:
VAR1: value1
VAR2: value2
variables
- (optional, available only in sub-pipelines) environment variables names and values, provided for all build Radix environments in sub-pipelines. These common environment variables can be overridden by environment-specific environment variables with the same names.
identity
spec:
build:
subPipeline:
identity:
azure:
clientId: 12345678-a263-abcd-8993-683cc6123456
When identity.azure.clientId
option is set, the environment variable AZURE_CLIENT_ID
with its value is automatically added to the running pipeline, and it can be used in this pipeline tasks. Read more about the identity in the component identity option and about using it in the sub-pipeline in the Pipeline with Azure workload identity example.
environments
spec:
environments:
- name: dev
build:
from: master
- name: prod
build:
from: release
The environments
section of the spec lists the environments for the application.
name
The name of the environment. Can be dev
, qa
, production
etc.
build
from
specifies which branch or git tag each environment will build from. If from
is not specified for the environment, no automatic builds or deployments will be created. This configuration is useful for a promotion-based workflow.
Wildcard branch or git tag mapping is also support, using *
and ?
. Examples:
feature/*
feature-?
hotfix/**/*
variables
- environment variable names and values (currently available only in sub-pipelines), provided for specific environments. They override common environment variables with the same names, if specified in the spec.build.variables
.
A text input field, will be available to put a full branch name for a build environment.
Example:
spec:
build:
variables:
VAR1: val1
CONNECTION_STRING: "Provider=MySQLProv;Data Source=prodDb;"
environments:
- name: dev
build:
from: main
variables:
VAR1: "val1-for-dev" #overrides common env-var VAR1 in the "dev" external pipeline
CONNECTION_STRING: "Provider=MySQLProv;Data Source=devDb;" #overrides common env-var CONNECTION_STRING in the "dev" custom sub-pipeline
- name: prod
build:
from: release
variables:
VAR3: val3 #env-var VAR3 only exists in the "prod" custom sub-pipeline, in addition to common VAR1 and CONNECTION_STRING
webhookEnabled
spec:
environments:
- name: dev
build:
from: master
webhookEnabled: false
webhookEnabled
- (optional, default true
) controls whether the environment is built and deployed by build-deploy
pipeline jobs triggered from GitHub webhook.
fromType
spec:
environments:
- name: dev
build:
from: master
fromType: branch|tag
fromType
- (optional, default both - branch or tag) controls whether the environment is built and deployed by build-deploy
pipeline jobs triggered from GitHub webhook:
branch
- on commit to a branchtag
- on created tag- not set - both on commit to a branch or on created tag
egress
spec:
environments:
- name: dev
build:
from: master
egress:
allowRadix: true
rules:
- destinations:
- "143.97.5.5/32"
- "143.97.6.1/32"
ports:
- port: 443
protocol: TCP
- name: prod
build:
from: release
Specify egress
with settings for which egress traffic is allowed from all components and jobs in the environment.
allowRadix
can be set to true
or false
to allow or deny traffic to other applications in Radix. The default value is false
.
rules
can be defined with a list of legal destinations
and ports
for egress traffic. Each entry in destinations
must be a string representing a valid IPv4 mask. Each entry in ports
must be an object with a valid TCP/UDP port
number and protocol
equal to either "TCP" or "UDP". If one or more egress rules are defined, any traffic not allowed by the egress rules will be blocked. If no egress rules are defined, all traffic is allowed.
See the egress configuration guide for usage patterns and tips and tricks.
If an environment
has defined the egress
field, all traffic is blocked by default. If egress
is not defined, all traffic is allowed.
If your application uses a custom OAuth2 implementation, outbound access to Microsoft authentication endpoints must be allowed. See allow traffic for OAuth2.
subPipeline
subPipeline
- (optional, available only in sub-pipelines) configuration of sub-pipeline options for specific environment.
- It can override common subPipeline or combine with it (if present) for a specific environment.
- It can remove the common Sub-Pipeline identity (if present) with
{}
(empty object) for a specific environment
spec:
environments:
- name: dev
subPipeline: {}
variables
spec:
environments:
- name: dev
subPipeline:
variables:
VAR1: value1
VAR2: value2
Sub-pipeline environment variables names and values, provided for specific build Radix environment in sub-pipelines. These variables will be combined with subPipeline environment variables (if present).
identity
spec:
environments:
- name: dev
subPipeline:
identity:
azure:
clientId: 12345678-a263-abcd-8993-683cc6123456
The identity
section enables identity for a specific environment. Read mode about build identity.
- It can remove the common identity with
{}
empty object for a specific environment
spec:
environments:
- name: dev
subPipeline:
identity:
azure: {}
components
This is where you specify the various components for your application - it needs at least one. Each component needs a name
; this will be used for building the Docker images (appName-componentName). Source for the component can be; a folder in the repository, a dockerfile or an image.
src
spec:
components:
- name: frontend
src: frontend
ports:
- name: http
port: 8080
- name: backend
src: backend
ports:
- name: http
port: 5000
src
defines the folder, relative to the repository root, to use as build context when building the Dockerfile
, defined by dockerfileName
, in Build and deploy pipeline jobs.
The default value is .
(root of the repository).
For Radix environment specific src
, refer to environmentConfig src.
The image
option takes precedence over src
and dockerfilename
.
dockerfileName
spec:
components:
- name: frontend
dockerfileName: Dockerfile # Resolved path from repository root: /Dockerfile
ports:
- name: http
port: 8080
- name: backend
dockerfileName: backend/Dockerfile # Resolved path from repository root: /backend/Dockerfile
ports:
- name: http
port: 5000
- name: api
src: api
dockerfileName: "../otherfolder/Dockerfile" # Resolved path from repository root: /otherfolder/Dockerfile
ports:
- name: http
port: 5000
- name: web
src: web
dockerfileName: "subfolder/Dockerfile" # Resolved path from repository root: /web/subfolder/Dockerfile
ports:
- name: http
port: 5000
dockerfileName
defines the name and path, relative to src
, of the Dockerfile
to build in Build and deploy pipeline jobs.
For Radix environment specific dockerfileName
, refer to environmentConfig image.
The image
option takes precedence over src
and dockerfilename
.
image
An alternative configuration of a component could be to use an existing container image, which can be specified in the option image
. When this option is set for a component - the component will be not build, but only deployed with this image. An example of such a configuration:
spec:
components:
- name: redis
image: redis:5.0-alpine
- name: swagger-ui
image: swaggerapi/swagger-ui
ports:
- name: http
port: 8080
publicPort: http
- When a container image is from the DockerHub repository, it is enough to specify only the image name. Examples:
image: redis:latest
image: redis:7.0.5
.- When an image is located in another container registry, the image name need to have the container registry URL. Example:
image: gcr.io/distroless/nodejs18-debian11
.image: gcr.io/distroless/nodejs18-debian11:latest
.
- When an image is not publicly available, it is required to provide an authentication information. Please read more about privateImageHubs option.
For Radix environment specific image
, refer to environmentConfig image.
replicas
spec:
components:
- name: backend
replicas: 2
replicas
can be used to horizontally scale the component. If replicas
is not set, it defaults to 1
. If replicas
is set to 0
, the component will not be deployed (i.e. stopped).
ports
spec:
components:
- name: frontend
ports:
- name: http
port: 8000
- name: api
port: 8001
A component can optionally have one or several ports:
name
- internal name of a port, used as a reference within the radixconfig. It needs to be unique within the componentports
list.port
- numeric value of a port, in the range between 1024 and 65535. It needs to be unique within the componentports
list.
A component doesn't need to have ports. If it has at least one port, it has to respond to TCP or HTTP requests, sent to this port. Kubernetes readiness probe will regularly request the first port in the ports
list to ensure that the component can handle requests.
When a new component version is deployed, the probe waits until replicas of the new component version start responding to such requests, keeping them in the "Starting" state. When the new replicas respond to these requests, the rolling update will remove the replicas of the old component version
publicPort
spec:
components:
- name: frontend
publicPort: http
The publicPort
field of a component, if set to <PORT_NAME>
, is used to make the component accessible on the internet by generating a public endpoint. By default, the public endpoint can be accessed from all public IP addresses. You can restrict access to the public endpoints by configuring a list of IP address ranges in network.ingress.public.allow
, see network for more information.
A component without publicPort: <PORT_NAME>
can only be accessed from another component in the app. If specified, the <PORT_NAME>
should exist in the ports
field.
If no ports specified for a component, publicPort
should not be set.
command
spec:
components:
- name: frontend
command:
- ./run.sh
command
- (optional) sets or overrides ENTRYPOINT directive array in a docker image. Variable references like $(VAR_NAME)
can be used with the container's environment variables. Read more in Kubernetes documentation. command
can be set or overridden for a specific environment.
The command can be followed by a list of arguments.
spec:
components:
- name: frontend
command:
- node
- server.js
Array syntax is also supported:
spec:
components:
- name: frontend
command: ["node", "server.js"]
args
spec:
components:
- name: frontend
args:
- --port=8000
- --host=server
args
- (optional) sets or overrides CMD directive array in a docker image. Variable references like $(VAR_NAME)
can be used with the container's environment variables. Read more in Kubernetes documentation. args
can be set or overridden for a specific environment.
Array syntax is also supported:
spec:
components:
- name: frontend
args: ["--port=8000", "--host=server"]
command
and args
can be combined. If both are set, command
will override the ENTRYPOINT
and args
will override the CMD
of the container image.
Following configuration will run the command in the container: node server.js --port=8000 --host=server
spec:
components:
- name: frontend
command: ["node", "server.js"]
args: ["--port=8000", "--host=server"]
monitoring
spec:
components:
- name: frontend
monitoring: true
When the monitoring
field is set to true
, is used to expose custom application metrics in the Radix monitoring dashboards. It is expected that the component provides a /metrics
endpoint: this will be queried periodically (every five seconds) by an instance of Prometheus running within Radix. General metrics, such as resource usage, will always be available in monitors, regardless of this being set.
monitoringConfig
spec:
components:
- name: frontend
ports:
- name: http
port: 8000
- name: metrics
port: 1234
monitoringConfig:
portName: metrics
path: /my-metrics
The monitoringConfig
field of a component can be used to override the default port and/or path used for monitoring
. Both fields are optional and are by default set to use the first available port and the path as /metrics
.
If overriding portName
it will have to match one of the defined ports in the component.
horizontalScaling
Scale your components replicas up and down based on resources or external metrics like CRON or Azure Service Bus.
If you need any other trigger types, find the list of available triggers at https://keda.sh/docs/latest/scalers/ and open a feature request on https://github.com/equinor/radix
You can override horizontalScaling in your environments and we will merge minReplicas
, maxReplicas
, pollingInterval
and cooldownPeriod
. If any triggers are defined in the environment, they will replace all triggers on the component level.
Read more about polling intervall and cooldown period in KEDAs documentation here
spec:
components:
- name: backend
horizontalScaling:
minReplicas: 0 # defaults to 1 if not set
maxReplicas: 6
# pollingInterval: 30 # Default
# cooldownPeriod: 300 # Default
triggers:
# Cpu/Memory triggers will scale up/down so the average usage
# is 85% of requested Cpu across all pods,
# or 75% of requested memory across all pods, whatever is highest.
- name: cpu
cpu:
value: 85
- name: memory
cpu:
value: 75
- name: cron
cron:
timezone: Europe/Oslo
start: 0 7 * * 1-5 # 07:00 Monday - Friday
end: 0 17 * * 1-5 # 17:00 Monday - Friday
desiredReplicas: 1
- name: azuresb
azureServiceBus:
namespace: <your servicebus namespace> #.servicebus.windows.net
# messageCount: 5
# activationMessageCount: 0
queueName: main
# or use TopicName/subscriptionName:
# topicName: my-topic
# subscriptionName: my-subscription
authentication: # Currently we only support Workload Identity
identity:
azure:
clientId: 00000000-0000-0000-0000-000000000000
# Deperecated: legacy resources will be rewritten as triggers by Radix.
# - It is not allowed to mix resources with triggers.
# resources:
# memory:
# averageUtilization: 75
# cpu:
# averageUtilization: 85
The horizontalScaling
field is used for enabling automatic scaling of the component. This field is optional, and if set, it will override the replicas
value of the component. If no triggers are defined, we will configure a default CPU trigger with a target of 80% average usage.
One exception is when the replicas
value is set to 0
(i.e. the component is stopped), the horizontalScaling
config will not be used.
The previous resources
block have been replaced by triggers
.
azureServiceBus
trigger
Take a look here github.com/equinor/radix-public-site/examples/radix-example-keda-servicebus for a sample implementation that runs on Radix.
Azure Service Bus supports either a queueName
, or a topicName
and subscriptionName
. You can also select the target average messageCount
(defaults to 5), and activationMessageCount
(defaults to 0).
To authenticate Keda for scaling, you must provide a clientId to a managed identity, that contains a federeated credential with these properties:
Federated credential scenario: Kubernetes Service Account
# Find real and current value here: https://console.radix.equinor.com/about (CLUSTER_OIDC_ISSUER_URL),
# it will change in the future, we will post details in the slack channel #omnia-radix when it must be changed.
Cluster Issuer URL: https://northeurope.oic.prod-aks.azure.com/00000000-0000-0000-0000-000000000000/00000000-0000-0000-0000-000000000000/
Namespace: keda
Service Account: keda-operator
# ⚠️ When you give Keda access to your Service Bus, any other Radix app can scale their app based on your queue.
# We are hoping on improving this - https://github.com/kedacore/keda/issues/5630
healthChecks
By default Radix configures a TCP Readiness probe that tells the platform your component is ready to accept traffic as soon as the port is opened. Radix support Readiness, Liveness and Startup Probes.
If any custom probes are configured, Radix will not include the default readiness probe and you should configure it yourself.
A HTTP Get probe for readiness probe is usually easer to manage than a TCP probe, and the probe should let Radix now when your component and your dependencies are ready for traffic.
TCP Probes only checks if the port is open or closed. This way its hard to explicitly open or close the port when your component or dependencies are unavailable after startup. This could also disrupt regular requests that might not be affected.
spec:
components:
- name: backend
healthChecks:
startupProbe:
tcpSocket:
port: 8000
livenessProbe:
httpGet:
port: 8000
path: /healthz/live
readinessProbe:
successThreshold: 1
periodSeconds: 30
failureThreshold: 3
initialDelaySeconds: 10
timeoutSeconds: 5
httpGet:
port: 8000
path: /healthz/ready # Component is Ready when this endpoint returns a successful status code (2xx or 3xx)
All probes have all settings (except for successThreshold that is not available for liveness and startup probes). We support HTTP, TCP, Exec and GRPC probes.
environmentConfig
can also override individual startup, liveness or readiness-probes (but will not merge probe specific config).
Incorrectly configured probes can lead to premature restarts and will affect your uptime.
Read more about probes here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
imageTagName
components:
- name: backend
image: docker.pkg.github.com/equinor/myapp/backend:{imageTagName}
imageTagName: master-latest
The imageTagName
allows for flexible configuration of fixed images, built outside of Radix. It can be configured with separate tag for each environment.
See this guide on how make use of imageTagName
in a deploy-only scenario.
volumeMounts
spec:
components:
- name: backend
volumeMounts:
- name: volume-name
path: /path/in/container/to/mount/to
blobFuse2:
protocol: fuse2
container: container-name
cacheMode: Block
blockCache:
blockSize: 4
poolSize: 100
diskSize: 250
diskTimeout: 120
prefetchCount: 11
prefetchOnOpen: false
parallelism: 8
fileCache:
timeout: 120
attributeCache:
timeout: 0
accessMode: ReadWriteMany
requestsStorage: 1M
uid: "2000"
gid: "2001"
useAdls: false
useAzureIdentity: false
storageAccount: radixblobtest6
subscriptionId: ffffffff-ffff-ffff-ffff-ffffffffffff
tenantId: ffffffff-ffff-ffff-ffff-ffffffffffff
streaming: # deprecated in favor of cacheMode
enabled: false
- name: temp-volume-name
path: /another/path/in/container/to/mount/to
emptyDir:
sizeLimit: 10M
The volumeMounts
field configures volume mounts within the running component.
name
- The name of the volume. Unique withinvolumeMounts
list of a componentpath
- The folder inside the running container, where the external storage is mounted.
Configure one of the following volume types:
emptyDir
- Mounts a read-write empty volume.blobFuse2
- Mounts an Azure storage account blob container.
emptyDir
sizeLimit
- The maxiumum capacity for the volume.
An emptyDir
volume mounts a temporary writable volume in the container. Data in an emptyDir
volume is safe across container crashes for component replicas, but is lost if a job container crashes and restarts. When a component replica is deleted for any reason, the data in emptyDir
is removed permanently.
emptyDir
volumes are useful when readOnlyFileSystem
is set to true
.
- scratch space, such as for a disk-based merge sort
- checkpointing a long computation for recovery from crashes
- holding files that a content-manager container fetches while a webserver container serves the data
blobFuse2
The blobFuse2 volume type adds support for mounting Azure storage account blob containers. Read the guide for detailed information and examples.
protocol
(optional, defaultfuse2
) - Name of the protocol to be used. Valid values arefuse2
or""
(blank).container
- Name of the blob container in the Azure storage account.cacheMode
(optional, defaultBlock
) - Specify how files should be cached. Valid values areBlock
,File
andDirectIO
. Read more about the different mode here.blockCache
(optional) - Settings forBlock
cache mode.blockSize
(optional, default4
) - Size (in MB) of a block to be downloaded as a unit.prefetchCount
(optional, default11
) - Max number of blocks to prefetch. Value must be0
or greater than10
.prefetchOnOpen
(optional, defaultfalse
) - Start prefetching on open or wait for first read.poolSize
(optional) - Defines the size (in MB) of total memory preallocated for block cache. Must be at leastblockSize
*prefetchCount
. IfprefetchCount
is set to0
then the minimum value is 1 *blockSize
. If this value is set lower than the required minimum, Radix will automatically use minimum to prevent failures.diskSize
(optional, default0
) - Defines the size (in MB) of total disk capacity that block cache can use.0
disables block caching on disk. Follows the same requirements and behavior aspoolSize
when set to a value greater than0
.diskTimeout
(optional, default120
) - Timeout (in seconds) for which persisted data on disk cache. Applicable only whendiskSize
greater than0
.parallelism
(optional, default8
) - Number of worker thread responsible for upload/download jobs.
fileCache
(optional) - Settings forFile
cache mode.timeout
(optional, default120
) - The timeout (in seconds) for which file cache is valid.
attributeCache
(optional) - Settings for file attribute cache.timeout
(optional, default0
) - The timeout (in seconds) for file attribute cache entries.
accessMode
(optional, defaultReadOnlyMany
) - Defines the access mode to the mounted volume. Valid values areReadOnlyMany
,ReadWriteOnce
orReadWriteMany
.requestsStorage
(optional, default1Mi
) - Defines the requested storage size for the Azure storage account blob container. Currently, this setting has no effect.uid
(optional) - Defines the ID of the user that will own the mounted files and directories. Currently, the blobfuse2 driver does no honor this setting.gid
(optional) - Defines the ID of the group that will own the mounted files and directories. Currently, the blobfuse2 driver does no honor this setting.useAdls
(optional, defaultfalse
) - Specify if Azure storage account is HNS (hierarchical namespace) enabled or not. This must be set totrue
when a HNS enabled blob container is mounted.useAzureIdentity
(optional, defaultfalse
) - Enables Azure Workload Identity credentials using the service principal configured in identity.azure for accessing the Azure Storage. If omitted or set tofalse
, Azure storage account keys is used for authentication.storageAccount
(optional) - Name of the Azure storage account. Required whenuseAzureIdentity
istrue
.resourceGroup
(optional) - Name of the Azure resource group for the Azure storage account. Required whenuseAzureIdentity
istrue
.subscriptionId
(optional) - Azure subscription ID for the Azure storage account. Required whenuseAzureIdentity
istrue
.tenantId
(optional, defaults to the Equinor tenant) - Azure tenant ID for the Azure storage account. Applicable whenuseAzureIdentity
istrue
.streaming
(deprecated) - Streaming is deprecated by the blobfuse2 driver, and is replaced with block caching. To prevent breaking changes for applications that have explicitly disabled streaming, by settingstreaming.enabled
tofalse
, in order to use file caching, this behavior is preserved as long ascacheMode
is not set.
ingressConfiguration
spec:
components:
- name: frontend
ingressConfiguration:
- websocketfriendly
The ingressConfiguration
field of a component will add extra configuration by annotations to the Nginx ingress, useful for a particular scenario.
Note that the settings affect the connections with the public component, not between a public and a private component.
websocketfriendly
will change connection timeout to 1 hour for the component.stickysessions
will change load balancing of the ingress to route to a single replica.leastconnectedlb
will try to route connection to the replica with least amount of load
See this for more information on what annotations will be put on the ingress, given the configuration. See nginx documentation for details about how the native nginx load balancing methods work.
alwaysPullImageOnDeploy
spec:
components:
- name: api
image: docker.pkg.github.com/equinor/my-app/api:latest
alwaysPullImageOnDeploy: false
Only relevant for teams that uses another CI tool than Radix and static tags. See deploy-only for more information.
secrets
spec:
components:
- name: backend
secrets:
- DB_PASS
The secrets
key contains a list of names. Values for these can be set via the Radix Web Console (under each active component within an environment). Each secret must be set on all environments. Secrets are available in the component as environment variables; a component will not be able to start without the secret being set.
resources
(common)
spec:
components:
- name: backend
resources:
requests:
memory: "64Mi"
cpu: "50m"
limits:
cpu: "1000m"
The resources
section specifies how much CPU and memory each component needs, that are shared among all Radix environments in a component.
These common resources are overridden by environment-specific resources. The requested quota of memory and cpu must be below the limit.
If no memory limit is set, but a memory request is set, we will set the limit equal to the requested value. The opposite is also true, if a memory limit is set, but no requests, we will sett the requested memory equal to the memory limit.
Read more about memory resources and QoS.
More details about resources
and about default resources.
variables
(common)
spec:
components:
- name: backend
variables:
DB_NAME: my-db
The variables
key contains environment variable names and their values, that are shared among all Radix environments in a component. These common environment variables are overridden by environment-specific environment variables that have exactly same names.
Environment variables can be changed in Radix Console.
environmentConfig
The environmentConfig
section is to set environment-specific settings for each component.
src
Overrides the src
option defined on the component level.
If the image
option is specified on the component level, this image
option will be ignored and this component will be built for this environment with that specified src
. An example of such configuration:
spec:
components:
- name: frontend
src: "."
environmentConfig:
- environment: dev
src: "./frontend"
- name: backend
environmentConfig:
- environment: dev
src: "./backend"
- name: api
image: ghcr.io/my-repo/my-app/api:v1.10
environmentConfig:
- environment: dev
src: "./api"
In this example:
- The
frontend
component in thedev
environment will be built from thefrontend
folder of the GitHub repo, and from a root folder for other environments. Both docker-files expected to beDockerfile
asdockerfileName
option is not specified. - The
backend
component in thedev
environment will be built from thebackend
folder of the GitHub repo, and from a root folder (used by default) for other environments. Both docker-files expected to beDockerfile
asdockerfileName
option is not specified. - The
api
component in thedev
environment will be built from theapi
folder. This option in the environment overrides animage
option on the component level, which valueghcr.io/my-repo/my-app/api:v1.10
will be used to deploy this component in other environments. The docker-file expected to beDockerfile
asdockerfileName
option is not specified.
dockerfileName
Overrides the dockerfileName
option defined on the component level.
If the image
option is specified on the component level, this image
option will be ignored and this component will be built for this environment with that specified dockerfileName
. An example of such configuration:
spec:
components:
- name: frontend
dockerfileName: Dockerfile
environmentConfig:
- environment: dev
dockerfileName: Dockerfile.dev
- name: backend
src: "./backend"
environmentConfig:
- environment: dev
dockerfileName: Dockerfile.dev
- name: api
image: ghcr.io/my-repo/my-app/api:v1.10
environmentConfig:
- environment: dev
dockerfileName: Dockerfile
In this example:
- The
frontend
component in thedev
environment will be built with theDockerfile.dev
docker-file, and with aDockerfile
docker-file for other environments. Both docker-files expected to be in the root of the GitHub repo assrc
option is not specified. - The
backend
component in thedev
environment will be built with theDockerfile.dev
docker-file, and with aDockerfile
docker-file (a name, used by default) for other environments. Both docker-files expected to be in thebackend
folder in the root of the GitHub repo. - The
api
component in thedev
environment will be built with theDockerfile
docker-file. This option in the environment overrides animage
option on the component level, which valueghcr.io/my-repo/my-app/api:v1.10
will be used to deploy this component in other environments. The docker-file expected to be in the root of the GitHub repo assrc
option is not specified.
image
When a component needs a different docker image in a particular application environment, this image can be specified in the image
option of the environmentConfig
section for this environment. An example of such configuration:
spec:
components:
- name: redis
image: redis:5.0-alpine
environmentConfig:
- environment: qa
image: redis:7.2.4
- name: web-app
src: ./app
dockerfileName: Dockerfile.app
environmentConfig:
- environment: prod
image: ghcr.io/my-repo/my-app/web-app:v1.10
In this example:
- The
redis
component in theqa
environment will be run on the imageredis:7.2.4
, in other environments it will be run on the default imageredis:5.0-alpine
- The
web-app
component in theprod
environment will be run on the pre-build imageghcr.io/my-repo/my-app/web-app:v1.10
, in other environments it will be built from the source folder./app
and the docker-fileDockerfile.app
For shared image across Radix environments, refer to common image.