Skip to content
This repository has been archived by the owner on Feb 22, 2021. It is now read-only.

Transformers

Shahar Gotshtat edited this page Jan 14, 2018 · 4 revisions

Apollo is using fabric-8 POJOs model of the entire kubernetes API to make programmatically changes on Deployment and Service YAMLs.
There are currently 7 transformers (classes that take deployment or service, change them and return the modified version), and it's really easy to add more based on your needs.

Deployment transformers

DeploymentEnvironmentVariableTransformer

This transformer will add environment variables to each deployment.
Currently it will add the "availability" section of the environment as "ENV", and the "geo_region" section as "REGION".
It is planned to have this dynamic.

DeploymentImageNameTransformer

As mentioned on the Image Name Convention page, this transformer will add the sha1 of the deployable version to the image name.
In case there is a specific tag, nothing will happen.

DeploymentLabelsTransformer

Apollo will add some labels to each deployment.
Some of them are purely for convenience, and 2 of them are for internal use:
current_commit_sha - Setting the deployable version sha1 so we can query the current version apollo_unique_identifier - Using this as a selector for deployments (upsert). This is consisted of the environment and the service to be unique and repetitive.

DeploymentNameTransformer

Apollo will change the name of the deployment and add the group name (if there is a group).

DeploymentScalingFactorTransformer

Apollo will change the scaling factor of the deployment, which is the number of Replicas.

Service transformers

ServiceLabelTransformer

Exactly the same as DeploymentLabelsTransformer, just fewer fields, and without the current_commit_sha

ServiceNodePortCoefficientTransformer

Described in detail in the Environment page, this transformer is changing the nodePort to match the environment service_port_coefficient