Labels
This article is covering the details about labels, how it is created, how to add a label and why to use a label.
Introduction
Odin provides versioning for service for better control and maintainability. However, sometimes it can become cumbersome to remember all the versions in an environment and identify which version is used where. Labels are created to solve the above concern and provide better control over the versions.
What is a Label?
Labels are strings that can be used to point to a particular version of service in a particular environment. Labels can also be used interchangeably with versions.
E.g: In the staging environment, there are 5 versions [V1.0-V1.4] for a service amongst which only V1.4 is production ready. So the service owner or the team can add a label "production" to the V1.4. This will help the service owner and the team to identify the production equivalent version easily in stage without opening every version and going though the changes.
Mapping
Labels should have one-on-one mapping with the versions in an environment. This implies that only one version of a service can be mapped to a particular label in an environment. However, one particular service version in an environment can be mapped to multiple labels.
E.g: There is a service called Gameplay and has 5 versions available in staging V1.0.0-V1.0.4. Out of the five versions, only version V1.0.4 is production ready and rest are old versions. So V1.0.4 can be added with a label "Production". The "Production" label cannot be used with any other versions of the service gameplay in staging. However, version V1.0.4 can also be attached with a tag called "Latest" because that is the latest version of code available. So one version can have multiple tags but one tag can be mapped to only one version in an environment for a particular service.
Commands
To create a label as per the requirement, following command to be used:
To add the created label "Latest" against the service "Profile" with version 1.0.0-SNAPSHOT, user can use the following command:
Similarly, the label can be removed from a particular version with the help of unlabel command as shown in below:
Last updated