FairwindsOps / pentagon

A framework for building repeatable, containerized, cloud-based infrastructure as code with Kubernetes.
https://www.reactiveops.com
Apache License 2.0
183 stars 25 forks source link

Adding an inventory does not use project configs #144

Closed ivanfetch closed 5 years ago

ivanfetch commented 6 years ago

When creating an inventory, multiple properties are missing from the output files, including:

My config.yml file, generated by pentagon start-project, contains:

create_keys: true
aws_default_region: !!python/unicode 'us-east-1'
configure: true
infrastructure_bucket: !!python/unicode 'ivantest-staging-infrastructure'
working_kubernetes_cluster_name: !!python/unicode 'working-1.kube.staging..ivan-test.com'
production_kubernetes_master_node_type: !!python/unicode 'm5.large'
configure_vpn: true
production_kubernetes_cluster_name: !!python/unicode 'production-1.kube.production.ivan-test.com'
hash_type: aws
working_kubernetes_worker_node_type: !!python/unicode 'm5.large'
working_kubernetes_master_node_type: !!python/unicode 'm5.large'
production_kubernetes_dns_zone: !!python/unicode 'kube.production.ivan-test.com'
working_kubernetes_dns_zone: !!python/unicode 'kube.staging.ivan-test.com'
kubernetes_version: !!python/unicode '1.10.8'
production_kubernetes_worker_node_type: !!python/unicode 'm5.large'
cloud: !!python/unicode 'aws'

I create an additional inventory using:

cd ivan-test-infrastructure/inventory
export AWS_ACCESS_KEY_ID="redacted"
export AWS_SECRET_ACCESS_KEY="redacted"
pentagon add inventory \
-f ../config.yml \
-Dtype=aws \
-Daws_access_key=$AWS_ACCESS_KEY_ID \
-Daws_secret_key= $AWS_SECRET_ACCESS_KEY \
-Daws_default_region=us-east-1 \
-Dinfrastructure_bucket=ivantest-staging-infrastructure \
-Dname=staging

Note I also tried creating an inventory by representing config.yml values as -D options to the pentagon add inventory command, with the same result. The -D options I specified in place of -f ../config.yml are:

-Dinfrastructure_bucket=ivan-test-staging-infrastructure \
-Dworking_kubernetes_dns_zone=kube.staging.ivan-test.com \
-Dproduction_kubernetes_dns_zone=kube.production.ivan-test.com \
-Dworking_kubernetes_cluster_name=working-1.kube.staging.ivan-test.com \
-Dproduction_kubernetes_cluster_name=production-1.kube.production.ivan-test.com \
-Dkubernetes_version=1.10.8 \
-Dworking_kubernetes_master_node_type=m5.large \
-Dworking_kubernetes_worker_node_type=m5.large \
-Dproduction_kubernetes_master_node_type=m5.large \
-Dproduction_kubernetes_worker_node_type=m5.large \

Here are relevant portions of a diff between the default and staging inventory directories:

diff -r default/config/local/vars.yml staging/config/local/vars.yml
4c4
< VPC_NAME: "20181016"
---
> VPC_NAME: ""
9,10c9,10
< AWS_AVAILABILITY_ZONES: "us-east-1a, us-east-1b, us-east-1c"
< AWS_AVAILABILITY_ZONE_COUNT: "3"
---
> AWS_AVAILABILITY_ZONES: ""
> AWS_AVAILABILITY_ZONE_COUNT: ""
14c14
< KOPS_STATE_STORE_BUCKET: "ivantest-staging-infrastructure"
---
> KOPS_STATE_STORE_BUCKET: ""
17,18c17,18
< vpc_tag_name: "20181016"
< org_name: "ivan-test"
---
> vpc_tag_name: ""
> org_name: ""
20,22c20,22
< canonical_zone: "ivan-test.com"
< vpn_bucket: "ivan-test-vpn"
< secrets_bucket: "ivan-test-secrets"
\ No newline at end of file
---
> canonical_zone: ""
> vpn_bucket: "-vpn"
> secrets_bucket: "-secrets"
\ No newline at end of file
diff -r default/config/private/secrets.yml staging/config/private/secrets.yml
2c2
< AWS_SECRET_ACCESS_KEY: &secret "redacted" #AWS/BOTO/Terraform
---
> AWS_SECRET_ACCESS_KEY: &secret "" #AWS/BOTO/Terraform
diff -r default/resources/admin-environment/env.yml staging/resources/admin-environment/env.yml
4c4
< default_ami: 'ami-ff02509a'
---
> default_ami: ''
diff -r default/terraform/aws_vpc.auto.tfvars staging/terraform/aws_vpc.auto.tfvars
1,4c1,4
< aws_vpc_name  = "20181016"
< vpc_cidr_base = "172.20"
< aws_azs = "us-east-1a, us-east-1b, us-east-1c"
< az_count = "3"
---
> aws_vpc_name  = ""
> vpc_cidr_base = ""
> aws_azs = ""
> az_count = ""
ejether commented 5 years ago

closed by https://github.com/reactiveops/pentagon/pull/147