Skip to content

Commit

Permalink
Merge pull request #59 from backguynn/multicluster-v1
Browse files Browse the repository at this point in the history
Clean up duplicate structs.
  • Loading branch information
backguynn authored Oct 13, 2023
2 parents 51badd6 + 70561b4 commit a1498bb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 106 deletions.
14 changes: 7 additions & 7 deletions pkg/api/lb.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (lbListModel *LoadBalancerListModel) GetKeyStruct() LoxiModel {

type LoadBalancerModel struct {
Service LoadBalancerService `json:"serviceArguments"`
SecondaryIPs []LoadBalancerSecIp `json:"secondaryIPs"`
SecondaryIPs []LoadBalancerSecIp `json:"secondaryIPs,omitempty"`
Endpoints []LoadBalancerEndpoint `json:"endpoints"`
}

Expand All @@ -31,15 +31,15 @@ type LoadBalancerService struct {
Protocol string `json:"protocol" key:"protocol"`
Sel EpSelect `json:"sel"`
Mode LbMode `json:"mode"`
BGP bool `json:"BGP" options:"bgp"`
Monitor bool `json:"Monitor"`
BGP bool `json:"BGP,omitempty" options:"bgp"`
Monitor bool `json:"Monitor,omitempty"`
Timeout uint32 `json:"inactiveTimeOut"`
Block uint16 `json:"block" options:"block"`
Managed bool `json:"managed,omitempty"`
ProbeType string `json:"probetype"`
ProbePort uint16 `json:"probeport"`
ProbeReq string `json:"probereq"`
ProbeResp string `json:"proberesp"`
ProbeType string `json:"probetype,omitempty"`
ProbePort uint16 `json:"probeport,omitempty"`
ProbeReq string `json:"probereq,omitempty"`
ProbeResp string `json:"proberesp,omitempty"`
}

func (lbService *LoadBalancerService) GetKeyStruct() LoxiModel {
Expand Down
53 changes: 8 additions & 45 deletions pkg/crds/multiclusterlbservice/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

type EpSelect uint
type LbMode int32
type MultiClusterLBModel api.LoadBalancerModel

// +genclient
// +genclient:nonNamespaced
Expand All @@ -34,56 +35,18 @@ type MultiClusterLBService struct {
Spec MultiClusterLBServiceSpec `json:"spec,omitempty"`
}

// MultiClusterLBServiceSpec defines the desired state of MultiClusterLBService
type MultiClusterLBServiceSpec struct {
Model MultiClusterLBModel `json:"lbModel"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type MultiClusterLBServiceList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []*MultiClusterLBService `json:"items"`
}

type LoadBalancerService struct {
ExternalIP string `json:"externalIP" key:"externalipaddress"`
Port uint16 `json:"port" key:"port"`
Protocol string `json:"protocol" key:"protocol"`
Sel EpSelect `json:"sel"`
Mode LbMode `json:"mode"`
BGP bool `json:"BGP,omitempty" options:"bgp"`
Monitor bool `json:"Monitor,omitempty"`
Timeout uint32 `json:"inactiveTimeOut"`
Block uint16 `json:"block" options:"block"`
Managed bool `json:"managed,omitempty"`
ProbeType string `json:"probetype,omitempty"`
ProbePort uint16 `json:"probeport,omitempty"`
ProbeReq string `json:"probereq,omitempty"`
ProbeResp string `json:"proberesp,omitempty"`
}

type LoadBalancerEndpoint struct {
EndpointIP string `json:"endpointIP"`
TargetPort uint16 `json:"targetPort"`
Weight uint8 `json:"weight"`
State string `json:"state,omitempty"`
}

type LoadBalancerSecIp struct {
SecondaryIP string `json:"secondaryIP"`
}

// MultiClusterLBServiceSpec defines the desired state of MultiClusterLBService
type MultiClusterLBServiceSpec struct {
Model LoadBalancerModel `json:"lbModel"`
}

type LoadBalancerModel struct {
Service LoadBalancerService `json:"serviceArguments"`
SecondaryIPs []LoadBalancerSecIp `json:"secondaryIPs,omitempty"`
Endpoints []LoadBalancerEndpoint `json:"endpoints"`
}

func (l *LoadBalancerModel) GetKeyStruct() api.LoxiModel {
return &l.Service
}

func (lbService *LoadBalancerService) GetKeyStruct() api.LoxiModel {
return lbService
func (lbModel *MultiClusterLBModel) GetKeyStruct() api.LoxiModel {
return &lbModel.Service
}
61 changes: 7 additions & 54 deletions pkg/crds/multiclusterlbservice/v1/zz_generated.deepcopy.go

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

0 comments on commit a1498bb

Please sign in to comment.