Skip to content

Commit

Permalink
Feat: add the observability Pipeline template (#628)
Browse files Browse the repository at this point in the history
Signed-off-by: barnettZQG <[email protected]>

Signed-off-by: barnettZQG <[email protected]>
  • Loading branch information
barnettZQG authored Oct 31, 2022
1 parent 3462a9a commit a8eef5c
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/pages/PipelineListPage/components/CreatePipeline/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { v4 as uuid } from 'uuid';
import type { Pipeline, PipelineDetail } from '../../../../interface/pipeline';
import { checkName } from '../../../../utils/common';
import locale from '../../../../utils/locale';
import { templates } from './pipeline-template';

const FormItem = Form.Item;

Expand Down Expand Up @@ -280,6 +281,19 @@ class CreatePipeline extends React.Component<PipelineProps, State> {
/>
</FormItem>
</Col>
<Col span={24} style={{ padding: '0 8px' }}>
<FormItem label={<Translation>Template</Translation>}>
<Select
locale={locale().Select}
name="template"
dataSource={templates}
placeholder="Select a template"
onChange={(value) => {
this.field.setValue('steps', value);
}}
/>
</FormItem>
</Col>
<Col span={24} style={{ padding: '0 8px' }}>
<FormItem
className={classNames({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
export const templates = [
{
label: 'Observability Template',
value: `
- name: Enable Prism
type: addon-operation
properties:
addonName: vela-prism
- name: Enable o11y
type: addon-operation
properties:
addonName: o11y-definitions
operation: enable
args:
- --override-definitions
- name: Enable Exporter
type: step-group
subSteps:
- name: Node Exporter
type: addon-operation
properties:
addonName: node-exporter
operation: enable
- name: Kube State Exporter
type: addon-operation
properties:
addonName: kube-state-metrics
operation: enable
- name: Prepare Prometheus
type: step-group
subSteps:
- name: get-exist-prometheus
type: list-config
properties:
template: prometheus-server
namespace: vela-system
outputs:
- name: prometheus
valueFrom: "output.configs"
- name: prometheus-server
inputs:
- from: prometheus
parameterKey: configs
if: context.readConfig == "false" || len(inputs.prometheus) == 0
type: addon-operation
properties:
addonName: prometheus-server
operation: enable
args:
- memory=1024Mi
- name: Prepare Loki
type: addon-operation
properties:
addonName: loki
operation: enable
args:
- agent=vector
- name: Prepare Grafana
type: step-group
subSteps:
- name: get-exist-grafana
type: list-config
properties:
template: grafana
namespace: vela-system
outputs:
- name: grafana
valueFrom: "output.configs"
- name: Install Grafana & Init Dashboards
inputs:
- from: grafana
parameterKey: configs
if: context.readConfig == "false" || len(inputs.grafana) == 0
type: addon-operation
properties:
addonName: grafana
operation: enable
args:
- serviceType=LoadBalancer
- name: Init Dashboards
inputs:
- from: grafana
parameterKey: configs
if: "len(inputs.grafana) != 0"
type: addon-operation
properties:
addonName: grafana
operation: enable
args:
- install=false
- name: Clean
type: clean-jobs
- name: print-message
type: print-message-in-status
properties:
message: "All addons have been enabled successfully, you can use 'vela addon list' to check them."
`,
},
];

0 comments on commit a8eef5c

Please sign in to comment.