diff --git a/catalogs/infra/cluster/cluster.yaml b/catalogs/infra/cluster/cluster.yaml new file mode 100644 index 00000000..2dc9578e --- /dev/null +++ b/catalogs/infra/cluster/cluster.yaml @@ -0,0 +1,7 @@ +apiVersion: deployments.plural.sh/v1alpha1 +kind: Cluster +metadata: + name: {{ context.name }} + namespace: infra +spec: + handle: {{ context.name }} \ No newline at end of file diff --git a/catalogs/infra/cluster/servicedeployment.yaml b/catalogs/infra/cluster/servicedeployment.yaml new file mode 100644 index 00000000..97de920c --- /dev/null +++ b/catalogs/infra/cluster/servicedeployment.yaml @@ -0,0 +1,17 @@ +apiVersion: deployments.plural.sh/v1alpha1 +kind: ServiceDeployment +metadata: + name: clusters + namespace: infra +spec: + namespace: infra + git: + folder: services/infra/clusters + ref: main + repositoryRef: + kind: GitRepository + name: infra + namespace: infra + clusterRef: + name: mgmt + namespace: infra diff --git a/catalogs/infra/cluster/stack.yaml b/catalogs/infra/cluster/stack.yaml new file mode 100644 index 00000000..bde2b6b1 --- /dev/null +++ b/catalogs/infra/cluster/stack.yaml @@ -0,0 +1,31 @@ +apiVersion: deployments.plural.sh/v1alpha1 +kind: InfrastructureStack +metadata: + name: cluster-{{ context.name }} +spec: + name: cluster-{{ context.name }} + detach: false + type: TERRAFORM + approval: true + manageState: true + actor: console@plural.sh + configuration: + version: '1.8' + repositoryRef: + name: infra + namespace: infra + clusterRef: + name: mgmt + namespace: infra + git: + ref: main + folder: terraform/modules/clusters/{{ context.cloud }} + environment: + - name: TF_VAR_cluster + value: {{ context.name }} + - name: TF_VAR_fleet + value: {{ context.fleet }} + - name: TF_VAR_tier + value: {{ context.tier }} + - name: TF_VAR_region + value: {{ context.region }} diff --git a/setup/catalogs/catalogs.yaml b/setup/catalogs/catalogs.yaml index a4d8a190..dde39e6f 100644 --- a/setup/catalogs/catalogs.yaml +++ b/setup/catalogs/catalogs.yaml @@ -33,3 +33,15 @@ spec: author: Plural description: | Sets up OSS devops infrastructure using Plural +--- +apiVersion: deployments.plural.sh/v1alpha1 +kind: Catalog +metadata: + name: infra +spec: + name: infra + category: data + icon: https://docs.plural.sh/favicon-128.png + author: Plural + description: | + Sets up infrastructure using Plural diff --git a/setup/catalogs/infra/cluster.yaml b/setup/catalogs/infra/cluster.yaml new file mode 100644 index 00000000..3f8b64f3 --- /dev/null +++ b/setup/catalogs/infra/cluster.yaml @@ -0,0 +1,53 @@ +apiVersion: deployments.plural.sh/v1alpha1 +kind: PrAutomation +metadata: + name: cluster +spec: + name: cluster + documentation: | + Sets up a PR to provision a cluster for a fleet + stage + creates: + git: + ref: sebastian/prod-2981-set-up-catalog-pipeline # TODO set to main + folder: catalogs/infra/cluster + templates: + - source: stack.yaml + destination: "services/infra/clusters/{{ context.cloud }}/stacks/{{ context.name }}.yaml" + external: true + - source: cluster.yaml + destination: "services/infra/clusters/{{ context.cloud }}/{{ context.name }}.yaml" + external: true + - source: servicedeployment.yaml + destination: "bootstrap/infra/clusters/servicedeployment.yaml" + external: true + repositoryRef: + name: scaffolds + catalogRef: + name: infra + scmConnectionRef: + name: plural # you'll need to add this ScmConnection manually before this is functional + title: "Adding {{ context.cloud }} cluster: {{ context.name }}" + message: "Adding {{ context.cloud }} cluster {{ context.name }} and registering it with Plural" + configuration: + - name: name + type: STRING + documentation: Name of the cluster. + - name: cloud + type: ENUM + documentation: The cloud provider you'll host on. + values: + - aws + - gcp + - azure + - name: fleet + type: STRING + documentation: Name for the fleet you want this cluster to belong to. + - name: tier + type: ENUM + documentation: What tier to place this cluster in. + values: + - dev + - prd + - name: region + type: STRING + documentation: Region where the cluster should be created.