-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
160 lines (152 loc) · 4.89 KB
/
template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
apiVersion: backstage.io/v1beta2
kind: Template
metadata:
name: gcp-template
title: Google Cloud Platform infrastructure template
description: Create a simple GCP stack
tags:
- gcp
- gke
spec:
owner: diego.braga86@gmail.com
type: service
# these are the steps which are rendered in the frontend with the form input
parameters:
- title: GCP stack values
required:
- component_id
- description
- networkRef
- clusterRef
- clusterNodesCount
- cloudSqlRef
- cloudSqlDatabaseVersion
- cloudSqlRegion
- cloudSqlTier
- cloudSqlDataDiskType
- cloudSqlDataDiskSizeGb
- gcpProject
- owner
properties:
component_id:
title: Name
type: string
description: Unique name of the component
description:
title: Description
type: string
description: Help others understand what this service does.
networkRef:
title: Network identifier
type: string
description: Network identifier
clusterRef:
title: Cluster identifier
type: string
description: Cluster identifier
clusterNodesCount:
title: Number of nodes of the cluster per region
type: integer
description: Number of nodes of the cluster per region
default: 2
cloudSqlRef:
title: Cloud SQL identifier
type: string
description: Cloud SQL identifier
cloudSqlDatabaseVersion:
title: Cloud SQL Database version
type: string
description: Cloud SQL Database version
default: POSTGRES_9_6
cloudSqlRegion:
title: Cloud SQL region
type: string
description: Cloud SQL region
default: europe-west3
cloudSqlTier:
title: Cloud SQL tier
type: string
description: Cloud SQL tier
default: db-custom-1-3840
cloudSqlDataDiskType:
title: Cloud SQL data disk type
type: string
description: Cloud SQL data disk type
default: PD_SSD
cloudSqlDataDiskSizeGb:
title: Cloud SQL data disk size (GB)
type: integer
description: Cloud SQL data disk size (GB)
default: 10
gcpProject:
title: Google Project ID where resources will be created
type: string
description: Google Project ID where resources will be created
owner:
title: Owner
type: string
description: Owner of the component
ui:field: OwnerPicker
ui:options:
allowedKinds:
- Group
- title: Choose a location
required:
- repoUrl
properties:
repoUrl:
title: Repository Location
type: string
ui:field: RepoUrlPicker
ui:options:
allowedHosts:
- github.com
# here's the steps that are executed in series in the scaffolder backend
steps:
- id: template
name: Fetch Skeleton + Template
action: fetch:template
input:
url: ./skeleton
values:
component_id: "{{ parameters.component_id }}"
description: "{{ parameters.description }}"
networkRef: "{{ parameters.networkRef }}"
clusterRef: "{{ parameters.clusterRef }}"
clusterNodesCount: "{{ parameters.clusterNodesCount }}"
cloudSqlRef: "{{ parameters.cloudSqlRef }}"
cloudSqlDatabaseVersion: "{{ parameters.cloudSqlDatabaseVersion }}"
cloudSqlRegion: "{{ parameters.cloudSqlRegion }}"
cloudSqlTier: "{{ parameters.cloudSqlTier }}"
cloudSqlDataDiskType: "{{ parameters.cloudSqlDataDiskType }}"
cloudSqlDataDiskSizeGb: "{{ parameters.cloudSqlDataDiskSizeGb }}"
gcpProject: "{{ parameters.gcpProject }}"
owner: "{{ parameters.owner }}"
destination: "{{ parseRepoUrl parameters.repoUrl }}"
- id: publish
name: Publish
action: publish:github
input:
allowedHosts: ["github.com"]
description: "This is a GCP stack with name {{ parameters.component_id }}"
repoUrl: "{{ parameters.repoUrl }}"
repoVisibility: public
- id: register
name: Register
action: catalog:register
input:
repoContentsUrl: "{{ steps.publish.output.repoContentsUrl }}"
catalogInfoPath: "/catalog-info.yaml"
- id: argocd
name: Create application on ArgoCD
action: kerberus:argocd
input:
host: ${{parameters.repoUrl}}
- id: githubprotection
name: Set GitHub branch protection
action: kerberus:githubprotection
input:
host: ${{parameters.repoUrl}}
output:
remoteUrl: "{{ steps.publish.output.remoteUrl }}"
entityRef: "{{ steps.register.output.entityRef }}"