Composable blueprints
Multiple blueprints can be composed into one master blueprint which specifies the deployment model for multiple included blueprints, by using includeBefore
and includeAfter
parameters. This allows you to scale your deployment and release models with any number of blueprints. During the implementation of a composed blueprint, the CLI will work through the blueprints in the sequence defined, merging the questions into a single list and applying any custom values that were defined in the composed blueprint. For more information on the YAML fields that enable composable blueprints, see [IncludeBefore/IncludeAfter fields for composability]((xl-platform//concept/blueprint-yaml-format/#includebeforeincludeafter-fields-for-composability).
Here is a testable blueprint which uses composability to include blueprints and set override files and parameter values:
apiVersion: xl/v2
kind: Blueprint
metadata:
name: Composed blueprint for K8S provisioning
version: 2.0
spec:
parameters:
- name: Provider
type: Select
prompt: Which K8S cluster provider do you want to use
options:
- label: Amazon
value: EKS
- label: Google Cloud
value: GKE
- label: Azure
value: AKS
- existing cluster
- name: KubeApp
type: Confirm
prompt: Do you want to deploy an application to the Kubernetes environment?
# includeBefore:
# - blueprint: kubernetes/environment
# fileOverrides:
# - path: xebialabs/kubernetes-environment.yaml.tmpl
# renameTo: xebialabs/k8s-environment.yaml
includeAfter:
- blueprint: kubernetes/environment
includeIf: !expr "Provider == 'existing cluster'"
fileOverrides:
- path: xebialabs/kubernetes-environment.yaml.tmpl
renameTo: xebialabs/k8s-environment.yaml
- blueprint: aws/basic-eks-cluster
includeIf: !expr "Provider == 'EKS'"
- blueprint: azure/basic-aks-cluster
includeIf: !expr "Provider == 'AKS'"
- blueprint: gcp/basic-gke-cluster
includeIf: !expr "Provider == 'GKE'"
- blueprint: kubernetes/application
includeIf: !expr "KubeApp"
parameterOverrides:
- name: KubernetesApplicationName
value: !expr "Provider == 'existing cluster' ? KubernetesName + '-app' : Provider + '-app'"
fileOverrides:
- path: xebialabs/kubernetes-application.yaml.tmpl
renameTo: xebialabs/k8s-application.yaml
If you run this blueprint in your environment you will be able to see the order of questions defined by the blueprint parameters, and the includeAfter
blueprints with their overridden values.