Skip to content

Commit

Permalink
Add Content Creation guide (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
Trojan295 authored Feb 12, 2021
1 parent e54baef commit 5cf290e
Show file tree
Hide file tree
Showing 34 changed files with 1,491 additions and 119 deletions.
706 changes: 706 additions & 0 deletions docs/tutorial/content-creation/README.md

Large diffs are not rendered by default.

Binary file added docs/tutorial/content-creation/assets/argo-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
15 changes: 9 additions & 6 deletions ocf-spec/0.0.1/schema/interface.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@
"$id": "#/properties/spec/properties/input/properties/parameters",
"type": "object",
"description": "The input parameters passed from User",
"properties": {
"jsonSchema": {
"$ref": "https://projectvoltron.dev/schemas/common/json-schema-type.json"
}
},
"additionalProperties": false
"additionalProperties": {
"type": "object",
"properties": {
"jsonSchema": {
"$ref": "https://projectvoltron.dev/schemas/common/json-schema-type.json"
}
},
"additionalProperties": false
}
},
"typeInstances": {
"$ref": "https://projectvoltron.dev/schemas/common/input-type-instances.json"
Expand Down
25 changes: 13 additions & 12 deletions och-content/core/interface/runner/generic/run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ metadata:
spec:
input:
parameters:
jsonSchema:
value: |-
{
"$schema": "http://json-schema.org/draft-07/schema",
"$ocfRefs": {
"inputType": {
"name": "cap.core.type.generic.value",
"revision": "0.0.1"
}
},
"allOf": [ { "$ref": "#/$ocfRefs/inputType" } ]
}
input-parameters:
jsonSchema:
value: |-
{
"$schema": "http://json-schema.org/draft-07/schema",
"$ocfRefs": {
"inputType": {
"name": "cap.core.type.runner.generic.run-input",
"revision": "0.1.0"
}
},
"allOf": [ { "$ref": "#/$ocfRefs/inputType" } ]
}
typeInstances:
runner-context:
typeRef:
Expand Down
186 changes: 186 additions & 0 deletions och-content/implementation/atlassian/confluence/install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
ocfVersion: 0.0.1
revision: 0.1.0
kind: Implementation
metadata:
prefix: cap.implementation.atlassian.confluence
name: install
displayName: Install Confluence
description: Action which installs Confluence via Helm chart
documentationURL: https://github.com/javimox/helm-charts/tree/master/charts/confluence-server
supportURL: https://mox.sh/helm/
license:
name: "Apache 2.0"
maintainers:
- email: team-dev@projectvoltron.dev
name: Voltron Dev Team
url: https://projectvoltron.dev

spec:
appVersion: "2.x.x"

additionalInput:
typeInstances:
postgresql:
typeRef:
path: cap.type.database.postgresql.config
revision: 0.1.0
verbs: [ "get" ]

additionalOutput:
typeInstances:
confluence-helm-release:
typeRef:
path: cap.type.helm.chart.release
revision: 0.1.0
database:
typeRef:
path: cap.type.postgresql.database
revision: 0.1.0
typeInstanceRelations:
confluence-config:
uses:
- confluence-helm-release
- postgresql
- database

implements:
- path: cap.interface.productivity.confluence.install
revision: 0.1.0

requires:
cap.core.type.platform:
oneOf:
- name: kubernetes
revision: 0.1.0

imports:
- interfaceGroupPath: cap.interface.runner.argo
alias: argo
methods:
- name: run
revision: 0.1.0
- interfaceGroupPath: cap.interface.runner.helm
alias: helm
methods:
- name: run
revision: 0.1.0
- interfaceGroupPath: cap.interface.database.postgresql
alias: postgresql
methods:
- name: install
revision: 0.1.0
- name: create-db
revision: 0.1.0
- interfaceGroupPath: cap.interface.templating.jinja2
alias: jinja2
methods:
- name: template
revision: 0.1.0

action:
runnerInterface: argo.run
args:
workflow:
entrypoint: main
templates:
- name: main
# Voltron Engine will inject the 'input-parameters' artifacts into the workflow entrypoint.
# It contains the Interface parameters, in our case it is `confluence.install-input`.
inputs:
artifacts:
- name: input-parameters
steps:
# If the postgresql TypeInstance was not provided, then create it
# using the imported 'postgresql.install' Interface.
- - name: install-db
voltron-action: postgresql.install
voltron-when: postgresql == nil
arguments:
artifacts:
- name: input-parameters
raw:
data: |
superuser:
username: superuser
password: okon
defaultDBName: postgres
# Create the database for Confluence in our PostgreSQL instance
# using the imported 'postgresql.create-db' Interface
- - name: create-db
voltron-action: postgresql.create-db
voltron-outputTypeInstances:
- name: database # Defining the output TypeInstance 'database'
from: database
arguments:
artifacts:
- name: postgresql
from: "{{workflow.outputs.artifacts.postgresql}}"
- name: database-input
raw:
data: |
name: confluencedb
owner: superuser
# Here we prepare the input for the Helm runner. In the next two steps,
# we use Jinja2 to render the input and fill the required parameters.
# In the future there might be better way to do this.
- - name: render-helm-args
voltron-action: jinja2.template
arguments:
artifacts:
- name: template
raw:
data: |
command: "install"
generateName: true
chart:
name: "confluence-server"
repo: "https://helm.mox.sh"
output:{% raw %}
goTemplate:
version: {{ '"{{ .Values.image.tag }}"' }}
host: {{ "'{{ template \"confluence-server.fullname\" . }}'" }}{% endraw %}
values:
postgresql:
enabled: false
databaseConnection:
host: "{{ host }}"
user: "{{ superuser.username }}"
password: "{{ superuser.password }}"
{% raw %}database: "{{ name }}"{% endraw %}
ingress:
enabled: true
hosts:
- host: confluence.voltron.local
paths: ['/']
- name: input-parameters
from: "{{workflow.outputs.artifacts.postgresql}}"

- - name: fill-params-in-helm-args
voltron-action: jinja2.template
arguments:
artifacts:
- name: template
from: "{{steps.render-helm-args.outputs.artifacts.render}}"
- name: input-parameters
from: "{{steps.create-db.outputs.artifacts.database}}"

# Execute the Helm runner, with the input parameters created in the previous step.
# This will create the Helm chart and deploy our Confluence instance
- - name: helm-run
voltron-action: helm.run
voltron-outputTypeInstances:
- name: confluence-config # Defining the output TypeInstance 'confluence-config'
from: additional
- name: confluence-helm-release # Defining the output TypeInstance 'confluence-helm-release'
from: helm-release
arguments:
artifacts:
- name: input-parameters
from: "{{steps.fill-params-in-helm-args.outputs.artifacts.render}}"
- name: runner-context
from: "{{workflow.outputs.artifacts.runner-context}}"

signature:
och: eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9
42 changes: 33 additions & 9 deletions och-content/implementation/atlassian/jira/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ spec:
uses:
- jira-helm-release
- postgresql
- database

implements:
- path: cap.interface.productivity.jira.install
Expand All @@ -56,7 +57,6 @@ spec:
revision: 0.1.0
- interfaceGroupPath: cap.interface.runner.helm
alias: helm
appVersion: 3.x.x
methods:
- name: run
revision: 0.1.0
Expand Down Expand Up @@ -84,19 +84,34 @@ spec:
steps:
- - name: install-db
voltron-when: postgresql == nil # conditional execution
voltron-action: postgresql.install
arguments:
# TODO: password should be generated or populated by user
artifacts:
- name: input-parameters
raw:
data: |
superuser:
username: jira
username: superuser
password: okon
defaultDBName: jira
voltron-action: postgresql.install
defaultDBName: postgres
- - name: create-helm-args
- - name: create-db
voltron-action: postgresql.create-db
voltron-outputTypeInstances:
- name: database
from: database
arguments:
artifacts:
- name: postgresql
from: "{{workflow.outputs.artifacts.postgresql}}"
- name: database-input
raw:
data: |
name: jiradb
owner: superuser
- - name: render-helm-args
voltron-action: jinja2.template
arguments:
artifacts:
Expand All @@ -110,16 +125,16 @@ spec:
repo: "https://helm.mox.sh"
output:{% raw %}
goTemplate:
version: "{{ .Values.image.tag }}"
host: '{{ template "jira-software.fullname" . }}'{% endraw %}
version: {{ '"{{ .Values.image.tag }}"' }}
host: {{ "'{{ template \"jira-software.fullname\" . }}'" }}{% endraw %}
values:
postgresql:
enabled: false
databaseConnection:
host: "{{ host }}"
user: "{{ superuser.username }}"
password: "{{ superuser.password }}"
database: "{{ defaultDBName }}"
{% raw %}database: "{{ name }}"{% endraw %}
ingress:
enabled: true
hosts:
Expand All @@ -128,6 +143,15 @@ spec:
- name: input-parameters
from: "{{workflow.outputs.artifacts.postgresql}}"

- - name: fill-params-in-helm-args
voltron-action: jinja2.template
arguments:
artifacts:
- name: template
from: "{{steps.render-helm-args.outputs.artifacts.render}}"
- name: input-parameters
from: "{{steps.create-db.outputs.artifacts.database}}"

- - name: helm-run
voltron-action: helm.run
voltron-outputTypeInstances:
Expand All @@ -138,7 +162,7 @@ spec:
arguments:
artifacts:
- name: input-parameters
from: "{{steps.create-helm-args.outputs.artifacts.render}}"
from: "{{steps.fill-params-in-helm-args.outputs.artifacts.render}}"
- name: runner-context
from: "{{workflow.outputs.artifacts.runner-context}}"

Expand Down
Loading

0 comments on commit 5cf290e

Please sign in to comment.