This commit is contained in:
Manabu Mccloskey 2023-07-11 15:43:24 -07:00
parent f6728e183e
commit fbdd28fc60
5 changed files with 75 additions and 15 deletions

View file

@ -6,7 +6,7 @@ metadata:
description: Creates an Apache Spark Application with Argo Workflows
spec:
owner: guest
type: service
type: job
# these are the steps which are rendered in the frontend with the form input
parameters:
- title: Fill in some steps
@ -29,13 +29,6 @@ spec:
ui:options:
catalogFilter:
kind: Group
# labels:
# title: Labels
# type: object
# additionalProperties:
# type: string
# description: Labels to apply to the application
# ui:autofocus: true
namespace:
title: Namespace
type: string
@ -43,7 +36,7 @@ spec:
description: Namespace to deploy this application into. Optional. Defaults to application name.
ui:options:
rows: 5
- title: Fill in some steps
- title: Paste your Spark manifest
required:
- manifest
properties:
@ -67,13 +60,11 @@ spec:
name: Fetch Base
action: fetch:template
input:
url: ./templates
url: ./templates/SparkManifest
values:
name: ${{ parameters.name }}
namespace: ${{ parameters.namespace }}
clusterName: 'cnoe-packaging-2'
# labels: ${{ parameters.labels }}
# manifest: ${{ parameters.manifest }}
clusterName: 'cnoe-packaging'
- id: write
name: write-to-file
action: roadiehq:utils:fs:write
@ -92,11 +83,46 @@ spec:
input:
path: merge.json
content: ${{ steps.parse.output.content }}
- id: deserialise
name: deserialize manifest
action: roadiehq:utils:fs:parse
input:
path: 'merge.json'
parser: 'json'
- id: fetch-base
name: Fetch Base
action: fetch:template
input:
url: ./templates/ArgoWorkflowsManifest
values:
name: ${{ parameters.name }}
namespace: ${{ parameters.namespace }}
clusterName: 'cnoe-packaging'
manifest: ${{ steps.deserialise.output.content }}
- id: apply
name: apply manifest
action: cnoe:kubernetes:apply
input:
manifestPath: manifest.yaml
namespaced: true
clusterName: "cnoe-packaging"
- id: create-repo
name: Create Repository
action: github:repo:create
input:
repoUrl: github.com?repo=spark-ui-${{parameters.name}}&owner=manabuOrg
- id: init-repo
name: Initialize Repository
action: github:repo:push
input:
repoUrl: github.com?repo=spark-ui-${{parameters.name}}&owner=manabuOrg
defaultBranch: main
- id: register
name: Register
action: catalog:register
input:
catalogInfoPath: 'catalog-info.yaml'
repoContentsUrl: ${{ steps['init-repo'].output.repoContentsUrl }}
output:
links:
- title: Open in catalog

View file

@ -0,0 +1,34 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: "spark-${{values.name}}-"
namespace: "${{values.namespace}}"
labels:
backstage.io/component-id: "${{values.name}}"
spec:
arguments: {}
entrypoint: demo-workflow
serviceAccountName: argo-workflows
workflowMetadata:
labels:
backstage.io/component-id: "${{values.name}}"
templates:
- name: demo-workflow
steps:
- - name: sleep
template: sleep
- - name: spark-operator
template: sparkapp
- name: sleep
container:
image: docker/whalesay
command: [ sleep ]
args: [ "60" ]
- name: sparkapp
resource:
action: create
setOwnerReference: true
successCondition: status.applicationState.state == COMPLETED
failureCondition: status.applicationState.state in (FAILED, ERROR)
manifest: |
${{values.manifest | dump}}

View file

@ -94,7 +94,7 @@ spec:
url: ./templates
values:
params: ${{parameters}}
clusterName: 'cnoe-packaging-2'
clusterName: 'cnoe-packaging'
name: ${{parameters.name}}
namespace: ${{parameters.namespace}}
- id: init-repo
@ -115,7 +115,7 @@ spec:
input:
manifestObject: ${{ steps.deserialise.output.content }}
namespaced: true
clusterName: "cnoe-packaging-2"
clusterName: "cnoe-packaging"
- id: register
name: Register
action: catalog:register