Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions cns/requestcontroller/kubecontroller/crdtranslator.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func CRDStatusToNCRequest(crdStatus nnc.NodeNetworkConfigStatus) (cns.CreateNetw
ncRequest.SecondaryIPConfigs = make(map[string]cns.SecondaryIPConfig)
ncRequest.NetworkContainerid = nc.ID
ncRequest.NetworkContainerType = cns.Docker
ncRequest.Version = nc.Version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous CRD definitions already deployed/running in our test clusters will not have this version field. @ramiro-gamarra or @thatmattlong, Shall we handle the update otherwise we will have to manually delete and re-create the CRD def again whenever we deploy this CNS. I would say lets handle the update

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good use-case for kubernetes api versioning. We should increment the version of this Kind. See https://kubebuilder.io/cronjob-tutorial/gvks.html for a description

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


if ip = net.ParseIP(nc.PrimaryIP); ip == nil {
return ncRequest, fmt.Errorf("Invalid PrimaryIP %s:", nc.PrimaryIP)
Expand Down
2 changes: 2 additions & 0 deletions cns/requestcontroller/kubecontroller/crdtranslator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const (
subnetAddressSpace = "10.0.0.0/24"
subnetPrefixLen = 24
testSecIp1 = "10.0.0.2"
version = "1"
)

func TestStatusToNCRequestMalformedPrimaryIP(t *testing.T) {
Expand Down Expand Up @@ -193,6 +194,7 @@ func TestStatusToNCRequestSuccess(t *testing.T) {
SubnetName: subnetName,
DefaultGateway: defaultGateway,
SubnetAddressSpace: subnetAddressSpace,
Version: version,
},
},
}
Expand Down
1 change: 1 addition & 0 deletions nodenetworkconfig/api/v1alpha/nodenetworkconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ type NetworkContainer struct {
IPAssignments []IPAssignment `json:"iPAssignments,omitempty"`
DefaultGateway string `json:"defaultGateway,omitempty"`
SubnetAddressSpace string `json:"subnetAddressSpace,omitempty"`
Version string `json:"version,omitempty"`
}

// IPAssignment groups an IP address and Name. Name is a UUID set by the the IP address assigner.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ spec:
type: string
subnetName:
type: string
version:
type: string
type: object
type: array
scaler:
Expand Down