From fabc79dc5619b20e1d122fbb4b3c9512f2cb1acc Mon Sep 17 00:00:00 2001 From: Giantlife Date: Mon, 31 Jul 2023 02:03:09 -0400 Subject: [PATCH 1/8] specified our managed kubernetes service provider as AWS -EKS --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b2644cc0dda..64c11c5384d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +**In our case, we will be using EKS** +

Online Boutique

From 3e0999a347bbd932e6d1aeb483a37542b68a6698 Mon Sep 17 00:00:00 2001 From: Giantlife Date: Mon, 31 Jul 2023 02:29:28 -0400 Subject: [PATCH 2/8] provided possible action plan for our bootcamp projects --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 64c11c5384d..de50bb3457d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,15 @@ -**In our case, we will be using EKS** +**STEPS FOR BOOTCAMP PROJECT** +**NB. In our case, we will be using EKS** + +**First, We need to containerize our microservices and push them into a publicly accessible ECR** + +**Second, we will set up an EKS cluster with Terraform module** + +**Third, we will install Kubectl, configure Helm and update the Helm charts to deploy applications onto the Kubernetes cluster** + +**Fourth, we will install Nginx Ingress controller and set up Ingress rules to enable external access to services within your Kubernetes cluster** + +

Online Boutique From 34f2562b2e90c2c87547efacc55a29bdd4da942c Mon Sep 17 00:00:00 2001 From: Giantlife Date: Mon, 31 Jul 2023 18:42:28 -0400 Subject: [PATCH 3/8] included an additional step --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index de50bb3457d..076c8ad71b5 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ **Fourth, we will install Nginx Ingress controller and set up Ingress rules to enable external access to services within your Kubernetes cluster** - +**Automate the entire deployment using a CI/CD pipeline - Jenkins or Gitlab Action**

Online Boutique From aca25f8be94dc3810f5922db1c65223d171687dc Mon Sep 17 00:00:00 2001 From: Giantlife Date: Mon, 31 Jul 2023 18:55:03 -0400 Subject: [PATCH 4/8] included one last step --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 076c8ad71b5..bfa04f0f772 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,9 @@ **Fourth, we will install Nginx Ingress controller and set up Ingress rules to enable external access to services within your Kubernetes cluster** -**Automate the entire deployment using a CI/CD pipeline - Jenkins or Gitlab Action** +**Fifth, eigure out how to integrate Istio and gRPC** + +**Finally, automate the entire deployment using a CI/CD pipeline - Jenkins or Gitlab Action**

Online Boutique From ac8aa5b2b079876b2d470602b3de08902f1933f0 Mon Sep 17 00:00:00 2001 From: Giantlife Date: Mon, 31 Jul 2023 18:56:44 -0400 Subject: [PATCH 5/8] included one last step with correction to a spelling error --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bfa04f0f772..d402b771821 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ **Fourth, we will install Nginx Ingress controller and set up Ingress rules to enable external access to services within your Kubernetes cluster** -**Fifth, eigure out how to integrate Istio and gRPC** +**Fifth, figure out how to integrate Istio and gRPC** **Finally, automate the entire deployment using a CI/CD pipeline - Jenkins or Gitlab Action** From 4d3f075efcad74f4ffcbf876a25e2a4541fdd7c1 Mon Sep 17 00:00:00 2001 From: Giantlife Date: Tue, 1 Aug 2023 23:16:49 -0400 Subject: [PATCH 6/8] added new vpc creation file, update other terraform files for aws usage --- terraform/main.tf | 138 ++++++++++++++++++------------------- terraform/memorystore.tf | 2 + terraform/output.tf | 23 ------- terraform/providers.tf | 32 +++++++-- terraform/terraform.tfvars | 17 ----- terraform/variables.tf | 36 +++++----- terraform/vpc.tf | 98 ++++++++++++++++++++++++++ 7 files changed, 210 insertions(+), 136 deletions(-) delete mode 100644 terraform/output.tf delete mode 100644 terraform/terraform.tfvars create mode 100644 terraform/vpc.tf diff --git a/terraform/main.tf b/terraform/main.tf index 40c9e2a6542..e36da7309da 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -1,95 +1,95 @@ -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Definition of local variables -locals { - base_apis = [ - "container.googleapis.com", - "monitoring.googleapis.com", - "cloudtrace.googleapis.com", - "cloudprofiler.googleapis.com" - ] - memorystore_apis = ["redis.googleapis.com"] +# Define the required providers +provider "aws" { + region = var.aws_region - # Variables cluster_list and cluster_name are used for an implicit dependency - # between module "gcloud" and resource "google_container_cluster" - cluster_id_parts = split("/", google_container_cluster.my_cluster.id) - cluster_name = element(local.cluster_id_parts, length(local.cluster_id_parts) - 1) } -# Enable Google Cloud APIs -module "enable_google_apis" { - source = "terraform-google-modules/project-factory/google//modules/project_services" - version = "~> 14.0" +# Create an AWS EKS cluster +resource "aws_eks_cluster" "my_cluster" { + name = var.cluster_name + role_arn = aws_iam_role.eks_cluster.arn - project_id = var.gcp_project_id - disable_services_on_destroy = false + vpc_config { + subnet_ids = var.subnet_ids + } - # activate_apis is the set of base_apis and the APIs required by user-configured deployment options - activate_apis = concat(local.base_apis, var.memorystore ? local.memorystore_apis : []) + depends_on = [ + aws_iam_role_policy_attachment.eks_cluster, + ] } -# Create GKE cluster -resource "google_container_cluster" "my_cluster" { - name = var.name - location = var.region +# Define an IAM role for the EKS cluster +resource "aws_iam_role" "eks_cluster" { + name = "eks-cluster-${var.cluster_name}" - # Enabling autopilot for this cluster - enable_autopilot = true + assume_role_policy = jsonencode({ + Version = "2012-10-17" + Statement = [ + { + Action = "sts:AssumeRole" + Effect = "Allow" + Principal = { + Service = "eks.amazonaws.com" + } + } + ] + }) +} - # Setting an empty ip_allocation_policy to allow autopilot cluster to spin up correctly - ip_allocation_policy { - } +# Attach the required IAM policy to the EKS cluster role +resource "aws_iam_role_policy_attachment" "eks_cluster" { + policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy" + role = aws_iam_role.eks_cluster.name +} - depends_on = [ - module.enable_google_apis - ] +# Provision the EKS cluster's Kubernetes config locally +data "aws_eks_cluster" "my_cluster" { + name = aws_eks_cluster.my_cluster.name } -# Get credentials for cluster -module "gcloud" { - source = "terraform-google-modules/gcloud/google" - version = "~> 3.0" +provider "kubernetes" { + host = data.aws_eks_cluster.my_cluster.endpoint + cluster_ca_certificate = base64decode(data.aws_eks_cluster.my_cluster.certificate_authority.0.data) + token = data.aws_eks_cluster_auth.my_cluster.token + load_config_file = false +} - platform = "linux" - additional_components = ["kubectl", "beta"] +data "aws_eks_cluster_auth" "my_cluster" { + name = aws_eks_cluster.my_cluster.name +} - create_cmd_entrypoint = "gcloud" - # Use local variable cluster_name for an implicit dependency on resource "google_container_cluster" - create_cmd_body = "container clusters get-credentials ${local.cluster_name} --zone=${var.region}" +# Apply Kubernetes manifest configurations +resource "kubernetes_manifest" "apply_deployment" { + config_path = var.filepath_manifest } -# Apply YAML kubernetes-manifest configurations -resource "null_resource" "apply_deployment" { - provisioner "local-exec" { - interpreter = ["bash", "-exc"] - command = "kubectl apply -k ${var.filepath_manifest}" +# Wait for all Pods to be ready before finishing +resource "kubernetes_pod" "wait_conditions" { + metadata { + namespace = var.namespace + name = "wait-pod" } - depends_on = [ - module.gcloud - ] -} + spec { + container { + image = "busybox" + name = "wait-container" + + command = [ + "sh", + "-c", + "while true; do sleep 30; done;" + ] + } + } -# Wait condition for all Pods to be ready before finishing -resource "null_resource" "wait_conditions" { provisioner "local-exec" { interpreter = ["bash", "-exc"] - command = "kubectl wait --for=condition=ready pods --all -n ${var.namespace} --timeout=-1s 2> /dev/null" + command = "kubectl wait --for=condition=ready pod/wait-pod -n ${var.namespace} --timeout=-1s 2> /dev/null" } depends_on = [ - resource.null_resource.apply_deployment + kubernetes_manifest.apply_deployment, ] } + diff --git a/terraform/memorystore.tf b/terraform/memorystore.tf index f7a1eea8498..3ee21de707f 100644 --- a/terraform/memorystore.tf +++ b/terraform/memorystore.tf @@ -13,6 +13,7 @@ # limitations under the License. # Create the Memorystore (redis) instance +/* resource "google_redis_instance" "redis-cart" { name = "redis-cart" memory_size_gb = 1 @@ -45,3 +46,4 @@ resource "null_resource" "kustomization-update" { resource.google_redis_instance.redis-cart ] } +*/ \ No newline at end of file diff --git a/terraform/output.tf b/terraform/output.tf deleted file mode 100644 index 3425981026e..00000000000 --- a/terraform/output.tf +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -output "cluster_location" { - description = "Location of the cluster" - value = resource.google_container_cluster.my_cluster.location -} - -output "cluster_name" { - description = "Name of the cluster" - value = resource.google_container_cluster.my_cluster.name -} diff --git a/terraform/providers.tf b/terraform/providers.tf index 244cb519910..c2e7b213871 100644 --- a/terraform/providers.tf +++ b/terraform/providers.tf @@ -14,14 +14,32 @@ terraform { required_providers { - google = { - source = "hashicorp/google" - version = "4.47.0" + aws = { + source = "hashicorp/aws" + version = "~> 5.0" } } } - -provider "google" { - project = var.gcp_project_id - region = var.region +terraform { + required_providers { + kubectl = { + source = "gavinbunney/kubectl" + version = ">= 1.14.0" + } + helm = { + source = "hashicorp/helm" + version = ">= 2.6.0" + } + } +} +provider "helm" { + kubernetes { + host = data.aws_eks_cluster.default.endpoint + cluster_ca_certificate = base64decode(data.aws_eks_cluster.default.certificate_authority[0].data) + exec { + api_version = "client.authentication.k8s.io/v1beta1" + args = ["eks", "get-token", "--cluster-name", data.aws_eks_cluster.default.id] + command = "aws" + } + } } diff --git a/terraform/terraform.tfvars b/terraform/terraform.tfvars deleted file mode 100644 index d83605bad42..00000000000 --- a/terraform/terraform.tfvars +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -gcp_project_id = "" - -memorystore = false diff --git a/terraform/variables.tf b/terraform/variables.tf index 90236ff8181..d5b76c182f6 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -12,36 +12,32 @@ # See the License for the specific language governing permissions and # limitations under the License. -variable "gcp_project_id" { +variable "aws_region" { + description = "AWS region for the resources." type = string - description = "The GCP project ID to apply this config to" +default = us-east-1 } -variable "name" { +variable "cluster_name" { + description = "EKS cluster name." type = string - description = "Name given to the new GKE cluster" - default = "online-boutique" +default = "online-boutique" } -variable "region" { - type = string - description = "Region of the new GKE cluster" - default = "us-central1" -} - -variable "namespace" { - type = string - description = "Kubernetes Namespace in which the Online Boutique resources are to be deployed" - default = "default" +variable "subnet_ids" { + description = "List of subnet IDs in which to place the EKS cluster." + type = list(string) +default = module.vpc.private_subnets } variable "filepath_manifest" { + description = "Path to the Kubernetes manifest file to apply." type = string - description = "Path to Online Boutique's Kubernetes resources, written using Kustomize" - default = "../kustomize/" +default = "../kustomize/" } -variable "memorystore" { - type = bool - description = "If true, Online Boutique's in-cluster Redis cache will be replaced with a Google Cloud Memorystore Redis cache" +variable "namespace" { + description = "Kubernetes namespace to apply the manifest to." + type = string +default = "default" } diff --git a/terraform/vpc.tf b/terraform/vpc.tf new file mode 100644 index 00000000000..6f12d07ab91 --- /dev/null +++ b/terraform/vpc.tf @@ -0,0 +1,98 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +module "vpc" { + source = "terraform-aws-modules/vpc/aws" + version = "3.14.3" + + name = "main" + cidr = "10.0.0.0/16" + + azs = ["us-east-1a", "us-east-1b"] + private_subnets = ["10.0.0.0/19", "10.0.32.0/19"] + public_subnets = ["10.0.64.0/19", "10.0.96.0/19"] + + public_subnet_tags = { + "kubernetes.io/role/elb" = "1" + } + private_subnet_tags = { + "kubernetes.io/role/internal-elb" = "1" + } + + enable_nat_gateway = true + single_nat_gateway = true + one_nat_gateway_per_az = false + + enable_dns_hostnames = true + enable_dns_support = true + + tags = { + Environment = "staging" + } +} + +enable_irsa = true + + eks_managed_node_group_defaults = { + disk_size = 50 + } + + eks_managed_node_groups = { + general = { + desired_size = 1 + min_size = 1 + max_size = 10 + + labels = { + role = "general" + } + + instance_types = ["t3.small"] + capacity_type = "ON_DEMAND" + } + + spot = { + desired_size = 1 + min_size = 1 + max_size = 10 + + labels = { + role = "spot" + } + + taints = [{ + key = "market" + value = "spot" + effect = "NO_SCHEDULE" + }] + + instance_types = ["t3.micro"] + capacity_type = "SPOT" + } + } + + node_security_group_additional_rules = { + ingress_allow_access_from_control_plane = { + type = "ingress" + protocol = "tcp" + from_port = 9443 + to_port = 9443 + source_cluster_security_group = true + description = "Allow access from control plane to webhook port of AWS load balancer controller" + } + } + + tags = { + Environment = "staging" + } \ No newline at end of file From 3e0930c4fe956fef3ea8bf0f1875b07318a454c1 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 2 Aug 2023 07:53:48 +0000 Subject: [PATCH 7/8] update terraform files, and updated microservices yaml files in base folder under Kustomize with ECR url --- kustomize/base/adservice.yaml | 2 +- kustomize/base/cartservice.yaml | 3 +-- kustomize/base/checkoutservice.yaml | 2 +- kustomize/base/currencyservice.yaml | 2 +- kustomize/base/emailservice.yaml | 2 +- kustomize/base/frontend.yaml | 2 +- kustomize/base/paymentservice.yaml | 2 +- kustomize/base/productcatalogservice.yaml | 2 +- kustomize/base/recommendationservice.yaml | 2 +- kustomize/base/shippingservice.yaml | 2 +- 10 files changed, 10 insertions(+), 11 deletions(-) diff --git a/kustomize/base/adservice.yaml b/kustomize/base/adservice.yaml index e981067f166..64e280f101b 100644 --- a/kustomize/base/adservice.yaml +++ b/kustomize/base/adservice.yaml @@ -41,7 +41,7 @@ spec: - all privileged: false readOnlyRootFilesystem: true - image: gcr.io/google-samples/microservices-demo/adservice:v0.5.0 + image: 240763333586.dkr.ecr.us-east-1.amazonaws.com/adservice:latest ports: - containerPort: 9555 env: diff --git a/kustomize/base/cartservice.yaml b/kustomize/base/cartservice.yaml index 154cf8b8072..fde49ee10dd 100644 --- a/kustomize/base/cartservice.yaml +++ b/kustomize/base/cartservice.yaml @@ -41,8 +41,7 @@ spec: - all privileged: false readOnlyRootFilesystem: true - image: gcr.io/google-samples/microservices-demo/cartservice:v0.5.0 - ports: + image: 240763333586.dkr.ecr.us-east-1.amazonaws.com/cartservice:latest - containerPort: 7070 env: - name: REDIS_ADDR diff --git a/kustomize/base/checkoutservice.yaml b/kustomize/base/checkoutservice.yaml index 93b23f0c1f0..167ecc1a66c 100644 --- a/kustomize/base/checkoutservice.yaml +++ b/kustomize/base/checkoutservice.yaml @@ -40,7 +40,7 @@ spec: - all privileged: false readOnlyRootFilesystem: true - image: gcr.io/google-samples/microservices-demo/checkoutservice:v0.5.0 + image: 240763333586.dkr.ecr.us-east-1.amazonaws.com/checkoutservice:latest ports: - containerPort: 5050 readinessProbe: diff --git a/kustomize/base/currencyservice.yaml b/kustomize/base/currencyservice.yaml index 7045bdbf58a..bfbfd9637d7 100644 --- a/kustomize/base/currencyservice.yaml +++ b/kustomize/base/currencyservice.yaml @@ -41,7 +41,7 @@ spec: - all privileged: false readOnlyRootFilesystem: true - image: gcr.io/google-samples/microservices-demo/currencyservice:v0.5.0 + image: 240763333586.dkr.ecr.us-east-1.amazonaws.com/currencyservice:latest ports: - name: grpc containerPort: 7000 diff --git a/kustomize/base/emailservice.yaml b/kustomize/base/emailservice.yaml index 99adbee0eaf..ecef9802ffc 100644 --- a/kustomize/base/emailservice.yaml +++ b/kustomize/base/emailservice.yaml @@ -41,7 +41,7 @@ spec: - all privileged: false readOnlyRootFilesystem: true - image: gcr.io/google-samples/microservices-demo/emailservice:v0.5.0 + image: 240763333586.dkr.ecr.us-east-1.amazonaws.com/emailservice:latest ports: - containerPort: 8080 env: diff --git a/kustomize/base/frontend.yaml b/kustomize/base/frontend.yaml index c96ce7654c8..00676310224 100644 --- a/kustomize/base/frontend.yaml +++ b/kustomize/base/frontend.yaml @@ -42,7 +42,7 @@ spec: - all privileged: false readOnlyRootFilesystem: true - image: gcr.io/google-samples/microservices-demo/frontend:v0.5.0 + image: 240763333586.dkr.ecr.us-east-1.amazonaws.com/frontend:latest ports: - containerPort: 8080 readinessProbe: diff --git a/kustomize/base/paymentservice.yaml b/kustomize/base/paymentservice.yaml index b46c3606c4f..1d3ebd11195 100644 --- a/kustomize/base/paymentservice.yaml +++ b/kustomize/base/paymentservice.yaml @@ -41,7 +41,7 @@ spec: - all privileged: false readOnlyRootFilesystem: true - image: gcr.io/google-samples/microservices-demo/paymentservice:v0.5.0 + image: 240763333586.dkr.ecr.us-east-1.amazonaws.com/paymentservice:latest ports: - containerPort: 50051 env: diff --git a/kustomize/base/productcatalogservice.yaml b/kustomize/base/productcatalogservice.yaml index 9a6a30fd228..89e81592910 100644 --- a/kustomize/base/productcatalogservice.yaml +++ b/kustomize/base/productcatalogservice.yaml @@ -41,7 +41,7 @@ spec: - all privileged: false readOnlyRootFilesystem: true - image: gcr.io/google-samples/microservices-demo/productcatalogservice:v0.5.0 + image: 240763333586.dkr.ecr.us-east-1.amazonaws.com/productcatalogservice:latest ports: - containerPort: 3550 env: diff --git a/kustomize/base/recommendationservice.yaml b/kustomize/base/recommendationservice.yaml index e889b806a15..5b3213549b2 100644 --- a/kustomize/base/recommendationservice.yaml +++ b/kustomize/base/recommendationservice.yaml @@ -41,7 +41,7 @@ spec: - all privileged: false readOnlyRootFilesystem: true - image: gcr.io/google-samples/microservices-demo/recommendationservice:v0.5.0 + image: 240763333586.dkr.ecr.us-east-1.amazonaws.com/recommendationservice:latest ports: - containerPort: 8080 readinessProbe: diff --git a/kustomize/base/shippingservice.yaml b/kustomize/base/shippingservice.yaml index 0e6fd82d207..77d5f754ec8 100644 --- a/kustomize/base/shippingservice.yaml +++ b/kustomize/base/shippingservice.yaml @@ -40,7 +40,7 @@ spec: - all privileged: false readOnlyRootFilesystem: true - image: gcr.io/google-samples/microservices-demo/shippingservice:v0.5.0 + image: 240763333586.dkr.ecr.us-east-1.amazonaws.com/shippingservice:latest ports: - containerPort: 50051 env: From a6aeab6b900c19b181b14ec52958576a607a2512 Mon Sep 17 00:00:00 2001 From: Giantlife Date: Wed, 2 Aug 2023 08:02:49 +0000 Subject: [PATCH 8/8] update terraform files, and updated microservices yaml files in base folder under Kustomize with ECR url --- src/checkoutservice/protoc-gen-go | 1121 +++++++++++++++++++++++ src/shippingservice/genproto/demo.pb.go | 315 ++++--- terraform.sh | 11 + terraform/main.tf | 46 +- terraform/providers.tf | 36 +- terraform/variables.tf | 5 +- terraform/vpc.tf | 143 +-- 7 files changed, 1440 insertions(+), 237 deletions(-) create mode 100644 src/checkoutservice/protoc-gen-go create mode 100755 terraform.sh diff --git a/src/checkoutservice/protoc-gen-go b/src/checkoutservice/protoc-gen-go new file mode 100644 index 00000000000..7e598459145 --- /dev/null +++ b/src/checkoutservice/protoc-gen-go @@ -0,0 +1,1121 @@ + + + + + + + + + + + + + + + + + + + + + + + protoc-gen-go command - google.golang.org/protobuf/cmd/protoc-gen-go - Go Packages + + + + + + + + + + + + +

+
+ +
+
+ + + + +
+ +
+ + + + +
+ +
+ +

protoc-gen-go

+ + command + + + + + + +
+ + +
+ + + + Version: v1.31.0 + + + Latest + + Latest + +
+ + Warning + +

This package is not in the latest version of its module.

+
+ +
+ + Go to latest + +
+
+ + + + Published: Jun 26, 2023 + + + + + License: BSD-3-Clause + + + + + + + + + Imports: 8 + + + + + + + Imported by: 42 + + + + + +
+ +
+ + + + + +
+ + +
+ +
+ + +
+
+
+ + + + +
+

+ + Documentation + +

+ + + + + +
+ + + +
+

Overview

+ +

The protoc-gen-go binary is a protoc plugin to generate Go code for +both proto2 and proto3 versions of the protocol buffer language. +

For more information about the usage of this plugin, see: +https://protobuf.dev/reference/go/go-generated. +

+
+ + + + + + + +
+
+ + + + + +
+

+ + Source Files + +

+ +
+ +
+
+ + + + +
+

+ + Directories + +

+
+
+ + +
+
+ + + + + + + + + + + + + +
PathSynopsis
+
+ +
Package internal_gengo is internal to the protobuf module.
+
+
Package internal_gengo is internal to the protobuf module.
+
+ + +
+
+
+
+
+ + + + + + +
+
+

Jump to

+ +
+
+ +
+
+
+
+
+ +
+
+
+ + +
+
+

Keyboard shortcuts

+ +
+
+ + + + + + + + + + + + + +
+ ? : This menu
+ / : Search site
+ f or F : Jump to
y or Y : Canonical URL
+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + diff --git a/src/shippingservice/genproto/demo.pb.go b/src/shippingservice/genproto/demo.pb.go index 05ee3ab78a7..d5837078a91 100644 --- a/src/shippingservice/genproto/demo.pb.go +++ b/src/shippingservice/genproto/demo.pb.go @@ -1,31 +1,16 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - // Code generated by protoc-gen-go. DO NOT EDIT. // source: demo.proto package hipstershop import ( + context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" - math "math" -) - -import ( - context "golang.org/x/net/context" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" ) // Reference imports to suppress errors if they are not otherwise used. @@ -37,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type CartItem struct { ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` @@ -1595,6 +1580,106 @@ func init() { proto.RegisterType((*Ad)(nil), "hipstershop.Ad") } +func init() { proto.RegisterFile("demo.proto", fileDescriptor_ca53982754088a9d) } + +var fileDescriptor_ca53982754088a9d = []byte{ + // 1500 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xef, 0x72, 0x13, 0xb7, + 0x16, 0xcf, 0x26, 0xb1, 0x1d, 0x1f, 0xc7, 0x4e, 0xa2, 0x9b, 0x04, 0xb3, 0x81, 0x10, 0x94, 0x81, + 0x0b, 0x17, 0x08, 0x4c, 0xee, 0x9d, 0xe1, 0x03, 0xdc, 0xd2, 0x8c, 0xc9, 0x18, 0x4f, 0xa1, 0xd0, + 0x0d, 0xe9, 0xd0, 0xa1, 0x53, 0xcf, 0xb2, 0x12, 0xf1, 0x96, 0xec, 0x6a, 0x91, 0xb4, 0x19, 0xcc, + 0xc7, 0xf6, 0x01, 0xfa, 0x1e, 0x7d, 0x81, 0xce, 0xf4, 0x11, 0xfa, 0xbd, 0xaf, 0xd0, 0xe7, 0xe8, + 0x48, 0xbb,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0xb7, + 0x03, 0x0d, 0x4e, 0x45, 0x7c, 0x7c, 0x0e, 0x3d, 0x03, 0xc2, 0x21, 0x2c, 0xf5, 0xa9, 0xfc, 0x26, + 0x66, 0x92, 0x1a, 0x93, 0x3b, 0xd0, 0x70, 0x09, 0xe1, 0x54, 0x08, 0x6d, 0xb4, 0xaa, 0x62, 0x2f, + 0xd9, 0x73, 0x0c, 0xe8, 0xf3, 0xa2, 0x76, 0x0f, 0x96, 0x73, 0x7b, 0x29, 0xe7, 0x3b, 0xb0, 0xe0, + 0x31, 0x21, 0xf5, 0xdb, 0x59, 0x53, 0xdf, 0xae, 0xa1, 0x30, 0x87, 0x82, 0x60, 0x06, 0xcb, 0x07, + 0x23, 0x3f, 0x7a, 0xce, 0x09, 0xe5, 0xff, 0x08, 0xe7, 0xff, 0xc1, 0x4a, 0xc1, 0x60, 0x1e, 0xfe, + 0x92, 0xbb, 0xde, 0x3b, 0x3f, 0x3c, 0xca, 0x73, 0x0b, 0x8c, 0x68, 0x40, 0xf0, 0x2f, 0x16, 0x34, + 0x52, 0xbb, 0xe8, 0x1a, 0x74, 0x84, 0xe4, 0x94, 0xca, 0x61, 0x91, 0x65, 0xd3, 0x69, 0x27, 0x52, + 0x03, 0x43, 0x30, 0xef, 0x99, 0x32, 0xd7, 0x74, 0xf4, 0xb7, 0x0a, 0x00, 0x21, 0x5d, 0x49, 0xd3, + 0x7c, 0x48, 0x16, 0x2a, 0x13, 0x3c, 0x16, 0x87, 0x92, 0x8f, 0x4d, 0x26, 0xa4, 0x4b, 0x74, 0x11, + 0x16, 0x3e, 0xfa, 0xd1, 0xd0, 0x63, 0x84, 0xea, 0x44, 0xa8, 0x39, 0x8d, 0x8f, 0x7e, 0xd4, 0x63, + 0x84, 0xe2, 0x57, 0x50, 0xd3, 0xae, 0x44, 0xdb, 0xd0, 0xf6, 0x62, 0xce, 0x69, 0xe8, 0x8d, 0x13, + 0x60, 0xc2, 0x66, 0xd1, 0x08, 0x15, 0x5a, 0x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, 0xe1, 0x19, 0xd4, 0x87, 0x46, 0x32, 0xf0, 0x48, 0x74, 0xbd, 0x9c, 0x0b, 0xd3, 0xc6, 0x21, + 0x7b, 0x42, 0x73, 0xc1, 0x33, 0xbb, 0x87, 0xd0, 0x79, 0xe1, 0x8e, 0x03, 0x1a, 0x66, 0x19, 0xdc, + 0x83, 0x7a, 0xd2, 0x91, 0x91, 0x5d, 0xd6, 0x5c, 0x9c, 0x10, 0xec, 0x8d, 0x89, 0x7b, 0x99, 0x43, + 0x46, 0xb0, 0xb8, 0xaf, 0x2a, 0xa8, 0x51, 0xfa, 0x4a, 0xfd, 0x60, 0x99, 0xd0, 0x48, 0xd0, 0xcd, + 0x4a, 0x34, 0x4c, 0x6f, 0x36, 0x53, 0x72, 0xf6, 0x0d, 0x2c, 0xf5, 0x46, 0xd4, 0x7b, 0xc7, 0xe2, + 0xec, 0x06, 0xcf, 0x01, 0xf2, 0xba, 0x5b, 0x89, 0xee, 0x53, 0x7d, 0xc6, 0xbe, 0x32, 0x75, 0x3f, + 0xbb, 0xcd, 0x13, 0x55, 0x82, 0x8d, 0xf6, 0x07, 0x50, 0xef, 0xab, 0x19, 0x5c, 0xa0, 0xf5, 0x6a, + 0x39, 0x4d, 0x35, 0x5e, 0x38, 0x25, 0x37, 0x9a, 0xde, 0xd4, 0xf5, 0x9f, 0x1b, 0xff, 0xfd, 0x3b, + 0x00, 0x00, 0xff, 0xff, 0xb2, 0xa0, 0x6e, 0x6c, 0xea, 0x10, 0x00, 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -1654,6 +1739,20 @@ type CartServiceServer interface { EmptyCart(context.Context, *EmptyCartRequest) (*Empty, error) } +// UnimplementedCartServiceServer can be embedded to have forward compatible implementations. +type UnimplementedCartServiceServer struct { +} + +func (*UnimplementedCartServiceServer) AddItem(ctx context.Context, req *AddItemRequest) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddItem not implemented") +} +func (*UnimplementedCartServiceServer) GetCart(ctx context.Context, req *GetCartRequest) (*Cart, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCart not implemented") +} +func (*UnimplementedCartServiceServer) EmptyCart(ctx context.Context, req *EmptyCartRequest) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method EmptyCart not implemented") +} + func RegisterCartServiceServer(s *grpc.Server, srv CartServiceServer) { s.RegisterService(&_CartService_serviceDesc, srv) } @@ -1762,6 +1861,14 @@ type RecommendationServiceServer interface { ListRecommendations(context.Context, *ListRecommendationsRequest) (*ListRecommendationsResponse, error) } +// UnimplementedRecommendationServiceServer can be embedded to have forward compatible implementations. +type UnimplementedRecommendationServiceServer struct { +} + +func (*UnimplementedRecommendationServiceServer) ListRecommendations(ctx context.Context, req *ListRecommendationsRequest) (*ListRecommendationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRecommendations not implemented") +} + func RegisterRecommendationServiceServer(s *grpc.Server, srv RecommendationServiceServer) { s.RegisterService(&_RecommendationService_serviceDesc, srv) } @@ -1848,6 +1955,20 @@ type ProductCatalogServiceServer interface { SearchProducts(context.Context, *SearchProductsRequest) (*SearchProductsResponse, error) } +// UnimplementedProductCatalogServiceServer can be embedded to have forward compatible implementations. +type UnimplementedProductCatalogServiceServer struct { +} + +func (*UnimplementedProductCatalogServiceServer) ListProducts(ctx context.Context, req *Empty) (*ListProductsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListProducts not implemented") +} +func (*UnimplementedProductCatalogServiceServer) GetProduct(ctx context.Context, req *GetProductRequest) (*Product, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetProduct not implemented") +} +func (*UnimplementedProductCatalogServiceServer) SearchProducts(ctx context.Context, req *SearchProductsRequest) (*SearchProductsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchProducts not implemented") +} + func RegisterProductCatalogServiceServer(s *grpc.Server, srv ProductCatalogServiceServer) { s.RegisterService(&_ProductCatalogService_serviceDesc, srv) } @@ -1967,6 +2088,17 @@ type ShippingServiceServer interface { ShipOrder(context.Context, *ShipOrderRequest) (*ShipOrderResponse, error) } +// UnimplementedShippingServiceServer can be embedded to have forward compatible implementations. +type UnimplementedShippingServiceServer struct { +} + +func (*UnimplementedShippingServiceServer) GetQuote(ctx context.Context, req *GetQuoteRequest) (*GetQuoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetQuote not implemented") +} +func (*UnimplementedShippingServiceServer) ShipOrder(ctx context.Context, req *ShipOrderRequest) (*ShipOrderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ShipOrder not implemented") +} + func RegisterShippingServiceServer(s *grpc.Server, srv ShippingServiceServer) { s.RegisterService(&_ShippingService_serviceDesc, srv) } @@ -2064,6 +2196,17 @@ type CurrencyServiceServer interface { Convert(context.Context, *CurrencyConversionRequest) (*Money, error) } +// UnimplementedCurrencyServiceServer can be embedded to have forward compatible implementations. +type UnimplementedCurrencyServiceServer struct { +} + +func (*UnimplementedCurrencyServiceServer) GetSupportedCurrencies(ctx context.Context, req *Empty) (*GetSupportedCurrenciesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSupportedCurrencies not implemented") +} +func (*UnimplementedCurrencyServiceServer) Convert(ctx context.Context, req *CurrencyConversionRequest) (*Money, error) { + return nil, status.Errorf(codes.Unimplemented, "method Convert not implemented") +} + func RegisterCurrencyServiceServer(s *grpc.Server, srv CurrencyServiceServer) { s.RegisterService(&_CurrencyService_serviceDesc, srv) } @@ -2150,6 +2293,14 @@ type PaymentServiceServer interface { Charge(context.Context, *ChargeRequest) (*ChargeResponse, error) } +// UnimplementedPaymentServiceServer can be embedded to have forward compatible implementations. +type UnimplementedPaymentServiceServer struct { +} + +func (*UnimplementedPaymentServiceServer) Charge(ctx context.Context, req *ChargeRequest) (*ChargeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Charge not implemented") +} + func RegisterPaymentServiceServer(s *grpc.Server, srv PaymentServiceServer) { s.RegisterService(&_PaymentService_serviceDesc, srv) } @@ -2214,6 +2365,14 @@ type EmailServiceServer interface { SendOrderConfirmation(context.Context, *SendOrderConfirmationRequest) (*Empty, error) } +// UnimplementedEmailServiceServer can be embedded to have forward compatible implementations. +type UnimplementedEmailServiceServer struct { +} + +func (*UnimplementedEmailServiceServer) SendOrderConfirmation(ctx context.Context, req *SendOrderConfirmationRequest) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendOrderConfirmation not implemented") +} + func RegisterEmailServiceServer(s *grpc.Server, srv EmailServiceServer) { s.RegisterService(&_EmailService_serviceDesc, srv) } @@ -2278,6 +2437,14 @@ type CheckoutServiceServer interface { PlaceOrder(context.Context, *PlaceOrderRequest) (*PlaceOrderResponse, error) } +// UnimplementedCheckoutServiceServer can be embedded to have forward compatible implementations. +type UnimplementedCheckoutServiceServer struct { +} + +func (*UnimplementedCheckoutServiceServer) PlaceOrder(ctx context.Context, req *PlaceOrderRequest) (*PlaceOrderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PlaceOrder not implemented") +} + func RegisterCheckoutServiceServer(s *grpc.Server, srv CheckoutServiceServer) { s.RegisterService(&_CheckoutService_serviceDesc, srv) } @@ -2342,6 +2509,14 @@ type AdServiceServer interface { GetAds(context.Context, *AdRequest) (*AdResponse, error) } +// UnimplementedAdServiceServer can be embedded to have forward compatible implementations. +type UnimplementedAdServiceServer struct { +} + +func (*UnimplementedAdServiceServer) GetAds(ctx context.Context, req *AdRequest) (*AdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAds not implemented") +} + func RegisterAdServiceServer(s *grpc.Server, srv AdServiceServer) { s.RegisterService(&_AdService_serviceDesc, srv) } @@ -2376,103 +2551,3 @@ var _AdService_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "demo.proto", } - -func init() { proto.RegisterFile("demo.proto", fileDescriptor_ca53982754088a9d) } - -var fileDescriptor_ca53982754088a9d = []byte{ - // 1500 bytes of a gzipped FileD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55, 0x82, 0x8d, 0xf6, 0x07, 0x50, 0xef, 0xab, 0x19, 0x5c, 0xa0, 0xf5, 0x6a, - 0x39, 0x4d, 0x35, 0x5e, 0x38, 0x25, 0x37, 0x9a, 0xde, 0xd4, 0xf5, 0x9f, 0x1b, 0xff, 0xfd, 0x3b, - 0x00, 0x00, 0xff, 0xff, 0xb2, 0xa0, 0x6e, 0x6c, 0xea, 0x10, 0x00, 0x00, -} diff --git a/terraform.sh b/terraform.sh new file mode 100755 index 00000000000..84093462eb4 --- /dev/null +++ b/terraform.sh @@ -0,0 +1,11 @@ + +#! /bin/bash +sudo apt-get update && sudo apt-get install -y gnupg software-properties-common +sudo apt update && sudo apt install gpg + wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg + gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint +echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list +sudo apt update +sudo apt install terraform +terraform version + diff --git a/terraform/main.tf b/terraform/main.tf index e36da7309da..7a972d60e42 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -1,8 +1,4 @@ # Define the required providers -provider "aws" { - region = var.aws_region - -} # Create an AWS EKS cluster resource "aws_eks_cluster" "my_cluster" { @@ -36,6 +32,7 @@ resource "aws_iam_role" "eks_cluster" { }) } + # Attach the required IAM policy to the EKS cluster role resource "aws_iam_role_policy_attachment" "eks_cluster" { policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy" @@ -51,45 +48,34 @@ provider "kubernetes" { host = data.aws_eks_cluster.my_cluster.endpoint cluster_ca_certificate = base64decode(data.aws_eks_cluster.my_cluster.certificate_authority.0.data) token = data.aws_eks_cluster_auth.my_cluster.token - load_config_file = false } data "aws_eks_cluster_auth" "my_cluster" { name = aws_eks_cluster.my_cluster.name } -# Apply Kubernetes manifest configurations -resource "kubernetes_manifest" "apply_deployment" { - config_path = var.filepath_manifest -} - -# Wait for all Pods to be ready before finishing -resource "kubernetes_pod" "wait_conditions" { - metadata { - namespace = var.namespace - name = "wait-pod" +/* +# Apply YAML Kubernetes-manifest configurations using kubectl +resource "null_resource" "apply_deployment" { + provisioner "local-exec" { + interpreter = ["bash", "-exc"] + command = "kubectl apply -f ${var.filepath_manifest}" } - spec { - container { - image = "busybox" - name = "wait-container" - - command = [ - "sh", - "-c", - "while true; do sleep 30; done;" - ] - } - } + depends_on = [ + provider.kubectl, + ] +} +# Wait condition for all Pods to be ready before finishing +resource "null_resource" "wait_conditions" { provisioner "local-exec" { interpreter = ["bash", "-exc"] - command = "kubectl wait --for=condition=ready pod/wait-pod -n ${var.namespace} --timeout=-1s 2> /dev/null" + command = "kubectl wait --for=condition=ready pods --all -n ${var.namespace} --timeout=-1s 2> /dev/null" } depends_on = [ - kubernetes_manifest.apply_deployment, + resource.null_resource.apply_deployment, ] } - +*/ \ No newline at end of file diff --git a/terraform/providers.tf b/terraform/providers.tf index c2e7b213871..d4e75706488 100644 --- a/terraform/providers.tf +++ b/terraform/providers.tf @@ -14,14 +14,11 @@ terraform { required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 5.0" + aws = { + source = "hashicorp/aws" + version = "5.10.0" } - } -} -terraform { - required_providers { + kubectl = { source = "gavinbunney/kubectl" version = ">= 1.14.0" @@ -30,16 +27,21 @@ terraform { source = "hashicorp/helm" version = ">= 2.6.0" } - } -} -provider "helm" { - kubernetes { - host = data.aws_eks_cluster.default.endpoint - cluster_ca_certificate = base64decode(data.aws_eks_cluster.default.certificate_authority[0].data) - exec { - api_version = "client.authentication.k8s.io/v1beta1" - args = ["eks", "get-token", "--cluster-name", data.aws_eks_cluster.default.id] - command = "aws" + + tls = { + source = "hashicorp/tls" + version = "~> 4.0.4" + } + + cloudinit = { + source = "hashicorp/cloudinit" + version = "~> 2.3.2" + } + random = { + source = "hashicorp/random" + version = "~> 3.5.1" } + } } + diff --git a/terraform/variables.tf b/terraform/variables.tf index d5b76c182f6..c232c377008 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -15,7 +15,7 @@ variable "aws_region" { description = "AWS region for the resources." type = string -default = us-east-1 + default = "us-east-1" } variable "cluster_name" { @@ -27,13 +27,12 @@ default = "online-boutique" variable "subnet_ids" { description = "List of subnet IDs in which to place the EKS cluster." type = list(string) -default = module.vpc.private_subnets } variable "filepath_manifest" { description = "Path to the Kubernetes manifest file to apply." type = string -default = "../kustomize/" +default = "../kustomize/base/" } variable "namespace" { diff --git a/terraform/vpc.tf b/terraform/vpc.tf index 6f12d07ab91..080d4af09d0 100644 --- a/terraform/vpc.tf +++ b/terraform/vpc.tf @@ -1,98 +1,107 @@ -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +data "aws_availability_zones" "available" {} + +locals { + cluster_name = "education-eks-${random_string.suffix.result}" +} + +resource "random_string" "suffix" { + length = 8 + special = false +} module "vpc" { source = "terraform-aws-modules/vpc/aws" - version = "3.14.3" + version = "5.0.0" + + name = "education-vpc" - name = "main" cidr = "10.0.0.0/16" + azs = slice(data.aws_availability_zones.available.names, 0, 3) + + private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"] + public_subnets = ["10.0.4.0/24", "10.0.5.0/24", "10.0.6.0/24"] - azs = ["us-east-1a", "us-east-1b"] - private_subnets = ["10.0.0.0/19", "10.0.32.0/19"] - public_subnets = ["10.0.64.0/19", "10.0.96.0/19"] + enable_nat_gateway = true + single_nat_gateway = true + enable_dns_hostnames = true public_subnet_tags = { - "kubernetes.io/role/elb" = "1" + "kubernetes.io/cluster/${local.cluster_name}" = "shared" + "kubernetes.io/role/elb" = 1 } + private_subnet_tags = { - "kubernetes.io/role/internal-elb" = "1" + "kubernetes.io/cluster/${local.cluster_name}" = "shared" + "kubernetes.io/role/internal-elb" = 1 } +} - enable_nat_gateway = true - single_nat_gateway = true - one_nat_gateway_per_az = false - - enable_dns_hostnames = true - enable_dns_support = true +module "eks" { + source = "terraform-aws-modules/eks/aws" + version = "19.15.3" - tags = { - Environment = "staging" - } -} + cluster_name = local.cluster_name + cluster_version = "1.27" -enable_irsa = true + vpc_id = module.vpc.vpc_id + subnet_ids = module.vpc.private_subnets + cluster_endpoint_public_access = true eks_managed_node_group_defaults = { - disk_size = 50 + ami_type = "AL2_x86_64" + } eks_managed_node_groups = { - general = { - desired_size = 1 - min_size = 1 - max_size = 10 - - labels = { - role = "general" - } + one = { + name = "node-group-1" instance_types = ["t3.small"] - capacity_type = "ON_DEMAND" - } - spot = { - desired_size = 1 min_size = 1 - max_size = 10 + max_size = 3 + desired_size = 2 + } - labels = { - role = "spot" - } + two = { + name = "node-group-2" - taints = [{ - key = "market" - value = "spot" - effect = "NO_SCHEDULE" - }] + instance_types = ["t3.small"] - instance_types = ["t3.micro"] - capacity_type = "SPOT" + min_size = 1 + max_size = 2 + desired_size = 1 } } +} - node_security_group_additional_rules = { - ingress_allow_access_from_control_plane = { - type = "ingress" - protocol = "tcp" - from_port = 9443 - to_port = 9443 - source_cluster_security_group = true - description = "Allow access from control plane to webhook port of AWS load balancer controller" - } - } +# https://aws.amazon.com/blogs/containers/amazon-ebs-csi-driver-is-now-generally-available-in-amazon-eks-add-ons/ +data "aws_iam_policy" "ebs_csi_policy" { + arn = "arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy" +} + +module "irsa-ebs-csi" { + source = "terraform-aws-modules/iam/aws//modules/iam-assumable-role-with-oidc" + version = "4.7.0" + + create_role = true + role_name = "AmazonEKSTFEBSCSIRole-${module.eks.cluster_name}" + provider_url = module.eks.oidc_provider + role_policy_arns = [data.aws_iam_policy.ebs_csi_policy.arn] + oidc_fully_qualified_subjects = ["system:serviceaccount:kube-system:ebs-csi-controller-sa"] +} + +resource "aws_eks_addon" "ebs-csi" { + cluster_name = module.eks.cluster_name + addon_name = "aws-ebs-csi-driver" + addon_version = "v1.20.0-eksbuild.1" + service_account_role_arn = module.irsa-ebs-csi.iam_role_arn tags = { - Environment = "staging" - } \ No newline at end of file + "eks_addon" = "ebs-csi" + "terraform" = "true" + } +} \ No newline at end of file