Skip to content

Commit 26d49e6

Browse files
committed
checkpoint-kai-1700576237
1 parent 59fae72 commit 26d49e6

File tree

5 files changed

+45
-23
lines changed

5 files changed

+45
-23
lines changed

README.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ $ make upgrade
8888

8989
This deployment command assumes you are locally authenticated to gcloud and kubectl, and have performed all of the above installations.
9090

91+
Note that, during the deploy process, you will likely need to enable several google APIs. Do so when prompted, then run the deploy again. This will show up as messages like:
92+
93+
> googleapi: Error 403: $API has not been used in project $PROECT before or it is disabled. Enable it by visiting...
94+
95+
These instructions all assume you are starting from the top level directory, whenever a `$SHELL` command is given.
96+
97+
### 0. Name your project
98+
99+
Open `config.yml` and modify the "Project configuration" section
100+
91101
### 1. Create a new project
92102

93103
Create a new project via https://console.cloud.google.com/, then set its name in `config.yml`
@@ -106,11 +116,25 @@ Create a terraform state bucket via https://console.cloud.google.com/, then set
106116
bucket: coilysiren-k8s-gpc-tfstate-3
107117
```
108118

109-
Then import it into terraform.
119+
Then you must set its name manually in every `state.tf` file. Open every `state.tf` file in the repo. You will see a block like this:
120+
121+
```hcl
122+
terraform {
123+
backend "gcs" {
124+
bucket = "coilysiren-k8s-gpc-tfstate-3"
125+
prefix = "terraform/state"
126+
}
127+
}
128+
```
129+
130+
You should modify the `bucket = ...` line with your bucket name, same as in `config.yml`.
131+
132+
Finally, import you import the bucket into terraform.
110133

111134
```bash
112135
# $SHELL
113136
cd infrastructure/foundation/
137+
terraform init
114138
terraform import google_storage_bucket.default coilysiren-k8s-gpc-tfstate-3
115139
```
116140

@@ -125,5 +149,3 @@ Run the deploy script
125149
source ./venv/bin/activate
126150
invoke deploy # see tasks.py for source code
127151
```
128-
129-
Note that, during the deploy process, you will likely need to enable several google APIs. Do so when prompted, then run the deploy again.

config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Personal configuration
2-
name: gke-test-2
3-
domain: gke-test-2.coilysiren.me
4-
zone: coilysiren.me
1+
# Project configuration
2+
name: gke-test-3
3+
domain: gke-test-3.coilysiren.me
4+
zone: coilysiren.me # domain - name = zone
55
66

77
# Google Cloud Platform configuration

infrastructure/application/state.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
locals {
2-
statebucket = yamldecode(file("../../config.yml")).statebucket
3-
}
4-
51
terraform {
62
backend "gcs" {
7-
bucket = "coilysiren-k8s-gpc-tfstate-0"
3+
bucket = "coilysiren-k8s-gpc-tfstate-3"
84
prefix = "terraform/state/application"
95
}
106
}
117

8+
locals {
9+
statebucket = yamldecode(file("../../config.yml")).statebucket
10+
}
11+
1212
# https://registry.terraform.io/providers/hashicorp/google/latest/docs
1313
provider "google" {
1414
project = yamldecode(file("../../config.yml")).project
@@ -35,7 +35,7 @@ data "google_project" "default" {}
3535
data "terraform_remote_state" "foundation" {
3636
backend = "gcs"
3737
config = {
38-
bucket = "coilysiren-k8s-gpc-tfstate-0"
38+
bucket = local.statebucket
3939
prefix = "terraform/state"
4040
}
4141
}

infrastructure/foundation/state.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
locals {
2-
statebucket = yamldecode(file("../../config.yml")).statebucket
3-
}
4-
51
terraform {
62
backend "gcs" {
7-
bucket = local.statebucket
3+
bucket = "coilysiren-k8s-gpc-tfstate-3"
84
prefix = "terraform/state"
95
}
106
}
117

8+
locals {
9+
statebucket = yamldecode(file("../../config.yml")).statebucket
10+
}
11+
1212
# https://registry.terraform.io/providers/hashicorp/google/latest/docs
1313
provider "google" {
1414
project = yamldecode(file("../../config.yml")).project
@@ -24,7 +24,7 @@ data "google_project" "default" {}
2424
#
2525
# https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket
2626
resource "google_storage_bucket" "default" {
27-
name = statebucket
27+
name = local.statebucket
2828
location = "US"
2929
force_destroy = true
3030
project = data.google_project.default.project_id

infrastructure/kubconfig.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ items:
44
kind: Ingress
55
metadata:
66
annotations:
7-
kubernetes.io/ingress.allow-http: "true"
7+
kubernetes.io/ingress.allow-http: 'true'
88
kubernetes.io/ingress.class: gce
99
networking.gke.io/managed-certificates: dns-cert
1010
name: application
@@ -17,7 +17,7 @@ items:
1717
ingressClassName: gce
1818
tls:
1919
- hosts:
20-
- gke-test-2.coilysiren.me
20+
- gke-test-3.coilysiren.me
2121
- apiVersion: v1
2222
kind: Service
2323
metadata:
@@ -55,10 +55,10 @@ items:
5555
app: application
5656
spec:
5757
containers:
58-
- image: us-central1-docker.pkg.dev/root-territory-384205/repository/gke-test-2:certs-6bbf26e-kai
58+
- image: us-central1-docker.pkg.dev/dotted-hope-405813/repository/gke-test-3:certs-59fae72-kai
5959
name: application
6060
ports:
6161
- containerPort: 8080
6262
kind: List
6363
metadata:
64-
resourceVersion: ""
64+
resourceVersion: ''

0 commit comments

Comments
 (0)