Skip to content

Commit

Permalink
Get rid of the control node object leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
Frostman committed Dec 6, 2024
1 parent b843c04 commit a3090e7
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 187 deletions.
12 changes: 0 additions & 12 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,4 @@ resources:
kind: Catalog
path: go.githedgehog.com/fabric/api/agent/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
domain: githedgehog.com
group: wiring
kind: ControlNode
path: go.githedgehog.com/fabric/api/wiring/v1beta1
version: v1beta1
webhooks:
defaulting: true
validation: true
webhookVersion: v1
version: "3"
60 changes: 0 additions & 60 deletions config/crd/bases/wiring.githedgehog.com_controlnodes.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ resources:
- bases/vpc.githedgehog.com_externalpeerings.yaml
- bases/dhcp.githedgehog.com_dhcpsubnets.yaml
- bases/agent.githedgehog.com_catalogs.yaml
- bases/wiring.githedgehog.com_controlnodes.yaml
#+kubebuilder:scaffold:crdkustomizeresource

patches:
Expand All @@ -56,7 +55,6 @@ patches:
#- path: patches/webhook_in_dhcp_dhcpsubnets.yaml
#- path: patches/webhook_in_agent_catalogs.yaml
- path: patches/webhook_in_wiring_switchprofiles.yaml
- path: patches/webhook_in_wiring_controlnodes.yaml
#+kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
Expand All @@ -78,7 +76,6 @@ patches:
#- path: patches/cainjection_in_dhcp_dhcpsubnets.yaml
#- path: patches/cainjection_in_agent_catalogs.yaml
- path: patches/cainjection_in_wiring_switchprofiles.yaml
- path: patches/cainjection_in_wiring_controlnodes.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

# the following config is for teaching kustomize how to do kustomization for CRDs.
Expand Down
7 changes: 0 additions & 7 deletions config/crd/patches/cainjection_in_wiring_controlnodes.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions config/crd/patches/webhook_in_wiring_controlnodes.yaml

This file was deleted.

4 changes: 1 addition & 3 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,4 @@ resources:
# For each CRD, "Editor" and "Viewer" roles are scaffolded by
# default, aiding admins in cluster management. Those roles are
# not used by the Project itself. You can comment the following lines
# if you do not want those helpers be installed with your Project.
# - wiring_controlnode_editor_role.yaml
# - wiring_controlnode_viewer_role.yaml
# if you do not want those helpers be installed with your Project.
27 changes: 0 additions & 27 deletions config/rbac/wiring_controlnode_editor_role.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions config/rbac/wiring_controlnode_viewer_role.yaml

This file was deleted.

38 changes: 2 additions & 36 deletions pkg/hhfctl/inspect/fabric.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,8 @@ type FabricIn struct {
}

type FabricOut struct {
Summary string `json:"summary,omitempty"`
ControlNodes []*FabricOutControl `json:"controlNodes,omitempty"`
Switches []*FabricOutSwitch `json:"switches,omitempty"`
}

type FabricOutControl struct {
Name string `json:"name,omitempty"`
State *AgentState `json:"state,omitempty"`
Summary string `json:"summary,omitempty"`
Switches []*FabricOutSwitch `json:"switches,omitempty"`
}

type FabricOutSwitch struct {
Expand All @@ -58,30 +52,6 @@ type FabricOutSwitch struct {
func (out *FabricOut) MarshalText() (string, error) {
str := &strings.Builder{}

// TODO return back after there is an agent running on the control node again
// str.WriteString("Control Nodes:\n")

// ctrlData := [][]string{}
// for _, ctrl := range out.ControlNodes {
// applied := ""

// if !ctrl.State.LastAppliedTime.IsZero() {
// applied = humanize.Time(ctrl.State.LastAppliedTime.Time)
// }

// ctrlData = append(ctrlData, []string{
// ctrl.Name,
// ctrl.State.Summary,
// fmt.Sprintf("%d/%d", ctrl.State.LastAppliedGen, ctrl.State.DesiredGen),
// applied,
// humanize.Time(ctrl.State.LastHeartbeat.Time),
// })
// }
// str.WriteString(RenderTable(
// []string{"Name", "State", "Gen", "Applied", "Heartbeat"},
// ctrlData,
// ))

str.WriteString("Switches:\n")

swData := [][]string{}
Expand Down Expand Up @@ -174,10 +144,6 @@ func Fabric(ctx context.Context, kube client.Reader, _ FabricIn) (*FabricOut, er
return strings.Compare(a.Name, b.Name)
})

slices.SortFunc(out.ControlNodes, func(a, b *FabricOutControl) int {
return strings.Compare(a.Name, b.Name)
})

out.Summary = fmt.Sprintf("Ready: %d/%d switches", readySwitches, totalSwitches)

return out, nil
Expand Down

0 comments on commit a3090e7

Please sign in to comment.