Environments
Pipelines and data channels are deployed to Kubernetes in namespaces. Namespaces are exposed as environments.
Attributes are added to the Kubernetes namespace object as annotations and labels to describe the environment:
- Environment Name:
label environment
- Environment Description:
annotation description
- Environment Color:
annotation tag
- Must be Published?:
annotation publishedArtifactsOnly
-true
if only published artifacts can be deployed.false
if artifacts from the sandbox space can be deployed. - Environment Predecessors:
annotation predecessors
- optional JSON list of predecessors
The values specified to describe an environment have these constraints:
- The namespace
name
is restricted to characters supported by a DNS name. - The environment name is restricted to characters supported by a Kubernetes label.
- The annotation values are restricted to characters support by a Kubernetes annotation.
- The environment color
tag
value must be a case-insensitive valid HTML color name. If an invalid color name is specified the color White is used.
These kubectl commands are used to manage Kubernetes namespaces (see Share a Cluster with Namespaces for complete documentation):
kubectl apply --filename
<file-name> - create or update a namespacekubectl describe namespace
<namespace-name> - display a namespacekubectl delete namespaces
<namespace-name> - remove a namespace
Note that if a deployed scoring flow or data channel uses any kubernetes Secrets, these secrets must also be created in the new namespace. Adding the elastic search secret is a minimal requirement.
Note: ensure that correct cluster context is set before executing any kubectl
commands.
kubectl config current-context kubectl config use-context <context-name>
The example below demonstrates creating, updating, displaying, and removing a namespace datachannels for environment Data-Channels:
// // Create Data-Channels environment // $ kubectl apply -f - <<! kind: Namespace apiVersion: v1 metadata: name: datachannels labels: environment: "Data-Channels" annotations: publishedArtifactsOnly: "true" description: "Data channel environment" predecessors: '["Development"]' tag: orange ! // // create elastic search secret // kubectl create secret generic elasticsearch-es-elastic-user --from-literal=elastic=elastic --namespace datachannels --dry-run=client --output=yaml 2>/dev/null | kubectl apply --filename - // // create scoring admin secret // kubectl create secret generic scoring-admin --from-literal=admin=admin --namespace datachannels // // Update Data-Channels environment (change approvedArtifacts value) // $ kubectl apply -f - <<! kind: Namespace apiVersion: v1 metadata: name: datachannels labels: environment: "Data-Channels" annotations: publishedArtifactsOnly: "false" description: "Data channel environment" predecessors: '["Development"]' tag: orange ! // // Display Data-Channels environment // kubectl describe namespace datachannels Name: datachannels Labels: environment=Data-Channels Annotations: publishedArtifactsOnly: false description: Data channel environment predecessors: ["Development"] tag: orange Status: Active No resource quota. No LimitRange resource. // // Remove Data-Channels environment // kubectl delete namespaces datachannels