-
Notifications
You must be signed in to change notification settings - Fork 262
cli: add ignition support #3120
Conversation
|
Can one of the admins verify this patch? |
|
@thorfour seems that tnc is ignoring the KubeconfigFetchCmd property |
squat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks promising. There are a few errors
config.tf
Outdated
| type = "string" | ||
|
|
||
| description = <<EOF | ||
| (optional) Ignition config file path. This is automatically generated by the installer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change these to (internal) since users should not touch it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about supplying the full json here rather than a file path? This way the tectonic CLI does not need to write anything to disk, just add the text to the terraform.tfvars.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically make sense, from a user perspective I like the file input
| } | ||
|
|
||
| func (c ConfigGenerator) GenerateIgnConfig(clusterDir string) error { | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra newline
| return poolToRole | ||
| } | ||
|
|
||
| func (c ConfigGenerator) GenerateIgnConfig(clusterDir string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment to this exported func?
| } | ||
|
|
||
| func (c ConfigGenerator) embedAppendBlock(ignCfg ignconfigtypes.Config, role string) *ignconfigtypes.Config { | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra newline
|
|
||
| func (c ConfigGenerator) embedAppendBlock(ignCfg ignconfigtypes.Config, role string) *ignconfigtypes.Config { | ||
|
|
||
| appendBlock := &ignconfigtypes.ConfigReference{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we generate a pointer to the struct and then de-reference it in the next statement?
installer/pkg/config/types.go
Outdated
|
|
||
| type nodePools []nodePool | ||
|
|
||
| type nodePool struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not look like anyone is using this type? https://github.com/enxebre/tectonic-installer/blob/07fe3dab9cc74f8184bb23b821063c8f75eaacda/installer/pkg/config/cluster.go#L36
installer/pkg/config/validate.go
Outdated
| return fmt.Sprintf("node pools cannot be shared, but %q is used by %s", e.name, strings.Join(e.fields, ", ")) | ||
| } | ||
|
|
||
| // ErrWrongIgnConfig is returned when a wrong ign config is given. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean by wrong? Invalid maybe?
installer/pkg/config/validate.go
Outdated
| } | ||
|
|
||
| func (c *Cluster) validateIgnitionFiles() []error { | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra newline
installer/pkg/config/validate.go
Outdated
| } | ||
|
|
||
| func validateFileExist(ignitionFile string) error { | ||
| if _, err := os.Stat(ignitionFile); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no need for the if here. Just always return err. This way, if the error is nil, then you are returning nil and if the error is not nil then you are returning an error
installer/pkg/config/validate.go
Outdated
| } | ||
|
|
||
| func validateIgnitionConfig(filePath string) error { | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra newline
squat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few errors
723229c to
bd8da86
Compare
|
@squat addressed the comments PTAL. cc @crawford @alexsomesan |
|
ok to test |
|
test failing due to asg permissions: cc @cpanato |
|
@enxebre this PR adds too many files. Did you run glide-vc as directed in the README to reduce the number of vendors files? |
951ae21 to
53faea3
Compare
squat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks very good. Just a couple small points
| ) | ||
|
|
||
| var ( | ||
| ignVersion = ignconfigtypes.IgnitionVersion{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably in-line the this struct for readability
| ignFile := p.IgnitionFile | ||
| ignCfg, err := parseIgnFile(ignFile) | ||
| if err != nil { | ||
| return err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should really wrap error so for improved context when debugging
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error seems to be completely ignored
| ) | ||
|
|
||
| const ( | ||
| IgnitionMaster = "ignition-master.ign" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you document these exported values?
installer/pkg/config/cluster.go
Outdated
| openstack.OpenStack `json:",inline" yaml:"openstack,omitempty"` | ||
| vmware.VMware `json:",inline" yaml:"vmware,omitempty"` | ||
| Internal `json:",inline" yaml:"-"` | ||
| IgnitionMaster string `json:"tectonic_ignition_master,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please ignore yaml in this and the below lines.
9645c9c to
20a585e
Compare
|
retest this please |
|
retest this please |
The writeFile helpers are from 2b82fbe (installer: Integrate multistep cli with configuration, 2018-02-16, coreos/tectonic-installer#2960) and 461ff5f (cli: add support for user ignition files, 2018-03-23, coreos/tectonic-installer#3120). But ioutil's function has almost the same signature. Remove our local versions and use the stdlib's instead. The \n addition is because ioutil.WriteFile does not append newlines (which workflow.writeFile did via Fprintln). I've used os.Create's 0666 [1] in most cases; callers can set a umask if they want to restrict that. The exception is in generatePrivateKey, where I've set 0600 to avoid leaking a private key even in the presence of a weak umask. [1]: https://golang.org/pkg/os/#Create
The ".ign" suffix is sufficient to identify these as ignition filenames. The old filenames were from 461ff5f (cli: add support for user ignition files, 2018-03-23, coreos/tectonic-installer#3120), which does not motivate the "ingition-" prefix. This gets us closer to the filenames discussed in bf830cc (Documentation/design: add prepare design, 2018-07-11, openshift#50) and b111829 (Documentation/design: add launch design, 2018-07-11, openshift#51).
Once we get #3079 will create a follow up PR for etcd to use the generated userdata