Platform
The platform workflow step allows to execute a Napptive Client command.
Basic example
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: example
spec:
components:
- name: component
type: worker
properties:
image: busybox
cmd: [ "sleep", "86400" ]
cpu: "0.25"
memory: "200Mi"
workflow:
steps:
# playground step
- name: <step1Name>
type: playground
properties:
name: <name> # (Optional) Required when there are more tan one playground step defined in the workflow
command: "cmd..." # Playground Command
pat: # Personal Access Token (https://docs.napptive.com/account/personal_access_tokens.html)
value: <Personal Access Token> # (Optional) The Personal Access Token
secretName: <secretName> # (Optional) Secret with the PLAYGROUND_PAT env is stored
config:
configMap: <configMapName> # (Optional) ConfigMap with a custom installation configuration (https://docs.napptive.com/cli/on_premise_configuration.html#add-installation)
entry: <data> # (Optional) the entry name with the custom installation in the ConfigMap (.playground.yaml by default)
- name: <step2Name>
type: apply-component
properties:
component: component
Full example
The following application creates a new environment and deploy a catalog application on it
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: playground-wf
spec:
components:
- name: poc-component
type: worker
properties:
image: busybox
cmd: [ "sleep", "86400" ]
cpu: "0.25"
memory: "200Mi"
- name: prerequisites
type: k8s-objects # Set to k8s-objects
properties:
objects:
# set the k8s manifest
# Secret
- apiVersion: v1
kind: Secret
metadata:
name: napptive-pat
type: Opaque
data:
PLAYGROUND_PAT: <Personal Access Token base64>
workflow:
steps:
# create Secrets and ConfigMaps
- name: deploy-prerequisites
type: apply-component
properties:
component: prerequisites
# Create an environment
- name: create-step
type: playground
dependsOn:
- deploy-prerequisites
properties:
name: create
command: "env create <accountName/newEnvName>"
pat:
secretName: napptive-pat
# Deploy an application in the new environment
- name: deploy-app-step
type: playground
dependsOn:
- create-step
if: status.create-step.phase.succeeded
properties:
name: deploy
command: "catalog deploy napptive/drawio:17.2.4"
pat:
secretName: napptive-pat
environmentName: "<accountName/newEnvName>"
- name: final-step
type: apply-component
dependsOn:
- deploy-app-step
properties:
component: poc-component