userdata

package
v21.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Content

type Content struct {
	// BashLibrary contains the bash library
	system.BashLibraryDefinition

	Header                      string                        // is the bash header for scripts
	Revision                    string                        // is the git revision used to build SafeScale
	Username                    string                        // is the name of the default user (api.DefaultUser)
	ExitOnError                 string                        // helper to quit script on error
	Password                    string                        // for the user safescale (for troubleshoot use, usable only in console)
	FirstPublicKey              string                        // is the public key used for first connection after Host creation
	FirstPrivateKey             string                        // is the private key used for first connection after Host creation
	FinalPublicKey              string                        // is the public key used to connect to Host starting phase3 (disabling FirstPublicKey)
	FinalPrivateKey             string                        // is the private key used to connect tp Host starting phase3 (disabling FirstPrivateKey)
	ConfIF                      bool                          // if set to true, configure all interfaces to DHCP
	IsGateway                   bool                          // if set to true, activate IP forwarding
	SSHPort                     string                        // Define Gateway SSHport
	PublicIP                    string                        // contains a public IP bound to the host
	AddGateway                  bool                          // if set to true, configure default gateway
	DNSServers                  []string                      // contains the list of DNS servers to use; used only if IsGateway is true
	CIDR                        string                        // contains the cidr of the network
	DefaultRouteIP              string                        // is the IP of the gateway or the VIP if gateway HA is enabled
	EndpointIP                  string                        // is the IP of the gateway or the VIP if gateway HA is enabled
	PrimaryGatewayPrivateIP     string                        // is the private IP of the primary gateway
	PrimaryGatewayPublicIP      string                        // is the public IP of the primary gateway
	SecondaryGatewayPrivateIP   string                        // is the private IP of the secondary gateway
	SecondaryGatewayPublicIP    string                        // is the public IP of the secondary gateway
	EmulatedPublicNet           string                        // is a private network which is used to emulate a public one
	HostName                    string                        // contains the name wanted as host name (default == name of the Cloud resource)
	Tags                        map[Phase]map[string][]string // contains tags and their content(s); a tag is named #<tag> in the template
	IsPrimaryGateway            bool                          // tells if the host is a primary gateway
	GatewayHAKeepalivedPassword string                        // contains the password to use in keepalived configurations
	ProviderName                string
	BuildSubnetworks            bool
	Debug                       bool
}

Content is the structure to apply to userdata.sh template

func NewContent

func NewContent() *Content

NewContent ...

func (Content) AddInTag

func (ud Content) AddInTag(phase Phase, tagname string, content string)

AddInTag adds some useful code on the end of userdata.netsec.sh just before the end (on the label #insert_tag)

func (*Content) Generate

func (ud *Content) Generate(phase Phase) ([]byte, fail.Error)

Generate generates the script file corresponding to the phase

func (Content) OK

func (ud Content) OK() bool

OK ...

func (*Content) Prepare

func (ud *Content) Prepare(
	options stacks.ConfigurationOptions, request abstract.HostRequest, cidr string, defaultNetworkCIDR string,
	timings temporal.Timings,
) fail.Error

Prepare prepares the initial configuration script executed by cloud compute resource

func (Content) ToMap

func (ud Content) ToMap() (map[string]interface{}, fail.Error)

type Phase

type Phase string
const (
	PHASE1_INIT                      Phase = "init"   // nolint
	PHASE2_NETWORK_AND_SECURITY      Phase = "netsec" // nolint
	PHASE3_GATEWAY_HIGH_AVAILABILITY Phase = "gwha"   // nolint
	PHASE4_SYSTEM_FIXES              Phase = "sysfix" // nolint
	PHASE5_FINAL                     Phase = "final"  // nolint
)

Jump to

Keyboard shortcuts

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