-
Notifications
You must be signed in to change notification settings - Fork 709
Implement "data" provision mode #3302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -221,6 +221,7 @@ const ( | |
ProvisionModeBoot ProvisionMode = "boot" | ||
ProvisionModeDependency ProvisionMode = "dependency" | ||
ProvisionModeAnsible ProvisionMode = "ansible" | ||
ProvisionModeData ProvisionMode = "data" | ||
) | ||
|
||
type Provision struct { | ||
|
@@ -229,6 +230,16 @@ type Provision struct { | |
Script string `yaml:"script" json:"script"` | ||
File *LocatorWithDigest `yaml:"file,omitempty" json:"file,omitempty" jsonschema:"nullable"` | ||
Playbook string `yaml:"playbook,omitempty" json:"playbook,omitempty"` | ||
// All ProvisionData fields must be nil unless Mode is ProvisionModeData | ||
ProvisionData `yaml:",inline"` // Flatten fields for "strict" YAML mode | ||
} | ||
|
||
type ProvisionData struct { | ||
Content *string `yaml:"content,omitempty" json:"content,omitempty" jsonschema:"nullable"` | ||
Overwrite *bool `yaml:"overwrite,omitempty" json:"overwrite,omitempty" jsonschema:"nullable"` | ||
Owner *string `yaml:"owner,omitempty" json:"owner,omitempty"` // any owner string supported by `chown`, defaults to "root:root" | ||
Path *string `yaml:"path,omitempty" json:"path,omitempty"` | ||
Permissions *string `yaml:"permissions,omitempty" json:"permissions,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be int? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had it as an I thought this could be a common cause of errors because Footnotes
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just noticed that I didn't update the comments in |
||
} | ||
|
||
type Containerd 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.
I don't think these ones have to be mixed in
provision:
.Can we just have
files: []
in the top-level ?Uh oh!
There was an error while loading. Please reload this page.
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.
The disjoint set of fields has bothered me too. But on the other hand, conceptually this is very similar to provisioning scripts; the main difference being that they are not executed. This
is pretty much the same as1:
So creating yet another top-level setting for it feels a bit unstructured.
And while not really a strong argument, creating another setting would also require a lot of code duplication for the template merging and file embedding code.
Footnotes
The main advantage (with external data files) is that you can create them easily with automation. E.g. you can use a YAML or JSON marshaler to create the file, but there is no default tooling to wrap them as here-documents in a script that writes the document to a file. ↩
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.
No strong opinion from me either