Skip to content

Commit

Permalink
Merge branch 'nephio-project:main' into req-status
Browse files Browse the repository at this point in the history
  • Loading branch information
henderiw authored Apr 20, 2023
2 parents 16b6c5f + d477a29 commit 06157be
Show file tree
Hide file tree
Showing 13 changed files with 2,430 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ help: ## Display this help.
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."


##@ Build Dependencies

## Location to install dependencies to
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/req.nephio.org_capacities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ spec:
throughput
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
maxNFConnections:
description: MaxNFConnections defines the max NF(s) that can be connected
to this NF/device
type: integer
maxSessions:
description: MaxSessions defines the max sessions of the control plane
expressed in unit of 1000s
Expand Down
400 changes: 400 additions & 0 deletions config/crd/bases/workload.nephio.org_amfdeployments.yaml

Large diffs are not rendered by default.

400 changes: 400 additions & 0 deletions config/crd/bases/workload.nephio.org_smfdeployments.yaml

Large diffs are not rendered by default.

400 changes: 400 additions & 0 deletions config/crd/bases/workload.nephio.org_upfdeployments.yaml

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions nf_deployments/v1alpha1/amf_deployment_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
Copyright 2023 The Nephio Authors.
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 (
"reflect"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
)

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
type AMFDeployment struct {
metav1.TypeMeta `json:",inline" yaml:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`

Spec AMFDeploymentSpec `json:"spec,omitempty" yaml:"spec,omitempty"`
Status AMFDeploymentStatus `json:"status,omitempty" yaml:"status,omitempty"`
}

// +kubebuilder:object:root=true
// AMFDeploymentList contains a list of AMFDeployments
type AMFDeploymentList struct {
metav1.TypeMeta `json:",inline" yaml:",inline"`
metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Items []AMFDeployment `json:"items" yaml:"items"`
}

type AMFDeploymentSpec struct {
NFDeploymentSpec `json:",inline" yaml:",inline"`
}

type AMFDeploymentStatus struct {
NFDeploymentStatus `json:",inline" yaml:",inline"`
}

// Interface type metadata.
var (
AMFDeploymentKind = reflect.TypeOf(AMFDeployment{}).Name()
AMFDeploymentGroupKind = schema.GroupKind{Group: Group, Kind: AMFDeploymentKind}.String()
AMFDeploymentKindAPIVersion = AMFDeploymentKind + "." + GroupVersion.String()
AMFDeploymenteGroupVersionKind = GroupVersion.WithKind(AMFDeploymentKind)
)
43 changes: 43 additions & 0 deletions nf_deployments/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
Copyright 2023 The Nephio Authors.
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 ipam v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=workload.nephio.org
package v1alpha1

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

const (
// Group in the kubernetes api
Group = "workload.nephio.org"
// Version in the kubernetes api
Version = "v1alpha1"
)

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

// 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
)
186 changes: 186 additions & 0 deletions nf_deployments/v1alpha1/nf_deployment_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
/*
Copyright 2023 The Nephio Authors.
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 (
nephioreqv1alpha1 "github.com/nephio-project/api/nf_requirements/v1alpha1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// NFDeploymentSpec defines the characteristics of a deployment of a network function
type NFDeploymentSpec struct {
// capacity defines the capacity characteristics of the NF deployment
// +optional
Capacity *nephioreqv1alpha1.CapacitySpec `json:"capacity,omitempty" yaml:"capacity,omitempty"`
// Interfaces defines the interfaces associated with the NF deployment
// +optional
Interfaces []InterfaceConfig `json:"interfaces,omitempty" yaml:"interfaces,omitempty"`
// NetworkInstances defines the network instances associated with the NF deployment
// +optional
NetworkInstances []NetworkInstance `json:"networkInstances,omitempty" yaml:"networkInstances,omitempty"`
// configRef defines addiitonal configuration references the nf depends upon
// +optional
ConfigRefs []corev1.ObjectReference `json:"configRefs,omitempty" yaml:"configRefs,omitempty"`
}

// InterfaceConfig defines the configuration of the interface
type InterfaceConfig struct {
// Name defines the name of the interface
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
Name string `json:"name" yaml:"name"`
// IPv4 defines the ipv4 configuration of the interface
// +optional
IPv4 *IPv4 `json:"ipv4,omitempty" yaml:"ipv4,omitempty"`
// IPv6Config defines the ipv6 configuration of the interface
// +optional
IPv6 *IPv6 `json:"ipv6,omitempty" yaml:"ipv6,omitempty"`
// VLANID defines the specific vlan id associated on this interface
// +optional
VLANID *uint16 `json:"vlanID,omitempty" yaml:"vlanID,omitempty"`
}

// IPv4 defines the configuration parameters of an ipv4 interface or peer
type IPv4 struct {
// Address defines the IPv4 address and prefix length in CIDR notation
// [IP prefix, range IPv4 with host bits]
Address string `json:"address" yaml:"address"`
// Gateway defines the IPv4 address associated to the interface as a gateway
// +optional
Gateway *string `json:"gateway,omitempty" yaml:"gateway,omitempty"`
}

// IPv6 defines the configuration parameters of an ipv6 interface or peer
type IPv6 struct {
// Address defines the IPv6 address and prefix length in CIDR notation
// [IP prefix, range IPv6 with host bits]
Address string `json:"address" yaml:"address"`
// Gateway defines the IPv6 address associated to the interface as a gateway
// +optional
Gateway *string `json:"gateway,omitempty" yaml:"gateway,omitempty"`
}

// A networkInstance is a Layer 3 forwarding construct
// such as a virtual routing and forwarding (VRF) instance,
type NetworkInstance struct {
// Name defines the name of the network instance
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
Name string `json:"name" yaml:"name"`
// interfaces defines the interfaces associated with the network instance
// +optional
Interfaces []string `json:"interfaces,omitempty" yaml:"interfaces,omitempty"`
// Peers defines the peer configuration associated with the network instance
// +optional
Peers []PeerConfig `json:"peers,omitempty" yaml:"peers,omitempty"`
// DataNetworks defines the data networks assocated with the network instance
// +optional
DataNetworks []DataNetwork `json:"dataNetworks,omitempty" yaml:"dataNetworks,omitempty"`
// BGP defines the BGP configuration associated with the network instance
// +optional
BGP *BGPConfig `json:"bgp,omitempty" yaml:"bgp,omitempty"`
}

// A PeerConfig defines the peer configuration
type PeerConfig struct {
// Name defines the name of the data network
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
Name *string `json:"name,omitempty" yaml:"name,omitempty"`
// IPv4 defines the ipv4 configuration of the peer
// +optional
IPv4 *IPv4 `json:"ipv4,omitempty" yaml:"ipv4,omitempty"`
// IPv6 defines the ipv6 configuration of the peer
// +optional
IPv6 *IPv6 `json:"ipv6,omitempty" yaml:"ipv6,omitempty"`
}

// A DataNetwork defines the Data Network name defined by 3GPP
type DataNetwork struct {
// Name defines the name of the data network
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
Name *string `json:"name,omitempty" yaml:"name,omitempty"`
// Pool defines the list of address pools associated with the data network
// +optional
Pool []Pool `json:"pool,omitempty" yaml:"pool,omitempty"`
}

type Pool struct {
// Prefix defines the ip cidr in prefix notation. It is defines as a subnet
// +kubebuilder:validation:Pattern=`(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))|((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))`
Prefix string `json:"prefix" yaml:"prefix"`
}

// BGPConfig specifies parameters for BGP related configuration for UPF and SMF
type BGPConfig struct {
// RouterID defines the router ID of the bgp process
RouterID string `json:"routerID" yaml:"routerID"`
// AutonomousSystem defines the AS number of the bgp process
AutonomousSystem int `json:"autonomousSystem" yaml:"autonomousSystem"`
// BGPNeigbors defines the configuration of the BGP neighbor
BGPNeigbors []BGPNeighbor `json:"bgpNeighbors" yaml:"bgpNeighbors"`
}

type BGPNeighbor struct {
// Address defines the IPv4 or IPv6 address of the BGP neighbor
Address string `json:"address" yaml:"address"`
// BGP interface name, MUST match the one use in InterfaceConfig
Name *string `json:"name,omitempty" yaml:"name,omitempty"`
// PeerAS defines the AS number of the bgp peer
PeerAS int `json:"peerAS" yaml:"peerAS"`
}

// NFDeploymentStatus defines the observed state of nf deployment
type NFDeploymentStatus struct {
// The generation observed by the deployment controller.
ObservedGeneration int32 `json:"observedGeneration" yaml:"observedGeneration"`
// Conditions define the current state of the NF deployment
Conditions []metav1.Condition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
}

type NFDeploymentConditionType string

const (
// Reconciling implies that the deployment is progressing.
// Reconciliation for a deployment is considered when a new version
// is adopted, when new pods scale up or old pods scale down, or when
// required peering is in progress.
// Condition name follows Kpt guidelines.
Reconciling NFDeploymentConditionType = "Reconciling"
// Deployment is unable to make progress towards Reconciliation.
// Reasons could be Pod creation failure, Peering failure etc.
// Condition name follows Kpt guidelines.
Stalled NFDeploymentConditionType = "Stalled"
// The Deployment is considered available when following conditions hold:
// 1. At-least the minimal set of Pods are up and running for at-least
//minReadySeconds.
// 2. The Deployment is ready for required peering.
Available NFDeploymentConditionType = "Available"
// The Deployment is making progress towards peering on the required
// interfaces. A successful peering implies that the NF is reachable by
// the required peers and is a able to reach them.
Peering NFDeploymentConditionType = "Peering"
// The Deployment is available and has peered successfully on required
// interfaces.
// At this stage, the deployment is ready to serve requests.
Ready NFDeploymentConditionType = "Ready"
)
59 changes: 59 additions & 0 deletions nf_deployments/v1alpha1/smf_deployment_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
Copyright 2023 The Nephio Authors.
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 (
"reflect"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
)

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

type SMFDeployment struct {
metav1.TypeMeta `json:",inline" yaml:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`

Spec SMFDeploymentSpec `json:"spec,omitempty" yaml:"spec,omitempty"`
Status SMFDeploymentStatus `json:"status,omitempty" yaml:"status,omitempty"`
}

//+kubebuilder:object:root=true

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

type SMFDeploymentSpec struct {
NFDeploymentSpec `json:",inline" yaml:",inline"`
}

type SMFDeploymentStatus struct {
NFDeploymentStatus `json:",inline" yaml:",inline"`
}

// Interface type metadata.
var (
SMFDeploymentKind = reflect.TypeOf(SMFDeployment{}).Name()
SMFDeploymentGroupKind = schema.GroupKind{Group: Group, Kind: SMFDeploymentKind}.String()
SMFDeploymentKindAPIVersion = SMFDeploymentKind + "." + GroupVersion.String()
SMFDeploymenteGroupVersionKind = GroupVersion.WithKind(SMFDeploymentKind)
)
Loading

0 comments on commit 06157be

Please sign in to comment.