-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from pluralsh/stacks-support
Work towards adding support for stacks in `plural up`
- Loading branch information
Showing
58 changed files
with
923 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
apiVersion: deployments.plural.sh/v1alpha1 | ||
kind: PrAutomation | ||
metadata: | ||
name: cluster-creator | ||
spec: | ||
name: cluster-creator | ||
documentation: | | ||
Sets up a PR to provision a cluster for a fleet + stage | ||
creates: | ||
templates: | ||
- source: templates/clusters/stack.yaml | ||
destination: "apps/clusters/{{ context.cloud }}/stacks/{{ context.name }}.yaml" | ||
external: false | ||
- source: templates/clusters/cluster.yaml | ||
destination: "apps/clusters/{{ context.cloud }}/clusters/{{ context.name }}.yaml" | ||
external: false | ||
- source: templates/clusters/clusters.yaml | ||
destination: "apps/services/clusters.yaml" | ||
external: false | ||
scmConnectionRef: | ||
name: github # 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" | ||
identifier: [[ .Identifier ]] # REPLACEME with your own repo slug | ||
configuration: | ||
- name: name | ||
type: STRING | ||
documentation: name for this cluster | ||
- name: cloud | ||
type: ENUM | ||
documentation: the cloud you'll host on | ||
values: | ||
- aws | ||
- gcp | ||
- azure | ||
- name: fleet | ||
type: STRING | ||
documentation: a 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# You will need to manually create the github scm connection this refers to | ||
# apiVersion: deployments.plural.sh/v1alpha1 | ||
# kind: ScmConnection | ||
# metadata: | ||
# name: github | ||
# spec: | ||
# name: github | ||
# type: GITHUB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: deployments.plural.sh/v1alpha1 | ||
kind: DeploymentSettings | ||
metadata: | ||
name: global | ||
namespace: plrl-deploy-operator | ||
spec: | ||
stacks: | ||
jobSpec: | ||
namespace: plrl-deploy-operator | ||
serviceAccount: stacks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: deployments.plural.sh/v1alpha1 | ||
kind: Cluster | ||
metadata: | ||
name: {{ context.name }} | ||
namespace: infra | ||
spec: | ||
handle: {{ context.name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: deployments.plural.sh/v1alpha1 | ||
kind: ServiceDeployment | ||
metadata: | ||
name: clusters | ||
namespace: infra | ||
spec: | ||
namespace: infra | ||
git: | ||
folder: apps/clusters | ||
ref: main | ||
repositoryRef: | ||
kind: GitRepository | ||
name: infra | ||
namespace: infra | ||
clusterRef: | ||
name: mgmt | ||
namespace: infra |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module "mgmt" { | ||
source = "../bootstrap/terraform/clouds/aws" | ||
source = "../terraform/modules/mgmt" | ||
cluster_name = "{{ .Cluster }}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module "mgmt" { | ||
source = "../bootstrap/terraform/clouds/linode" | ||
source = "../terraform/modules/mgmt" | ||
cluster_name = "{{ .Cluster }}" | ||
region = "{{ .Region }}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: stacks | ||
namespace: plrl-deploy-operator | ||
annotations: | ||
eks.amazonaws.com/role-arn: {{ .StacksIdentity }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: stacks | ||
namespace: plrl-deploy-operator | ||
annotations: | ||
azure.workload.identity/client-id: {{ .StacksIdentity }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: stacks | ||
namespace: plrl-deploy-operator | ||
annotations: | ||
iam.gke.io/gcp-service-account: {{ .StacksIdentity }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module "assumable_role_stacks" { | ||
source = "terraform-aws-modules/iam/aws//modules/iam-assumable-role-with-oidc" | ||
version = "5.39.1" | ||
create_role = true | ||
role_name = "${var.cluster_name}-plrl-stacks" | ||
provider_url = replace(module.eks.cluster_oidc_issuer_url, "https://", "") | ||
role_policy_arns = [aws_iam_policy.stacks.arn] | ||
oidc_fully_qualified_subjects = [ | ||
"system:serviceaccount:plrl-deploy-operator:stacks", | ||
] | ||
} | ||
|
||
resource "aws_iam_policy" "stacks" { | ||
name_prefix = "stacks" | ||
description = "stacks permissions for ${var.cluster_name}" | ||
policy = <<-POLICY | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Action": "*", | ||
"Resource": "*" | ||
} | ||
] | ||
} | ||
POLICY | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.