Skip to content

Conversation

@wking
Copy link
Member

@wking wking commented Oct 3, 2018

Builds on #403; I'll rebase after that lands.

This removes a few Cluster properties which are no longer used by the new installer. It also drops YAML loading for Cluster now that it's a one-way map from InstallConfig to Terraform JSON. I've shifted validation into its own package, since we should be validating these at the InstallConfig level.

I've dropped the old Cluster (and subtype) specific validation. We'll want to add InstallConfig validation once we support loading it from the disk, but for now we can rely on the UserProvided validation (and this commit was already large enough ;).

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 3, 2018
@wking wking force-pushed the separate-validate-package branch from 5882b2e to 4d47856 Compare October 3, 2018 21:38
@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 3, 2018
@wking wking force-pushed the separate-validate-package branch from 4d47856 to a0a1dbc Compare October 3, 2018 21:44
@wking wking changed the title pkg/validate: Move to separate package and trim cruft pkg/types/config: Break into pkg/validate and pkg/tfvars Oct 3, 2018
@abhinavdahiya
Copy link
Contributor

Can we not create a new package that has types. we already have pkg/types. maybe just a new file.

@wking
Copy link
Member Author

wking commented Oct 4, 2018

Can we not create a new package that has types. we already have pkg/types.

We already have types all over:

$ git describe
v0.1.0-30-ge4c8898
$ for DIR in pkg/*; do echo -n "${DIR} "; git grep '^type ' "${DIR}" | wc -l; done
pkg/asset 72
pkg/destroy 5
pkg/ipnet 1
pkg/rhcos 0
pkg/terraform 1
pkg/types 50

My impression was that pkg/types was going to be for external consumers who wanted to use something we were pushing into the cluster (e.g. InstallConfig). And that ideally, pkg/types would have very minimal external dependencies or dynamic code outside of the type definitions themselves. This roughly corresponds to our current docs for the package.

The new pkg/tfvars has an internal type, but its public API is just the one function, which nobody except for us is likely to care about. If my understanding of pkg/types scoping is accurate, then the TFVars function does not qualify for pkg/types inclusion.

@abhinavdahiya
Copy link
Contributor

/approve

wking added 2 commits October 4, 2018 19:58
Stop relying on field promotion [1], because I'm about to add
InstallConfig.Platform.Name().

[1]: https://golang.org/ref/spec#Struct_types
This removes a few Cluster properties which are no longer used by the
new installer.  It also drops YAML loading for Cluster now that it's a
one-way map from InstallConfig to Terraform JSON.  I've shifted
validation into its own package, since we should be validating these
at the InstallConfig level.

I've also shifted the Terraform variable generation out of pkg/types,
because it's not about public types.  I've reduced the variable
generation to a single function.

I've dropped the old Cluster (and subtype) specific validation.  We'll
want to add InstallConfig validation once we support loading it from
the disk, but for now we can rely on the UserProvided validation (and
this commit was already large enough ;).
@wking wking force-pushed the separate-validate-package branch from a0a1dbc to 619db92 Compare October 5, 2018 03:06
@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 5, 2018
@wking
Copy link
Member Author

wking commented Oct 5, 2018

Rebased onto master and green.

Copy link
Contributor

@abhinavdahiya abhinavdahiya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 5, 2018
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinavdahiya, wking

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [abhinavdahiya,wking]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 5a708e2 into openshift:master Oct 5, 2018
@wking wking deleted the separate-validate-package branch October 5, 2018 04:18
wking added a commit to wking/openshift-installer that referenced this pull request Nov 29, 2018
DefaultIfName was added in f245ca6 (installer: validate libvirt,
2018-06-06, coreos/tectonic-installer#3265), but the last consumer was
removed by 619db92 (pkg/types/config: Break into pkg/validate and
pkg/tfvars, 2018-10-03, openshift#412).  We currently feed the default bridge
name in via pkg/asset/installconfig/libvirt's defaultNetworkIfName.

The AWS and OpenStack default variables I'm also removing here have a
similar history and current default location.
wking added a commit to wking/openshift-installer that referenced this pull request Jan 16, 2019
Before this commit, this section would clobber any config.AWS
properties which had been set up while iterating over machine pools.
I'd introduced that bug in 619db92 (pkg/types/config: Break into
pkg/validate and pkg/tfvars, 2018-10-03, openshift#412), before which this
section ran before the machine-pool iteration, so there had been
nothing to clobber.
wking added a commit to wking/openshift-installer that referenced this pull request Apr 9, 2020
This seems to be a relic of 619db92 (pkg/types/config: Break into
pkg/validate and pkg/tfvars, 2018-10-03, openshift#412) and 5192edd (Add
OpenStack OWNERS, 2018-10-06, openshift#428) coming in close proximity.
vrutkovs pushed a commit to vrutkovs/installer that referenced this pull request Apr 13, 2020
This seems to be a relic of 619db92 (pkg/types/config: Break into
pkg/validate and pkg/tfvars, 2018-10-03, openshift#412) and 5192edd (Add
OpenStack OWNERS, 2018-10-06, openshift#428) coming in close proximity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants