This file contains hidden or 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
| @Library('ni-utils') _ | |
| //service name is extrapolated from repository name | |
| def svcName = currentBuild.rawBuild.project.parent.displayName | |
| //get pod template definition | |
| def pod = libraryResource 'org/foo/k8s-pod-template.groovy' | |
| def image_dependencies = | |
| ''' | |
| - name: fermium-alpine |
This file contains hidden or 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
| import groovy.text.StreamingTemplateEngine | |
| def call(input, variables) { | |
| def engine = new StreamingTemplateEngine() | |
| return engine.createTemplate(input).make(variables).toString() | |
| } |
This file contains hidden or 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
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| labels: | |
| app: aws-cli | |
| buildnode: "true" | |
| spec: | |
| serviceAccountName: jenkins | |
| nodeSelector: | |
| kops.k8s.io/instancegroup: buildnodes |
This file contains hidden or 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
| #!/usr/bin/env groovy | |
| import groovy.text.StreamingTemplateEngine | |
| def call(sharedLibrary, svcName, buildCommands, pod, slackChannel) { | |
| if (pod.contains("<%")) { | |
| pod = new StreamingTemplateEngine().createTemplate(pod).make(['' : '']).toString() | |
| } | |
| def podLabel = "${svcName}-${UUID.randomUUID().toString().substring(0,8)}" | |
| pipeline { |
This file contains hidden or 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
| cluster_endpoint=$(aws eks describe-cluster \ | |
| --region $region_code \ | |
| --name $cluster_name \ | |
| --query "cluster.endpoint" \ | |
| --output text) | |
| certificate_data=$(aws eks describe-cluster \ | |
| --region $region_code \ | |
| --name $cluster_name \ | |
| --query "cluster.certificateAuthority.data" \ |
This file contains hidden or 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
| include "eks" { | |
| path = "${get_path_to_repo_root()}/modules/eks/terragrunt.hcl" | |
| } | |
| locals { | |
| env_vars = read_terragrunt_config(get_path_to_repo_root()) | |
| } | |
| dependency "vpc" { | |
| config_path = "${get_path_to_repo_root()}/infra/vpc" |
This file contains hidden or 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
| terraform { | |
| # https://registry.terraform.io/modules/terraform-aws-modules/eks/aws/latest | |
| source = "tfr:///terraform-aws-modules/eks/aws?version=18.27.1" | |
| after_hook "terragrunt-read-config" { | |
| commands = ["apply"] | |
| execute = ["bash", "./script.sh"] | |
| } | |
| extra_arguments "set_env" { | |
| commands = ["apply"] | |
| env_vars = { |
This file contains hidden or 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
| terraform { | |
| # https://registry.terraform.io/modules/terraform-aws-modules/eks/aws/latest/submodules/eks-managed-node-group | |
| source = "tfr:///terraform-aws-modules/eks/aws//modules/eks-managed-node-group?version=18.27.1" | |
| } |
This file contains hidden or 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
| locals { | |
| cluster_full_name = "devops-us-east-1.k8s.local" | |
| kube_config_path = pathexpand("./${local.cluster_full_name}.config") | |
| aws_region = "us-east-1" | |
| bucket = "${get_env("BUCKET")}" | |
| cluster_name = "devops" | |
| cluster_version = "1.22" | |
| account_id = "${get_env("ACCOUNT_ID")}" | |
| profile = "devops" | |
| namespaces = ["workshop"] |
This file contains hidden or 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
| include "vpc" { | |
| path = "${dirname(get_repo_root())}/${basename(get_repo_root())}/modules/vpc/terragrunt.hcl" | |
| } | |
| locals { | |
| env_vars = read_terragrunt_config(get_path_to_repo_root()) | |
| } | |
| inputs = { | |
| name = local.env_vars.locals.cluster_name |