-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http://gke-test-2.coilysiren.me/api/healthcheck <img width="562" alt="image" src="https://github.com/coilysiren/k8s-gcp/assets/5768468/63f22428-0b99-4a0f-8bd0-6a478f257c6f">
- Loading branch information
1 parent
0747798
commit 2b9bd06
Showing
8 changed files
with
209 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,27 @@ | ||
locals { | ||
name = yamldecode(file("../../config.yml")).name | ||
} | ||
|
||
# https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/client_config | ||
data "google_client_config" "default" {} | ||
|
||
data "kubernetes_service" "service" { | ||
metadata { | ||
name = "application" | ||
} | ||
} | ||
|
||
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone | ||
data "aws_route53_zone" "zone" { | ||
name = "coilysiren.me." | ||
private_zone = false | ||
} | ||
|
||
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record | ||
resource "aws_route53_record" "record" { | ||
zone_id = data.aws_route53_zone.zone.zone_id | ||
name = "${local.name}.coilysiren.me." | ||
type = "A" | ||
ttl = "300" | ||
records = [data.kubernetes_service.service.status.0.load_balancer.0.ingress.0.ip] | ||
} |
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,37 @@ | ||
terraform { | ||
backend "gcs" { | ||
bucket = "coilysiren-k8s-gpc-tfstate-0" | ||
prefix = "terraform/state/application" | ||
} | ||
} | ||
|
||
# https://registry.terraform.io/providers/hashicorp/google/latest/docs | ||
provider "google" { | ||
project = yamldecode(file("../../config.yml")).project | ||
region = yamldecode(file("../../config.yml")).region | ||
} | ||
|
||
# https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs | ||
provider "kubernetes" { | ||
host = "https://${data.terraform_remote_state.foundation.outputs.endpoint}" | ||
token = data.google_client_config.default.access_token | ||
cluster_ca_certificate = base64decode(data.terraform_remote_state.foundation.outputs.ca_certificate) | ||
} | ||
|
||
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs | ||
provider "aws" { | ||
# AWS doesn't have the same regions as GCP, and also doesn't format then in the same way. | ||
# That said, this isn't a huge issue because we are only using AWS for DNS. | ||
region = "us-east-1" | ||
} | ||
|
||
# https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/project | ||
data "google_project" "default" {} | ||
|
||
data "terraform_remote_state" "foundation" { | ||
backend = "gcs" | ||
config = { | ||
bucket = "coilysiren-k8s-gpc-tfstate-0" | ||
prefix = "terraform/state" | ||
} | ||
} |
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
apiVersion: v1 | ||
items: | ||
- apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
cloud.google.com/neg: '{"ingress":true}' | ||
finalizers: | ||
- service.kubernetes.io/load-balancer-cleanup | ||
labels: | ||
app: application | ||
name: application | ||
spec: | ||
allocateLoadBalancerNodePorts: true | ||
externalTrafficPolicy: Cluster | ||
internalTrafficPolicy: Cluster | ||
ports: | ||
- port: 80 | ||
targetPort: 8080 | ||
selector: | ||
app: application | ||
type: LoadBalancer | ||
- apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: application | ||
name: application | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: application | ||
template: | ||
metadata: | ||
labels: | ||
app: application | ||
spec: | ||
containers: | ||
- image: us-central1-docker.pkg.dev/root-territory-384205/repository/gke-test-2:dns-21c2dd5-kai | ||
name: application | ||
ports: | ||
- containerPort: 8080 | ||
kind: List | ||
metadata: | ||
resourceVersion: '' |
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