Skip to content

Commit

Permalink
Showing 4 changed files with 15 additions and 5 deletions.
8 changes: 6 additions & 2 deletions api/agent/v1alpha2/agent_types.go
Original file line number Diff line number Diff line change
@@ -28,6 +28,8 @@ import (

// AgentSpec defines the desired state of Agent
type AgentSpec struct {
Role wiringapi.SwitchRole `json:"role,omitempty"`
Description string `json:"description,omitempty"`
Config AgentSpecConfig `json:"config,omitempty"`
Version AgentVersion `json:"version,omitempty"`
Users []UserCreds `json:"users,omitempty"`
@@ -140,8 +142,10 @@ type NOSInfo struct {
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:categories=hedgehog;fabric,shortName=ag
// +kubebuilder:printcolumn:name="HWSKU",type=string,JSONPath=`.status.nosInfo.hwskuVersion`,priority=0
// +kubebuilder:printcolumn:name="ASIC",type=string,JSONPath=`.status.nosInfo.asicVersion`,priority=0
// +kubebuilder:printcolumn:name="Role",type=string,JSONPath=`.spec.role`,priority=0
// +kubebuilder:printcolumn:name="Descr",type=string,JSONPath=`.spec.description`,priority=0
// +kubebuilder:printcolumn:name="HWSKU",type=string,JSONPath=`.status.nosInfo.hwskuVersion`,priority=1
// +kubebuilder:printcolumn:name="ASIC",type=string,JSONPath=`.status.nosInfo.asicVersion`,priority=1
// +kubebuilder:printcolumn:name="Heartbeat",type=date,JSONPath=`.status.lastHeartbeat`,priority=1
// +kubebuilder:printcolumn:name="Applied",type=date,JSONPath=`.status.lastAppliedTime`,priority=0
// +kubebuilder:printcolumn:name="AppliedG",type=string,JSONPath=`.status.lastAppliedGen`,priority=0
6 changes: 4 additions & 2 deletions api/wiring/v1alpha2/server_types.go
Original file line number Diff line number Diff line change
@@ -34,8 +34,9 @@ const (

// ServerSpec defines the desired state of Server
type ServerSpec struct {
Type ServerType `json:"type,omitempty"`
Profile string `json:"profile,omitempty"`
Type ServerType `json:"type,omitempty"`
Description string `json:"description,omitempty"`
Profile string `json:"profile,omitempty"`
}

// ServerStatus defines the observed state of Server
@@ -45,6 +46,7 @@ type ServerStatus struct{}
// +kubebuilder:subresource:status
// +kubebuilder:resource:categories=hedgehog;wiring;fabric,shortName=srv
// +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.type`,priority=0
// +kubebuilder:printcolumn:name="Descr",type=string,JSONPath=`.spec.description`,priority=0
// +kubebuilder:printcolumn:name="Rack",type=string,JSONPath=`.metadata.labels.fabric\.githedgehog\.com/rack`,priority=1
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,priority=0
// Server is the Schema for the servers API
4 changes: 3 additions & 1 deletion api/wiring/v1alpha2/switch_types.go
Original file line number Diff line number Diff line change
@@ -56,6 +56,7 @@ func (r SwitchRole) IsLeaf() bool {
type SwitchSpec struct {
// +kubebuilder:validation:Required
Role SwitchRole `json:"role,omitempty"`
Description string `json:"description,omitempty"`
Profile string `json:"profile,omitempty"`
Location Location `json:"location,omitempty"`
LocationSig LocationSig `json:"locationSig,omitempty"`
@@ -74,7 +75,8 @@ type SwitchStatus struct {
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:categories=hedgehog;wiring;fabric,shortName=sw
// +kubebuilder:printcolumn:name="Location",type=string,JSONPath=`.spec.location`,priority=0
// +kubebuilder:printcolumn:name="Role",type=string,JSONPath=`.spec.role`,priority=0
// +kubebuilder:printcolumn:name="Descr",type=string,JSONPath=`.spec.description`,priority=0
// +kubebuilder:printcolumn:name="LocationUUID",type=string,JSONPath=`.metadata.labels.fabric\.githedgehog\.com/location`,priority=0
// +kubebuilder:printcolumn:name="PortGroupSpeeds",type=string,JSONPath=`.spec.portGroupSpeeds`,priority=1
// +kubebuilder:printcolumn:name="Rack",type=string,JSONPath=`.metadata.labels.fabric\.githedgehog\.com/rack`,priority=1
2 changes: 2 additions & 0 deletions pkg/ctrl/agent/agent_ctrl.go
Original file line number Diff line number Diff line change
@@ -248,6 +248,8 @@ func (r *AgentReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl
agent := &agentapi.Agent{ObjectMeta: switchNsName}
_, err = ctrlutil.CreateOrUpdate(ctx, r.Client, agent, func() error {
agent.Labels = sw.Labels
agent.Spec.Role = sw.Spec.Role
agent.Spec.Description = sw.Spec.Description
agent.Spec.Config.ControlVIP = r.Cfg.ControlVIP
agent.Spec.Switch = sw.Spec
agent.Spec.Connections = conns

0 comments on commit 21a2de1

Please sign in to comment.