forms.go 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825
  1. package infra
  2. const testForm = `name: Test
  3. hasSource: false
  4. includeHiddenFields: true
  5. isClusterScoped: true
  6. tabs:
  7. - name: main
  8. label: Configuration
  9. sections:
  10. - name: section_one
  11. contents:
  12. - type: heading
  13. label: String to echo
  14. - type: string-input
  15. variable: echo
  16. settings:
  17. default: hello
  18. `
  19. const rdsForm = `name: RDS
  20. hasSource: false
  21. includeHiddenFields: true
  22. isClusterScoped: true
  23. tabs:
  24. - name: main
  25. label: Main
  26. sections:
  27. - name: heading
  28. contents:
  29. - type: heading
  30. label: Database Settings
  31. - name: user
  32. contents:
  33. - type: string-input
  34. label: Database Master User
  35. required: true
  36. placeholder: "admin"
  37. variable: db_user
  38. - name: password
  39. contents:
  40. - type: string-input
  41. required: true
  42. label: Database Master Password
  43. variable: db_passwd
  44. - name: name
  45. contents:
  46. - type: string-input
  47. label: Database Name
  48. required: true
  49. placeholder: "rds-staging"
  50. variable: db_name
  51. - name: machine-type
  52. contents:
  53. - type: select
  54. label: ⚙️ Database Machine Type
  55. variable: machine_type
  56. settings:
  57. default: db.t3.medium
  58. options:
  59. - label: db.t2.medium
  60. value: db.t2.medium
  61. - label: db.t2.xlarge
  62. value: db.t2.xlarge
  63. - label: db.t2.2xlarge
  64. value: db.t2.2xlarge
  65. - label: db.t3.medium
  66. value: db.t3.medium
  67. - label: db.t3.xlarge
  68. value: db.t3.xlarge
  69. - label: db.t3.2xlarge
  70. value: db.t3.2xlarge
  71. - name: family-versions
  72. contents:
  73. - type: select
  74. label: Database Family Version
  75. variable: db_family
  76. settings:
  77. default: postgres13
  78. options:
  79. - label: "Postgres 9"
  80. value: postgres9
  81. - label: "Postgres 10"
  82. value: postgres10
  83. - label: "Postgres 11"
  84. value: postgres11
  85. - label: "Postgres 12"
  86. value: postgres12
  87. - label: "Postgres 13"
  88. value: postgres13
  89. - name: pg-9-versions
  90. show_if:
  91. is: "postgres9"
  92. variable: db_family
  93. contents:
  94. - type: select
  95. label: Database Version
  96. variable: db_engine_version
  97. settings:
  98. default: "9.6.23"
  99. options:
  100. - label: "v9.6.1"
  101. value: "9.6.1"
  102. - label: "v9.6.2"
  103. value: "9.6.2"
  104. - label: "v9.6.3"
  105. value: "9.6.3"
  106. - label: "v9.6.4"
  107. value: "9.6.4"
  108. - label: "v9.6.5"
  109. value: "9.6.5"
  110. - label: "v9.6.6"
  111. value: "9.6.6"
  112. - label: "v9.6.7"
  113. value: "9.6.7"
  114. - label: "v9.6.8"
  115. value: "9.6.8"
  116. - label: "v9.6.10"
  117. value: "9.6.10"
  118. - label: "v9.6.11"
  119. value: "9.6.11"
  120. - label: "v9.6.12"
  121. value: "9.6.12"
  122. - label: "v9.6.13"
  123. value: "9.6.13"
  124. - label: "v9.6.14"
  125. value: "9.6.14"
  126. - label: "v9.6.15"
  127. value: "9.6.15"
  128. - label: "v9.6.16"
  129. value: "9.6.16"
  130. - label: "v9.6.17"
  131. value: "9.6.17"
  132. - label: "v9.6.18"
  133. value: "9.6.18"
  134. - label: "v9.6.19"
  135. value: "9.6.19"
  136. - label: "v9.6.20"
  137. value: "9.6.20"
  138. - label: "v9.6.21"
  139. value: "9.6.21"
  140. - label: "v9.6.22"
  141. value: "9.6.22"
  142. - label: "v9.6.23"
  143. value: "9.6.23"
  144. - name: pg-10-versions
  145. show_if:
  146. is: "postgres10"
  147. variable: db_family
  148. contents:
  149. - type: select
  150. label: Database Version
  151. variable: db_engine_version
  152. settings:
  153. default: "10.18"
  154. options:
  155. - label: "v10.1"
  156. value: "10.1"
  157. - label: "v10.2"
  158. value: "10.2"
  159. - label: "v10.3"
  160. value: "10.3"
  161. - label: "v10.4"
  162. value: "10.4"
  163. - label: "v10.5"
  164. value: "10.5"
  165. - label: "v10.6"
  166. value: "10.6"
  167. - label: "v10.7"
  168. value: "10.7"
  169. - label: "v10.8"
  170. value: "10.8"
  171. - label: "v10.9"
  172. value: "10.9"
  173. - label: "v10.10"
  174. value: "10.10"
  175. - label: "v10.11"
  176. value: "10.11"
  177. - label: "v10.12"
  178. value: "10.12"
  179. - label: "v10.13"
  180. value: "10.13"
  181. - label: "v10.14"
  182. value: "10.14"
  183. - label: "v10.15"
  184. value: "10.15"
  185. - label: "v10.16"
  186. value: "10.16"
  187. - label: "v10.17"
  188. value: "10.17"
  189. - label: "v10.18"
  190. value: "10.18"
  191. - name: pg-11-versions
  192. show_if:
  193. is: "postgres11"
  194. variable: db_family
  195. contents:
  196. - type: select
  197. label: Database Version
  198. variable: db_engine_version
  199. settings:
  200. default: "11.13"
  201. options:
  202. - label: "v11.1"
  203. value: "11.1"
  204. - label: "v11.2"
  205. value: "11.2"
  206. - label: "v11.3"
  207. value: "11.3"
  208. - label: "v11.4"
  209. value: "11.4"
  210. - label: "v11.5"
  211. value: "11.5"
  212. - label: "v11.6"
  213. value: "11.6"
  214. - label: "v11.7"
  215. value: "11.7"
  216. - label: "v11.8"
  217. value: "11.8"
  218. - label: "v11.9"
  219. value: "11.9"
  220. - label: "v11.10"
  221. value: "11.10"
  222. - label: "v11.11"
  223. value: "11.11"
  224. - label: "v11.12"
  225. value: "11.12"
  226. - label: "v11.13"
  227. value: "11.13"
  228. - name: pg-12-versions
  229. show_if:
  230. is: "postgres12"
  231. variable: db_family
  232. contents:
  233. - type: select
  234. label: Database Version
  235. variable: db_engine_version
  236. settings:
  237. default: "12.8"
  238. options:
  239. - label: "v12.2"
  240. value: "12.2"
  241. - label: "v12.3"
  242. value: "12.3"
  243. - label: "v12.4"
  244. value: "12.4"
  245. - label: "v12.5"
  246. value: "12.5"
  247. - label: "v12.6"
  248. value: "12.6"
  249. - label: "v12.7"
  250. value: "12.7"
  251. - label: "v12.8"
  252. value: "12.8"
  253. - label: "v12.10"
  254. value: "12.10"
  255. - name: pg-13-versions
  256. show_if:
  257. is: "postgres13"
  258. variable: db_family
  259. contents:
  260. - type: select
  261. label: Database Version
  262. variable: db_engine_version
  263. settings:
  264. default: "13.4"
  265. options:
  266. - label: "v13.1"
  267. value: "13.1"
  268. - label: "v13.2"
  269. value: "13.2"
  270. - label: "v13.3"
  271. value: "13.3"
  272. - label: "v13.4"
  273. value: "13.4"
  274. - label: "v13.6"
  275. value: "13.6"
  276. - name: additional-settings
  277. contents:
  278. - type: heading
  279. label: Additional Settings
  280. - type: checkbox
  281. variable: db_deletion_protection
  282. label: Enable deletion protection for the database.
  283. settings:
  284. default: false
  285. - name: storage
  286. label: Storage
  287. sections:
  288. - name: storage
  289. contents:
  290. - type: heading
  291. label: Storage Settings
  292. - type: number-input
  293. label: Specify the amount of storage to allocate to this instance in gigabytes.
  294. variable: db_allocated_storage
  295. placeholder: "ex: 10"
  296. settings:
  297. default: 10
  298. - type: number-input
  299. label: Specify the maximum storage that this instance can scale to in gigabytes.
  300. variable: db_max_allocated_storage
  301. placeholder: "ex: 20"
  302. settings:
  303. default: 20
  304. - type: checkbox
  305. variable: db_storage_encrypted
  306. label: Enable storage encryption for the database.
  307. settings:
  308. default: false
  309. - name: advanced
  310. label: Advanced
  311. sections:
  312. - name: replicas
  313. contents:
  314. - type: heading
  315. label: Read Replicas
  316. - type: subtitle
  317. label: Specify the number of read replicas to run alongside your RDS instance.
  318. - type: number-input
  319. label: Replicas
  320. variable: db_replicas
  321. placeholder: "ex: 1"
  322. settings:
  323. default: 0`
  324. const ecrForm = `name: ECR
  325. hasSource: false
  326. includeHiddenFields: true
  327. tabs:
  328. - name: main
  329. label: Configuration
  330. sections:
  331. - name: section_one
  332. contents:
  333. - type: heading
  334. label: ECR Configuration
  335. - type: string-input
  336. label: ECR Name
  337. required: true
  338. placeholder: my-awesome-registry
  339. variable: ecr_name
  340. `
  341. const eksForm = `name: EKS
  342. hasSource: false
  343. includeHiddenFields: true
  344. tabs:
  345. - name: main
  346. label: Configuration
  347. sections:
  348. - name: section_one
  349. contents:
  350. - type: heading
  351. label: EKS Configuration
  352. - type: select
  353. label: ⚙️ AWS Machine Type
  354. variable: machine_type
  355. settings:
  356. default: t2.medium
  357. options:
  358. - label: t2.medium
  359. value: t2.medium
  360. - label: t2.large
  361. value: t2.large
  362. - label: t2.xlarge
  363. value: t2.xlarge
  364. - label: t2.2xlarge
  365. value: t2.2xlarge
  366. - label: t3.medium
  367. value: t3.medium
  368. - label: t3.large
  369. value: t3.large
  370. - label: t3.xlarge
  371. value: t3.xlarge
  372. - label: t3.2xlarge
  373. value: t3.2xlarge
  374. - type: string-input
  375. label: 👤 Issuer Email
  376. required: true
  377. placeholder: example@example.com
  378. variable: issuer_email
  379. - type: string-input
  380. label: EKS Cluster Name
  381. required: true
  382. placeholder: my-cluster
  383. variable: cluster_name
  384. - type: number-input
  385. label: Minimum number of EC2 instances to create in the application autoscaling group.
  386. variable: min_instances
  387. placeholder: "ex: 1"
  388. settings:
  389. default: 1
  390. - type: number-input
  391. label: Maximum number of EC2 instances to create in the application autoscaling group.
  392. variable: max_instances
  393. placeholder: "ex: 10"
  394. settings:
  395. default: 10
  396. - name: additional_nodegroup
  397. label: Additional Node Groups
  398. sections:
  399. - name: is_additional_enabled
  400. contents:
  401. - type: heading
  402. label: Additional Node Groups
  403. - type: checkbox
  404. variable: additional_nodegroup_enabled
  405. label: Enable an additional node group for this cluster.
  406. settings:
  407. default: false
  408. - name: additional_settings
  409. show_if: additional_nodegroup_enabled
  410. contents:
  411. - type: string-input
  412. label: Label for this node group.
  413. variable: additional_nodegroup_label
  414. placeholder: "ex: porter.run/workload-kind=job"
  415. settings:
  416. default: porter.run/workload-kind=database
  417. - type: string-input
  418. label: Taint for this node group.
  419. variable: additional_nodegroup_taint
  420. placeholder: "ex: porter.run/workload-kind=job:NoSchedule"
  421. settings:
  422. default: porter.run/workload-kind=database:NoSchedule
  423. - type: checkbox
  424. variable: additional_stateful_nodegroup_enabled
  425. label: Stateful Workload
  426. settings:
  427. default: false
  428. - type: select
  429. label: ⚙️ AWS System Machine Type
  430. variable: additional_nodegroup_machine_type
  431. settings:
  432. default: t2.medium
  433. options:
  434. - label: t2.medium
  435. value: t2.medium
  436. - label: t2.large
  437. value: t2.large
  438. - label: t2.xlarge
  439. value: t2.xlarge
  440. - label: t2.2xlarge
  441. value: t2.2xlarge
  442. - label: t3.medium
  443. value: t3.medium
  444. - label: t3.large
  445. value: t3.large
  446. - label: t3.xlarge
  447. value: t3.xlarge
  448. - label: t3.2xlarge
  449. value: t3.2xlarge
  450. - type: number-input
  451. label: Minimum number of EC2 instances to create in the application autoscaling group.
  452. variable: additional_nodegroup_min_instances
  453. placeholder: "ex: 1"
  454. settings:
  455. default: 1
  456. - type: number-input
  457. label: Maximum number of EC2 instances to create in the application autoscaling group.
  458. variable: additional_nodegroup_max_instances
  459. placeholder: "ex: 10"
  460. settings:
  461. default: 10
  462. - name: advanced
  463. label: Advanced
  464. sections:
  465. - name: system_machine_type
  466. contents:
  467. - type: heading
  468. label: System Machine Type Settings
  469. - type: select
  470. label: ⚙️ AWS System Machine Type
  471. variable: system_machine_type
  472. settings:
  473. default: t2.medium
  474. options:
  475. - label: t2.medium
  476. value: t2.medium
  477. - label: t2.large
  478. value: t2.large
  479. - label: t2.xlarge
  480. value: t2.xlarge
  481. - label: t2.2xlarge
  482. value: t2.2xlarge
  483. - label: t3.medium
  484. value: t3.medium
  485. - label: t3.large
  486. value: t3.large
  487. - label: t3.xlarge
  488. value: t3.xlarge
  489. - label: t3.2xlarge
  490. value: t3.2xlarge
  491. - name: spot_instance_should_enable
  492. contents:
  493. - type: heading
  494. label: Spot Instance Settings
  495. - type: checkbox
  496. variable: spot_instances_enabled
  497. label: Enable spot instances for this cluster.
  498. settings:
  499. default: false
  500. - name: spot_instance_price
  501. show_if: spot_instances_enabled
  502. contents:
  503. - type: string-input
  504. label: Assign a bid price for the spot instance (optional).
  505. variable: spot_price
  506. placeholder: "ex: 0.05"
  507. - name: net_settings
  508. contents:
  509. - type: heading
  510. label: Networking Settings
  511. - type: string-input
  512. label: "Add a different CIDR range prefix (first two octets: for example 10.99 will create a VPC with CIDR range 10.99.0.0/16)."
  513. variable: cluster_vpc_cidr_octets
  514. placeholder: "ex: 10.99"
  515. settings:
  516. default: "10.99"
  517. `
  518. const gcrForm = `name: GCR
  519. hasSource: false
  520. includeHiddenFields: true
  521. tabs:
  522. - name: main
  523. label: Configuration
  524. sections:
  525. - name: section_one
  526. contents:
  527. - type: heading
  528. label: GCR Configuration
  529. - type: select
  530. label: 📍 GCP Region
  531. variable: gcp_region
  532. settings:
  533. default: us-central1
  534. options:
  535. - label: asia-east1
  536. value: asia-east1
  537. - label: asia-east2
  538. value: asia-east2
  539. - label: asia-northeast1
  540. value: asia-northeast1
  541. - label: asia-northeast2
  542. value: asia-northeast2
  543. - label: asia-northeast3
  544. value: asia-northeast3
  545. - label: asia-south1
  546. value: asia-south1
  547. - label: asia-southeast1
  548. value: asia-southeast1
  549. - label: asia-southeast2
  550. value: asia-southeast2
  551. - label: australia-southeast1
  552. value: australia-southeast1
  553. - label: europe-north1
  554. value: europe-north1
  555. - label: europe-west1
  556. value: europe-west1
  557. - label: europe-west2
  558. value: europe-west2
  559. - label: europe-west3
  560. value: europe-west3
  561. - label: europe-west4
  562. value: europe-west4
  563. - label: europe-west6
  564. value: europe-west6
  565. - label: northamerica-northeast1
  566. value: northamerica-northeast1
  567. - label: southamerica-east1
  568. value: southamerica-east1
  569. - label: us-central1
  570. value: us-central1
  571. - label: us-east1
  572. value: us-east1
  573. - label: us-east4
  574. value: us-east4
  575. - label: us-east1
  576. value: us-east1
  577. - label: us-east1
  578. value: us-east1
  579. - label: us-west1
  580. value: us-west1
  581. - label: us-east1
  582. value: us-west2
  583. - label: us-west3
  584. value: us-west3
  585. - label: us-west4
  586. value: us-west4
  587. `
  588. const gkeForm = `name: GKE
  589. hasSource: false
  590. includeHiddenFields: true
  591. tabs:
  592. - name: main
  593. label: Configuration
  594. sections:
  595. - name: section_one
  596. contents:
  597. - type: heading
  598. label: GKE Configuration
  599. - type: select
  600. label: 📍 GCP Region
  601. variable: gcp_region
  602. settings:
  603. default: us-central1
  604. options:
  605. - label: asia-east1
  606. value: asia-east1
  607. - label: asia-east2
  608. value: asia-east2
  609. - label: asia-northeast1
  610. value: asia-northeast1
  611. - label: asia-northeast2
  612. value: asia-northeast2
  613. - label: asia-northeast3
  614. value: asia-northeast3
  615. - label: asia-south1
  616. value: asia-south1
  617. - label: asia-southeast1
  618. value: asia-southeast1
  619. - label: asia-southeast2
  620. value: asia-southeast2
  621. - label: australia-southeast1
  622. value: australia-southeast1
  623. - label: europe-north1
  624. value: europe-north1
  625. - label: europe-west1
  626. value: europe-west1
  627. - label: europe-west2
  628. value: europe-west2
  629. - label: europe-west3
  630. value: europe-west3
  631. - label: europe-west4
  632. value: europe-west4
  633. - label: europe-west6
  634. value: europe-west6
  635. - label: northamerica-northeast1
  636. value: northamerica-northeast1
  637. - label: southamerica-east1
  638. value: southamerica-east1
  639. - label: us-central1
  640. value: us-central1
  641. - label: us-east1
  642. value: us-east1
  643. - label: us-east4
  644. value: us-east4
  645. - label: us-east1
  646. value: us-east1
  647. - label: us-east1
  648. value: us-east1
  649. - label: us-west1
  650. value: us-west1
  651. - label: us-east1
  652. value: us-west2
  653. - label: us-west3
  654. value: us-west3
  655. - label: us-west4
  656. value: us-west4
  657. - type: string-input
  658. label: 👤 Issuer Email
  659. required: true
  660. placeholder: example@example.com
  661. variable: issuer_email
  662. - type: string-input
  663. label: GKE Cluster Name
  664. required: true
  665. placeholder: my-cluster
  666. variable: cluster_name
  667. `
  668. const docrForm = `name: DOCR
  669. hasSource: false
  670. includeHiddenFields: true
  671. tabs:
  672. - name: main
  673. label: Configuration
  674. sections:
  675. - name: section_one
  676. contents:
  677. - type: heading
  678. label: DOCR Configuration
  679. - type: select
  680. label: DO Subscription Tier
  681. variable: docr_subscription_tier
  682. settings:
  683. default: basic
  684. options:
  685. - label: Basic
  686. value: basic
  687. - label: Professional
  688. value: professional
  689. - type: string-input
  690. label: DOCR Name
  691. required: true
  692. placeholder: my-awesome-registry
  693. variable: docr_name
  694. `
  695. const doksForm = `name: DOKS
  696. hasSource: false
  697. includeHiddenFields: true
  698. tabs:
  699. - name: main
  700. label: Configuration
  701. sections:
  702. - name: section_one
  703. contents:
  704. - type: heading
  705. label: DOKS Configuration
  706. - type: select
  707. label: 📍 DO Region
  708. variable: do_region
  709. settings:
  710. default: nyc1
  711. options:
  712. - label: Amsterdam 3
  713. value: ams3
  714. - label: Bangalore 1
  715. value: blr1
  716. - label: Frankfurt 1
  717. value: fra1
  718. - label: London 1
  719. value: lon1
  720. - label: New York 1
  721. value: nyc1
  722. - label: New York 3
  723. value: nyc3
  724. - label: San Francisco 2
  725. value: sfo2
  726. - label: San Francisco 3
  727. value: sfo3
  728. - label: Singapore 1
  729. value: sgp1
  730. - label: Toronto 1
  731. value: tor1
  732. - type: string-input
  733. label: 👤 Issuer Email
  734. required: true
  735. placeholder: example@example.com
  736. variable: issuer_email
  737. - type: string-input
  738. label: DOKS Cluster Name
  739. required: true
  740. placeholder: my-cluster
  741. variable: cluster_name
  742. `
  743. const acrForm = `name: ACR
  744. hasSource: false
  745. includeHiddenFields: true
  746. isClusterScoped: false
  747. tabs:
  748. - name: main
  749. label: Configuration
  750. sections:
  751. - name: section_one
  752. contents:
  753. - type: heading
  754. label: ACR Configuration
  755. - type: select
  756. label: 📍 Azure Region
  757. variable: aks_region
  758. settings:
  759. default: East US
  760. options:
  761. - label: East US
  762. value: East US
  763. - label: East US 2
  764. value: East US 2
  765. - label: West US 2
  766. value: West US 2
  767. - label: West US 3
  768. value: West US 3
  769. - label: Norway East
  770. value: Norway East
  771. - type: string-input
  772. label: ACR Name
  773. required: true
  774. placeholder: my-registry
  775. variable: acr_name
  776. `
  777. const aksForm = `name: AKS
  778. hasSource: false
  779. includeHiddenFields: true
  780. isClusterScoped: false
  781. tabs:
  782. - name: main
  783. label: Configuration
  784. sections:
  785. - name: section_one
  786. contents:
  787. - type: heading
  788. label: AKS Configuration
  789. - type: select
  790. label: 📍 Azure Region
  791. variable: aks_region
  792. settings:
  793. default: East US
  794. options:
  795. - label: East US
  796. value: East US
  797. - label: East US 2
  798. value: East US 2
  799. - label: West US 2
  800. value: West US 2
  801. - label: West US 3
  802. value: West US 3
  803. - label: Norway East
  804. value: Norway East
  805. - type: string-input
  806. label: 👤 Issuer Email
  807. required: true
  808. placeholder: example@example.com
  809. variable: issuer_email
  810. - type: string-input
  811. label: AKS Cluster Name
  812. required: true
  813. placeholder: my-cluster
  814. variable: cluster_name
  815. `