Skip to content

ContinuousEngineeringProject/factory-infra-gcp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

132 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Factory Infrastructure Terraform Quickstart template

Use this template to easily create a new Git Repository for managing Factory cloud infrastructure needs. We recommend using Terraform to manage the infrastructure needed to run the Factory.

Getting Started

Prerequisites

  1. A Git organisation that will be used to create the GitOps repositories used by the Factory. e.g. https://github.com/organizations/plan.
  2. Create a git factory bot user (different from your own personal user) and generate a personal access token, this will be used by the factory to interact with git repositories. e.g. https://github.com/settings/tokens/new?scopes=repo,read:user,read:org,user:email,write:repo_hook,delete_repo,admin:repo_hook.
    • Add the factory bot user to your Git Organisation, and give it Owner permissions.
  3. Check and install latest terraform CLI - see here.
  4. Check and install latest jx CLI - see here
  5. Check and install latest gcloud CLI - see here.
    • Configure the gcloud CLI to use the correct project.
      make gcloud.config
    • Create your factory service account for terraform to use.
      make sa.create
      env | grep GOOGLE_APPLICATION_CREDENTIALS
    • Create your factory APEX dns zone, if you don't have one already. For full details click here.
      make sa.use
      make dns.create
  6. Create a Factory Cluster git repository from this GitHub Template https://github.com/ContinuousEngineeringProject/factory-cluster-jx3/generate.
    • Follow the instructions in the 'Create a new factory cluster' section of the README.md in the Factory Cluster repository you just created.
  7. Create a Factory Infrastructure git repository from this GitHub Template https://github.com/ContinuousEngineeringProject/factory-infra-gcp/generate.

Factory setup

  1. Update the values.auto.tfvars file from the Factory Infrastructure git repository.
    • (If using Kubernetes version 1.23+) add kuberhealthy = false.
  2. (If using Kubernetes version 1.23+) update the local Terraform files.
    • Initiate the Terraform modules
      terraform init
    • Update jx_kh_check_version version in .terraform/modules/eks-jx.health.jx-health/variables.tf to 80.
    • Update kuberhealthy helm release version in .terraform/modules/eks-jx.health.jx-health/main.tf to 92
  3. Commit and push the changes to the Factory Infrastructure git repository.
  4. Build the factory cluster
    make factory.build
    $(terraform output -raw connect)
    $(terraform output -raw follow_install_logs)

Terraform Inputs

For the full list of terraform inputs see the documentation for jenkins-x/terraform-google-jx

Name Description Type Default Required
apex_domain The apex / parent domain to be allocated to the cluster string "" no
apex_domain_gcp_project The GCP project the parent domain is managed by, used to write recordsets for a subdomain if set. Defaults to current project. string "" no
apex_domain_integration_enabled Add recordsets from a subdomain to a parent / apex domain bool true no
autoscaler_location_policy location policy for primary node pool string "ANY" no
autoscaler_max_node_count Maximum number of cluster nodes number 5 no
autoscaler_min_node_count Minimum number of cluster nodes number 3 no
cluster_location The location (region or zone) in which the cluster master will be created. If you specify a zone (such as us-central1-a), the cluster will be a zonal cluster with a single cluster master. If you specify a region (such as us-west1), the cluster will be a regional cluster with multiple masters spread across zones in the region string "us-central1-a" no
cluster_name Name of the Kubernetes cluster to create string "" no
force_destroy Flag to determine whether storage buckets get forcefully destroyed bool false no
gcp_project The name of the GCP project to use string n/a yes
gsm Enables Google Secrets Manager, not available with JX2 bool false no
initial_cluster_node_count initial number of cluster nodes number 3 no
initial_primary_node_pool_node_count initial number of pool nodes number 1 no
jx_bot_token Bot token used to interact with the Jenkins X cluster git repository string n/a yes
jx_bot_username Bot username used to interact with the Jenkins X cluster git repository string n/a yes
jx_git_url URL for the Jenins X cluster git repository string n/a yes
kuberhealthy Enables Kuberhealthy helm installation bool true no
lets_encrypt_production Flag to determine wether or not to use the Let's Encrypt production server. bool true no
master_authorized_networks List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically allowlists). list(object({ cidr_block = string, display_name = string }))
[
{
"cidr_block": "0.0.0.0/0",
"display_name": "any"
}
]
no
node_disk_size Node disk size in GB string "100" no
node_disk_type Node disk type, either pd-standard or pd-ssd string "pd-standard" no
node_machine_type Node type for the Kubernetes cluster string "n1-standard-2" no
node_preemptible Use preemptible nodes bool false no
node_spot Use spot nodes bool false no
resource_labels Set of labels to be applied to the cluster map(string) {} no
subdomain Optional sub domain for the installation string "" no
tls_email Email used by Let's Encrypt. Required for TLS when parent_domain is specified string "" no

Cleanup

To remove any cloud resources created by the Factory run:

$(terraform output -raw connect)
make factory.destroy

Contributing

About

Factory Infrastructure Git Template for Terraform and Google Cloud Platform for managing cloud resources

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • HCL 64.8%
  • Makefile 29.0%
  • Shell 6.2%