initialize

package
v1.36.6 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BondConfigTemplate = []byte(`
{{- /* remove leading whitespace */ -}}
#
## This file was generated by cray-site-init.
#
NAME='Internal Interface'

# Set static IP (becomes "preferred" if dhcp is enabled)
BOOTPROTO='static'
IPADDR='{{.CIDR}}'
PREFIXLEN='{{.Mask}}'

# CHANGE AT OWN RISK:
BONDING_MODULE_OPTS='mode=802.3ad miimon=100 lacp_rate=fast xmit_hash_policy=layer2+3'

# DO NOT CHANGE THESE:
ONBOOT='yes'
STARTMODE='auto'
BONDING_MASTER='yes'

# BOND MEMBERS:
{{ range $i, $v := .Members -}}
BONDING_SLAVE{{$i}}='{{$v}}'
{{ end -}}
`)

BondConfigTemplate is the text/template for setting up the bond on the install NCN

View Source
var ConmanConfigTemplate = []byte(`
{{- /* remove leading whitespace */ -}}
#
## This file was generated by cray-site-init.
#
SERVER keepalive=ON
SERVER logdir="/var/log/conman"
SERVER logfile="conman.log"
SERVER loopback=ON
SERVER pidfile="/var/run/conman/conman.pid"
SERVER resetcmd="powerman -0 %N; sleep 3; powerman -1 %N"
SERVER timestamp=1h
GLOBAL seropts="115200,8n1"
GLOBAL log="console.%N"
GLOBAL logopts="sanitize,timestamp"
{{range .}}
console name="{{.Hostname}}-mgmt"     dev="ipmi:{{.IP}}" ipmiopts="U:{{.User}},P:{{.Pass}},W:solpayloadsize"
{{- end}}
`)

ConmanConfigTemplate manages the Conman Configuration

View Source
var Lan0ConfigTemplate = []byte(`
{{- /* remove leading whitespace */ -}}
#
## This file was generated by cray-site-init.
#
NAME='External Site-Link'

# Select the NIC(s) for direct, external access.
BRIDGE_PORTS='{{.Nic}}'

# Set static IP (becomes "preferred" if dhcp is enabled)
# NOTE: IPADDR's route will override DHCPs.
BOOTPROTO='static'
IPADDR='{{.IP}}'
PREFIXLEN='{{.IPPrefix}}'

# DO NOT CHANGE THESE:
ONBOOT='yes'
STARTMODE='auto'
BRIDGE='yes'
BRIDGE_STP='no'
`)

Lan0ConfigTemplate is the text/template for handling the external site link

View Source
var MetalLBConfigMapTemplate = []byte(`
{{- /* remove leading whitespace */ -}}
#
## This file was generated by cray-site-init.
#
---
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    peers:{{range .PeerSwitches}}
    - peer-address: {{ .IPAddress }}
      peer-asn: {{ .PeerASN }}
      my-asn: {{ .MyASN }}
      {{- end}}
    address-pools:{{range .Networks}}
    - name: {{ .Name}}
      protocol: {{ .Protocol }}
      addresses: {{range $subnet := .Addresses}}
      - {{ $subnet }}
      {{- end}}
    {{- end}}
`)

MetalLBConfigMapTemplate manages the ConfigMap for MetalLB

View Source
var StaticConfigTemplate = []byte(`
{{- /* remove leading whitespace */ -}}
#
## This file was generated by cray-site-init.
#
# Static Configurations
{{range .NCNS}}
# DHCP Entries for {{.Hostname}}
dhcp-host=id:{{.Xname}},set:{{.Hostname}},{{.Bond0Mac0}},{{.Bond0Mac1}},{{.MtlIP}},{{.Hostname}},20m # MTL
dhcp-host=id:{{.Xname}},set:{{.Hostname}},{{.Bond0Mac0}},{{.Bond0Mac1}},{{.NmnIP}},{{.Hostname}},20m # Bond0 Mac0/Mac1
dhcp-host=id:{{.Xname}},set:{{.Hostname}},{{.Bond0Mac0}},{{.Bond0Mac1}},{{.HmnIP}},{{.Hostname}},20m # HMN
{{ if eq $.BICAN "CAN" -}}
dhcp-host=id:{{.Xname}},set:{{.Hostname}},{{.Bond0Mac0}},{{.Bond0Mac1}},{{.CanIP}},{{.Hostname}},20m # CAN
{{ end -}}
dhcp-host={{.BmcMac}},{{.BmcIP}},{{.Hostname}}-mgmt,20m #HMN
# Host Record Entries for {{.Hostname}}
{{ if eq $.BICAN "CAN" -}}
host-record={{.Hostname}},{{.Hostname}}.can,{{.CanIP}}
{{ end -}}
host-record={{.Hostname}},{{.Hostname}}.hmn,{{.HmnIP}}
host-record={{.Hostname}},{{.Hostname}}.nmn,{{.NmnIP}}
host-record={{.Hostname}},{{.Hostname}}.mtl,{{.MtlIP}}
host-record={{.Xname}},{{.Hostname}}.nmn,{{.NmnIP}}
host-record={{.Hostname}}-mgmt,{{.Hostname}}-mgmt.hmn,{{.BmcIP}}
# Override root-path with {{.Hostname}}'s xname
dhcp-option-force=tag:{{.Hostname}},17,{{.Xname}}
{{end}}
# Virtual IP Addresses for k8s and the rados gateway
host-record=kubeapi-vip,kubeapi-vip.nmn,{{.KUBEVIP}} # k8s-virtual-ip
host-record=rgw-vip,rgw-vip.nmn,{{.RGWVIP}} # rgw-virtual-ip
host-record={{.APIGWALIASES}},{{.APIGWIP}} # api gateway

cname=kubernetes-api.vshasta.io,ncn-m001
`)

StaticConfigTemplate manages the static portion of the DNSMasq configuration Systems with onboard NICs will have a MTL MAC. Others will also use the NMN

View Source
var SubnetConfigDHCPOnlyTemplate = []byte(`
{{- /* remove leading whitespace */ -}}
#
## This file was generated by cray-site-init.
#
# {{.NetName}}:
server=/{{.NetName | lower}}/
address=/{{.NetName | lower}}/
dhcp-option=interface:{{.InterfaceName}},option:domain-search,{{.NetName | lower}}
interface-name=pit.{{.NetName | lower}},{{.InterfaceName}}
interface={{.InterfaceName}}
cname=packages.{{.NetName | lower}},pit.{{.NetName | lower}}
cname=registry.{{.NetName | lower}},pit.{{.NetName | lower}}
dhcp-option=interface:{{.InterfaceName}},option:router,{{.Gateway}}
dhcp-range=interface:{{.InterfaceName}},{{.DHCPStart}},{{.DHCPEnd}},10m
`)

SubnetConfigDHCPOnlyTemplate handles subnet definitions with reduced DHCP options.

View Source
var SubnetConfigTemplate = []byte(`
{{- /* remove leading whitespace */ -}}
#
## This file was generated by cray-site-init.
#
# {{.NetName}}:
server=/{{.NetName | lower}}/
address=/{{.NetName | lower}}/
domain=nmn,{{.CIDR.IP}},{{.DHCPEnd}},local
interface-name=pit.{{.NetName | lower}},{{.InterfaceName}}
dhcp-option=interface:{{.InterfaceName}},option:domain-search,{{.NetName | lower}}
interface={{.InterfaceName}}
cname=packages.{{.NetName | lower}},pit.{{.NetName | lower}}
{{ if eq .NetName "MTL" -}}
cname=packages.local,pit.{{.NetName | lower}}
{{ end -}}
cname=registry.{{.NetName | lower}},pit.{{.NetName | lower}}
dhcp-option=interface:{{.InterfaceName}},option:dns-server,{{.PITServer}}
dhcp-option=interface:{{.InterfaceName}},option:ntp-server,{{.PITServer}}
dhcp-option=interface:{{.InterfaceName}},option:router,{{.Gateway}}
dhcp-range=interface:{{.InterfaceName}},{{.DHCPStart}},{{.DHCPEnd}},10m
`)

SubnetConfigTemplate handles subnet definitions for DNSMasq.

View Source
var VlanConfigTemplate = []byte(`
{{- /* remove leading whitespace */ -}}
#
## This file was generated by cray-site-init.
#
NAME='{{.FullName}}'

# Set static IP (becomes "preferred" if dhcp is enabled)
BOOTPROTO='static'
IPADDR='{{.CIDR}}'
PREFIXLEN='{{.Mask}}'

# CHANGE AT OWN RISK:
ETHERDEVICE='{{.ParentInterfaceName}}'

# DO NOT CHANGE THESE:
VLAN_PROTOCOL='ieee802-1Q'
VLAN='yes'
VLAN_ID={{.Vlan}}
ONBOOT='yes'
STARTMODE='auto'
`)

VlanConfigTemplate is the text/template to bootstrap the install cd

View Source
var VlanRouteTemplate = []byte(`
{{- /* remove leading whitespace */ -}}
#
## This file was generated by cray-site-init.
#
{{ range . -}}
{{.CIDR}} {{.Gateway}} {{.Mask}} -
{{ end -}}
`)

VlanRouteTemplate allows us to add static routes to the vlan(s) on the PIT node

Functions

func AllocateIps

func AllocateIps(ncns []*LogicalNCN, networks map[string]*networking.IPV4Network)

AllocateIps distributes IP reservations for each of the NCNs within the networks

func CabinetForXname

func CabinetForXname(xname string) (
	string, error,
)

CabinetForXname extracts the cabinet identifier from an xname

func ExtractSLSNetworks

func ExtractSLSNetworks(sls *slsCommon.SLSState) (
	[]networking.IPV4Network, error,
)

ExtractSLSNetworks converts from the SLS version of Network Definitions to a list of IPV4Networks

func ExtractSLSSwitches

func ExtractSLSSwitches(sls *slsCommon.SLSState) (
	[]networking.ManagementSwitch, error,
)

ExtractSLSSwitches reads the SLSState object and finds any switches

func GenerateInstanceID

func GenerateInstanceID() string

GenerateInstanceID creates an instance-id fit for use in the instance metadata

func GetSLSCabinets

func GetSLSCabinets(
	state slsCommon.SLSState, class slsCommon.CabinetType,
) []slsCommon.GenericHardware

GetSLSCabinets will get all of the cabinets from SLS of the specified class

func MakeBaseCampfromNCNs

func MakeBaseCampfromNCNs(
	v *viper.Viper, ncns []LogicalNCN, shastaNetworks map[string]*networking.IPV4Network,
) (
	map[string]CloudInit, error,
)

MakeBaseCampfromNCNs uses ncns and networks to create the basecamp config

func MakeBasecampGlobals

func MakeBasecampGlobals(
	v *viper.Viper,
	logicalNcns []LogicalNCN,
	shastaNetworks map[string]*networking.IPV4Network,
	installNetwork string,
	installSubnet string,
	installNCN string,
) (
	map[string]interface{}, error,
)

MakeBasecampGlobals uses the defaults above to create a suitable k/v pairing for the Globals in data.json for basecamp

func MakeBasecampHostRecords

func MakeBasecampHostRecords(
	ncns []LogicalNCN, shastaNetworks map[string]*networking.IPV4Network, installNCN string,
) interface{}

MakeBasecampHostRecords uses the ncns to generate a list of host ips and their names for use in /etc/hosts

func NewCommand

func NewCommand() *cobra.Command

NewCommand represents the init command

func ParseSLSFile

func ParseSLSFile(path string) (
	slsCommon.SLSState, error,
)

ParseSLSFile takes a path and returns an SLSState struct for parsing

func ParseSLSfromURL

func ParseSLSfromURL(url string) (
	slsCommon.SLSState, error,
)

ParseSLSfromURL takes a url (likely the sls dumpstate url) and returns a useful struct

func WriteBasecampData

func WriteBasecampData(
	path string, ncns []LogicalNCN, shastaNetworks map[string]*networking.IPV4Network, globals interface{},
)

WriteBasecampData writes basecamp data.json for the installer

func WriteCPTNetworkConfig

func WriteCPTNetworkConfig(
	path string, v *viper.Viper, ncn LogicalNCN, shastaNetworks map[string]*networking.IPV4Network,
) error

WriteCPTNetworkConfig writes the Network Configuration details for the installation node (PIT)

func WriteConmanConfig

func WriteConmanConfig(
	path string, ncns []LogicalNCN,
)

WriteConmanConfig provides conman configuration for the installer

func WriteDNSMasqConfig

func WriteDNSMasqConfig(
	path string, v *viper.Viper, bootstrap []LogicalNCN, networks map[string]*networking.IPV4Network,
)

WriteDNSMasqConfig writes the dnsmasq configuration files necessary for installation

func WriteMetalLBConfigMap

func WriteMetalLBConfigMap(
	path string, v *viper.Viper, networks map[string]*networking.IPV4Network, switches []*networking.ManagementSwitch,
)

WriteMetalLBConfigMap creates the yaml configmap

Types

type AddressPoolDetail

type AddressPoolDetail struct {
	Name      string   `yaml:"name" valid:"_,required"`
	Protocol  string   `yaml:"protocol" valid:"_,required"`
	Addresses []string `yaml:"addresses" valid:"required"`
}

AddressPoolDetail holds information about each of the MetalLB address pools

type BaseCampGlobals

type BaseCampGlobals struct {

	// CEPH Installation Globals
	CephFSImage          string `json:"ceph-cephfs-image"`
	CephRBDImage         string `json:"ceph-rbd-image"`
	CephStorageNodeCount string `json:"ceph-num-storage-nodes"` // "3"
	CephRGWVip           string `json:"rgw-virtual-ip"`
	CephWipe             bool   `json:"wipe-ceph-osds"`

	// Not sure what consumes this.
	// Are we sure we want to reference something outside the cluster for this?
	ImageRegistry string `json:"docker-image-registry"` // dtr.dev.cray.com"

	// Commenting out several that I think we don't need
	// Domain string `json:domain`        // dnsmasq should provide this
	DNSServer string `json:"dns-server"`

	// Kubernetes Installation Globals
	KubernetesVIP              string `json:"kubernetes-virtual-ip"`
	KubernetesMaxPods          string `json:"kubernetes-max-pods-per-node"`
	KubernetesPodCIDR          string `json:"kubernetes-pods-cidr"`          // "10.32.0.0/12"
	KubernetesServicesCIDR     string `json:"kubernetes-services-cidr"`      // "10.16.0.0/12"
	KubernetesWeaveMTU         string `json:"kubernetes-weave-mtu"`          // 1376
	KubernetesCiliumOpReplicas string `json:"cilium-operator-replicas"`      // 1
	KubernetesPrimaryCNI       string `json:"k8s-primary-cni"`               // weave
	KubernetesKubeProxyReplace string `json:"cilium-kube-proxy-replacement"` // disabled

	NumStorageNodes int `json:"num_storage_nodes"`
}

BaseCampGlobals is the set of information needed for an install to reach the handoff point.

type BasecampHostRecord

type BasecampHostRecord struct {
	IP      string   `json:"ip"`
	Aliases []string `json:"aliases"`
}

BasecampHostRecord is what we need for passing stuff to /etc/hosts

type CloudInit

type CloudInit struct {
	MetaData MetaData               `yaml:"meta-data" json:"meta-data"`
	UserData map[string]interface{} `yaml:"user-data" json:"user-data"`
}

CloudInit is the main cloud-init struct. Leave the meta-data, user-data, and phone home info as generic interfaces as the user defines how much info exists in it.

type CustomizationsNetworking

type CustomizationsNetworking struct {
	NMN          string `yaml:"nmn" valid:"cidr,required"`
	NMNLB        string `yaml:"nmn_load_balancers" valid:"cidr,required"`
	HMN          string `yaml:"hmn" valid:"cidr,required"`
	HMNLB        string `yaml:"hmn_load_balancers" valid:"cidr,required"`
	HSN          string `yaml:"high_speed" valid:"cidr,required"`
	NetStaticIps struct {
		SiteToSystem       net.IP   `yaml:"site_to_system_lookups" valid:"ipv4,required"`
		SystemToSite       net.IP   `yaml:"system_to_site_lookups" valid:"ipv4,required"`
		NmnTftp            net.IP   `yaml:"nmn_tftp" valid:"ipv4,required"`
		HmnTftp            net.IP   `yaml:"hmn_tftp" valid:"ipv4,required"`
		NmnAPIGateway      net.IP   `yaml:"nmn_api_gw" valid:"ipv4,required"`
		NmnUnbound         net.IP   `yaml:"nmn_unbound" valid:"ipv4,required"`
		NmnAPIGatewayLocal net.IP   `yaml:"nmn_api_gw_local" valid:"ipv4,required"`
		HmnAPIGateway      net.IP   `yaml:"hmn_api_gw" valid:"ipv4,required"`
		NcnMasters         []net.IP `yaml:"nmn_ncn_masters" valid:"required"`
		NcnStorage         []net.IP `yaml:"nmn_ncn_storage" valid:"required"`
		NcnStorageMons     []net.IP `yaml:"nmn_ncn_storage_mons" valid:"required"`
	}
	DNS struct {
		ExternalDomain    string `yaml:"external" valid:"host,required"`
		ExternalS3        string `yaml:"external_s3" valid:"required,host"`
		ExternalAuth      string `yaml:"external_auth" valid:"required,host"`
		ExternalAPI       string `yaml:"external_api" valid:"required,host"`
		InternalS3        string `yaml:"internal_s3" valid:"required,host"`
		InternalAPI       string `yaml:"internal_api" valid:"required,host"`
		PrimaryServerName string `yaml:"primary_server_name" valid:"required,host"`
		SecondaryServers  string `yaml:"secondary_servers" valid:"required,host"`
		NotifyZones       string `yaml:"notify_zones" valid:"required,host"`
	}
	MetalLB struct {
		Peers        []PeerDetail        `yaml:"peers"`
		AddressPools []AddressPoolDetail `yaml:"address-pools"`
	}
}

CustomizationsNetworking is the struct for holding all Networking related variables for use in customizations.yaml

type CustomizationsWLM

type CustomizationsWLM struct {
	WLMStaticIPs struct {
		SlurmCtlD net.IP `` /* 131-byte string literal not displayed */
		SlurmDbd  net.IP `` /* 129-byte string literal not displayed */
		Pbs       net.IP `yaml:"pbs" valid:"ipv4,required" desc:"The PBS IP address on the nmn, accessible from all UAIs,UANs, and Compute Nodes"`
		PbsComm   net.IP `` /* 129-byte string literal not displayed */
	}
	MacVlanSetup struct {
		NMNSubnetCIDR              string `yaml:"nmn_subnet" valid:"cidr,required"`
		NMNSupernetCIDR            string `yaml:"nmn_supernet" valid:"cidr,required"`
		NMNSupernetGateway         net.IP `yaml:"nmn_supernet_gateway" valid:"ipv4,required"`
		NMNVlanInterface           string `yaml:"nmn_vlan" valid:"_,required"`
		NMNMacVlanReservationStart net.IP `yaml:"nmn_reservation_start" valid:"ipv4,required"`
		NMNMacVlanReservationEnd   net.IP `yaml:"nmn_reservation_end" valid:"ipv4,required"`
		Routes                     []struct {
			Destination string `yaml:"dst" valid:"cidr,required"`
			Gateway     string `yaml:"gw" valid:"cidr,required"`
		}
	}
}

CustomizationsWLM is the struct for holding all WLM related values for customizations.yaml

type CustomizationsYaml

type CustomizationsYaml struct {
	Networking CustomizationsNetworking `yaml:"network"`
	WLM        CustomizationsWLM        `yaml:"wlm"`
}

CustomizationsYaml is the golang representation of the customizations.yaml stanza we generate

func GenCustomizationsYaml

func GenCustomizationsYaml(
	ncns []LogicalNCN, shastaNetworks map[string]*networking.IPV4Network, switches []*networking.ManagementSwitch,
) CustomizationsYaml

GenCustomizationsYaml generates our configurations.yaml nested struct

func (*CustomizationsYaml) IsValid

func (c *CustomizationsYaml) IsValid() bool

IsValid uses govalidator and struct tags to validate and returns a boolean

func (*CustomizationsYaml) ValidationErrors

func (c *CustomizationsYaml) ValidationErrors() error

ValidationErrors uses govalidator and struct tags to validate and returns errors

type DNSMasqBootstrapNetwork

type DNSMasqBootstrapNetwork struct {
	Subnet    networking.IPV4Subnet
	Interface string
}

DNSMasqBootstrapNetwork holds information for configuring DNSMasq on the LiveCD

type LogicalNCN

type LogicalNCN struct {
	Role             string         `yaml:"role" json:"role" csv:"NCN Role"`
	Subrole          string         `yaml:"subrole" json:"subrole" csv:"NCN Subrole"`
	BmcMac           string         `yaml:"bmc-mac" json:"bmc-mac" csv:"BMC MAC"`
	BmcPort          string         `yaml:"bmc-port" json:"bmc-port" csv:"BMC Switch Port"`
	NmnMac           string         `yaml:"nmn-mac" json:"nmn-mac" csv:"NMN MAC"`
	NmnPort          string         `yaml:"nmn-port" json:"nmn-port" csv:"NMN Switch Port"`
	NmnIP            string         `yaml:"nmn-ip" json:"nmn-ip" csv:"-"`
	HmnIP            string         `yaml:"hmn-ip" json:"hmn-ip" csv:"-"`
	MtlIP            string         `yaml:"mtl-ip" json:"mtl-ip" csv:"-"`
	CmnIP            string         `yaml:"cmn-ip" json:"cmn-ip" csv:"-"`
	CanIP            string         `yaml:"can-ip" json:"can-ip" csv:"-"`
	Xname            string         `yaml:"xname" json:"xname" csv:"NCN xname"`
	Hostname         string         `yaml:"hostname" json:"hostname" csv:"-"`
	InstanceID       string         `yaml:"instance-id" json:"instance-id" csv:"-"` // should be unique for the life of the image
	Region           string         `yaml:"region" json:"region" csv:"-"`
	AvailabilityZone string         `yaml:"availability-zone" json:"availability-zone" csv:"-"`
	ShastaRole       string         `yaml:"shasta-role" json:"shasta-role" csv:"-"` // map to HSM Subrole
	Aliases          []string       `yaml:"aliases" json:"aliases" csv:"-"`
	Networks         []NCNNetwork   `yaml:"networks" json:"networks" csv:"-"`
	Interfaces       []NCNInterface `yaml:"interfaces" json:"interfaces" csv:"-"`
	BmcIP            string         `yaml:"bmc-ip" json:"bmc-ip" csv:"-"`
	Bond0Mac0        string         `yaml:"bond0-mac0" json:"bond0-mac0" csv:"-"`
	Bond0Mac1        string         `yaml:"bond0-mac1" json:"bond0-mac1" csv:"-"`
	Cabinet          string         `yaml:"cabinet" json:"cabinet" csv:"-"` // Use to establish availability zone
}

LogicalNCN is the main struct for NCNs It replaces the deprecated BootstrapNCNMetadata and still matches the ncn_metadata.csv file as NCN xname,NCN Role,NCN Subrole,BMC MAC,BMC Switch Port,NMN MAC,NMN Switch Port

func ExtractSLSNCNs

func ExtractSLSNCNs(sls *slsCommon.SLSState) (
	[]LogicalNCN, error,
)

ExtractSLSNCNs pulls the port information for the BMCs of all Management Nodes

func ReadNodeCSV

func ReadNodeCSV(filename string) (
	[]*LogicalNCN, error,
)

ReadNodeCSV parses a CSV file into a list of NCN_bootstrap nodes for use by the installer

func (LogicalNCN) GetHostname

func (lncn LogicalNCN) GetHostname() string

GetHostname returns an explicit hostname if possible, otherwise the Xname, otherwise an empty string

func (*LogicalNCN) GetIP

func (lncn *LogicalNCN) GetIP(netName string) net.IP

GetIP takes in a netname and returns an IP address for that netname

func (*LogicalNCN) Normalize

func (lncn *LogicalNCN) Normalize() error

Normalize the values of a LogicalNCN

func (*LogicalNCN) Validate

func (lncn *LogicalNCN) Validate() error

Validate is a validator that checks for a minimum set of info

type LogicalUAN

type LogicalUAN struct {
	Xname    string   `yaml:"xname" json:"xname" csv:"NCN xname"`
	Hostname string   `yaml:"hostname" json:"hostname" csv:"-"`
	Role     string   `yaml:"role" json:"role" csv:"NCN Role"`
	Subrole  string   `yaml:"subrole" json:"subrole" csv:"NCN Subrole"`
	CanIP    net.IP   `yaml:"bmc-ip" json:"bmc-ip" csv:"-"`
	Aliases  []string `yaml:"aliases" json:"aliases" csv:"-"`
}

LogicalUAN is like LogicalNCN, but for UANs

func ExtractUANs

func ExtractUANs(sls *slsCommon.SLSState) (
	[]LogicalUAN, error,
)

ExtractUANs pulls the information needed to assign CAN addresses to the UAN xnames

type MetaData

type MetaData struct {
	Hostname         string                 `yaml:"local-hostname" json:"local-hostname"`       // should be local hostname e.g. ncn-m003
	Xname            string                 `yaml:"xname" json:"xname"`                         // should be xname e.g. x3000c0s1b0n0
	InstanceID       string                 `yaml:"instance-id" json:"instance-id"`             // should be unique for the life of the image
	Region           string                 `yaml:"region" json:"region"`                       // unused currently
	AvailabilityZone string                 `yaml:"availability-zone" json:"availability-zone"` // unused currently
	ShastaRole       string                 `yaml:"shasta-role" json:"shasta-role"`             // map to HSM role
	IPAM             map[string]interface{} `yaml:"ipam" json:"ipam"`
}

MetaData is part of the cloud-init structure and is only used for validating the required fields in the `CloudInit` struct below.

type MetalLBConfigMap

type MetalLBConfigMap struct {
	LeafSwitches  []PeerDetail
	PeerSwitches  []PeerDetail
	SpineSwitches []PeerDetail
	EdgeSwitches  []PeerDetail
	Networks      []AddressPoolDetail
}

MetalLBConfigMap holds information needed by the MetalLBConfigMapTemplate

func GetMetalLBConfig

func GetMetalLBConfig(
	v *viper.Viper, networks map[string]*networking.IPV4Network, switches []*networking.ManagementSwitch,
) MetalLBConfigMap

GetMetalLBConfig gathers the information for the metallb config map

type NCNInterface

type NCNInterface struct {
	InterfaceType string `json:"product" csv:"product"`
	PCIAddress    string `json:"pci-address" csv:"bus info"`
	DeviceName    string `json:"device-name" csv:"logical name"`
	MacAddress    string `json:"mac-address" csv:"serial"`
	IPAddress     string `json:"ip-address" csv:"_"`
	Usage         string `json:"usage" csv:"-"`
}

NCNInterface holds information for all MAC addresses in all NCNs. CSV definitions are the lshw fields

type NCNNetwork

type NCNNetwork struct {
	NetworkName         string `json:"network-name"`
	FullName            string `json:"full-name"`
	IPAddress           string `json:"ip-address"`
	InterfaceName       string `json:"net-device"`
	InterfaceMac        string `json:"mac-address"`
	ParentInterfaceName string `json:"parent-interface-name"`
	Vlan                int    `json:"vlan"`
	CIDR                string `json:"cidr"`
	Mask                string `json:"mask"`
	Gateway             net.IP `json:"gateway"`
}

NCNNetwork holds information about networks in the NCN context

type NewBootstrapNCNMetadata

type NewBootstrapNCNMetadata struct {
	Xname        string `json:"xname" csv:"Xname"`
	Role         string `json:"role" csv:"Role"`
	Subrole      string `json:"subrole" csv:"Subrole"`
	BmcMac       string `json:"bmc-mac" csv:"BMC MAC"`
	BootstrapMac string `json:"bootstrap-mac" csv:"Bootstrap MAC"`
	Bond0Mac0    string `json:"bond0-mac0" csv:"Bond0 MAC0"`
	Bond0Mac1    string `json:"bond0-mac1" csv:"Bond0 MAC1"`
}

NewBootstrapNCNMetadata is a type that matches the updated ncn_metadata.csv file as Xname,Role,Subrole,BMC MAC,Bootstrap MAC,Bond0 MAC0,Bond0 Mac1 It is probable that on many machines bootstrap mac will be the same as one of the bond macs Do not be alarmed.

type NtpConfig

type NtpConfig struct {
	ConfPath string `json:"confpath"`
	Template string `json:"template"`
}

NtpConfig is the options for the cloud-init ntp module. this is mainly the template that gets deployed to the NCNs

type NtpModule

type NtpModule struct {
	Enabled    bool      `json:"enabled"`
	NtpClient  string    `json:"ntp_client"`
	NTPPeers   []string  `json:"peers"`
	NTPAllow   []string  `json:"allow"`
	NTPServers []string  `json:"servers"`
	NTPPools   []string  `json:"pools,omitempty"`
	Config     NtpConfig `json:"config"`
}

NtpModule enables use of the cloud-init ntp module

type PasswordCredential

type PasswordCredential struct {
	Username   string `form:"username" json:"username"`
	Password   string `form:"password" json:"password"`
	ServiceURL string `form:"service_url" json:"service_url" binding:"omitempty"`
}

PasswordCredential is a struct for holding username/password credentials

type PeerDetail

type PeerDetail struct {
	IPAddress string `yaml:"peer-address" valid:"_,required"`
	PeerASN   int    `yaml:"peer-asn" valid:"_,required"`
	MyASN     int    `yaml:"my-asn" valid:"_,required"`
}

PeerDetail holds information about each of the BGP routers that we peer with in MetalLB

type WriteFiles

type WriteFiles struct {
	Content     string `json:"content"`
	Owner       string `json:"owner"`
	Path        string `json:"path"`
	Permissions string `json:"permissions"`
}

WriteFiles enables use of the cloud-init write_files module

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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