Documentation
¶
Overview ¶
Package userdata renders cloud-init user-data scripts for Podplane VMs.
Index ¶
- func QuoteEnvValue(value string) string
- func RenderMutableEnv(vars MutableVars) string
- func SourceForNstance(manifest *deps.Manifest, depsMirrorURL string, awsAccountID string, ...) (string, error)
- type ClusterData
- type InstanceData
- type MutableVars
- type ProviderData
- type ServerData
- type TemplateVars
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QuoteEnvValue ¶ added in v0.1.2
QuoteEnvValue quotes a value using the same single-quote format as vmconfig's shell helpers use for env files.
func RenderMutableEnv ¶ added in v0.1.2
func RenderMutableEnv(vars MutableVars) string
RenderMutableEnv renders the subset of user-data env that vmconfig's update-mutable-env.sh accepts for post-boot updates.
Types ¶
type ClusterData ¶ added in v0.1.2
type InstanceData ¶ added in v0.1.2
type MutableVars ¶ added in v0.1.2
MutableVars are the variables exposed to the canonical Nstance-style userdata template and rendered into mutable.env.
func (MutableVars) SetObjectStorageEndpoint ¶ added in v0.1.2
func (v MutableVars) SetObjectStorageEndpoint(endpoint string)
SetObjectStorageEndpoint sets all component object storage endpoints to the same value. Use direct field assignment when components use different stores.
func (MutableVars) SetObjectStorageRegion ¶ added in v0.1.2
func (v MutableVars) SetObjectStorageRegion(region string)
SetObjectStorageRegion sets all component object storage regions to the same value. Use direct field assignment when components use different stores.
type ProviderData ¶ added in v0.1.2
type ServerData ¶ added in v0.1.2
type TemplateVars ¶
type TemplateVars struct {
// Manifest is the resolved vmconfig manifest for this VM.
Manifest *deps.Manifest `validate:"required"`
// DepsMirrorURL, when set, overrides all upstream dependency URLs with
// mirror-relative paths (<base>/<name>/<version>/<filename>). Used for
// local development and air-gapped installs.
DepsMirrorURL string `validate:"omitempty,url"`
// The following fields map to the same structure nstance-server uses
// in production for interpolating data into production userdata
Cluster ClusterData
Provider ProviderData
Instance InstanceData
Server ServerData
Vars MutableVars
// AWSAccountID and GoogleProjectID are dedicated fields because they are
// tf provider inputs, not Nstance mutable env vars pushed through Vars.
AWSAccountID string
GoogleProjectID string
// Nonce is a dedicated field because it is Nstance first-boot bootstrap data,
// not a value vmconfig should receive later through mutable.env.
Nonce string
}
TemplateVars are the template variables consumed by user-data.sh.
func (*TemplateVars) ApplyDefaults ¶
func (v *TemplateVars) ApplyDefaults()
ApplyDefaults populates derived values (e.g. cluster-prefixed bucket names) when the caller has not set them explicitly.
func (*TemplateVars) ManifestFilter ¶
func (v *TemplateVars) ManifestFilter() deps.ItemFilter
ManifestFilter selects dependencies that apply to this VM's provider.
func (*TemplateVars) Render ¶
func (v *TemplateVars) Render() (string, error)
Render produces the rendered user-data script.
func (*TemplateVars) Validate ¶
func (v *TemplateVars) Validate() error
Validate checks the TemplateVars are populated correctly enough to render.