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
16 changes: 16 additions & 0 deletions networkcontainer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Dependencies for generator
GOFILES = $(wildcard api/*/*.go)

generate: $(GOFILES) controller-gen
controller-gen object:headerFile="boilerplate.go.txt" paths="./..."

.PHONY: controller-gen

controller-gen:
@(cd && GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0)

.PHONY: manifests

manifests: controller-gen
mkdir -p manifests
controller-gen crd:trivialVersions=true paths="./..." output:crd:artifacts:config=manifests/
3 changes: 3 additions & 0 deletions networkcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# NetworkContainer CRDs

This package contains the CRD definitions for NetworkContainer, which would be consumed in CNS.
35 changes: 35 additions & 0 deletions networkcontainer/api/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*

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 v1alpha1 contains API Schema definitions for the networking v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=networking.azure.com
package v1alpha1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "networking.azure.com", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)
76 changes: 76 additions & 0 deletions networkcontainer/api/v1alpha1/networkcontainer_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*

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 v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// Important: Run "make" to regenerate code after modifying this file

// NetworkContainerSpec defines the desired state of NetworkContainer
type NetworkContainerSpec struct {
// UUID - network container UUID
UUID string `json:"uuid,omitempty"`
// Network - customer VNet GUID
Network string `json:"network,omitempty"`
// Subnet - customer subnet name
Subnet string `json:"subnet,omitempty"`
// Node - kubernetes node name
Node string `json:"node,omitempty"`
// InterfaceName - the interface name for consuming Pod
InterfaceName string `json:"interfaceName,omitempty"`
// ReservationID - reservation ID for allocating IP
ReservationID string `json:"reservationID,omitempty"`
}

// NetworkContainerStatus defines the observed state of NetworkContainer
type NetworkContainerStatus struct {
// The IP address
IP string `json:"ip,omitempty"`
// The gateway IP address
Gateway string `json:"gateway,omitempty"`
// The state of network container
State string `json:"state,omitempty"`
// The subnet CIDR
IPSubnet string `json:"ipSubnet,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// NetworkContainer is the Schema for the networkcontainers API
type NetworkContainer struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec NetworkContainerSpec `json:"spec,omitempty"`
Status NetworkContainerStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// NetworkContainerList contains a list of NetworkContainer
type NetworkContainerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []NetworkContainer `json:"items"`
}

func init() {
SchemeBuilder.Register(&NetworkContainer{}, &NetworkContainerList{})
}
113 changes: 113 additions & 0 deletions networkcontainer/api/v1alpha1/zz_generated.deepcopy.go

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

14 changes: 14 additions & 0 deletions networkcontainer/boilerplate.go.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*

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.
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.3.0
creationTimestamp: null
name: networkcontainers.networking.azure.com
spec:
group: networking.azure.com
names:
kind: NetworkContainer
listKind: NetworkContainerList
plural: networkcontainers
singular: networkcontainer
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: NetworkContainer is the Schema for the networkcontainers API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: NetworkContainerSpec defines the desired state of NetworkContainer
properties:
interfaceName:
description: InterfaceName - the interface name for consuming Pod
type: string
network:
description: Network - customer VNet GUID
type: string
node:
description: Node - kubernetes node name
type: string
reservationID:
description: ReservationID - reservation ID for allocating IP
type: string
subnet:
description: Subnet - customer subnet name
type: string
uuid:
description: UUID - network container UUID
type: string
type: object
status:
description: NetworkContainerStatus defines the observed state of NetworkContainer
properties:
gateway:
description: The gateway IP address
type: string
ip:
description: The IP address
type: string
ipSubnet:
description: The subnet CIDR
type: string
state:
description: The state of network container
type: string
type: object
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []