Skip to content

WIP add option to pass user_data url#37

Closed
hardys wants to merge 1 commit into
openshift-metal3:masterfrom
hardys:user_data_download
Closed

WIP add option to pass user_data url#37
hardys wants to merge 1 commit into
openshift-metal3:masterfrom
hardys:user_data_download

Conversation

@hardys

@hardys hardys commented Feb 19, 2020

Copy link
Copy Markdown

Currently the installer passes a pointer/wrapper config which
contains a URL, this presents a problem when the target nodes
don't have networking up at the (early) stage of running ignition
in the ramdisk.

Instead, we can download the entire config, which it appears we
can pass to ironic since the instance_info is now defined as
longtext (which on mariadb is 4GB), this is a much higher limit
than the majority of other platforms which do require the pointer
config due to user_data size limits.

@hardys

hardys commented Feb 19, 2020

Copy link
Copy Markdown
Author

/cc @stbenjam @kirankt - interested to get your thoughts on this approach as we discussed it recently

It's untested but based on some hacky test code I pushed to https://github.com/hardys/dev-scripts/blob/get_go/get.go (that reads from the tfvars, we can probably do the equivalent thing inside the installer to pass these two new values).

@stbenjam

Copy link
Copy Markdown
Member

I'd like to see the cert made optional. In the case of OpenShift, I think by the time the Ironic API is available bootstrap should be already serving the ignition but I'm not sure it's guaranteed - what do you think about having retry logic?

@stbenjam

Copy link
Copy Markdown
Member

Test failures are legit. Imports are missing, and some minor lint things.

@hardys hardys force-pushed the user_data_download branch from 69f9aa4 to 94a0eba Compare February 19, 2020 17:29
@hardys

hardys commented Feb 19, 2020

Copy link
Copy Markdown
Author

Test failures are legit. Imports are missing, and some minor lint things.

Ack I think I fixed them all now, thanks - I did notice some seemingly unrelated errors though:

ironic/resource_ironic_node_v1_test.go:17:26: undefined: testAccPreCheck
ironic/resource_ironic_node_v1_test.go:18:17: undefined: testAccProviders
ironic/resource_ironic_node_v1_test.go:106:18: undefined: testAccProvider
ironic/resource_ironic_node_v1_test.go:132:17: undefined: testAccProvider
FAIL	github.com/openshift-metal3/terraform-provider-ironic/ironic [build failed]
make: *** [Makefile:30: test] Error 2

@hardys hardys force-pushed the user_data_download branch from 94a0eba to 878155a Compare February 19, 2020 17:35
@hardys

hardys commented Feb 20, 2020

Copy link
Copy Markdown
Author

Ok so I discovered make test doesn't work locally unless you set the same env vars as travis, and run the ironic services on the host - we should perhaps automate that or make the tests fail more clearly when run in a non-CI setup.

Comment thread ironic/resource_ironic_deployment.go Outdated
return fmt.Errorf("could not get user_data_url: %s", err)
}
defer resp.Body.Close()
userData, err := ioutil.ReadAll(resp.Body)

@kirankt kirankt Feb 21, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isn't the scope of this userData local to the if block. So in the end, aren't we still passing the stub userData rather than the one fetched in the if block?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes well spotted - I found the same issue running the tests locally, will fix 👍

@kirankt

kirankt commented Feb 24, 2020

Copy link
Copy Markdown
Contributor

Another thought. Why can't we fetch the URL, CA cert from the stub ignition and directly create a config drive like @hardys' example here: https://github.com/hardys/dev-scripts/blob/get_go/get.go . Instead of creating two new TF vars, we can still keep user_data and change the provider's logic to send full ignition.

e.g. https://github.com/kirankt/terraform-provider-ironic/blob/full-ignition/ironic/resource_ironic_deployment.go

@stbenjam

Copy link
Copy Markdown
Member

Another thought. Why can't we fetch the URL, CA cert from the stub ignition and directly create a config drive like @hardys' example here: hardys/dev-scripts:get.go@get_go . Instead of creating two new TF vars, we can still keep user_data and change the provider's logic to send full ignition.

e.g. kirankt/terraform-provider-ironic:ironic/resource_ironic_deployment.go@full-ignition

IMHO, I really don't want RHCOS or OpenShift-specific things in terraform-provider-ironic, it's a generic provider for Ironic usable by anyone. Having a variable for specifying a user data URL is more generic.

@hardys

hardys commented Feb 24, 2020

Copy link
Copy Markdown
Author

Another thought. Why can't we fetch the URL, CA cert from the stub ignition and directly create a config drive like @hardys' example here: https://github.com/hardys/dev-scripts/blob/get_go/get.go . Instead of creating two new TF vars, we can still keep user_data and change the provider's logic to send full ignition.

e.g. https://github.com/kirankt/terraform-provider-ironic/blob/full-ignition/ironic/resource_ironic_deployment.go

Yeah I did consider this, but decided against it for the reasons already mentioned by @stbenjam - I ran out of time last week to work on an installer PR, but I think that is the place to prepare the data needed by this PR, since the pointer/wrapper config is really an implementation detail specific to the installer.

@hardys hardys force-pushed the user_data_download branch from 878155a to d05e8f5 Compare February 25, 2020 16:49
Currently the installer passes a pointer/wrapper config which
contains a URL, this presents a problem when the target nodes
don't have networking up at the (early) stage of running ignition
in the ramdisk.

Instead, we can download the entire config, which it appears we
can pass to ironic since the instance_info is now defined as
longtext (which on mariadb is 4GB), this is a much higher limit
than the majority of other platforms which do require the pointer
config due to user_data size limits.
@hardys

hardys commented Mar 31, 2020

Copy link
Copy Markdown
Author

This was included in #38

@hardys hardys closed this Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants