Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
torumakabe committed Jun 28, 2023
1 parent b00b6e4 commit 460fc08
Show file tree
Hide file tree
Showing 78 changed files with 510 additions and 1,127 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-terraform-blue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- name: "Setup Terraform"
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.4.6
terraform_version: 1.5.1
terraform_wrapper: false

- name: "Terraform Format"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-terraform-green.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- name: "Setup Terraform"
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.4.6
terraform_version: 1.5.1
terraform_wrapper: false

- name: "Terraform Format"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-terraform-shared.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: "Setup Terraform"
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.4.6
terraform_version: 1.5.1
terraform_wrapper: false

- name: "Terraform Format"
Expand Down
25 changes: 10 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ DRY is a great concept, and you should be aware that it will come true in the fu

Prerequisites & tested

- [Terraform](https://www.terraform.io/docs/index.html): 1.4.6
- hashicorp/azurerm: 3.59.0
- hashicorp/kubernetes: 2.21
- [Terraform](https://www.terraform.io/docs/index.html): 1.5.1
- hashicorp/azurerm: 3.62.0
- State store: Local
- [TFLint](https://github.com/terraform-linters/tflint): 0.46.1
- [azurerm plugin](https://github.com/terraform-linters/tflint-ruleset-azurerm): 0.23.0
- [Flux(v2)](https://fluxcd.io/docs/): 2.0.0-rc.5
- [Azure/kubelogin](https://github.com/Azure/kubelogin): 0.0.29
- [azurerm plugin](https://github.com/terraform-linters/tflint-ruleset-azurerm): 0.24.0
- [Azure/kubelogin](https://github.com/Azure/kubelogin): 0.0.30
- Ubuntu: 22.04.2 LTS

### Privileges required for execution

Expand All @@ -47,7 +46,7 @@ Prerequisites & tested
- For admin operation & Flux execution
- Assign role to Azure AD group and [specify](./terraform/blue/prod.tfvars) it as terrafofm var
- GitHub Repo control (GitHub PAT)
- For execution of Flux
- For execution of Flux with GitHub
- GitHub Actions CI (Azure Service Principal)
- Azure Subscription Reader (Azure role)
- [Using OIDC auth for Terraform](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_oidc)
Expand Down Expand Up @@ -82,19 +81,15 @@ The policy of this sample for variables such as IDs and secrets is as follows.

You have to prepare the following variables for each envs(e.g dev, prod).

- Azure Resources (Shared): [Terraform tfvars](./terraform/shared/dev.tfvars)
- Azure Resources (Blue/Green): [Terraform tfvars](./terraform/blue/dev.tfvars)
- Shared: [Terraform tfvars](./terraform/shared/dev.tfvars)
- Blue/Green: [Terraform tfvars](./terraform/blue/dev.tfvars)

You can also [use environment variables](https://www.terraform.io/docs/language/values/variables.html) instead of tfvars file.

### Bootstrap order

1. Azure Resources (Shared): [Terraform dir](./terraform/shared)
2. Azure Resources (Blue/Green): [Terraform dir](./terraform/blue)
3. Kubernetes Resources (Blue/Green): [Flux helper script](./flux/scripts)

- [For Production](./flux/scripts/bootstrap.sh)
- [For Dev (without storing its manifests in a Git repository)](./flux/scripts/setup-dev.sh)
1. Shared: [Terraform dir](./terraform/shared)
2. Blue/Green: [Terraform dir](./terraform/blue)

You can operate Blue/Green in any order, but always be aware of the context of clusters.

Expand Down
12 changes: 0 additions & 12 deletions flux/apps/blue-dev-test/demoapp/deployment-values.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions flux/apps/blue-dev-test/demoapp/kustomization.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions flux/apps/blue-dev-test/kustomization.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions flux/apps/blue-dev-test/podinfo/kustomization.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions flux/apps/blue-dev-test/podinfo/release-values.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions flux/apps/green-dev-test/demoapp/deployment-values.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions flux/apps/green-dev-test/demoapp/kustomization.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions flux/apps/green-dev-test/kustomization.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions flux/apps/green-dev-test/podinfo/kustomization.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions flux/apps/green-dev-test/podinfo/release-values.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion flux/clusters/base/apps.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: apps
Expand Down
2 changes: 1 addition & 1 deletion flux/clusters/base/infrastructure.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: infrastructure
Expand Down
7 changes: 0 additions & 7 deletions flux/clusters/blue-dev-test/apps-values.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions flux/clusters/blue-dev-test/infrastructure-values.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions flux/clusters/blue-dev-test/kustomization.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion flux/clusters/blue/apps-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: apps
Expand Down
2 changes: 1 addition & 1 deletion flux/clusters/blue/infrastructure-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: infrastructure
Expand Down
7 changes: 0 additions & 7 deletions flux/clusters/green-dev-test/apps-values.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions flux/clusters/green-dev-test/infrastructure-values.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions flux/clusters/green-dev-test/kustomization.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion flux/clusters/green/apps-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: apps
Expand Down
2 changes: 1 addition & 1 deletion flux/clusters/green/infrastructure-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: infrastructure
Expand Down
4 changes: 4 additions & 0 deletions flux/infrastructure/base/chaos-mesh/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ spec:
chaosDaemon:
runtime: containerd
socketPath: /run/containerd/containerd.sock
dnsServer:
tolerations:
- key: CriticalAddonsOnly
operator: Exists
1 change: 1 addition & 0 deletions flux/infrastructure/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ resources:
- sources
- nginx
- chaos-mesh
- azure-monitor
20 changes: 0 additions & 20 deletions flux/infrastructure/blue-dev-test/chaos-mesh-values.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions flux/infrastructure/blue-dev-test/kustomization.yaml

This file was deleted.

24 changes: 0 additions & 24 deletions flux/infrastructure/blue-dev-test/nginx-values.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions flux/infrastructure/green-dev-test/chaos-mesh-values.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions flux/infrastructure/green-dev-test/kustomization.yaml

This file was deleted.

Loading

0 comments on commit 460fc08

Please sign in to comment.