fab

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PresetBM   cnc.Preset = "lab"
	PresetVLAB cnc.Preset = "vlab"
)
View Source
const (
	Stage                cnc.Stage = iota // Just a placeholder stage
	StageInstall0Prep                     // Preparation for K3s and Zot installation
	StageInstall1K3sZot                   // Kube and Registry Installation, wait for registry available
	StageInstall2Misc                     // Install misc services and wait for them to be ready
	StageInstall3Fabric                   // Install Fabric and wait for it to be ready
	StageInstall4DasBoot                  // Install Das Boot and wait for it to be ready
	StageInstall9Reloader

	StageMax // Keep it last so we can iterate over all stages
)

We expect services installed during the stage to be available at the end of it

View Source
const (
	OCIRepoCACN     = "OCI Repository CA"
	OCIRepoServerCN = "localhost"

	KeyUsageCA     = x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign
	KeyUsageServer = x509.KeyUsageDigitalSignature | x509.KeyUsageKeyEncipherment
)
View Source
const (
	FlatcarControlUser = "core"
	ControlOSIgnition  = "ignition.json"
	DefaultVLABSSHKey  = "ssh-key"
)
View Source
const (
	CategoryConfigBaseSuffix = " fabricator options:"
)

Variables

View Source
var (
	HHSubnet                      = "172.30.0.0/16" // All Hedgehog Fabric IPs assignment will happen from this subnet
	ControlKubeClusterCIDR        = "172.28.0.0/16"
	ControlKubeServiceCIDR        = "172.29.0.0/16"
	ControlKubeClusterDNS         = "172.29.0.10"
	ControlVIP                    = "172.30.1.1"
	ControlVIPMask                = "/32"
	ASNSpine               uint32 = 65100
	ASNLeafStart           uint32 = 65101
	ZotCheckURL                   = fmt.Sprintf("https://%s:%d/v2/_catalog", ControlVIP, ZotNodePort)
	K3sAPIPort                    = 6443
	ZotNodePort                   = 31000
	DasBootNTPNodePort            = 30123
	DasBootSyslogNodePort         = 30514
	ControlProxyNodePort          = 31028

	DevSSHKey     = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGpF2+9I1Nj4BcN7y6DjzTbq1VcUYIRGyfzId5ZoBEFj" // 1P: Fabric Dev SSH Key Shared
	DevPassword   = "$5$8nAYPGcl4l6G7Av1$Qi4/gnM0yPtGv9kjpMh78NuNSfQWy7vR1rulHpurL36"                  //nolint:gosec // 1P: Fabric Dev SONiC Admin
	DevSonicUsers = []meta.UserCreds{
		{
			Name:     "admin",
			Password: "$5$8nAYPGcl4l6G7Av1$Qi4/gnM0yPtGv9kjpMh78NuNSfQWy7vR1rulHpurL36",
			Role:     "admin",
		},
		{
			Name:     "op",
			Password: "$5$oj/NxDtFw3eTyini$VHwdjWXSNYRxlFMu.1S5ZlGJbUF/CGmCAZIBroJlax4",
			Role:     "operator",
		},
	}

	OCIScheme = "oci://"

	// Base
	RefSource          = cnc.Ref{Repo: "ghcr.io/githedgehog"}
	RefTarget          = cnc.Ref{Repo: fmt.Sprintf("%s:%d/githedgehog", ControlVIP, ZotNodePort)}
	RefTargetInCluster = RefTarget

	// K3s
	RefK3s = cnc.Ref{Name: "k3s", Tag: "v1.29.1-k3s2"}

	// Zot
	RefZot            = cnc.Ref{Name: "zot", Tag: "v1.4.3"}
	RefZotTargetImage = cnc.Ref{Repo: "ghcr.io/project-zot", Name: "zot-minimal-linux-amd64"}

	// Das Boot
	DasBootSeederClusterIP = "172.29.42.42"

	RefDasBootVersion      = cnc.Ref{Tag: "v0.11.4"}
	RefDasBootCRDsChart    = cnc.Ref{Name: "das-boot/charts/das-boot-crds"}
	RefDasBootSeederChart  = cnc.Ref{Name: "das-boot/charts/das-boot-seeder"}
	RefDasBootSeederImage  = cnc.Ref{Name: "das-boot/das-boot-seeder"}
	RefDasBootRegCtrlChart = cnc.Ref{Name: "das-boot/charts/das-boot-registration-controller"}
	RefDasBootRegCtrlImage = cnc.Ref{Name: "das-boot/das-boot-registration-controller"}

	RefDasBootRsyslogChart = cnc.Ref{Name: "das-boot/charts/rsyslog", Tag: "0.1.2"}
	RefDasBootRsyslogImage = cnc.Ref{Name: "das-boot/rsyslog", Tag: "0.1.0"}

	RefDasBootNTPChart = cnc.Ref{Name: "das-boot/charts/ntp", Tag: "0.0.3"}
	RefDasBootNTPImage = cnc.Ref{Name: "das-boot/ntp", Tag: "latest"}

	// ONIE
	RefHONIEVersion        = cnc.Ref{Tag: "0.1.3"}
	RefONIETargetVersion   = cnc.Ref{Tag: "latest"} // the target tag currently *must* always be "latest" as this is hardcoded in DAS BOOT
	RefONIESrcTargetsPairs = []struct {
		src     cnc.Ref
		targets []cnc.Ref
	}{
		{
			// contains filtered or unexported fields
		},

		{
			// contains filtered or unexported fields
		},
		{
			// contains filtered or unexported fields
		},
		{
			// contains filtered or unexported fields
		},

		{
			// contains filtered or unexported fields
		},
	}

	// SONiC
	RefSonicBCMBase   = cnc.Ref{Name: "sonic-bcom-private", Tag: "base-bin-4.2.0"}
	RefSonicBCMCampus = cnc.Ref{Name: "sonic-bcom-private", Tag: "campus-bin-4.2.0"}
	RefSonicBCMVS     = cnc.Ref{Name: "sonic-bcom-private", Tag: "vs-bin-4.2.0"}

	RefSonicTargetVersion = cnc.Ref{Tag: "latest"}
	RefSonicTargetsBase   = []cnc.Ref{
		{Name: "sonic/x86_64-dellemc_s5248f_c3538-r0"},
		{Name: "sonic/x86_64-dellemc_s5232f_c3538-r0"},
		{Name: "sonic/x86_64-cel_questone_2-r0"},
		{Name: "sonic/x86_64-cel_seastone_2-r0"},
		{Name: "sonic/x86_64-cel_silverstone-r0"},
		{Name: "sonic/x86_64-accton_as7726_32x-r0"},
		{Name: "sonic/x86_64-accton_as7326_56x-r0"},
		{Name: "sonic/x86_64-accton_as7712_32x-r0"},
	}
	RefSonicTargetsCampus = []cnc.Ref{
		{Name: "sonic/x86_64-accton_as4630_54npe-r0"},
	}
	RefSonicTargetsVS = []cnc.Ref{
		{Name: "sonic/x86_64-kvm_x86_64-r0"},
	}

	// Fabric
	RefFabricVersion         = cnc.Ref{Tag: "v0.37.1"}
	RefFabricAPIChart        = cnc.Ref{Name: "fabric/charts/fabric-api"}
	RefFabricChart           = cnc.Ref{Name: "fabric/charts/fabric"}
	RefFabricImage           = cnc.Ref{Name: "fabric/fabric"}
	RefFabricAgent           = cnc.Ref{Name: "fabric/agent"}
	RefFabricControlAgent    = cnc.Ref{Name: "fabric/agent"}
	RefFabricCtl             = cnc.Ref{Name: "fabric/hhfctl", Tag: "v0.37.2"}
	RefFabricDHCPServer      = cnc.Ref{Name: "fabric/fabric-dhcp-server"}
	RefFabricDHCPServerChart = cnc.Ref{Name: "fabric/charts/fabric-dhcp-server"}
	RefFabricDHCPD           = cnc.Ref{Name: "fabric/fabric-dhcpd"}
	RefFabricDHCPDChart      = cnc.Ref{Name: "fabric/charts/fabric-dhcpd"}
	RefAlloy                 = cnc.Ref{Name: "fabric/alloy", Tag: "v1.0.0"}
	RefControlProxy          = cnc.Ref{Name: "fabric/fabric-proxy", Tag: "1.9.1"}
	RefControlProxyChart     = cnc.Ref{Name: "fabric/charts/fabric-proxy"}

	// Misc
	RefK9s       = cnc.Ref{Name: "fabricator/k9s", Tag: "v0.31.7"}
	RefRBACProxy = cnc.Ref{Name: "fabricator/kube-rbac-proxy", Tag: "v0.14.1"}
	RefToolbox   = cnc.Ref{Name: "fabricator/toolbox", Tag: "latest"}

	// Cert manager
	RefCertManagerVersion    = cnc.Ref{Tag: "v1.13.0"}
	RefCertManagerCAInjector = cnc.Ref{Name: "fabricator/cert-manager-cainjector"}
	RefCertManagerController = cnc.Ref{Name: "fabricator/cert-manager-controller"}
	RefCertManagerACMESolver = cnc.Ref{Name: "fabricator/cert-manager-acmesolver"}
	RefCertManagerWebhook    = cnc.Ref{Name: "fabricator/cert-manager-webhook"}
	RefCertManagerCtl        = cnc.Ref{Name: "fabricator/cert-manager-ctl"}
	RefCertManagerChart      = cnc.Ref{Name: "fabricator/charts/cert-manager"}

	// Reloader
	RefMiscReloader      = cnc.Ref{Name: "fabricator/reloader", Tag: "v1.0.40"}
	RefMiscReloaderChart = cnc.Ref{Name: "fabricator/charts/reloader", Tag: "1.0.40"}

	// VLAB
	RefVLABONIE       = cnc.Ref{Name: "honie", Tag: "lldp"}
	RefVLABFlarcar    = cnc.Ref{Name: "flatcar", Tag: "3760.2.0"}
	RefVLABEEPROMEdit = cnc.Ref{Name: "onie-qcow2-eeprom-edit", Tag: "latest"}
)
View Source
var (
	BundleControlInstall = cnc.Bundle{
		Name:        "control-install",
		IsInstaller: true,
	}
	BundleControlOS = cnc.Bundle{
		Name: "control-os",
	}
	BundleServerInstall = cnc.Bundle{
		Name:        "server-install",
		IsInstaller: true,
	}
	BundleServerOS = cnc.Bundle{
		Name: "server-os",
	}
	BundleVlabFiles = cnc.Bundle{
		Name: "vlab-files",
	}
	BundleVlabVMs = cnc.Bundle{
		Name: "vlab-vms",
	}
	BundleHlabFiles = cnc.Bundle{
		Name: "hlab-files",
	}
)

Functions

func LoadVLAB

func LoadVLAB(basedir string, mngr *cnc.Manager, dryRun bool, size string, restrictServers bool) (*vlab.Service, error)

func NewCNCManager

func NewCNCManager() *cnc.Manager

Types

type Base

type Base struct {
	cnc.NoValidationComponent

	Source          cnc.Ref  `json:"source,omitempty"`
	Target          cnc.Ref  `json:"target,omitempty"`
	TargetInCluster cnc.Ref  `json:"targetInCluster,omitempty"`
	AuthorizedKeys  []string `json:"authorizedKeys,omitempty"`
	Dev             bool     `json:"dev,omitempty"`
	// contains filtered or unexported fields
}

func BaseConfig

func BaseConfig(get cnc.GetComponent) *Base

func (*Base) Build

func (cfg *Base) Build(basedir string, preset cnc.Preset, _ meta.FabricMode, _ cnc.GetComponent, _ *wiring.Data, _ cnc.AddBuildOp, _ cnc.AddRunOp) error

func (*Base) Flags

func (cfg *Base) Flags() []cli.Flag

func (*Base) Hydrate

func (cfg *Base) Hydrate(preset cnc.Preset, _ meta.FabricMode) error

func (*Base) IsEnabled

func (cfg *Base) IsEnabled(_ cnc.Preset) bool

func (*Base) Name

func (cfg *Base) Name() string

type ControlOS

type ControlOS struct {
	cnc.NoValidationComponent

	PasswordHash string `json:"passwordHash,omitempty"`
}

func (*ControlOS) Build

func (cfg *ControlOS) Build(_ string, _ cnc.Preset, _ meta.FabricMode, get cnc.GetComponent, data *wiring.Data, run cnc.AddBuildOp, _ cnc.AddRunOp) error

func (*ControlOS) Flags

func (cfg *ControlOS) Flags() []cli.Flag

func (*ControlOS) Hydrate

func (cfg *ControlOS) Hydrate(_ cnc.Preset, _ meta.FabricMode) error

func (*ControlOS) IsEnabled

func (cfg *ControlOS) IsEnabled(_ cnc.Preset) bool

func (*ControlOS) Name

func (cfg *ControlOS) Name() string

type DasBoot

type DasBoot struct {
	cnc.NoValidationComponent

	Ref             cnc.Ref    `json:"ref,omitempty"`
	RsyslogChartRef cnc.Ref    `json:"rsyslogChartRef,omitempty"`
	RsyslogImageRef cnc.Ref    `json:"rsyslogImageRef,omitempty"`
	NTPChartRef     cnc.Ref    `json:"ntpChartRef,omitempty"`
	NTPImageRef     cnc.Ref    `json:"ntpImageRef,omitempty"`
	CRDsChartRef    cnc.Ref    `json:"crdsChartRef,omitempty"`
	SeederChartRef  cnc.Ref    `json:"seederChartRef,omitempty"`
	SeederImageRef  cnc.Ref    `json:"seederImageRef,omitempty"`
	RegCtrlChartRef cnc.Ref    `json:"regCtrlChartRef,omitempty"`
	RegCtrlImageRef cnc.Ref    `json:"regCtrlImageRef,omitempty"`
	SONiCBaseRef    cnc.Ref    `json:"sonicBaseRef,omitempty"`
	SONiCCampusRef  cnc.Ref    `json:"sonicCampusRef,omitempty"`
	SONiCVSRef      cnc.Ref    `json:"sonicVSRef,omitempty"`
	TLS             DasBootTLS `json:"tls,omitempty"`
	ClusterIP       string     `json:"clusterIP,omitempty"`
	NTPServers      string     `json:"ntpServers,omitempty"`
}

func (*DasBoot) Build

func (cfg *DasBoot) Build(_ string, preset cnc.Preset, _ meta.FabricMode, get cnc.GetComponent, _ *wiring.Data, run cnc.AddBuildOp, install cnc.AddRunOp) error

func (*DasBoot) Flags

func (cfg *DasBoot) Flags() []cli.Flag

func (*DasBoot) Hydrate

func (cfg *DasBoot) Hydrate(_ cnc.Preset, _ meta.FabricMode) error

func (*DasBoot) IsEnabled

func (cfg *DasBoot) IsEnabled(_ cnc.Preset) bool

func (*DasBoot) Name

func (cfg *DasBoot) Name() string

type DasBootTLS

type DasBootTLS struct {
	ServerCA cnc.KeyPair `json:"serverCA,omitempty"`
	Server   cnc.KeyPair `json:"server,omitempty"`
	ClientCA cnc.KeyPair `json:"clientCA,omitempty"`
	ConfigCA cnc.KeyPair `json:"configCA,omitempty"`
	Config   cnc.KeyPair `json:"config,omitempty"`
}

type Fabric

type Fabric struct {
	Ref                      cnc.Ref          `json:"ref,omitempty"`
	FabricAPIChartRef        cnc.Ref          `json:"fabricApiChartRef,omitempty"`
	FabricChartRef           cnc.Ref          `json:"fabricChartRef,omitempty"`
	FabricImageRef           cnc.Ref          `json:"fabricImageRef,omitempty"`
	AgentRef                 cnc.Ref          `json:"agentRef,omitempty"`
	ControlAgentRef          cnc.Ref          `json:"controlAgentRef,omitempty"`
	CtlRef                   cnc.Ref          `json:"ctlRef,omitempty"`
	FabricDHCPServerRef      cnc.Ref          `json:"dhcpServerRef,omitempty"`
	FabricDHCPServerChartRef cnc.Ref          `json:"dhcpServerChartRef,omitempty"`
	FabricDHCPDRef           cnc.Ref          `json:"dhcpdRef,omitempty"`
	FabricDHCPDChartRef      cnc.Ref          `json:"dhcpdChartRef,omitempty"`
	BaseVPCCommunity         string           `json:"baseVPCCommunity,omitempty"`
	ServerFacingMTUOffset    uint             `json:"serverFacingMTUOffset,omitempty"`
	DHCPServer               string           `json:"dhcpServer,omitempty"`
	AlloyRef                 cnc.Ref          `json:"alloyRef,omitempty"`
	Alloy                    meta.AlloyConfig `json:"alloy,omitempty"`
	ControlProxyRef          cnc.Ref          `json:"controlProxyRef,omitempty"`
	ControlProxyChartRef     cnc.Ref          `json:"controlProxyChartRef,omitempty"`
	ControlProxy             bool             `json:"controlProxy,omitempty"`
	SwitchUsers              []meta.UserCreds `json:"switchUsers,omitempty"`
}

func (*Fabric) Build

func (cfg *Fabric) Build(_ string, _ cnc.Preset, fabricMode meta.FabricMode, get cnc.GetComponent, wiring *wiringlib.Data, run cnc.AddBuildOp, install cnc.AddRunOp) error

func (*Fabric) Flags

func (cfg *Fabric) Flags() []cli.Flag

func (*Fabric) Hydrate

func (cfg *Fabric) Hydrate(_ cnc.Preset, _ meta.FabricMode) error

func (*Fabric) IsEnabled

func (cfg *Fabric) IsEnabled(_ cnc.Preset) bool

func (*Fabric) Name

func (cfg *Fabric) Name() string

func (*Fabric) Validate added in v0.13.0

func (cfg *Fabric) Validate(_ string, _ cnc.Preset, fabricMode meta.FabricMode, get cnc.GetComponent, wiring *wiringlib.Data) error

type K3s

type K3s struct {
	cnc.NoValidationComponent

	Ref         cnc.Ref  `json:"ref,omitempty"`
	ClusterCIDR string   `json:"clusterCIDR,omitempty"`
	ServiceCIDR string   `json:"serviceCIDR,omitempty"`
	ClusterDNS  string   `json:"clusterDNS,omitempty"`
	TLSSAN      []string `json:"tlsSAN,omitempty"`
	// contains filtered or unexported fields
}

func K3sConfig added in v0.6.0

func K3sConfig(get cnc.GetComponent) *K3s

func (*K3s) Build

func (cfg *K3s) Build(_ string, _ cnc.Preset, _ meta.FabricMode, get cnc.GetComponent, wiring *wiring.Data, run cnc.AddBuildOp, install cnc.AddRunOp) error

func (*K3s) ControlNodeName

func (cfg *K3s) ControlNodeName(data *wiring.Data) (string, error)

func (*K3s) Flags

func (cfg *K3s) Flags() []cli.Flag

func (*K3s) Hydrate

func (cfg *K3s) Hydrate(_ cnc.Preset, _ meta.FabricMode) error

func (*K3s) IsEnabled

func (cfg *K3s) IsEnabled(_ cnc.Preset) bool

func (*K3s) Name

func (cfg *K3s) Name() string

type Misc

type Misc struct {
	cnc.NoValidationComponent

	K9sRef                   cnc.Ref `json:"k9sRef,omitempty"`
	RBACProxyImageRef        cnc.Ref `json:"rbacProxyRef,omitempty"`
	CertManagerRef           cnc.Ref `json:"certManagerRef,omitempty"`
	CertManagerCAInjectorRef cnc.Ref `json:"certManagerCAInjectorRef,omitempty"`
	CertManagerControllerRef cnc.Ref `json:"certManagerControllerRef,omitempty"`
	CertManagerAcmeSolverRef cnc.Ref `json:"certManagerAcmeSolverRef,omitempty"`
	CertManagerWebhookRef    cnc.Ref `json:"certManagerWebhookRef,omitempty"`
	CertManagerCtlRef        cnc.Ref `json:"certManagerCtlRef,omitempty"`
	CertManagerChartRef      cnc.Ref `json:"certManagerChartRef,omitempty"`
	ReloaderImageRef         cnc.Ref `json:"reloaderImageRef,omitempty"`
	ReloaderChartRef         cnc.Ref `json:"reloaderChartRef,omitempty"`
}

func MiscConfig

func MiscConfig(get cnc.GetComponent) *Misc

func (*Misc) Build

func (cfg *Misc) Build(_ string, _ cnc.Preset, _ meta.FabricMode, get cnc.GetComponent, _ *wiring.Data, run cnc.AddBuildOp, install cnc.AddRunOp) error

func (*Misc) Flags

func (cfg *Misc) Flags() []cli.Flag

func (*Misc) Hydrate

func (cfg *Misc) Hydrate(_ cnc.Preset, _ meta.FabricMode) error

func (*Misc) IsEnabled

func (cfg *Misc) IsEnabled(_ cnc.Preset) bool

func (*Misc) Name

func (cfg *Misc) Name() string

type ServerOS added in v0.5.3

type ServerOS struct {
	cnc.NoValidationComponent

	PasswordHash string  `json:"passwordHash,omitempty"`
	ToolboxRef   cnc.Ref `json:"toolboxRef,omitempty"`
}

func (*ServerOS) Build added in v0.5.3

func (cfg *ServerOS) Build(_ string, _ cnc.Preset, _ meta.FabricMode, get cnc.GetComponent, data *wiring.Data, run cnc.AddBuildOp, install cnc.AddRunOp) error

func (*ServerOS) Flags added in v0.5.3

func (cfg *ServerOS) Flags() []cli.Flag

func (*ServerOS) Hydrate added in v0.5.3

func (cfg *ServerOS) Hydrate(_ cnc.Preset, _ meta.FabricMode) error

func (*ServerOS) IsEnabled added in v0.5.3

func (cfg *ServerOS) IsEnabled(preset cnc.Preset) bool

func (*ServerOS) Name added in v0.5.3

func (cfg *ServerOS) Name() string

type VLAB

type VLAB struct {
	cnc.NoValidationComponent

	ONIERef       cnc.Ref `json:"onieRef,omitempty"`
	FlatcarRef    cnc.Ref `json:"flatcarRef,omitempty"`
	EEPROMEditRef cnc.Ref `json:"eepromEditRef,omitempty"`
}

func (*VLAB) Build

func (cfg *VLAB) Build(_ string, _ cnc.Preset, _ meta.FabricMode, get cnc.GetComponent, data *wiring.Data, run cnc.AddBuildOp, _ cnc.AddRunOp) error

func (*VLAB) Flags

func (cfg *VLAB) Flags() []cli.Flag

func (*VLAB) Hydrate

func (cfg *VLAB) Hydrate(_ cnc.Preset, _ meta.FabricMode) error

func (*VLAB) IsEnabled

func (cfg *VLAB) IsEnabled(preset cnc.Preset) bool

func (*VLAB) Name

func (cfg *VLAB) Name() string

type Zot

type Zot struct {
	cnc.NoValidationComponent

	Ref cnc.Ref `json:"ref,omitempty"`
	TLS ZotTLS  `json:"tls,omitempty"`
}

func ZotConfig

func ZotConfig(get cnc.GetComponent) *Zot

func (*Zot) Build

func (cfg *Zot) Build(_ string, _ cnc.Preset, _ meta.FabricMode, get cnc.GetComponent, _ *wiring.Data, run cnc.AddBuildOp, install cnc.AddRunOp) error

func (*Zot) Flags

func (cfg *Zot) Flags() []cli.Flag

func (*Zot) Hydrate

func (cfg *Zot) Hydrate(_ cnc.Preset, _ meta.FabricMode) error

func (*Zot) IsEnabled

func (cfg *Zot) IsEnabled(_ cnc.Preset) bool

func (*Zot) Name

func (cfg *Zot) Name() string

type ZotTLS

type ZotTLS struct {
	CA     cnc.KeyPair `json:"ca,omitempty"`
	Server cnc.KeyPair `json:"server,omitempty"`
}

Directories

Path Synopsis
cnc
bin

Jump to

Keyboard shortcuts

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