Skip to content
This repository was archived by the owner on Feb 5, 2020. It is now read-only.

Conversation

@enxebre
Copy link
Contributor

@enxebre enxebre commented Mar 16, 2018

  • Add a IgnitionFile field for node pools
  • the cli validate ign file and embed the tnc append block
  • Terraform always receive the generated user-data ign file path as an input

Once we get #3079 will create a follow up PR for etcd to use the generated userdata

@coreosbot
Copy link

Can one of the admins verify this patch?

@enxebre
Copy link
Contributor Author

enxebre commented Mar 16, 2018

@thorfour seems that tnc is ignoring the KubeconfigFetchCmd property

Copy link
Contributor

@squat squat left a 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.
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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 {

Copy link
Contributor

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 {
Copy link
Contributor

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 {

Copy link
Contributor

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{
Copy link
Contributor

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?


type nodePools []nodePool

type nodePool struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

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.
Copy link
Contributor

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?

}

func (c *Cluster) validateIgnitionFiles() []error {

Copy link
Contributor

Choose a reason for hiding this comment

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

extra newline

}

func validateFileExist(ignitionFile string) error {
if _, err := os.Stat(ignitionFile); err != nil {
Copy link
Contributor

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

}

func validateIgnitionConfig(filePath string) error {

Copy link
Contributor

Choose a reason for hiding this comment

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

extra newline

Copy link
Contributor

@squat squat left a 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

@enxebre enxebre force-pushed the ign-cli branch 4 times, most recently from 723229c to bd8da86 Compare March 19, 2018 10:29
@enxebre
Copy link
Contributor Author

enxebre commented Mar 19, 2018

@squat addressed the comments PTAL. cc @crawford @alexsomesan

@enxebre
Copy link
Contributor Author

enxebre commented Mar 19, 2018

ok to test

@enxebre
Copy link
Contributor Author

enxebre commented Mar 20, 2018

test failing due to asg permissions:

* aws_autoscaling_group.workers: AccessDenied: User: arn:aws:sts::846518947292:assumed-role/tf-tectonic-installer/TECTONIC_INSTALLER_awsbas-pr-3120-8630a1 is not authorized to perform: autoscaling:DeleteTags on resource: arn:aws:autoscaling:us-east-2:846518947292:autoScalingGroup:64585609-4a53-4c26-9a37-238442081a0c:autoScalingGroupName/awsbas-pr-3120-8630a1-workers

cc @cpanato

@squat
Copy link
Contributor

squat commented Mar 23, 2018

@enxebre this PR adds too many files. Did you run glide-vc as directed in the README to reduce the number of vendors files?

@enxebre enxebre force-pushed the ign-cli branch 3 times, most recently from 951ae21 to 53faea3 Compare March 23, 2018 10:54
@enxebre enxebre requested a review from alexsomesan March 23, 2018 11:19
Copy link
Contributor

@squat squat left a 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{
Copy link
Contributor

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
Copy link
Contributor

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
}

Copy link
Contributor

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"
Copy link
Contributor

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?

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"`
Copy link
Contributor

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.

@enxebre enxebre force-pushed the ign-cli branch 2 times, most recently from 9645c9c to 20a585e Compare March 23, 2018 16:17
@enxebre
Copy link
Contributor Author

enxebre commented Mar 23, 2018

retest this please

squat
squat previously approved these changes Mar 26, 2018
squat
squat previously approved these changes Mar 26, 2018
@enxebre enxebre mentioned this pull request Mar 27, 2018
@enxebre
Copy link
Contributor Author

enxebre commented Mar 27, 2018

retest this please

@squat squat merged commit 4d3eea6 into coreos:master Mar 27, 2018
wking added a commit to wking/openshift-installer that referenced this pull request Jul 9, 2018
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
wking added a commit to wking/openshift-installer that referenced this pull request Jul 23, 2018
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).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants