Documentation ¶
Index ¶
- Variables
- func MakeBaseCampfromNCNs(v *viper.Viper, ncns []csi.LogicalNCN, ...) (map[string]CloudInit, error)
- func MakeBasecampGlobals(v *viper.Viper, logicalNcns []csi.LogicalNCN, ...) (map[string]interface{}, error)
- func MakeBasecampHostRecords(ncns []csi.LogicalNCN, shastaNetworks map[string]*csi.IPV4Network, ...) interface{}
- func WriteBasecampData(path string, ncns []csi.LogicalNCN, shastaNetworks map[string]*csi.IPV4Network, ...)
- func WriteCPTNetworkConfig(path string, v *viper.Viper, ncn csi.LogicalNCN, ...) error
- func WriteConmanConfig(path string, ncns []csi.LogicalNCN)
- func WriteDNSMasqConfig(path string, v *viper.Viper, bootstrap []csi.LogicalNCN, ...)
- func WriteMetalLBConfigMap(path string, v *viper.Viper, networks map[string]*csi.IPV4Network, ...)
- type AddressPoolDetail
- type BaseCampGlobals
- type BasecampHostRecord
- type CloudInit
- type CustomizationsNetworking
- type CustomizationsWLM
- type CustomizationsYaml
- type DNSMasqBootstrapNetwork
- type MetaData
- type MetalLBConfigMap
- type NtpConfig
- type NtpModule
- type PasswordCredential
- type PeerDetail
- type WriteFiles
Constants ¶
This section is empty.
Variables ¶
var Bond0ConfigTemplate = []byte(`
NAME='Internal Interface'# Select the NIC(s) for access to the CRAY.
# Select the NIC(s) for access.
BONDING_SLAVE0='{{.Bond0}}'
BONDING_SLAVE1='{{.Bond1}}'
# Set static IP (becomes "preferred" if dhcp is enabled)
BOOTPROTO='static'
IPADDR='{{.CIDR}}' # i.e. '192.168.64.1/20'
PREFIXLEN='{{.Mask}}' # i.e. '20'
# CHANGE AT OWN RISK:
BONDING_MODULE_OPTS='mode=802.3ad miimon=100 lacp_rate=fast xmit_hash_policy=layer2+3'# DO NOT CHANGE THESE:
# DO NOT CHANGE THESE:
ONBOOT='yes'
STARTMODE='manual'
BONDING_MASTER='yes'
`)
Bond0ConfigTemplate is the text/template for setting up the bond on the install NCN
var CANConfigTemplate = []byte(`
# CAN:
server=/can/
address=/can/
dhcp-option=interface:bond0.can0,option:domain-search,can
interface-name=pit.can,bond0.can0
interface=bond0.can0
cname=packages.can,pit.can
cname=registry.can,pit.can
dhcp-option=interface:bond0.can0,option:router,{{.Gateway}}
dhcp-range=interface:bond0.can0,{{.DHCPStart}},{{.DHCPEnd}},10m
`)
CANConfigTemplate manages the CAN portion of the DNSMasq configuration
var CMNConfigTemplate = []byte(`
# CMN:
server=/cmn/
address=/cmn/
dhcp-option=interface:bond0.cmn0,option:domain-search,cmn
interface-name=pit.cmn,bond0.cmn0
interface=bond0.cmn0
cname=packages.cmn,pit.cmn
cname=registry.cmn,pit.cmn
dhcp-option=interface:bond0.cmn0,option:router,{{.Gateway}}
dhcp-range=interface:bond0.cmn0,{{.DHCPStart}},{{.DHCPEnd}},10m
`)
CMNConfigTemplate manages the CAN portion of the DNSMasq configuration
var ConmanConfigTemplate = []byte(`
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
var HMNConfigTemplate = []byte(`
# HMN:
server=/hmn/
address=/hmn/
domain=hmn,{{.CIDR.IP}},{{.DHCPEnd}},local
interface-name=pit.hmn,bond0.hmn0
dhcp-option=interface:bond0.hmn0,option:domain-search,hmn
interface=bond0.hmn0
cname=packages.hmn,pit.hmn
cname=registry.hmn,pit.hmn
# This needs to point to the liveCD IP for provisioning in bare-metal environments.
dhcp-option=interface:bond0.hmn0,option:dns-server,{{.PITServer}}
dhcp-option=interface:bond0.hmn0,option:ntp-server,{{.PITServer}}
dhcp-option=interface:bond0.hmn0,option:router,{{.Gateway}}
dhcp-range=interface:bond0.hmn0,{{.DHCPStart}},{{.DHCPEnd}},10m
`)
HMNConfigTemplate manages the HMN portion of the DNSMasq configuration typically bond0.hmn0
var Lan0ConfigTemplate = []byte(`
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}}' # i.e. 10.100.10.1/24
PREFIXLEN='{{.IPPrefix}}' # i.e. 24
# DO NOT CHANGE THESE:
ONBOOT='yes'
STARTMODE='auto'
BRIDGE='yes'
BRIDGE_STP='no'
`)
Lan0ConfigTemplate is the text/template for handling the external site link
var MTLConfigTemplate = []byte(`
# MTL:
server=/mtl/
address=/mtl/
domain=mtl,{{.CIDR.IP}},{{.DHCPEnd}},local
dhcp-option=interface:bond0,option:domain-search,mtl
interface=bond0
interface-name=pit.mtl,bond0
cname=packages.local,pit.mtl
cname=packages.mtl,pit.mtl
cname=registry.mtl,pit.mtl
# This needs to point to the liveCD IP for provisioning in bare-metal environments.
dhcp-option=interface:bond0,option:dns-server,{{.PITServer}}
dhcp-option=interface:bond0,option:ntp-server,{{.PITServer}}
# This must point at the router for the network; the L3/IP for the VLAN.
dhcp-option=interface:bond0,option:router,{{.Gateway}}
dhcp-range=interface:bond0,{{.DHCPStart}},{{.DHCPEnd}},10m
`)
MTLConfigTemplate manages the MTL portion of the DNSMasq configuration
var MetalLBConfigMapTemplate = []byte(`
---
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
var NMNConfigTemplate = []byte(`
# NMN:
server=/nmn/
address=/nmn/
interface-name=pit.nmn,bond0.nmn0
domain=nmn,{{.CIDR.IP}},{{.DHCPEnd}},local
dhcp-option=interface:bond0.nmn0,option:domain-search,nmn
interface=bond0.nmn0
cname=packages.nmn,pit.nmn
cname=registry.nmn,pit.nmn
# This needs to point to the liveCD IP for provisioning in bare-metal environments.
dhcp-option=interface:bond0.nmn0,option:dns-server,{{.PITServer}}
dhcp-option=interface:bond0.nmn0,option:ntp-server,{{.PITServer}}
dhcp-option=interface:bond0.nmn0,option:router,{{.Gateway}}
dhcp-range=interface:bond0.nmn0,{{.DHCPStart}},{{.DHCPEnd}},10m
`)
NMNConfigTemplate manages the NMN portion of the DNSMasq configuration
var StaticConfigTemplate = []byte(`
# 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
dhcp-host=id:{{.Xname}},set:{{.Hostname}},{{.Bond0Mac0}},{{.Bond0Mac1}},{{.CanIP}},{{.Hostname}},20m # CAN
dhcp-host={{.BmcMac}},{{.BmcIP}},{{.Hostname}}-mgmt,20m #HMN
# Host Record Entries for {{.Hostname}}
host-record={{.Hostname}},{{.Hostname}}.can,{{.CanIP}}
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
var VlanConfigTemplate = []byte(`
NAME='{{.FullName}}'
# Set static IP (becomes "preferred" if dhcp is enabled)
BOOTPROTO='static'
IPADDR='{{.CIDR}}' # i.e. '192.168.80.1/20'
PREFIXLEN='{{.Mask}}' # i.e. '20'
# CHANGE AT OWN RISK:
ETHERDEVICE='bond0'
# 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
var VlanRouteTemplate = []byte(`
{{- range . -}}
{{.CIDR}} {{.Gateway}} {{.Mask}} -
{{ end -}}
`)
VlanRouteTemplate allows us to add static routes to the vlan(s) on the PIT node
Functions ¶
func MakeBaseCampfromNCNs ¶
func MakeBaseCampfromNCNs(v *viper.Viper, ncns []csi.LogicalNCN, shastaNetworks map[string]*csi.IPV4Network) (map[string]CloudInit, error)
MakeBaseCampfromNCNs uses ncns and networks to create the basecamp config
func MakeBasecampGlobals ¶
func MakeBasecampGlobals(v *viper.Viper, logicalNcns []csi.LogicalNCN, shastaNetworks map[string]*csi.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 []csi.LogicalNCN, shastaNetworks map[string]*csi.IPV4Network, installNCN string) interface{}
MakeBasecampHostRecords uses the ncns to generate a list of host ips and their names for use in /etc/hosts
func WriteBasecampData ¶
func WriteBasecampData(path string, ncns []csi.LogicalNCN, shastaNetworks map[string]*csi.IPV4Network, globals interface{})
WriteBasecampData writes basecamp data.json for the installer
func WriteCPTNetworkConfig ¶
func WriteCPTNetworkConfig(path string, v *viper.Viper, ncn csi.LogicalNCN, shastaNetworks map[string]*csi.IPV4Network) error
WriteCPTNetworkConfig writes the Network Configuration details for the installation node (PIT)
func WriteConmanConfig ¶
func WriteConmanConfig(path string, ncns []csi.LogicalNCN)
WriteConmanConfig provides conman configuration for the installer
func WriteDNSMasqConfig ¶
func WriteDNSMasqConfig(path string, v *viper.Viper, bootstrap []csi.LogicalNCN, networks map[string]*csi.IPV4Network)
WriteDNSMasqConfig writes the dnsmasq configuration files necssary for installation
func WriteMetalLBConfigMap ¶
func WriteMetalLBConfigMap(path string, v *viper.Viper, networks map[string]*csi.IPV4Network, switches []*csi.ManagementSwitch)
WriteMetalLBConfigMap creates the yaml configmap
Types ¶
type AddressPoolDetail ¶ added in v1.9.13
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:"kube-proxy-replacement"` // strict NumStorageNodes int `json:"num_storage_nodes"` }
BaseCampGlobals is the set of information needed for an install to reach the handoff point.
type BasecampHostRecord ¶
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 []csi.LogicalNCN, shastaNetworks map[string]*csi.IPV4Network, switches []*csi.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 csi.IPV4Subnet Interface string }
DNSMasqBootstrapNetwork holds information for configuring DNSMasq on the LiveCD
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 ¶ added in v1.9.13
func GetMetalLBConfig(v *viper.Viper, networks map[string]*csi.IPV4Network, switches []*csi.ManagementSwitch) MetalLBConfigMap
GetMetalLBConfig gathers the information for the metallb config map
type NtpConfig ¶
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 ¶ added in v1.9.9
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