Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Even more work for B1 #191

Merged
merged 27 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ece4601
Better dirty version gen
Frostman Oct 21, 2024
09654e0
Add k9s shortcuts for ssh and serial
Frostman Oct 21, 2024
24dac88
Use GetSerialInfo from hhfctl
Frostman Oct 21, 2024
2d46d7a
Add switch ssh using hhfab
Frostman Oct 21, 2024
b7663aa
Fix injecting vlab switch authorized keys
Frostman Oct 22, 2024
057cbd5
Bump fabric to v0.52.1
Frostman Oct 22, 2024
4b5a1f1
Bump fabric to v0.52.2
Frostman Oct 22, 2024
e6e64f4
Bump fabric to v0.52.3
Frostman Oct 22, 2024
38221f4
Fabricator installs all components while installer just waits for them
Frostman Oct 22, 2024
d2caeec
Fix missed error handling
Frostman Oct 22, 2024
142bf47
Add missed gen docs
Frostman Oct 22, 2024
a517375
Just merge docs recipe into gen
Frostman Oct 22, 2024
aa4b870
Just remove docs recipe from all
Frostman Oct 22, 2024
4461853
Update all components from operator and check their status
Frostman Oct 22, 2024
8244b46
Make installer wait for fabricator applied and ready
Frostman Oct 22, 2024
2e61405
Add todo to check comp versions
Frostman Oct 22, 2024
55a3b24
Bump fabric to v0.52.4
Frostman Oct 22, 2024
5b3dc64
Enable controls usb build by default (not for vlab)
Frostman Oct 22, 2024
75d4b30
Allow setting vpc subnet interface mtu in setupvpcs
Frostman Oct 22, 2024
cde1d16
Make waitSwitchesReady work with non-existing agents
Frostman Oct 22, 2024
3e1f940
Add note that waiting for fab ready may take longer
Frostman Oct 22, 2024
0b88f1f
Switch to control-usb-root v3815.2.5-hh1
Frostman Oct 22, 2024
ffb6d7c
Update onie-vlab version
Frostman Oct 22, 2024
958c0d0
Bump onie updaters to v0.1.0
Frostman Oct 22, 2024
e2bc4a2
Fix switch ssh helper
Frostman Oct 22, 2024
c1b8464
Allow passing args to vlab ssh
Frostman Oct 22, 2024
9f3f732
Bump fabric to v0.52.5
Frostman Oct 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
# Don't remove it! We shouldn't allow CI to pass if there are any changes not committed after running just
- name: Just all autogeneration and fail on dirty
run: |
just --timestamp gen docs
just --timestamp gen
git status --short
git diff --quiet

Expand Down
37 changes: 37 additions & 0 deletions api/fabricator/v1beta1/fabricator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

const (
ConditionApplied = "Applied"
ConditionReady = "Ready"
)

type FabricatorSpec struct {
Expand All @@ -28,6 +29,7 @@ type FabricatorSpec struct {

type FabricatorStatus struct {
IsBootstrap bool `json:"isBootstrap,omitempty"`
IsInstall bool `json:"isInstall,omitempty"`
Versions Versions `json:"versions,omitempty"`

// Time of the last attempt to apply configuration
Expand All @@ -44,9 +46,44 @@ type FabricatorStatus struct {
// Conditions of the fabricator, includes readiness marker for use with kubectl wait
Conditions []metav1.Condition `json:"conditions"`

Components ComponentsStatus `json:"components,omitempty"`

// TODO reserved VLANs, subnets, etc.
}

type ComponentStatus string

const (
CompStatusUnknown ComponentStatus = ""
CompStatusNotFound ComponentStatus = "NotFound"
CompStatusPending ComponentStatus = "Pending"
CompStatusReady ComponentStatus = "Ready"
)

type ComponentsStatus struct {
CertManagerCtrl ComponentStatus `json:"certManagerCtrl,omitempty"`
CertManagerWebhook ComponentStatus `json:"certManagerWebhook,omitempty"`
Reloader ComponentStatus `json:"reloader,omitempty"`
Zot ComponentStatus `json:"zot,omitempty"`
NTP ComponentStatus `json:"ntp,omitempty"`
FabricCtrl ComponentStatus `json:"fabricCtrl,omitempty"`
FabricBoot ComponentStatus `json:"fabricBoot,omitempty"`
FabricDHCP ComponentStatus `json:"fabricDHCP,omitempty"`
FabricProxy ComponentStatus `json:"fabricProxy,omitempty"`
}

func (c *ComponentsStatus) IsReady() bool {
return c.CertManagerCtrl == CompStatusReady &&
c.CertManagerWebhook == CompStatusReady &&
c.Reloader == CompStatusReady &&
c.Zot == CompStatusReady &&
c.NTP == CompStatusReady &&
c.FabricCtrl == CompStatusReady &&
c.FabricBoot == CompStatusReady &&
c.FabricDHCP == CompStatusReady &&
c.FabricProxy == CompStatusReady
}

type FabOverrides struct {
Versions Versions `json:"versions,omitempty"`
}
Expand Down
16 changes: 16 additions & 0 deletions api/fabricator/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 15 additions & 9 deletions cmd/hhfab/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ func Run(ctx context.Context) error {
Aliases: []string{"usb"},
Usage: "use installer USB image for control node(s)",
EnvVars: []string{"HHFAB_CONTROL_USB"},
Value: false,
Value: true,
},
),
Before: before(false),
Expand Down Expand Up @@ -588,8 +588,8 @@ func Run(ctx context.Context) error {
Usage: "ssh to a VLAB VM or HW if supported",
Flags: append(defaultFlags, accessNameFlag),
Before: before(false),
Action: func(_ *cli.Context) error {
if err := hhfab.DoVLABSSH(ctx, workDir, cacheDir, accessName); err != nil {
Action: func(c *cli.Context) error {
if err := hhfab.DoVLABSSH(ctx, workDir, cacheDir, accessName, c.Args().Slice()); err != nil {
return fmt.Errorf("ssh: %w", err)
}

Expand All @@ -601,8 +601,8 @@ func Run(ctx context.Context) error {
Usage: "get serial console of a VLAB VM or HW if supported",
Flags: append(defaultFlags, accessNameFlag),
Before: before(false),
Action: func(_ *cli.Context) error {
if err := hhfab.DoVLABSerial(ctx, workDir, cacheDir, accessName); err != nil {
Action: func(c *cli.Context) error {
if err := hhfab.DoVLABSerial(ctx, workDir, cacheDir, accessName, c.Args().Slice()); err != nil {
return fmt.Errorf("serial: %w", err)
}

Expand All @@ -614,8 +614,8 @@ func Run(ctx context.Context) error {
Usage: "get serial console log of a VLAB VM or HW if supported",
Flags: append(defaultFlags, accessNameFlag),
Before: before(false),
Action: func(_ *cli.Context) error {
if err := hhfab.DoVLABSerialLog(ctx, workDir, cacheDir, accessName); err != nil {
Action: func(c *cli.Context) error {
if err := hhfab.DoVLABSerialLog(ctx, workDir, cacheDir, accessName, c.Args().Slice()); err != nil {
return fmt.Errorf("serial log: %w", err)
}

Expand Down Expand Up @@ -663,12 +663,17 @@ func Run(ctx context.Context) error {
&cli.StringSliceFlag{
Name: "dns-servers",
Aliases: []string{"dns"},
Usage: "DNS servers for VPCs",
Usage: "DNS servers for VPCs advertised by DHCP",
},
&cli.StringSliceFlag{
Name: "time-servers",
Aliases: []string{"ntp"},
Usage: "Time servers for VPCs",
Usage: "Time servers for VPCs advertised by DHCP",
},
&cli.UintFlag{
Name: "interface-mtu",
Aliases: []string{"mtu"},
Usage: "interface MTU for VPCs advertised by DHCP",
},
),
Before: before(false),
Expand All @@ -682,6 +687,7 @@ func Run(ctx context.Context) error {
SubnetsPerVPC: c.Int("subnets-per-vpc"),
DNSServers: c.StringSlice("dns-servers"),
TimeServers: c.StringSlice("time-servers"),
InterfaceMTU: uint16(c.Uint("interface-mtu")), //nolint:gosec
}); err != nil {
return fmt.Errorf("setup-vpcs: %w", err)
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))

utilruntime.Must(comp.HelmAPISchemeBuilder.AddToScheme(scheme))
utilruntime.Must(comp.CMApiSchemeBuilder.AddToScheme(scheme))
utilruntime.Must(comp.CMMetaSchemeBuilder.AddToScheme(scheme))

utilruntime.Must(fabapi.AddToScheme(scheme))
// +kubebuilder:scaffold:scheme
Expand Down
23 changes: 23 additions & 0 deletions config/crd/bases/fabricator.githedgehog.com_fabricators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,27 @@ spec:
type: object
status:
properties:
components:
properties:
certManagerCtrl:
type: string
certManagerWebhook:
type: string
fabricBoot:
type: string
fabricCtrl:
type: string
fabricDHCP:
type: string
fabricProxy:
type: string
ntp:
type: string
reloader:
type: string
zot:
type: string
type: object
conditions:
description: Conditions of the fabricator, includes readiness marker
for use with kubectl wait
Expand Down Expand Up @@ -371,6 +392,8 @@ spec:
type: array
isBootstrap:
type: boolean
isInstall:
type: boolean
lastAppliedController:
description: Controller version that applied the last successful configuration
type: string
Expand Down
32 changes: 32 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,42 @@ kind: ClusterRole
metadata:
name: manager-role
rules:
- apiGroups:
- apps
resources:
- deployments
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- cert-manager.io
resources:
- certificates
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- cert-manager.io
resources:
- certificates/status
verbs:
- get
- apiGroups:
- ""
resources:
- configmaps
- secrets
- services
verbs:
- create
- delete
Expand Down
45 changes: 45 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,49 @@ Package v1beta1 contains API Schema definitions for the fabricator v1beta1 API g



#### ComponentStatus

_Underlying type:_ _string_





_Appears in:_
- [ComponentsStatus](#componentsstatus)

| Field | Description |
| --- | --- |
| `` | |
| `NotFound` | |
| `Pending` | |
| `Ready` | |


#### ComponentsStatus







_Appears in:_
- [FabricatorStatus](#fabricatorstatus)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `certManagerCtrl` _[ComponentStatus](#componentstatus)_ | | | |
| `certManagerWebhook` _[ComponentStatus](#componentstatus)_ | | | |
| `reloader` _[ComponentStatus](#componentstatus)_ | | | |
| `zot` _[ComponentStatus](#componentstatus)_ | | | |
| `ntp` _[ComponentStatus](#componentstatus)_ | | | |
| `fabricCtrl` _[ComponentStatus](#componentstatus)_ | | | |
| `fabricBoot` _[ComponentStatus](#componentstatus)_ | | | |
| `fabricDHCP` _[ComponentStatus](#componentstatus)_ | | | |
| `fabricProxy` _[ComponentStatus](#componentstatus)_ | | | |


#### ControlConfig


Expand Down Expand Up @@ -338,13 +381,15 @@ _Appears in:_
| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `isBootstrap` _boolean_ | | | |
| `isInstall` _boolean_ | | | |
| `versions` _[Versions](#versions)_ | | | |
| `lastAttemptTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#time-v1-meta)_ | Time of the last attempt to apply configuration | | |
| `lastAttemptGen` _integer_ | Generation of the last attempt to apply configuration | | |
| `lastAppliedTime` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#time-v1-meta)_ | Time of the last successful configuration application | | |
| `lastAppliedGen` _integer_ | Generation of the last successful configuration application | | |
| `lastAppliedController` _string_ | Controller version that applied the last successful configuration | | |
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#condition-v1-meta) array_ | Conditions of the fabricator, includes readiness marker for use with kubectl wait | | |
| `components` _[ComponentsStatus](#componentsstatus)_ | | | |


#### FabricatorVersions
Expand Down
Loading
Loading