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

Issue 181 #185

Closed endzyme closed 5 years ago

endzyme commented 5 years ago
endzyme commented 5 years ago

How to test this

Existing AWS functionality

pentagon add inventory \
-Dcloud=aws \
-Dinfrastructure_bucket=asdf \
-Dname=somename \
-Daws_access_key=fake \
-Daws_secret_key=fake \
-Dproject_name=fakeproject \
-o output_path

Testing with gcp settings

pentagon add inventory \
-Dcloud=gcp \
-Dcluster_name=mycluster \
-Dkubernetes_version=1.11.7-gke6 \
-Dnodes_cidr=1.2.3.0/24 \
-Dpods_cidr=2.3.4.0/24 \
-Dservices_cidr=3.4.5.0/24 \
-Dproject=fake-project-one \
-Dinfrastructure_bucket=asdf \
-Dname=somename \
-Dproject_name=fakeproject \
-o output_path_gcp

Testing gcp cluster without generating an inventory

pentagon add gcp.cluster.public \
-Dcloud=gcp \
-Dcluster_name=mycluster \
-Dkubernetes_version=1.11.7-gke6 \
-Dnodes_cidr=1.2.3.0/24 \
-Dpods_cidr=2.3.4.0/24 \
-Dservices_cidr=3.4.5.0/24 \
-Dproject=fake-project-one \
-o only_the_tf_cluster_path

Things I don't like

  1. There is no depth in defining sub-component invocations: Something that cannot be addressed in this PR
  2. The inventory hack is to make backwards compatibility (i don't like the hack)
  3. You cannot discover what requirements you'll need to set ahead of time - this requires running the command N times before you finally set all your correct requirements (annoying and no addressable in this PR)
  4. You can never know if you're double-using a variable set by -Dvarname=xyz due to how the data for each class invocation is handed down (not addressable in this PR)
  5. I could not write tests for this due to how the inheritance works (not a simple task and would require rework of structured classes and interfaces
  6. Due to naming of params - terms can get overloaded (project vs project_name is one of these examples: gcp project vs wherever project-name is used)
endzyme commented 5 years ago

182

endzyme commented 5 years ago

NOTE: I still haven't tested if the terraform runs

endzyme commented 5 years ago

Latest push fixes the pentagon start-project proj-name issue (it didn't run before).

Now you can run:

pentagon debug start-project testing \
--cloud gcp \
--gcp-project testing-gcp-project \
--gcp-cluster-name cluster-name-1 \
--gcp-pods-cidr 0.0.0.0/1 \
--gcp-nodes-cidr 0.0.0.0/1 \
--gcp-services-cidr 0.0.0.0/1
endzyme commented 5 years ago

@ejether I added some different mechanism for versioning here - can you review again (specifically on integrating versioneer)

endzyme commented 5 years ago

@ejether I added some different mechanism for versioning here - can you review again (specifically on integrating versioneer)

Ignore this @ejether - it broke more than it solved. I will update the changelog and some other normal versioning procedures