From 25cce1a54dc7ac232e4545273fcf05f8fd8ca9e4 Mon Sep 17 00:00:00 2001 From: Wim Henderickx Date: Tue, 25 Apr 2023 07:09:23 +0200 Subject: [PATCH] changed peerconfig --- .../workload.nephio.org_amfdeployments.yaml | 134 ++++++++++++------ .../workload.nephio.org_smfdeployments.yaml | 134 ++++++++++++------ .../workload.nephio.org_upfdeployments.yaml | 134 ++++++++++++------ .../v1alpha1/nf_deployment_types.go | 11 +- .../v1alpha1/zz_generated.deepcopy.go | 26 +++- 5 files changed, 294 insertions(+), 145 deletions(-) diff --git a/config/crd/bases/workload.nephio.org_amfdeployments.yaml b/config/crd/bases/workload.nephio.org_amfdeployments.yaml index fc5d62e5..0c5f3fea 100644 --- a/config/crd/bases/workload.nephio.org_amfdeployments.yaml +++ b/config/crd/bases/workload.nephio.org_amfdeployments.yaml @@ -265,55 +265,99 @@ spec: maxLength: 253 minLength: 1 type: string - peers: - description: Peers defines the peer configuration associated - with the network instance - items: - description: A PeerConfig defines the peer configuration - properties: - ipv4: - description: IPv4 defines the ipv4 configuration of the - peer - properties: - address: - description: Address defines the IPv4 address and - prefix length in CIDR notation [IP prefix, range - IPv4 with host bits] - type: string - gateway: - description: Gateway defines the IPv4 address associated - to the interface as a gateway - type: string - required: - - address - type: object - ipv6: - description: IPv6 defines the ipv6 configuration of the - peer - properties: - address: - description: Address defines the IPv6 address and - prefix length in CIDR notation [IP prefix, range - IPv6 with host bits] - type: string - gateway: - description: Gateway defines the IPv6 address associated - to the interface as a gateway - type: string - required: - - address - type: object - name: - description: Name defines the name of the data network - maxLength: 253 - minLength: 1 - type: string - type: object - type: array required: - name type: object type: array + peers: + description: Peers defines the peers the network function is associated + with + items: + description: A PeerConfig defines the peer configuration + properties: + ipv4: + description: IPv4 defines the ipv4 configuration of the peer + properties: + address: + description: Address defines the IPv4 address and prefix + length in CIDR notation [IP prefix, range IPv4 with host + bits] + type: string + gateway: + description: Gateway defines the IPv4 address associated + to the interface as a gateway + type: string + required: + - address + type: object + ipv6: + description: IPv6 defines the ipv6 configuration of the peer + properties: + address: + description: Address defines the IPv6 address and prefix + length in CIDR notation [IP prefix, range IPv6 with host + bits] + type: string + gateway: + description: Gateway defines the IPv6 address associated + to the interface as a gateway + type: string + required: + - address + type: object + labels: + additionalProperties: + type: string + description: Labels define metadata assoicated with the peer + configuration + type: object + name: + description: Name defines the name of the data network + maxLength: 253 + minLength: 1 + type: string + networkInstance: + description: NetworkInstance defines the networkInstance to + which this peer config belongs Name and optionally Namespace + is used here + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead + of an entire object, this string should contain a valid + JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container + within a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that + triggered the event) or if no container name is specified + "spec.containers[2]" (container with index 2 in this pod). + This syntax is chosen only to have some well-defined way + of referencing a part of an object. TODO: this design + is not final and this field is subject to change in the + future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + x-kubernetes-map-type: atomic + type: object + type: array type: object status: properties: diff --git a/config/crd/bases/workload.nephio.org_smfdeployments.yaml b/config/crd/bases/workload.nephio.org_smfdeployments.yaml index 50c7627c..856aeefd 100644 --- a/config/crd/bases/workload.nephio.org_smfdeployments.yaml +++ b/config/crd/bases/workload.nephio.org_smfdeployments.yaml @@ -265,55 +265,99 @@ spec: maxLength: 253 minLength: 1 type: string - peers: - description: Peers defines the peer configuration associated - with the network instance - items: - description: A PeerConfig defines the peer configuration - properties: - ipv4: - description: IPv4 defines the ipv4 configuration of the - peer - properties: - address: - description: Address defines the IPv4 address and - prefix length in CIDR notation [IP prefix, range - IPv4 with host bits] - type: string - gateway: - description: Gateway defines the IPv4 address associated - to the interface as a gateway - type: string - required: - - address - type: object - ipv6: - description: IPv6 defines the ipv6 configuration of the - peer - properties: - address: - description: Address defines the IPv6 address and - prefix length in CIDR notation [IP prefix, range - IPv6 with host bits] - type: string - gateway: - description: Gateway defines the IPv6 address associated - to the interface as a gateway - type: string - required: - - address - type: object - name: - description: Name defines the name of the data network - maxLength: 253 - minLength: 1 - type: string - type: object - type: array required: - name type: object type: array + peers: + description: Peers defines the peers the network function is associated + with + items: + description: A PeerConfig defines the peer configuration + properties: + ipv4: + description: IPv4 defines the ipv4 configuration of the peer + properties: + address: + description: Address defines the IPv4 address and prefix + length in CIDR notation [IP prefix, range IPv4 with host + bits] + type: string + gateway: + description: Gateway defines the IPv4 address associated + to the interface as a gateway + type: string + required: + - address + type: object + ipv6: + description: IPv6 defines the ipv6 configuration of the peer + properties: + address: + description: Address defines the IPv6 address and prefix + length in CIDR notation [IP prefix, range IPv6 with host + bits] + type: string + gateway: + description: Gateway defines the IPv6 address associated + to the interface as a gateway + type: string + required: + - address + type: object + labels: + additionalProperties: + type: string + description: Labels define metadata assoicated with the peer + configuration + type: object + name: + description: Name defines the name of the data network + maxLength: 253 + minLength: 1 + type: string + networkInstance: + description: NetworkInstance defines the networkInstance to + which this peer config belongs Name and optionally Namespace + is used here + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead + of an entire object, this string should contain a valid + JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container + within a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that + triggered the event) or if no container name is specified + "spec.containers[2]" (container with index 2 in this pod). + This syntax is chosen only to have some well-defined way + of referencing a part of an object. TODO: this design + is not final and this field is subject to change in the + future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + x-kubernetes-map-type: atomic + type: object + type: array type: object status: properties: diff --git a/config/crd/bases/workload.nephio.org_upfdeployments.yaml b/config/crd/bases/workload.nephio.org_upfdeployments.yaml index 5839f61c..18d2ee2c 100644 --- a/config/crd/bases/workload.nephio.org_upfdeployments.yaml +++ b/config/crd/bases/workload.nephio.org_upfdeployments.yaml @@ -265,55 +265,99 @@ spec: maxLength: 253 minLength: 1 type: string - peers: - description: Peers defines the peer configuration associated - with the network instance - items: - description: A PeerConfig defines the peer configuration - properties: - ipv4: - description: IPv4 defines the ipv4 configuration of the - peer - properties: - address: - description: Address defines the IPv4 address and - prefix length in CIDR notation [IP prefix, range - IPv4 with host bits] - type: string - gateway: - description: Gateway defines the IPv4 address associated - to the interface as a gateway - type: string - required: - - address - type: object - ipv6: - description: IPv6 defines the ipv6 configuration of the - peer - properties: - address: - description: Address defines the IPv6 address and - prefix length in CIDR notation [IP prefix, range - IPv6 with host bits] - type: string - gateway: - description: Gateway defines the IPv6 address associated - to the interface as a gateway - type: string - required: - - address - type: object - name: - description: Name defines the name of the data network - maxLength: 253 - minLength: 1 - type: string - type: object - type: array required: - name type: object type: array + peers: + description: Peers defines the peers the network function is associated + with + items: + description: A PeerConfig defines the peer configuration + properties: + ipv4: + description: IPv4 defines the ipv4 configuration of the peer + properties: + address: + description: Address defines the IPv4 address and prefix + length in CIDR notation [IP prefix, range IPv4 with host + bits] + type: string + gateway: + description: Gateway defines the IPv4 address associated + to the interface as a gateway + type: string + required: + - address + type: object + ipv6: + description: IPv6 defines the ipv6 configuration of the peer + properties: + address: + description: Address defines the IPv6 address and prefix + length in CIDR notation [IP prefix, range IPv6 with host + bits] + type: string + gateway: + description: Gateway defines the IPv6 address associated + to the interface as a gateway + type: string + required: + - address + type: object + labels: + additionalProperties: + type: string + description: Labels define metadata assoicated with the peer + configuration + type: object + name: + description: Name defines the name of the data network + maxLength: 253 + minLength: 1 + type: string + networkInstance: + description: NetworkInstance defines the networkInstance to + which this peer config belongs Name and optionally Namespace + is used here + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead + of an entire object, this string should contain a valid + JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container + within a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that + triggered the event) or if no container name is specified + "spec.containers[2]" (container with index 2 in this pod). + This syntax is chosen only to have some well-defined way + of referencing a part of an object. TODO: this design + is not final and this field is subject to change in the + future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + x-kubernetes-map-type: atomic + type: object + type: array type: object status: properties: diff --git a/nf_deployments/v1alpha1/nf_deployment_types.go b/nf_deployments/v1alpha1/nf_deployment_types.go index 1c23408c..0fd5c881 100644 --- a/nf_deployments/v1alpha1/nf_deployment_types.go +++ b/nf_deployments/v1alpha1/nf_deployment_types.go @@ -35,6 +35,9 @@ type NFDeploymentSpec struct { // configRef defines addiitonal configuration references the nf depends upon // +optional ConfigRefs []corev1.ObjectReference `json:"configRefs,omitempty" yaml:"configRefs,omitempty"` + // Peers defines the peers the network function is associated with + // +optional + Peers []PeerConfig `json:"peers,omitempty" yaml:"peers,omitempty"` } // InterfaceConfig defines the configuration of the interface @@ -86,9 +89,6 @@ type NetworkInstance struct { // 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"` @@ -104,12 +104,17 @@ type PeerConfig struct { // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 Name *string `json:"name,omitempty" yaml:"name,omitempty"` + // Labels define metadata assoicated with the peer configuration + Labels map[string]string `json:"labels,omitempty" yaml:"labels,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"` + // NetworkInstance defines the networkInstance to which this peer config belongs + // Name and optionally Namespace is used here + NetworkInstance *corev1.ObjectReference `json:"networkInstance,omitempty" yaml:"networkInstance,omitempty"` } // A DataNetwork defines the Data Network name defined by 3GPP diff --git a/nf_deployments/v1alpha1/zz_generated.deepcopy.go b/nf_deployments/v1alpha1/zz_generated.deepcopy.go index 07b8a7ed..84f044f2 100644 --- a/nf_deployments/v1alpha1/zz_generated.deepcopy.go +++ b/nf_deployments/v1alpha1/zz_generated.deepcopy.go @@ -283,6 +283,13 @@ func (in *NFDeploymentSpec) DeepCopyInto(out *NFDeploymentSpec) { *out = make([]v1.ObjectReference, len(*in)) copy(*out, *in) } + if in.Peers != nil { + in, out := &in.Peers, &out.Peers + *out = make([]PeerConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NFDeploymentSpec. @@ -325,13 +332,6 @@ func (in *NetworkInstance) DeepCopyInto(out *NetworkInstance) { *out = make([]string, len(*in)) copy(*out, *in) } - if in.Peers != nil { - in, out := &in.Peers, &out.Peers - *out = make([]PeerConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } if in.DataNetworks != nil { in, out := &in.DataNetworks, &out.DataNetworks *out = make([]DataNetwork, len(*in)) @@ -364,6 +364,13 @@ func (in *PeerConfig) DeepCopyInto(out *PeerConfig) { *out = new(string) **out = **in } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } if in.IPv4 != nil { in, out := &in.IPv4, &out.IPv4 *out = new(IPv4) @@ -374,6 +381,11 @@ func (in *PeerConfig) DeepCopyInto(out *PeerConfig) { *out = new(IPv6) (*in).DeepCopyInto(*out) } + if in.NetworkInstance != nil { + in, out := &in.NetworkInstance, &out.NetworkInstance + *out = new(v1.ObjectReference) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PeerConfig.