Skip to content

Commit

Permalink
updated infra
Browse files Browse the repository at this point in the history
  • Loading branch information
henderiw committed Nov 3, 2024
1 parent 2d5fc83 commit f57a256
Show file tree
Hide file tree
Showing 68 changed files with 3,691 additions and 2,227 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ dist

# Go workspace file
go.work
vendor
vendor
db
14 changes: 4 additions & 10 deletions apis/id/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ type PartitionNodeID struct {
Node string `json:"node" yaml:"node" protobuf:"bytes,3,opt,name=node"`
}

type PortID struct {
NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"`
type PartitionPortID struct {
PartitionNodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"`
// ModuleBay defines the moduleBay reference id
ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,2,opt,name=moduleBay"`
// Module defines the module reference id
Expand All @@ -48,14 +48,8 @@ type PortID struct {
Port int `json:"port" yaml:"port" protobuf:"bytes,4,opt,name=port"`
}

type AdaptorID struct {
NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"`
// ModuleBay defines the moduleBay reference id
ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,2,opt,name=moduleBay"`
// Module defines the module reference id
Module *int `json:"module,omitempty" yaml:"module,omitempty" protobuf:"bytes,3,opt,name=module"`
// Port defines the id of the port
Port int `json:"port" yaml:"port" protobuf:"bytes,4,opt,name=port"`
type PartitionAdaptorID struct {
PartitionPortID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"`
// Adaptor defines the name of the adaptor
Adaptor string `json:"adaptor" yaml:"adaptor" protobuf:"bytes,5,opt,name=adaptor"`
}
Expand Down
16 changes: 5 additions & 11 deletions apis/id/v1alpha1/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ type PartitionNodeID struct {
Node string `json:"node" yaml:"node" protobuf:"bytes,3,opt,name=node"`
}

type PortID struct {
NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"`
type PartitionPortID struct {
PartitionNodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"`
// ModuleBay defines the moduleBay reference id
ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,2,opt,name=moduleBay"`
// Module defines the module reference id
Expand All @@ -48,15 +48,9 @@ type PortID struct {
Port int `json:"port" yaml:"port" protobuf:"bytes,4,opt,name=port"`
}

type AdaptorID struct {
NodeID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"`
// ModuleBay defines the moduleBay reference id
ModuleBay *int `json:"moduleBay,omitempty" yaml:"moduleBay,omitempty" protobuf:"bytes,2,opt,name=moduleBay"`
// Module defines the module reference id
Module *int `json:"module,omitempty" yaml:"module,omitempty" protobuf:"bytes,3,opt,name=module"`
// Port defines the id of the port
Port int `json:"port" yaml:"port" protobuf:"bytes,4,opt,name=port"`
//Adaptor defines the adaptor used in the port, like an sfp, qsfp
type PartitionAdaptorID struct {
PartitionPortID `json:",inline" yaml:",inline" protobuf:"bytes,1,opt,name=nodeID"`
// Adaptor defines the name of the adaptor
Adaptor string `json:"adaptor" yaml:"adaptor" protobuf:"bytes,5,opt,name=adaptor"`
}

Expand Down
54 changes: 22 additions & 32 deletions apis/id/v1alpha1/zz_generated.deepcopy.go

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

54 changes: 22 additions & 32 deletions apis/id/zz_generated.deepcopy.go

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

32 changes: 32 additions & 0 deletions apis/infra/adaptor_helper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
Copyright 2024 Nokia.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package infra

import (
"github.com/kform-dev/choreo/apis/condition"
)

// GetCondition returns the condition based on the condition kind
func (r *Adaptor) GetCondition(t condition.ConditionType) condition.Condition {
return r.Status.GetCondition(t)
}

// SetConditions sets the conditions on the resource. it allows for 0, 1 or more conditions
// to be set at once
func (r *Adaptor) SetConditions(c ...condition.Condition) {
r.Status.SetConditions(c...)
}
Loading

0 comments on commit f57a256

Please sign in to comment.