Skip to content

Commit 4168954

Browse files
authored
feat: rename NetworkContainer to MultiTenantNetworkContainer (#892)
1 parent b09ca83 commit 4168954

File tree

11 files changed

+64
-61
lines changed

11 files changed

+64
-61
lines changed

cns/multitenantcontroller/multitenantoperator/multitenantcrdcontroller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/Azure/azure-container-networking/cns/cnsclient/httpapi"
1010
"github.com/Azure/azure-container-networking/cns/logger"
1111
"github.com/Azure/azure-container-networking/cns/restserver"
12-
ncapi "github.com/Azure/azure-container-networking/networkcontainer/api/v1alpha1"
12+
ncapi "github.com/Azure/azure-container-networking/crds/multitenantnetworkcontainer/api/v1alpha1"
1313
apierrors "k8s.io/apimachinery/pkg/api/errors"
1414
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1515
"k8s.io/apimachinery/pkg/runtime"

cns/multitenantcontroller/multitenantoperator/multitenantcrdreconciler.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/Azure/azure-container-networking/cns"
99
"github.com/Azure/azure-container-networking/cns/cnsclient"
1010
"github.com/Azure/azure-container-networking/cns/logger"
11-
ncapi "github.com/Azure/azure-container-networking/networkcontainer/api/v1alpha1"
11+
ncapi "github.com/Azure/azure-container-networking/crds/multitenantnetworkcontainer/api/v1alpha1"
1212
apierrors "k8s.io/apimachinery/pkg/api/errors"
1313
"k8s.io/apimachinery/pkg/runtime"
1414
ctrl "sigs.k8s.io/controller-runtime"
@@ -34,7 +34,7 @@ type multiTenantCrdReconciler struct {
3434
// Reconcile is called on multi-tenant CRD status changes.
3535
func (r *multiTenantCrdReconciler) Reconcile(request reconcile.Request) (reconcile.Result, error) {
3636
ctx := context.Background()
37-
var nc ncapi.NetworkContainer
37+
var nc ncapi.MultiTenantNetworkContainer
3838

3939
if err := r.KubeClient.Get(ctx, request.NamespacedName, &nc); err != nil {
4040
if apierrors.IsNotFound(err) {
@@ -124,7 +124,7 @@ func (r *multiTenantCrdReconciler) Reconcile(request reconcile.Request) (reconci
124124
// SetupWithManager Sets up the reconciler with a new manager, filtering using NodeNetworkConfigFilter
125125
func (r *multiTenantCrdReconciler) SetupWithManager(mgr ctrl.Manager) error {
126126
return ctrl.NewControllerManagedBy(mgr).
127-
For(&ncapi.NetworkContainer{}).
127+
For(&ncapi.MultiTenantNetworkContainer{}).
128128
WithEventFilter(r.predicate()).
129129
Complete(r)
130130
}
@@ -147,7 +147,7 @@ func (r *multiTenantCrdReconciler) predicate() predicate.Predicate {
147147
}
148148

149149
func (r *multiTenantCrdReconciler) equalNode(o runtime.Object) bool {
150-
nc, ok := o.(*ncapi.NetworkContainer)
150+
nc, ok := o.(*ncapi.MultiTenantNetworkContainer)
151151
if ok {
152152
return strings.EqualFold(nc.Spec.Node, r.NodeName)
153153
}

cns/multitenantcontroller/multitenantoperator/multitenantcrdreconciler_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/Azure/azure-container-networking/cns"
77
"github.com/Azure/azure-container-networking/cns/logger"
88
"github.com/Azure/azure-container-networking/cns/multitenantcontroller/mockclients"
9-
ncapi "github.com/Azure/azure-container-networking/networkcontainer/api/v1alpha1"
9+
ncapi "github.com/Azure/azure-container-networking/crds/multitenantnetworkcontainer/api/v1alpha1"
1010
"github.com/golang/mock/gomock"
1111
. "github.com/onsi/ginkgo"
1212
. "github.com/onsi/gomega"
@@ -69,11 +69,11 @@ var _ = Describe("multiTenantCrdReconciler", func() {
6969
})
7070

7171
It("Should succeed when the NC is in Terminated state", func() {
72-
var nc ncapi.NetworkContainer = ncapi.NetworkContainer{
72+
var nc ncapi.MultiTenantNetworkContainer = ncapi.MultiTenantNetworkContainer{
7373
ObjectMeta: metav1.ObjectMeta{
7474
DeletionTimestamp: &metav1.Time{},
7575
},
76-
Status: ncapi.NetworkContainerStatus{
76+
Status: ncapi.MultiTenantNetworkContainerStatus{
7777
State: "Terminated",
7878
},
7979
}
@@ -85,8 +85,8 @@ var _ = Describe("multiTenantCrdReconciler", func() {
8585
})
8686

8787
It("Should succeed when the NC is not in Initialized state", func() {
88-
var nc ncapi.NetworkContainer = ncapi.NetworkContainer{
89-
Status: ncapi.NetworkContainerStatus{
88+
var nc ncapi.MultiTenantNetworkContainer = ncapi.MultiTenantNetworkContainer{
89+
Status: ncapi.MultiTenantNetworkContainerStatus{
9090
State: "Pending",
9191
},
9292
}
@@ -99,11 +99,11 @@ var _ = Describe("multiTenantCrdReconciler", func() {
9999

100100
It("Should succeed when the NC is in Initialized state and it has already been persisted in CNS", func() {
101101
var uuid = "uuid"
102-
var nc ncapi.NetworkContainer = ncapi.NetworkContainer{
103-
Spec: ncapi.NetworkContainerSpec{
102+
var nc ncapi.MultiTenantNetworkContainer = ncapi.MultiTenantNetworkContainer{
103+
Spec: ncapi.MultiTenantNetworkContainerSpec{
104104
UUID: uuid,
105105
},
106-
Status: ncapi.NetworkContainerStatus{
106+
Status: ncapi.MultiTenantNetworkContainerStatus{
107107
State: "Initialized",
108108
},
109109
}
@@ -117,11 +117,11 @@ var _ = Describe("multiTenantCrdReconciler", func() {
117117

118118
It("Should fail when the NC subnet isn't in correct format", func() {
119119
var uuid = "uuid"
120-
var nc ncapi.NetworkContainer = ncapi.NetworkContainer{
121-
Spec: ncapi.NetworkContainerSpec{
120+
var nc ncapi.MultiTenantNetworkContainer = ncapi.MultiTenantNetworkContainer{
121+
Spec: ncapi.MultiTenantNetworkContainerSpec{
122122
UUID: uuid,
123123
},
124-
Status: ncapi.NetworkContainerStatus{
124+
Status: ncapi.MultiTenantNetworkContainerStatus{
125125
State: "Initialized",
126126
IPSubnet: "1.2.3.4.5",
127127
},
@@ -137,11 +137,11 @@ var _ = Describe("multiTenantCrdReconciler", func() {
137137

138138
It("Should succeed when the NC subnet is in correct format", func() {
139139
var uuid = "uuid"
140-
var nc ncapi.NetworkContainer = ncapi.NetworkContainer{
141-
Spec: ncapi.NetworkContainerSpec{
140+
var nc ncapi.MultiTenantNetworkContainer = ncapi.MultiTenantNetworkContainer{
141+
Spec: ncapi.MultiTenantNetworkContainerSpec{
142142
UUID: uuid,
143143
},
144-
Status: ncapi.NetworkContainerStatus{
144+
Status: ncapi.MultiTenantNetworkContainerStatus{
145145
State: "Initialized",
146146
IPSubnet: "1.2.3.0/24",
147147
},
File renamed without changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# MultiTenantNetworkContainer CRDs
2+
3+
This package contains the CRD definitions for MultiTenantNetworkContainer, which would be consumed in CNS.

networkcontainer/api/v1alpha1/networkcontainer_types.go renamed to crds/multitenantnetworkcontainer/api/v1alpha1/multitenantnetworkcontainer_types.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2323
// Important: Run "make" to regenerate code after modifying this file
2424

25-
// NetworkContainerSpec defines the desired state of NetworkContainer
26-
type NetworkContainerSpec struct {
25+
// MultiTenantNetworkContainerSpec defines the desired state of MultiTenantNetworkContainer
26+
type MultiTenantNetworkContainerSpec struct {
2727
// UUID - network container UUID
2828
UUID string `json:"uuid,omitempty"`
2929
// Network - customer VNet GUID
@@ -38,8 +38,8 @@ type NetworkContainerSpec struct {
3838
ReservationID string `json:"reservationID,omitempty"`
3939
}
4040

41-
// NetworkContainerStatus defines the observed state of NetworkContainer
42-
type NetworkContainerStatus struct {
41+
// MultiTenantNetworkContainerStatus defines the observed state of MultiTenantNetworkContainer
42+
type MultiTenantNetworkContainerStatus struct {
4343
// The IP address
4444
IP string `json:"ip,omitempty"`
4545
// The gateway IP address
@@ -53,24 +53,24 @@ type NetworkContainerStatus struct {
5353
// +kubebuilder:object:root=true
5454
// +kubebuilder:subresource:status
5555

56-
// NetworkContainer is the Schema for the networkcontainers API
57-
type NetworkContainer struct {
56+
// MultiTenantNetworkContainer is the Schema for the MultiTenantnetworkcontainers API
57+
type MultiTenantNetworkContainer struct {
5858
metav1.TypeMeta `json:",inline"`
5959
metav1.ObjectMeta `json:"metadata,omitempty"`
6060

61-
Spec NetworkContainerSpec `json:"spec,omitempty"`
62-
Status NetworkContainerStatus `json:"status,omitempty"`
61+
Spec MultiTenantNetworkContainerSpec `json:"spec,omitempty"`
62+
Status MultiTenantNetworkContainerStatus `json:"status,omitempty"`
6363
}
6464

6565
// +kubebuilder:object:root=true
6666

67-
// NetworkContainerList contains a list of NetworkContainer
68-
type NetworkContainerList struct {
67+
// MultiTenantNetworkContainerList contains a list of MultiTenantNetworkContainer
68+
type MultiTenantNetworkContainerList struct {
6969
metav1.TypeMeta `json:",inline"`
7070
metav1.ListMeta `json:"metadata,omitempty"`
71-
Items []NetworkContainer `json:"items"`
71+
Items []MultiTenantNetworkContainer `json:"items"`
7272
}
7373

7474
func init() {
75-
SchemeBuilder.Register(&NetworkContainer{}, &NetworkContainerList{})
75+
SchemeBuilder.Register(&MultiTenantNetworkContainer{}, &MultiTenantNetworkContainerList{})
7676
}

networkcontainer/api/v1alpha1/zz_generated.deepcopy.go renamed to crds/multitenantnetworkcontainer/api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

networkcontainer/manifests/networking.azure.com_networkcontainers.yaml renamed to crds/multitenantnetworkcontainer/manifests/networking.azure.com_multitenantnetworkcontainers.yaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,21 @@ metadata:
66
annotations:
77
controller-gen.kubebuilder.io/version: v0.3.0
88
creationTimestamp: null
9-
name: networkcontainers.networking.azure.com
9+
name: multitenantnetworkcontainers.networking.azure.com
1010
spec:
1111
group: networking.azure.com
1212
names:
13-
kind: NetworkContainer
14-
listKind: NetworkContainerList
15-
plural: networkcontainers
16-
singular: networkcontainer
13+
kind: MultiTenantNetworkContainer
14+
listKind: MultiTenantNetworkContainerList
15+
plural: multitenantnetworkcontainers
16+
singular: multitenantnetworkcontainer
1717
scope: Namespaced
1818
subresources:
1919
status: {}
2020
validation:
2121
openAPIV3Schema:
22-
description: NetworkContainer is the Schema for the networkcontainers API
22+
description: MultiTenantNetworkContainer is the Schema for the MultiTenantnetworkcontainers
23+
API
2324
properties:
2425
apiVersion:
2526
description: 'APIVersion defines the versioned schema of this representation
@@ -34,7 +35,8 @@ spec:
3435
metadata:
3536
type: object
3637
spec:
37-
description: NetworkContainerSpec defines the desired state of NetworkContainer
38+
description: MultiTenantNetworkContainerSpec defines the desired state of
39+
MultiTenantNetworkContainer
3840
properties:
3941
interfaceName:
4042
description: InterfaceName - the interface name for consuming Pod
@@ -56,7 +58,8 @@ spec:
5658
type: string
5759
type: object
5860
status:
59-
description: NetworkContainerStatus defines the observed state of NetworkContainer
61+
description: MultiTenantNetworkContainerStatus defines the observed state
62+
of MultiTenantNetworkContainer
6063
properties:
6164
gateway:
6265
description: The gateway IP address

0 commit comments

Comments
 (0)