Code Monkey home page Code Monkey logo

cap-terraform's Introduction

End-to-end CAP deployment for public cloud platforms with Terraform

The goal is to setup a cluster, configure dependencies(storage classes, helm 3) and perform helm installs for CAP, Stratos and Metrics. In cap-1.5.x, UAA and SCF are deployed with an nginx Ingress Controller but Stratos and Metrics are deployed with LoadBalancer services. Let's Encrypt issued certificates are used for UAA/SCF but self-signed certificates are used for Stratos and Metrics deployments.

For cap-2.x you must use Terraform 0.13. The CAP, Stratos and Metrics services are exposed through a single Ingress Controller with different ingress rules. The top-level domain is the same for all deployments, Stratos is deployed with a stratos subdomain and Metrics with a metrics subdomain so they can be accessed at stratos.yourdomain.com and metrics.yourdomain.com FQDNs. Let's Encrypt certificates are issued for CAP, Stratos and Metrics.

The inputs are provided through terraform variables (for use with blue-horizon). For details on how to use the templates for specific providers see the respective READMEs in the provider directories.

cap-terraform's People

Contributors

bear454 avatar fargozhu avatar prabalsharma avatar rasadus03 avatar satadruroy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cap-terraform's Issues

Will EKS be supported?

I think most of the activity we're hearing about is on EKS and the QS may not be renewed for 1.5 in favor of TF. If e2e supported EKS then I believe we'd see heavy use.

nodes to join the cluster

provision nodes to attempt joining the cluster on EKS and this way remove the need of doing manually.

It was working on 0.11 scripts...

Validation warnings on AKS content

Warning: Interpolation-only expressions are deprecated

  on external-dns.tf line 18, in resource "helm_release" "external-dns":
  18:         value = "${kubernetes_secret.azure_dns_sp_creds.metadata.0.name}"

Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.

Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.

(and 25 more similar warnings elsewhere)


Warning: Quoted references are deprecated

  on external-dns.tf line 40, in resource "helm_release" "external-dns":
  40:     depends_on = ["kubernetes_cluster_role_binding.tiller"]

In this context, references are expected literally rather than in quotes.
Terraform 0.11 and earlier required quotes, but quoted references are now
deprecated and will be removed in a future version of Terraform. Remove the
quotes surrounding this reference to silence this warning.

(and 3 more similar warnings elsewhere)


Warning: Quoted type constraints are deprecated

  on variables.tf line 2, in variable "az_resource_group":
   2:     type = "string"

Terraform 0.11 and earlier required type constraints to be given in quotes,
but that form is now deprecated and will be removed in a future version of
Terraform. To silence this warning, remove the quotes around "string".

(and 9 more similar warnings elsewhere)

Reference to random_string resource not defined

Error: Reference to undeclared resource

  on modules/network/vpc.tf line 9, in locals:
   9:     cluster_name = "cap-${random_string.cluster_name.result}"

A managed resource "random_string" "cluster_name" has not been declared in
network.```

on  #12 

CAP end-to-end deployment requires some Route53 permissions, but none of the CAP documents explain what exactly

During execution of terraform plan I got following errors :

Error: Error fetching Availability Zones: UnauthorizedOperation: You are not authorized to perform this operation.
	status code: 403, request id: 17536565-dcb6-49c3-ab83-1f8f29a5f64f

  on providers.tf line 18, in data "aws_availability_zones" "available":
  18: data "aws_availability_zones" "available" {



Error: Error finding Route 53 Hosted Zone: AccessDenied: User: arn:aws:iam::598531485887:user/vault.publiccloud.qa.suse.de is not authorized to perform: route53:ListHostedZones
	status code: 403, request id: ee80b0aa-b77c-4fcc-bf5f-aaa2f9407d8a

  on modules/eks/worker-iam.tf line 2, in data "aws_route53_zone" "selected":
   2: data "aws_route53_zone" "selected" {



Error: Error fetching Availability Zones: UnauthorizedOperation: You are not authorized to perform this operation.
	status code: 403, request id: b16c1421-3af5-4802-be52-5bc6f3f93990

  on modules/network/vpc.tf line 20, in data "aws_availability_zones" "available":
  20: data "aws_availability_zones" "available" {}

so looks like credentials which I was using does not have proper permissions but I failed to find any document mentioning which exactly

Provide a storageclass named "persistent" on EKS

On EKS deployments, it would be nice to have a default storageclass named persistent, instead of gp2. That would bring consistency with the documentation, and allows to easily reuse existing automation without specific cases for EKS.

eks aws_auth configmap management may cause race conditions

I've encountered 2 race conditions recently that I believe have been caused by terraform's management of the aws-auth configmap here

In a recent CI-initiated terraform destroy, the following error was encountered:

...
module.eks.aws_security_group.aws-node: Still destroying... [id=sg-069b01ce27e2bffd3, 30m1s elapsed]
Error: Error deleting security group: DependencyViolation: resource sg-069b01ce27e2bffd3 has a dependent object
	status code: 400, request id: 11278f08-4336-4f13-b335-bf0dc38e1ed8

During debugging, I noticed that kube couldn't be accessed with the kubeconfig generated by terraform output, which led to the discovery that this configmap had already been deleted. This cluster is now in a state where terraform can't destroy it, due to dependencies still existing in that security group, which @colstrom has speculated is due to cleanup of an eni expected to be managed by the worker node failing, because the worker node could no longer manage cluster resources after deletion of this configmap.

This configmap has also led to race conditions during deployment, where terraform apply has been failing with alarming frequency, with the following error:

module.services.kubernetes_config_map.aws_auth: Still creating... [30s elapsed]

Error: Post https://6A7BFC843CD4C7578DCB503446548A17.gr7.us-west-2.eks.amazonaws.com/api/v1/namespaces/kube-system/configmaps: dial tcp 34.218.122.126:443: i/o timeout

  on modules/services/aws_auth_cm.tf line 7, in resource "kubernetes_config_map" "aws_auth":
   7: resource "kubernetes_config_map" "aws_auth" {

Though I believe this is due to attempting to overwrite/patch it before the kube api is up.

Remove explicit provider credentials' variables for reusability

Instead of hardcoding provider credentials on a variables.tf, we could either pass them as env vars, or letting terraform take the credentials from the host. This allows for easier reuse of the terraform deployments on CI.

Having the credentials included in variables.tf simplifies the operator life when having several similar deployments from different accounts, but I would argue that this is somewhat rare. And anyways, the same could be achieved with a file containing the env vars to be loaded, or a different wrapper like https://github.com/SUSE/catapult.

See:
https://www.terraform.io/docs/providers/aws/index.html#environment-variables
https://www.terraform.io/docs/providers/google/provider_reference.html#full-reference

All platforms need to work with Helm 3 (in addition to Helm 2)

Hello.

Problem

For KubeCF (and CAP 2.0 then) all platforms should deploy with Helm 3. Right now, the terraform scripts fail because the helm provider that we are using is for Helm 2.

We need to keep both Helm 2 and Helm 3 terraform scripts around, to be able to deploy CAP 1.X and CAP 2.X though.

Workaround

For now, we are deploying as it is with Helm 2 with cap-terraform, and then reusing the kubeconfig on a folder with Helm 3. With catapult: BACKEND={gke,eks} make k8s which we have pinned to Helm 2, and then, HELM_VERSION=v3.3.1 BACKEND={gke,eks} make kubeconfig locally and on pipelines. This leaves Tiller pods on the deployment, for which we don't care for now.

Need to rename aksk8scfg to something more obvious

Currently kubeconfig produced by terraform has name aksk8scfg it appears that this name is not straightforward for person who is not familiar with project. So need to come up with more obvious name ( kubeconfig ? )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.