Commit graph

14 commits

Author SHA1 Message Date
Erin Call a21848484b
Initialize run.Configs in the NewSTEP functions [#67]
This fixes the run package's leaky abstraction; other packages no longer
need to know or care that run.Config even exists.

Note that since the various Steps now depend on having a non-nil pointer
to a run.Config, it's unsafe (or at least risky) to initialize them
directly. They should be created with their NewSTEPNAME functions. All
their fields are now private, to reflect this.
2020-01-17 10:55:12 -08:00
Erin Call d8ddb79ef4
Test InitKube's use of the Debug flag [#67]
(Just something I happened across while writing the previous commit)
2020-01-16 15:32:40 -08:00
Erin Call 231138563c
Remove the cfg argument from Step.Execute [#67]
This is the first step toward removing run.Config entirely. InitKube was
the only Step that even used cfg in its Execute function; the rest just
discarded it.
2020-01-16 15:30:40 -08:00
Erin Call 88bb8085b0
Deduplicate the kubeValues data in InitKube [#67]
Now that the InitKube initialization happens inside its own package, the
private .values field can be populated at the same time, rather than
having to wait for Prepare().

Also clarified the config/template filename fields (configFile vs.
ConfigFile was particularly ambiguous).
2020-01-16 15:12:15 -08:00
Erin Call 588c7cb9f7
Initialize Steps with a NewSTEPNAME function [#67]
This seems to be be a more natural separation of concerns--the knowledge
of which config fields map to which parts of a Step belong to the Step,
not to the Plan.
2020-01-16 13:50:04 -08:00
Erin Call 3b85c38714
Test yaml validity without a new dependency [#15]
It turns out testify already depends on yaml, so we aren't adding
anything new by using it here.
2019-12-26 12:53:36 -08:00
Erin Call 1422ec77a4
Merge branch 'master' into kubeconfig-tests 2019-12-26 12:50:00 -08:00
Erin Call 2a13fff548
Don't check the generated config's yaml syntax [#13]
See discussion on https://github.com/pelotech/drone-helm3/pull/36 --it
doesn't really make sense to add a dependency on yaml just for testing.
2019-12-26 12:39:02 -08:00
Erin Call b2066961e1
Merge branch 'master' into kubeconfig-tests 2019-12-26 11:55:32 -08:00
Joachim Hill-Grannec 253a4465f8
Merge branch 'master' into config-fixup 2019-12-26 11:36:55 -08:00
Erin Call 6b331fdf03
Check the validity of the kubeconfig template [#13]
It's a little tricky to find a balance between "brittle" and "thorough"
in this test--I'd like to verify that e.g. the certificate is in
clusters[0].cluster.certificate-authority-data, not at the root. On the
other hand, we can't actually show that it's a valid kubeconfig file
without actually *using* it, so there's a hard upper limit on the
strength of the assertions. I've settled on verifying that all the
settings make it into the file and the file is syntactically-valid yaml.
2019-12-25 10:11:14 -08:00
Erin Call 4755f502b5
Always use the default kubeconfig file path [#20] 2019-12-23 12:47:16 -08:00
Erin Call dc4ecb6b91
Allow an empty Certificate setting [#29]
I just plain misunderstood how kubernetes CAs worked!
2019-12-20 16:11:20 -08:00
Erin Call 13c663e906
Initialize kubernetes config on upgrade
This change revealed more about how the system needs to work, so there
are some supporting changes:

* helm.upgrade and helm.help are now vars rather than raw functions.
    This allows unit tests to target the "which step should we run"
    logic directly by comparing function pointers, rather than having to
    configure/prepare a fully-valid Plan and then infer the logic’s
    correctness based on the Plan’s state.
* configuration that's specific to kubeconfig initialization is now part
    of the InitKube struct rather than run.Config, since other steps
    shouldn’t need access to those settings (particularly the secrets).
* Step.Execute now receives a run.Config so it can log debug output.
2019-12-16 15:41:04 -08:00