cloudinit

package
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 2 Imported by: 3 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudConfig

type CloudConfig struct {

	// Timezone describes the timezone represented in /usr/share/zoneinfo.
	Timezone string `json:"timezone,omitempty"`

	// DefaultUserEnabled may be set to true to ensure even if the Users field
	// is not empty, the default user is still created on systems that have one
	// defined. By default, Cloud-Init ignores the default user if the
	// CloudConfig provides one or more non-default users via the Users field.
	DefaultUserEnabled bool `json:"defaultUserEnabled,omitempty"`

	// Users allows adding/configuring one or more users on the guest.
	Users []User `json:"users,omitempty"`

	// RunCmd allows running one or more commands on the guest.
	// The entries in this list can adhere to two, different formats:
	//
	// Format 1 -- a string that contains the command and its arguments, ex.
	//
	//     runcmd:
	//     - "ls -al"
	//
	// Format 2 -- a list of the command and its arguments, ex.
	//
	//     runcmd:
	//     - - echo
	//       - "Hello, world."
	RunCmd json.RawMessage `json:"runcmd,omitempty"`

	// WriteFiles allows adding files to the guest file system.
	WriteFiles []WriteFile `json:"write_files,omitempty"`

	// SSHPwdAuth sets whether or not to accept password authentication.
	// In order for this config to be applied, SSH may need to be restarted.
	// On systemd systems, this restart will only happen if the SSH service has
	// already been started. On non-systemd systems, a restart will be attempted
	// regardless of the service state.
	SSHPwdAuth *bool `json:"ssh_pwauth,omitempty"`
}

CloudConfig is the VM Operator API subset of a Cloud-Init CloudConfig and contains several of the CloudConfig's frequently used modules.

func (*CloudConfig) DeepCopy

func (in *CloudConfig) DeepCopy() *CloudConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudConfig.

func (*CloudConfig) DeepCopyInto

func (in *CloudConfig) DeepCopyInto(out *CloudConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type User

type User struct {

	// CreateGroups is a flag that may be set to false to disable creation of
	// specified user groups.
	//
	// Defaults to true when Name is not "default".
	CreateGroups *bool `json:"create_groups,omitempty"`

	// ExpireData is the date on which the user's account will be disabled.
	ExpireDate *string `json:"expiredate,omitempty"`

	// Gecos is an optional comment about the user, usually a comma-separated
	// string of the user's real name and contact information.
	Gecos *string `json:"gecos,omitempty"`

	// Groups is an optional list of groups to add to the user.
	Groups []string `json:"groups,omitempty"`

	// HashedPasswd is a hash of the user's password that will be applied even
	// if the specified user already exists.
	HashedPasswd *vmopv1common.SecretKeySelector `json:"hashed_passwd,omitempty"`

	// Homedir is the optional home directory for the user.
	//
	// Defaults to "/home/<username>" when Name is not "default".
	Homedir *string `json:"homedir,omitempty"`

	// Inactive optionally represents the number of days until the user is
	// disabled.
	Inactive *int32 `json:"inactive,omitempty"`

	// LockPasswd disables password login.
	//
	// Defaults to true when Name is not "default".
	LockPasswd *bool `json:"lock_passwd,omitempty"`

	// Name is the user's login name.
	//
	// Please note this field may be set to the special value of "default" when
	// this User is the first element in the Users list from the CloudConfig.
	// When set to "default", all other fields from this User must be nil.
	Name string `json:"name"`

	// NoCreateHome prevents the creation of the home directory.
	//
	// Defaults to false when Name is not "default".
	NoCreateHome *bool `json:"no_create_home,omitempty"`

	// NoLogInit prevents the initialization of lastlog and faillog for the
	// user.
	//
	// Defaults to false when Name is not "default".
	NoLogInit *bool `json:"no_log_init,omitempty"`

	// NoUserGroup prevents the creation of the group named after the user.
	//
	// Defaults to false when Name is not "default".
	NoUserGroup *bool `json:"no_user_group,omitempty"`

	// Passwd is a hash of the user's password that will be applied only to
	// a newly created user. To apply a new, hashed password to an existing user
	// please use HashedPasswd instead.
	Passwd *vmopv1common.SecretKeySelector `json:"passwd,omitempty"`

	// PrimaryGroup is the primary group for the user.
	//
	// Defaults to the value of the Name field when it is not "default".
	PrimaryGroup *string `json:"primary_group,omitempty"`

	// SELinuxUser is the SELinux user for the user's login.
	SELinuxUser *string `json:"selinux_user,omitempty"`

	// Shell is the path to the user's login shell.
	//
	// Please note the default is to set no shell, which results in a
	// system-specific default being used.
	Shell *string `json:"shell,omitempty"`

	// SnapUser specifies an e-mail address to create the user as a Snappy user
	// through "snap create-user".
	//
	// If an Ubuntu SSO account is associated with the address, the username and
	// SSH keys will be requested from there.
	SnapUser *string `json:"snapuser,omitempty"`

	// SSHAuthorizedKeys is a list of SSH keys to add to the user's authorized
	// keys file.
	//
	// Please note this field may not be combined with SSHRedirectUser.
	SSHAuthorizedKeys []string `json:"ssh_authorized_keys,omitempty"`

	// SSHImportID is a list of SSH IDs to import for the user.
	//
	// Please note this field may not be combined with SSHRedirectUser.
	SSHImportID []string `json:"ssh_import_id,omitempty"`

	// SSHRedirectUser may be set to true to disable SSH logins for this user.
	//
	// Please note that when specified, all SSH keys from cloud meta-data will
	// be configured in a disabled state for this user. Any SSH login as this
	// user will timeout with a message to login instead as the default user.
	//
	// This field may not be combined with SSHAuthorizedKeys or SSHImportID.
	//
	// Defaults to false when Name is not "default".
	SSHRedirectUser *bool `json:"ssh_redirect_user,omitempty"`

	// Sudo is a sudo rule to apply to the user.
	//
	// When omitted, no sudo rules will be applied to the user.
	Sudo *string `json:"sudo,omitempty"`

	// System is an optional flag that indicates the user should be created as
	// a system user with no home directory.
	//
	// Defaults to false when Name is not "default".
	System *bool `json:"system,omitempty"`

	// UID is the user's ID.
	//
	// When omitted the guest will default to the next available number.
	UID *int64 `json:"uid,omitempty"`
}

User is a CloudConfig user data structure.

func (*User) DeepCopy

func (in *User) DeepCopy() *User

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new User.

func (*User) DeepCopyInto

func (in *User) DeepCopyInto(out *User)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WriteFile

type WriteFile struct {

	// Append specifies whether or not to append the content to an existing file
	// if the file specified by Path already exists.
	Append bool `json:"append,omitempty"`

	// Content is the optional content to write to the provided Path.
	//
	// When omitted an empty file will be created or existing file will be
	// modified.
	//
	// The value for this field can adhere to two, different formats:
	//
	// Format 1 -- a string that contains the command and its arguments, ex.
	//
	//     content: Hello, world.
	//
	// Please note that format 1 supports all of the manners of specifying a
	// YAML string.
	//
	// Format 2 -- a secret reference with the name of the key that contains
	//             the content for the file, ex.
	//
	//     content:
	//       name: my-bootstrap-secret
	//       key: my-file-content
	Content json.RawMessage `json:"content,omitempty"`

	// Defer indicates to defer writing the file until Cloud-Init's "final"
	// stage, after users are created and packages are installed.
	Defer bool `json:"defer,omitempty"`

	// Encoding is an optional encoding type of the content.
	Encoding WriteFileEncoding `json:"encoding,omitempty"`

	// Owner is an optional "owner:group" to chown the file.
	Owner string `json:"owner,omitempty"`

	// Path is the path of the file to which the content is decoded and written.
	Path string `json:"path"`

	// Permissions an optional set of file permissions to set.
	//
	// Please note the permissions should be specified as an octal string, ex.
	// "0###".
	//
	// When omitted the guest will default this value to "0644".
	Permissions string `json:"permissions,omitempty"`
}

WriteFile is a CloudConfig write_file data structure.

func (*WriteFile) DeepCopy

func (in *WriteFile) DeepCopy() *WriteFile

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WriteFile.

func (*WriteFile) DeepCopyInto

func (in *WriteFile) DeepCopyInto(out *WriteFile)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WriteFileEncoding

type WriteFileEncoding string

WriteFileEncoding specifies the encoding type of a file's content.

const (
	WriteFileEncodingFluffyB64    WriteFileEncoding = "b64"
	WriteFileEncodingFluffyBase64 WriteFileEncoding = "base64"
	WriteFileEncodingFluffyGz     WriteFileEncoding = "gz"
	WriteFileEncodingFluffyGzip   WriteFileEncoding = "gzip"
	WriteFileEncodingGzB64        WriteFileEncoding = "gz+b64"
	WriteFileEncodingGzBase64     WriteFileEncoding = "gz+base64"
	WriteFileEncodingGzipB64      WriteFileEncoding = "gzip+b64"
	WriteFileEncodingGzipBase64   WriteFileEncoding = "gzip+base64"
	WriteFileEncodingTextPlain    WriteFileEncoding = "text/plain"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL