diff --git a/dist/images/install.sh b/dist/images/install.sh index 6bb7c8e455d..ffe8671bb04 100755 --- a/dist/images/install.sh +++ b/dist/images/install.sh @@ -1446,8 +1446,6 @@ spec: type: boolean disableInterConnection: type: boolean - htbqos: - type: string enableDHCP: type: boolean dhcpV4Options: @@ -1745,37 +1743,6 @@ spec: status: {} conversion: strategy: None ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: htbqoses.kubeovn.io -spec: - group: kubeovn.io - versions: - - name: v1 - served: true - storage: true - additionalPrinterColumns: - - name: PRIORITY - type: string - jsonPath: .spec.priority - schema: - openAPIV3Schema: - type: object - properties: - spec: - type: object - properties: - priority: - type: string # Value in range 0 to 4,294,967,295. - scope: Cluster - names: - plural: htbqoses - singular: htbqos - kind: HtbQos - shortNames: - - htbqos EOF if $DPDK; then @@ -1812,7 +1779,6 @@ rules: - provider-networks/status - security-groups - security-groups/status - - htbqoses - iptables-eips - iptables-fip-rules - iptables-dnat-rules @@ -2315,7 +2281,6 @@ rules: - provider-networks/status - security-groups - security-groups/status - - htbqoses - iptables-eips - iptables-fip-rules - iptables-dnat-rules diff --git a/dist/images/update/1.8.3-1.9.1.sh b/dist/images/update/1.8.3-1.9.1.sh index ac38fcb3828..9bf90c50810 100755 --- a/dist/images/update/1.8.3-1.9.1.sh +++ b/dist/images/update/1.8.3-1.9.1.sh @@ -422,8 +422,6 @@ spec: type: boolean disableInterConnection: type: boolean - htbqos: - type: string scope: Cluster names: plural: subnets @@ -674,36 +672,6 @@ spec: conversion: strategy: None --- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: htbqoses.kubeovn.io -spec: - group: kubeovn.io - versions: - - name: v1 - served: true - storage: true - additionalPrinterColumns: - - name: PRIORITY - type: string - jsonPath: .spec.priority - schema: - openAPIV3Schema: - type: object - properties: - spec: - type: object - properties: - priority: - type: string # Value in range 0 to 4,294,967,295. - scope: Cluster - names: - plural: htbqoses - singular: htbqos - kind: HtbQos - shortNames: - - htbqos EOF kubectl apply -f kube-ovn-crd-1.9.yaml @@ -740,7 +708,6 @@ rules: - provider-networks/status - security-groups - security-groups/status - - htbqoses verbs: - "*" - apiGroups: diff --git a/kubeovn-helm/templates/kube-ovn-crd.yaml b/kubeovn-helm/templates/kube-ovn-crd.yaml index 4f717742de1..a6d4779bc39 100644 --- a/kubeovn-helm/templates/kube-ovn-crd.yaml +++ b/kubeovn-helm/templates/kube-ovn-crd.yaml @@ -1232,8 +1232,6 @@ spec: type: boolean disableInterConnection: type: boolean - htbqos: - type: string enableDHCP: type: boolean dhcpV4Options: @@ -1531,34 +1529,3 @@ spec: status: {} conversion: strategy: None ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: htbqoses.kubeovn.io -spec: - group: kubeovn.io - versions: - - name: v1 - served: true - storage: true - additionalPrinterColumns: - - name: PRIORITY - type: string - jsonPath: .spec.priority - schema: - openAPIV3Schema: - type: object - properties: - spec: - type: object - properties: - priority: - type: string # Value in range 0 to 4,294,967,295. - scope: Cluster - names: - plural: htbqoses - singular: htbqos - kind: HtbQos - shortNames: - - htbqos diff --git a/kubeovn-helm/templates/ovn-CR.yaml b/kubeovn-helm/templates/ovn-CR.yaml index 184c5124bb2..1b54cdea39f 100644 --- a/kubeovn-helm/templates/ovn-CR.yaml +++ b/kubeovn-helm/templates/ovn-CR.yaml @@ -22,7 +22,6 @@ rules: - provider-networks/status - security-groups - security-groups/status - - htbqoses - iptables-eips - iptables-fip-rules - iptables-dnat-rules diff --git a/pkg/apis/kubeovn/v1/register.go b/pkg/apis/kubeovn/v1/register.go index f8bd244ff40..472156939a2 100644 --- a/pkg/apis/kubeovn/v1/register.go +++ b/pkg/apis/kubeovn/v1/register.go @@ -61,8 +61,6 @@ func addKnownTypes(scheme *runtime.Scheme) error { &OvnSnatRuleList{}, &SecurityGroup{}, &SecurityGroupList{}, - &HtbQos{}, - &HtbQosList{}, &SwitchLBRule{}, &SwitchLBRuleList{}, &VpcDns{}, diff --git a/pkg/apis/kubeovn/v1/types.go b/pkg/apis/kubeovn/v1/types.go index 2ec1e5ad97b..512ef6349d5 100644 --- a/pkg/apis/kubeovn/v1/types.go +++ b/pkg/apis/kubeovn/v1/types.go @@ -121,9 +121,7 @@ type SubnetSpec struct { Private bool `json:"private"` AllowSubnets []string `json:"allowSubnets,omitempty"` - Vlan string `json:"vlan,omitempty"` - HtbQos string `json:"htbqos,omitempty"` - + Vlan string `json:"vlan,omitempty"` Vips []string `json:"vips,omitempty"` LogicalGateway bool `json:"logicalGateway,omitempty"` @@ -786,31 +784,6 @@ type SecurityGroupList struct { Items []SecurityGroup `json:"items"` } -// +genclient -// +genclient:noStatus -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +genclient:nonNamespaced - -type HtbQos struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec HtbQosSpec `json:"spec"` -} - -type HtbQosSpec struct { - Priority string `json:"priority"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -type HtbQosList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - Items []HtbQos `json:"items"` -} - // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +genclient:nonNamespaced diff --git a/pkg/apis/kubeovn/v1/zz_generated.deepcopy.go b/pkg/apis/kubeovn/v1/zz_generated.deepcopy.go index 6de31889882..611c8ca5e12 100644 --- a/pkg/apis/kubeovn/v1/zz_generated.deepcopy.go +++ b/pkg/apis/kubeovn/v1/zz_generated.deepcopy.go @@ -62,82 +62,6 @@ func (in *CustomInterface) DeepCopy() *CustomInterface { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HtbQos) DeepCopyInto(out *HtbQos) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HtbQos. -func (in *HtbQos) DeepCopy() *HtbQos { - if in == nil { - return nil - } - out := new(HtbQos) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HtbQos) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HtbQosList) DeepCopyInto(out *HtbQosList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]HtbQos, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HtbQosList. -func (in *HtbQosList) DeepCopy() *HtbQosList { - if in == nil { - return nil - } - out := new(HtbQosList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HtbQosList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HtbQosSpec) DeepCopyInto(out *HtbQosSpec) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HtbQosSpec. -func (in *HtbQosSpec) DeepCopy() *HtbQosSpec { - if in == nil { - return nil - } - out := new(HtbQosSpec) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IP) DeepCopyInto(out *IP) { *out = *in @@ -1486,6 +1410,11 @@ func (in *SubnetSpec) DeepCopyInto(out *SubnetSpec) { *out = make([]Acl, len(*in)) copy(*out, *in) } + if in.EnableLb != nil { + in, out := &in.EnableLb, &out.EnableLb + *out = new(bool) + **out = **in + } return } diff --git a/pkg/client/clientset/versioned/typed/kubeovn/v1/fake/fake_htbqos.go b/pkg/client/clientset/versioned/typed/kubeovn/v1/fake/fake_htbqos.go deleted file mode 100644 index da95cb21262..00000000000 --- a/pkg/client/clientset/versioned/typed/kubeovn/v1/fake/fake_htbqos.go +++ /dev/null @@ -1,122 +0,0 @@ -/* -Copyright The Kubernetes 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeHtbQoses implements HtbQosInterface -type FakeHtbQoses struct { - Fake *FakeKubeovnV1 -} - -var htbqosesResource = schema.GroupVersionResource{Group: "kubeovn.io", Version: "v1", Resource: "htbqoses"} - -var htbqosesKind = schema.GroupVersionKind{Group: "kubeovn.io", Version: "v1", Kind: "HtbQos"} - -// Get takes name of the htbQos, and returns the corresponding htbQos object, and an error if there is any. -func (c *FakeHtbQoses) Get(ctx context.Context, name string, options v1.GetOptions) (result *kubeovnv1.HtbQos, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(htbqosesResource, name), &kubeovnv1.HtbQos{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.HtbQos), err -} - -// List takes label and field selectors, and returns the list of HtbQoses that match those selectors. -func (c *FakeHtbQoses) List(ctx context.Context, opts v1.ListOptions) (result *kubeovnv1.HtbQosList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(htbqosesResource, htbqosesKind, opts), &kubeovnv1.HtbQosList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &kubeovnv1.HtbQosList{ListMeta: obj.(*kubeovnv1.HtbQosList).ListMeta} - for _, item := range obj.(*kubeovnv1.HtbQosList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested htbQoses. -func (c *FakeHtbQoses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(htbqosesResource, opts)) -} - -// Create takes the representation of a htbQos and creates it. Returns the server's representation of the htbQos, and an error, if there is any. -func (c *FakeHtbQoses) Create(ctx context.Context, htbQos *kubeovnv1.HtbQos, opts v1.CreateOptions) (result *kubeovnv1.HtbQos, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(htbqosesResource, htbQos), &kubeovnv1.HtbQos{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.HtbQos), err -} - -// Update takes the representation of a htbQos and updates it. Returns the server's representation of the htbQos, and an error, if there is any. -func (c *FakeHtbQoses) Update(ctx context.Context, htbQos *kubeovnv1.HtbQos, opts v1.UpdateOptions) (result *kubeovnv1.HtbQos, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(htbqosesResource, htbQos), &kubeovnv1.HtbQos{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.HtbQos), err -} - -// Delete takes name of the htbQos and deletes it. Returns an error if one occurs. -func (c *FakeHtbQoses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(htbqosesResource, name, opts), &kubeovnv1.HtbQos{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeHtbQoses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(htbqosesResource, listOpts) - - _, err := c.Fake.Invokes(action, &kubeovnv1.HtbQosList{}) - return err -} - -// Patch applies the patch and returns the patched htbQos. -func (c *FakeHtbQoses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *kubeovnv1.HtbQos, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(htbqosesResource, name, pt, data, subresources...), &kubeovnv1.HtbQos{}) - if obj == nil { - return nil, err - } - return obj.(*kubeovnv1.HtbQos), err -} diff --git a/pkg/client/clientset/versioned/typed/kubeovn/v1/fake/fake_kubeovn_client.go b/pkg/client/clientset/versioned/typed/kubeovn/v1/fake/fake_kubeovn_client.go index 554c72654e0..0e614bd52a9 100644 --- a/pkg/client/clientset/versioned/typed/kubeovn/v1/fake/fake_kubeovn_client.go +++ b/pkg/client/clientset/versioned/typed/kubeovn/v1/fake/fake_kubeovn_client.go @@ -28,10 +28,6 @@ type FakeKubeovnV1 struct { *testing.Fake } -func (c *FakeKubeovnV1) HtbQoses() v1.HtbQosInterface { - return &FakeHtbQoses{c} -} - func (c *FakeKubeovnV1) IPs() v1.IPInterface { return &FakeIPs{c} } diff --git a/pkg/client/clientset/versioned/typed/kubeovn/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/kubeovn/v1/generated_expansion.go index 2aab46affd0..0f47344d9b1 100644 --- a/pkg/client/clientset/versioned/typed/kubeovn/v1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/kubeovn/v1/generated_expansion.go @@ -18,8 +18,6 @@ limitations under the License. package v1 -type HtbQosExpansion interface{} - type IPExpansion interface{} type IptablesDnatRuleExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/kubeovn/v1/htbqos.go b/pkg/client/clientset/versioned/typed/kubeovn/v1/htbqos.go deleted file mode 100644 index bd7077c4743..00000000000 --- a/pkg/client/clientset/versioned/typed/kubeovn/v1/htbqos.go +++ /dev/null @@ -1,168 +0,0 @@ -/* -Copyright The Kubernetes 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - "time" - - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - scheme "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// HtbQosesGetter has a method to return a HtbQosInterface. -// A group's client should implement this interface. -type HtbQosesGetter interface { - HtbQoses() HtbQosInterface -} - -// HtbQosInterface has methods to work with HtbQos resources. -type HtbQosInterface interface { - Create(ctx context.Context, htbQos *v1.HtbQos, opts metav1.CreateOptions) (*v1.HtbQos, error) - Update(ctx context.Context, htbQos *v1.HtbQos, opts metav1.UpdateOptions) (*v1.HtbQos, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.HtbQos, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.HtbQosList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HtbQos, err error) - HtbQosExpansion -} - -// htbQoses implements HtbQosInterface -type htbQoses struct { - client rest.Interface -} - -// newHtbQoses returns a HtbQoses -func newHtbQoses(c *KubeovnV1Client) *htbQoses { - return &htbQoses{ - client: c.RESTClient(), - } -} - -// Get takes name of the htbQos, and returns the corresponding htbQos object, and an error if there is any. -func (c *htbQoses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.HtbQos, err error) { - result = &v1.HtbQos{} - err = c.client.Get(). - Resource("htbqoses"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of HtbQoses that match those selectors. -func (c *htbQoses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.HtbQosList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.HtbQosList{} - err = c.client.Get(). - Resource("htbqoses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested htbQoses. -func (c *htbQoses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("htbqoses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a htbQos and creates it. Returns the server's representation of the htbQos, and an error, if there is any. -func (c *htbQoses) Create(ctx context.Context, htbQos *v1.HtbQos, opts metav1.CreateOptions) (result *v1.HtbQos, err error) { - result = &v1.HtbQos{} - err = c.client.Post(). - Resource("htbqoses"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(htbQos). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a htbQos and updates it. Returns the server's representation of the htbQos, and an error, if there is any. -func (c *htbQoses) Update(ctx context.Context, htbQos *v1.HtbQos, opts metav1.UpdateOptions) (result *v1.HtbQos, err error) { - result = &v1.HtbQos{} - err = c.client.Put(). - Resource("htbqoses"). - Name(htbQos.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(htbQos). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the htbQos and deletes it. Returns an error if one occurs. -func (c *htbQoses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Resource("htbqoses"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *htbQoses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("htbqoses"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched htbQos. -func (c *htbQoses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HtbQos, err error) { - result = &v1.HtbQos{} - err = c.client.Patch(pt). - Resource("htbqoses"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/kubeovn/v1/kubeovn_client.go b/pkg/client/clientset/versioned/typed/kubeovn/v1/kubeovn_client.go index 86dad154b9e..b9e3e1d0afa 100644 --- a/pkg/client/clientset/versioned/typed/kubeovn/v1/kubeovn_client.go +++ b/pkg/client/clientset/versioned/typed/kubeovn/v1/kubeovn_client.go @@ -28,7 +28,6 @@ import ( type KubeovnV1Interface interface { RESTClient() rest.Interface - HtbQosesGetter IPsGetter IptablesDnatRulesGetter IptablesEIPsGetter @@ -53,10 +52,6 @@ type KubeovnV1Client struct { restClient rest.Interface } -func (c *KubeovnV1Client) HtbQoses() HtbQosInterface { - return newHtbQoses(c) -} - func (c *KubeovnV1Client) IPs() IPInterface { return newIPs(c) } diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 5a9cf825907..cac2c8df264 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -53,8 +53,6 @@ func (f *genericInformer) Lister() cache.GenericLister { func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { // Group=kubeovn.io, Version=v1 - case v1.SchemeGroupVersion.WithResource("htbqoses"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().HtbQoses().Informer()}, nil case v1.SchemeGroupVersion.WithResource("ips"): return &genericInformer{resource: resource.GroupResource(), informer: f.Kubeovn().V1().IPs().Informer()}, nil case v1.SchemeGroupVersion.WithResource("iptables-dnat-rules"): diff --git a/pkg/client/informers/externalversions/kubeovn/v1/htbqos.go b/pkg/client/informers/externalversions/kubeovn/v1/htbqos.go deleted file mode 100644 index 3560b8f2aa9..00000000000 --- a/pkg/client/informers/externalversions/kubeovn/v1/htbqos.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes 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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1 - -import ( - "context" - time "time" - - kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - versioned "github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned" - internalinterfaces "github.com/kubeovn/kube-ovn/pkg/client/informers/externalversions/internalinterfaces" - v1 "github.com/kubeovn/kube-ovn/pkg/client/listers/kubeovn/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// HtbQosInformer provides access to a shared informer and lister for -// HtbQoses. -type HtbQosInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1.HtbQosLister -} - -type htbQosInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewHtbQosInformer constructs a new informer for HtbQos type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewHtbQosInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredHtbQosInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredHtbQosInformer constructs a new informer for HtbQos type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredHtbQosInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().HtbQoses().List(context.TODO(), options) - }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.KubeovnV1().HtbQoses().Watch(context.TODO(), options) - }, - }, - &kubeovnv1.HtbQos{}, - resyncPeriod, - indexers, - ) -} - -func (f *htbQosInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredHtbQosInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *htbQosInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&kubeovnv1.HtbQos{}, f.defaultInformer) -} - -func (f *htbQosInformer) Lister() v1.HtbQosLister { - return v1.NewHtbQosLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/kubeovn/v1/interface.go b/pkg/client/informers/externalversions/kubeovn/v1/interface.go index 14af985943c..f4af610ced6 100644 --- a/pkg/client/informers/externalversions/kubeovn/v1/interface.go +++ b/pkg/client/informers/externalversions/kubeovn/v1/interface.go @@ -24,8 +24,6 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { - // HtbQoses returns a HtbQosInformer. - HtbQoses() HtbQosInformer // IPs returns a IPInformer. IPs() IPInformer // IptablesDnatRules returns a IptablesDnatRuleInformer. @@ -73,11 +71,6 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// HtbQoses returns a HtbQosInformer. -func (v *version) HtbQoses() HtbQosInformer { - return &htbQosInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - // IPs returns a IPInformer. func (v *version) IPs() IPInformer { return &iPInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} diff --git a/pkg/client/listers/kubeovn/v1/expansion_generated.go b/pkg/client/listers/kubeovn/v1/expansion_generated.go index 2926ee5143d..f60b7615dbc 100644 --- a/pkg/client/listers/kubeovn/v1/expansion_generated.go +++ b/pkg/client/listers/kubeovn/v1/expansion_generated.go @@ -18,10 +18,6 @@ limitations under the License. package v1 -// HtbQosListerExpansion allows custom methods to be added to -// HtbQosLister. -type HtbQosListerExpansion interface{} - // IPListerExpansion allows custom methods to be added to // IPLister. type IPListerExpansion interface{} diff --git a/pkg/client/listers/kubeovn/v1/htbqos.go b/pkg/client/listers/kubeovn/v1/htbqos.go deleted file mode 100644 index 62e9dc2958b..00000000000 --- a/pkg/client/listers/kubeovn/v1/htbqos.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright The Kubernetes 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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// HtbQosLister helps list HtbQoses. -// All objects returned here must be treated as read-only. -type HtbQosLister interface { - // List lists all HtbQoses in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1.HtbQos, err error) - // Get retrieves the HtbQos from the index for a given name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1.HtbQos, error) - HtbQosListerExpansion -} - -// htbQosLister implements the HtbQosLister interface. -type htbQosLister struct { - indexer cache.Indexer -} - -// NewHtbQosLister returns a new HtbQosLister. -func NewHtbQosLister(indexer cache.Indexer) HtbQosLister { - return &htbQosLister{indexer: indexer} -} - -// List lists all HtbQoses in the indexer. -func (s *htbQosLister) List(selector labels.Selector) (ret []*v1.HtbQos, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.HtbQos)) - }) - return ret, err -} - -// Get retrieves the HtbQos from the index for a given name. -func (s *htbQosLister) Get(name string) (*v1.HtbQos, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("htbqos"), name) - } - return obj.(*v1.HtbQos), nil -} diff --git a/pkg/controller/init.go b/pkg/controller/init.go index 16231740408..b4a3af0c5f8 100644 --- a/pkg/controller/init.go +++ b/pkg/controller/init.go @@ -53,11 +53,6 @@ func (c *Controller) InitOVN() error { return err } - if err := c.initHtbQos(); err != nil { - klog.Errorf("init default qos failed: %v", err) - return err - } - return nil } @@ -807,50 +802,6 @@ func (c *Controller) initAppendLspExternalIds(portName string, pod *v1.Pod) erro return nil } -// InitHtbQos init high/medium/low qos crd -func (c *Controller) initHtbQos() error { - var err error - qosNames := []string{util.HtbQosHigh, util.HtbQosMedium, util.HtbQosLow} - var priority string - - for _, qosName := range qosNames { - _, err = c.config.KubeOvnClient.KubeovnV1().HtbQoses().Get(context.Background(), qosName, metav1.GetOptions{}) - if err == nil { - continue - } - - if !k8serrors.IsNotFound(err) { - klog.Errorf("failed to get default htb qos %s: %v", qosName, err) - continue - } - - switch qosName { - case util.HtbQosHigh: - priority = "1" - case util.HtbQosMedium: - priority = "3" - case util.HtbQosLow: - priority = "5" - default: - klog.Errorf("qos %s is not default defined", qosName) - } - - htbQos := kubeovnv1.HtbQos{ - TypeMeta: metav1.TypeMeta{Kind: "HTBQOS"}, - ObjectMeta: metav1.ObjectMeta{Name: qosName}, - Spec: kubeovnv1.HtbQosSpec{ - Priority: priority, - }, - } - - if _, err = c.config.KubeOvnClient.KubeovnV1().HtbQoses().Create(context.Background(), &htbQos, metav1.CreateOptions{}); err != nil { - klog.Errorf("create htb qos %s failed: %v", qosName, err) - continue - } - } - return err -} - func (c *Controller) initNodeChassis() error { nodes, err := c.nodesLister.List(labels.Everything()) if err != nil { diff --git a/pkg/daemon/controller.go b/pkg/daemon/controller.go index a9d4250aefb..5b12705b7c3 100644 --- a/pkg/daemon/controller.go +++ b/pkg/daemon/controller.go @@ -11,7 +11,6 @@ import ( v1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/types" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" @@ -51,9 +50,6 @@ type Controller struct { nodesLister listerv1.NodeLister nodesSynced cache.InformerSynced - htbQosLister kubeovnlister.HtbQosLister - htbQosSynced cache.InformerSynced - recorder record.EventRecorder protocol string @@ -74,7 +70,6 @@ func NewController(config *Configuration, podInformerFactory informers.SharedInf subnetInformer := kubeovnInformerFactory.Kubeovn().V1().Subnets() podInformer := podInformerFactory.Core().V1().Pods() nodeInformer := nodeInformerFactory.Core().V1().Nodes() - htbQosInformer := kubeovnInformerFactory.Kubeovn().V1().HtbQoses() controller := &Controller{ config: config, @@ -95,9 +90,6 @@ func NewController(config *Configuration, podInformerFactory informers.SharedInf nodesLister: nodeInformer.Lister(), nodesSynced: nodeInformer.Informer().HasSynced, - htbQosLister: htbQosInformer.Lister(), - htbQosSynced: htbQosInformer.Informer().HasSynced, - recorder: recorder, } @@ -465,7 +457,6 @@ func (c *Controller) enqueuePod(old, new interface{}) { if oldPod.Annotations[util.IngressRateAnnotation] != newPod.Annotations[util.IngressRateAnnotation] || oldPod.Annotations[util.EgressRateAnnotation] != newPod.Annotations[util.EgressRateAnnotation] || - oldPod.Annotations[util.PriorityAnnotation] != newPod.Annotations[util.PriorityAnnotation] || oldPod.Annotations[util.NetemQosLatencyAnnotation] != newPod.Annotations[util.NetemQosLatencyAnnotation] || oldPod.Annotations[util.NetemQosLimitAnnotation] != newPod.Annotations[util.NetemQosLimitAnnotation] || oldPod.Annotations[util.NetemQosLossAnnotation] != newPod.Annotations[util.NetemQosLossAnnotation] || @@ -488,7 +479,6 @@ func (c *Controller) enqueuePod(old, new interface{}) { if newPod.Annotations[fmt.Sprintf(util.AllocatedAnnotationTemplate, provider)] == "true" { if oldPod.Annotations[fmt.Sprintf(util.IngressRateAnnotationTemplate, provider)] != newPod.Annotations[fmt.Sprintf(util.IngressRateAnnotationTemplate, provider)] || oldPod.Annotations[fmt.Sprintf(util.EgressRateAnnotationTemplate, provider)] != newPod.Annotations[fmt.Sprintf(util.EgressRateAnnotationTemplate, provider)] || - oldPod.Annotations[fmt.Sprintf(util.PriorityAnnotationTemplate, provider)] != newPod.Annotations[fmt.Sprintf(util.PriorityAnnotationTemplate, provider)] || oldPod.Annotations[fmt.Sprintf(util.NetemQosLatencyAnnotationTemplate, provider)] != newPod.Annotations[fmt.Sprintf(util.NetemQosLatencyAnnotationTemplate, provider)] || oldPod.Annotations[fmt.Sprintf(util.NetemQosLimitAnnotationTemplate, provider)] != newPod.Annotations[fmt.Sprintf(util.NetemQosLimitAnnotationTemplate, provider)] || oldPod.Annotations[fmt.Sprintf(util.NetemQosLossAnnotationTemplate, provider)] != newPod.Annotations[fmt.Sprintf(util.NetemQosLossAnnotationTemplate, provider)] || @@ -568,78 +558,6 @@ func (c *Controller) markAndCleanInternalPort() error { return nil } -func (c *Controller) deleteSubnetQos(subnet *kubeovnv1.Subnet) error { - pods, err := c.podsLister.List(labels.Everything()) - if err != nil { - klog.Errorf("failed to list pods, %v", err) - return err - } - - for _, pod := range pods { - if pod.Spec.HostNetwork || - pod.DeletionTimestamp != nil { - continue - } - podName := pod.Name - - if pod.Annotations[util.LogicalSwitchAnnotation] == subnet.Name { - // if pod's annotation for ingress-rate or priority exists, should keep qos for pod - if pod.Annotations[util.IngressRateAnnotation] != "" || - pod.Annotations[util.PriorityAnnotation] != "" { - continue - } - if pod.Annotations[fmt.Sprintf(util.VmTemplate, util.OvnProvider)] != "" { - podName = pod.Annotations[fmt.Sprintf(util.VmTemplate, util.OvnProvider)] - } - ifaceID := ovs.PodNameToPortName(podName, pod.Namespace, util.OvnProvider) - if err := c.clearQos(podName, pod.Namespace, ifaceID); err != nil { - return err - } - } - - // clear priority for attach interface provided by kube-ovn in pod - attachNets, err := util.ParsePodNetworkAnnotation(pod.Annotations[util.AttachmentNetworkAnnotation], pod.Namespace) - if err != nil { - return err - } - for _, multiNet := range attachNets { - provider := fmt.Sprintf("%s.%s.ovn", multiNet.Name, multiNet.Namespace) - if subnet.Spec.Provider != provider || - pod.Annotations[fmt.Sprintf(util.IngressRateAnnotationTemplate, provider)] != "" || - pod.Annotations[fmt.Sprintf(util.PriorityAnnotationTemplate, provider)] != "" { - continue - } - if pod.Annotations[fmt.Sprintf(util.VmTemplate, provider)] != "" { - podName = pod.Annotations[fmt.Sprintf(util.VmTemplate, provider)] - } - - if pod.Annotations[fmt.Sprintf(util.AllocatedAnnotationTemplate, provider)] == "true" { - ifaceID := ovs.PodNameToPortName(podName, pod.Namespace, provider) - if err := c.clearQos(podName, pod.Namespace, ifaceID); err != nil { - return err - } - } - } - } - return nil -} - -func (c *Controller) getSubnetQosPriority(subnetName string) string { - var priority string - subnet, err := c.subnetsLister.Get(subnetName) - if err != nil { - klog.Errorf("failed to get subnet %s: %v", subnet, err) - } else if subnet.Spec.HtbQos != "" { - htbQos, err := c.htbQosLister.Get(subnet.Spec.HtbQos) - if err != nil { - klog.Errorf("failed to get htbqos %s: %v", subnet.Spec.HtbQos, err) - } else { - priority = htbQos.Spec.Priority - } - } - return priority -} - // Run starts controller func (c *Controller) Run(stopCh <-chan struct{}) { defer utilruntime.HandleCrash() @@ -653,7 +571,7 @@ func (c *Controller) Run(stopCh <-chan struct{}) { go wait.Until(rotateLog, 1*time.Hour, stopCh) go wait.Until(c.operateMod, 10*time.Second, stopCh) - if ok := cache.WaitForCacheSync(stopCh, c.providerNetworksSynced, c.subnetsSynced, c.podsSynced, c.nodesSynced, c.htbQosSynced); !ok { + if ok := cache.WaitForCacheSync(stopCh, c.providerNetworksSynced, c.subnetsSynced, c.podsSynced, c.nodesSynced); !ok { util.LogFatalAndExit(nil, "failed to wait for caches to sync") } diff --git a/pkg/daemon/controller_linux.go b/pkg/daemon/controller_linux.go index eb4cc0bbf94..589119bb86a 100644 --- a/pkg/daemon/controller_linux.go +++ b/pkg/daemon/controller_linux.go @@ -183,17 +183,6 @@ func (c *Controller) reconcileRouters(event subnetEvent) error { } } - if oldSubnet != nil && newSubnet != nil && oldSubnet.Spec.HtbQos != "" && newSubnet.Spec.HtbQos == "" { - if err := c.deleteSubnetQos(newSubnet); err != nil { - klog.Errorf("failed to delete htb qos for subnet %s: %v", newSubnet.Name, err) - return err - } - } else if newSubnet != nil && newSubnet.Spec.HtbQos != "" { - if err := c.setSubnetQosPriority(newSubnet); err != nil { - klog.Errorf("failed to set htb qos priority for subnet %s: %v", newSubnet.Name, err) - return err - } - } return nil } @@ -449,16 +438,9 @@ func (c *Controller) handlePod(key string) error { podName = pod.Annotations[fmt.Sprintf(util.VmTemplate, util.OvnProvider)] } - priority := pod.Annotations[util.PriorityAnnotation] - subnetName := pod.Annotations[util.LogicalSwitchAnnotation] - subnetPriority := c.getSubnetQosPriority(subnetName) - if priority == "" && subnetPriority != "" { - priority = subnetPriority - } - // set default nic bandwidth ifaceID := ovs.PodNameToPortName(podName, pod.Namespace, util.OvnProvider) - err = ovs.SetInterfaceBandwidth(podName, pod.Namespace, ifaceID, pod.Annotations[util.EgressRateAnnotation], pod.Annotations[util.IngressRateAnnotation], priority) + err = ovs.SetInterfaceBandwidth(podName, pod.Namespace, ifaceID, pod.Annotations[util.EgressRateAnnotation], pod.Annotations[util.IngressRateAnnotation]) if err != nil { return err } @@ -484,14 +466,8 @@ func (c *Controller) handlePod(key string) error { } if pod.Annotations[fmt.Sprintf(util.AllocatedAnnotationTemplate, provider)] == "true" { ifaceID = ovs.PodNameToPortName(podName, pod.Namespace, provider) - priority := pod.Annotations[fmt.Sprintf(util.PriorityAnnotationTemplate, provider)] - subnetName := pod.Annotations[fmt.Sprintf(util.LogicalSwitchAnnotationTemplate, provider)] - subnetPriority := c.getSubnetQosPriority(subnetName) - if priority == "" && subnetPriority != "" { - priority = subnetPriority - } - err = ovs.SetInterfaceBandwidth(podName, pod.Namespace, ifaceID, pod.Annotations[fmt.Sprintf(util.EgressRateAnnotationTemplate, provider)], pod.Annotations[fmt.Sprintf(util.IngressRateAnnotationTemplate, provider)], priority) + err = ovs.SetInterfaceBandwidth(podName, pod.Namespace, ifaceID, pod.Annotations[fmt.Sprintf(util.EgressRateAnnotationTemplate, provider)], pod.Annotations[fmt.Sprintf(util.IngressRateAnnotationTemplate, provider)]) if err != nil { return err } @@ -555,104 +531,6 @@ func (c *Controller) loopEncapIpCheck() { } } -func (c *Controller) setSubnetQosPriority(subnet *kubeovnv1.Subnet) error { - htbQos, err := c.htbQosLister.Get(subnet.Spec.HtbQos) - if err != nil { - klog.Errorf("failed to get htbqos %s: %v", subnet.Spec.HtbQos, err) - return err - } - - pods, err := c.podsLister.List(labels.Everything()) - if err != nil { - klog.Errorf("failed to list pods, %v", err) - return err - } - - qosIfaceUidMap, err := ovs.ListExternalIds("qos") - if err != nil { - return err - } - queueIfaceUidMap, err := ovs.ListExternalIds("queue") - if err != nil { - return err - } - - for _, pod := range pods { - if pod.Spec.HostNetwork || - pod.DeletionTimestamp != nil || - pod.Status.PodIP == "" { - continue - } - podName := pod.Name - if pod.Annotations[fmt.Sprintf(util.VmTemplate, util.OvnProvider)] != "" { - podName = pod.Annotations[fmt.Sprintf(util.VmTemplate, util.OvnProvider)] - } - - // set priority for eth0 interface in pod - if pod.Annotations[util.LogicalSwitchAnnotation] == subnet.Name { - ifaceID := ovs.PodNameToPortName(podName, pod.Namespace, util.OvnProvider) - priority := htbQos.Spec.Priority - if pod.Annotations[util.PriorityAnnotation] != "" { - priority = pod.Annotations[util.PriorityAnnotation] - } - if err = ovs.SetPodQosPriority(podName, pod.Namespace, ifaceID, priority, qosIfaceUidMap, queueIfaceUidMap); err != nil { - klog.Errorf("failed to set htbqos priority for pod %s/%s, iface %v: %v", pod.Namespace, pod.Name, ifaceID, err) - return err - } - } - - // set priority for attach interface provided by kube-ovn in pod - attachNets, err := util.ParsePodNetworkAnnotation(pod.Annotations[util.AttachmentNetworkAnnotation], pod.Namespace) - if err != nil { - return err - } - for _, multiNet := range attachNets { - provider := fmt.Sprintf("%s.%s.ovn", multiNet.Name, multiNet.Namespace) - if subnet.Spec.Provider != provider { - continue - } - if pod.Annotations[fmt.Sprintf(util.VmTemplate, provider)] != "" { - podName = pod.Annotations[fmt.Sprintf(util.VmTemplate, provider)] - } - - if pod.Annotations[fmt.Sprintf(util.AllocatedAnnotationTemplate, provider)] == "true" { - ifaceID := ovs.PodNameToPortName(podName, pod.Namespace, provider) - priority := htbQos.Spec.Priority - if pod.Annotations[fmt.Sprintf(util.PriorityAnnotationTemplate, provider)] != "" { - priority = pod.Annotations[fmt.Sprintf(util.PriorityAnnotationTemplate, provider)] - } - - if err = ovs.SetPodQosPriority(podName, pod.Namespace, ifaceID, priority, qosIfaceUidMap, queueIfaceUidMap); err != nil { - klog.Errorf("failed to set htbqos priority for pod %s/%s, iface %v: %v", pod.Namespace, pod.Name, ifaceID, err) - return err - } - } - } - } - return nil -} - -func (c *Controller) clearQos(podName, podNamespace, ifaceID string) error { - if htbQos, _ := ovs.IsHtbQos(ifaceID); !htbQos { - return nil - } - - if err := ovs.ClearPortQosBinding(ifaceID); err != nil { - klog.Errorf("failed to delete qos binding info for interface %s: %v", ifaceID, err) - return err - } - - if err := ovs.ClearPodBandwidth(podName, podNamespace, ifaceID); err != nil { - klog.Errorf("failed to delete htbqos record for pod %s/%s, iface %v: %v", podNamespace, podName, ifaceID, err) - return err - } - - if err := ovs.ClearHtbQosQueue(podName, podNamespace, ifaceID); err != nil { - klog.Errorf("failed to delete htbqos queue for pod %s/%s, iface %v: %v", podNamespace, podName, ifaceID, err) - return err - } - return nil -} func (c *Controller) operateMod() { modules, ok := os.LookupEnv(util.KoENV) if !ok || modules == "" { diff --git a/pkg/daemon/controller_windows.go b/pkg/daemon/controller_windows.go index bb8fd84f739..5de5215c513 100644 --- a/pkg/daemon/controller_windows.go +++ b/pkg/daemon/controller_windows.go @@ -186,7 +186,7 @@ func (c *Controller) handlePod(key string) error { // set default nic bandwidth ifaceID := ovs.PodNameToPortName(podName, pod.Namespace, util.OvnProvider) - err = ovs.SetInterfaceBandwidth(podName, pod.Namespace, ifaceID, pod.Annotations[util.EgressRateAnnotation], pod.Annotations[util.IngressRateAnnotation], pod.Annotations[util.PriorityAnnotation]) + err = ovs.SetInterfaceBandwidth(podName, pod.Namespace, ifaceID, pod.Annotations[util.EgressRateAnnotation], pod.Annotations[util.IngressRateAnnotation]) if err != nil { return err } @@ -207,7 +207,7 @@ func (c *Controller) handlePod(key string) error { } if pod.Annotations[fmt.Sprintf(util.AllocatedAnnotationTemplate, provider)] == "true" { ifaceID = ovs.PodNameToPortName(podName, pod.Namespace, provider) - err = ovs.SetInterfaceBandwidth(podName, pod.Namespace, ifaceID, pod.Annotations[fmt.Sprintf(util.EgressRateAnnotationTemplate, provider)], pod.Annotations[fmt.Sprintf(util.IngressRateAnnotationTemplate, provider)], pod.Annotations[fmt.Sprintf(util.PriorityAnnotationTemplate, provider)]) + err = ovs.SetInterfaceBandwidth(podName, pod.Namespace, ifaceID, pod.Annotations[fmt.Sprintf(util.EgressRateAnnotationTemplate, provider)], pod.Annotations[fmt.Sprintf(util.IngressRateAnnotationTemplate, provider)]) if err != nil { return err } @@ -228,11 +228,6 @@ func (c *Controller) loopEncapIpCheck() { // TODO } -func (c *Controller) clearQos(podName, podNamespace, ifaceID string) error { - // TODO - return nil -} - func rotateLog() { // TODO } diff --git a/pkg/daemon/gateway.go b/pkg/daemon/gateway.go index c5d14a19d93..b63def16944 100644 --- a/pkg/daemon/gateway.go +++ b/pkg/daemon/gateway.go @@ -45,14 +45,14 @@ func (c *Controller) setGatewayBandwidth() error { klog.Errorf("failed to get node, %v", err) return err } - ingress, egress, priority := node.Annotations[util.IngressRateAnnotation], node.Annotations[util.EgressRateAnnotation], node.Annotations[util.PriorityAnnotation] + ingress, egress := node.Annotations[util.IngressRateAnnotation], node.Annotations[util.EgressRateAnnotation] ifaceId := fmt.Sprintf("node-%s", c.config.NodeName) - if ingress == "" && egress == "" && priority == "" { + if ingress == "" && egress == "" { if htbQos, _ := ovs.IsHtbQos(ifaceId); !htbQos { return nil } } - return ovs.SetInterfaceBandwidth("", "", ifaceId, egress, ingress, priority) + return ovs.SetInterfaceBandwidth("", "", ifaceId, egress, ingress) } func (c *Controller) setICGateway() error { diff --git a/pkg/daemon/handler.go b/pkg/daemon/handler.go index 0e3d90a051e..46f2ac50e04 100644 --- a/pkg/daemon/handler.go +++ b/pkg/daemon/handler.go @@ -83,7 +83,7 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon } var gatewayCheckMode int - var macAddr, ip, ipAddr, cidr, gw, subnet, ingress, egress, providerNetwork, ifName, nicType, podNicName, priority, vmName, latency, limit, loss, u2oInterconnectionIP string + var macAddr, ip, ipAddr, cidr, gw, subnet, ingress, egress, providerNetwork, ifName, nicType, podNicName, vmName, latency, limit, loss, u2oInterconnectionIP string var isDefaultRoute bool var pod *v1.Pod var err error @@ -118,7 +118,6 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon subnet = pod.Annotations[fmt.Sprintf(util.LogicalSwitchAnnotationTemplate, podRequest.Provider)] ingress = pod.Annotations[fmt.Sprintf(util.IngressRateAnnotationTemplate, podRequest.Provider)] egress = pod.Annotations[fmt.Sprintf(util.EgressRateAnnotationTemplate, podRequest.Provider)] - priority = pod.Annotations[fmt.Sprintf(util.PriorityAnnotationTemplate, podRequest.Provider)] latency = pod.Annotations[fmt.Sprintf(util.NetemQosLatencyAnnotationTemplate, podRequest.Provider)] limit = pod.Annotations[fmt.Sprintf(util.NetemQosLimitAnnotationTemplate, podRequest.Provider)] loss = pod.Annotations[fmt.Sprintf(util.NetemQosLossAnnotationTemplate, podRequest.Provider)] @@ -208,11 +207,6 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon return } - subnetPriority := csh.Controller.getSubnetQosPriority(subnet) - if priority == "" && subnetPriority != "" { - priority = subnetPriority - } - if podSubnet.Status.U2OInterconnectionIP != "" && podSubnet.Spec.U2OInterconnection { u2oInterconnectionIP = podSubnet.Status.U2OInterconnectionIP } @@ -257,12 +251,12 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon klog.Infof("create container interface %s mac %s, ip %s, cidr %s, gw %s, custom routes %v", ifName, macAddr, ipAddr, cidr, gw, podRequest.Routes) detectIPConflict := podSubnet.Spec.Vlan != "" if nicType == util.InternalType { - podNicName, err = csh.configureNicWithInternalPort(podRequest.PodName, podRequest.PodNamespace, podRequest.Provider, podRequest.NetNs, podRequest.ContainerID, ifName, macAddr, mtu, ipAddr, gw, isDefaultRoute, detectIPConflict, podRequest.Routes, podRequest.DNS.Nameservers, podRequest.DNS.Search, ingress, egress, priority, podRequest.DeviceID, nicType, latency, limit, loss, gatewayCheckMode, u2oInterconnectionIP) + podNicName, err = csh.configureNicWithInternalPort(podRequest.PodName, podRequest.PodNamespace, podRequest.Provider, podRequest.NetNs, podRequest.ContainerID, ifName, macAddr, mtu, ipAddr, gw, isDefaultRoute, detectIPConflict, podRequest.Routes, podRequest.DNS.Nameservers, podRequest.DNS.Search, ingress, egress, podRequest.DeviceID, nicType, latency, limit, loss, gatewayCheckMode, u2oInterconnectionIP) } else if nicType == util.DpdkType { - err = csh.configureDpdkNic(podRequest.PodName, podRequest.PodNamespace, podRequest.Provider, podRequest.NetNs, podRequest.ContainerID, ifName, macAddr, mtu, ipAddr, gw, ingress, egress, priority, getShortSharedDir(pod.UID, podRequest.VhostUserSocketVolumeName), podRequest.VhostUserSocketName) + err = csh.configureDpdkNic(podRequest.PodName, podRequest.PodNamespace, podRequest.Provider, podRequest.NetNs, podRequest.ContainerID, ifName, macAddr, mtu, ipAddr, gw, ingress, egress, getShortSharedDir(pod.UID, podRequest.VhostUserSocketVolumeName), podRequest.VhostUserSocketName) } else { podNicName = ifName - err = csh.configureNic(podRequest.PodName, podRequest.PodNamespace, podRequest.Provider, podRequest.NetNs, podRequest.ContainerID, podRequest.VfDriver, ifName, macAddr, mtu, ipAddr, gw, isDefaultRoute, detectIPConflict, podRequest.Routes, podRequest.DNS.Nameservers, podRequest.DNS.Search, ingress, egress, priority, podRequest.DeviceID, nicType, latency, limit, loss, gatewayCheckMode, u2oInterconnectionIP) + err = csh.configureNic(podRequest.PodName, podRequest.PodNamespace, podRequest.Provider, podRequest.NetNs, podRequest.ContainerID, podRequest.VfDriver, ifName, macAddr, mtu, ipAddr, gw, isDefaultRoute, detectIPConflict, podRequest.Routes, podRequest.DNS.Nameservers, podRequest.DNS.Search, ingress, egress, podRequest.DeviceID, nicType, latency, limit, loss, gatewayCheckMode, u2oInterconnectionIP) } if err != nil { errMsg := fmt.Errorf("configure nic failed %v", err) diff --git a/pkg/daemon/ovs_linux.go b/pkg/daemon/ovs_linux.go index da941209fce..89d7d5a80ed 100644 --- a/pkg/daemon/ovs_linux.go +++ b/pkg/daemon/ovs_linux.go @@ -30,7 +30,7 @@ import ( var pciAddrRegexp = regexp.MustCompile(`\b([0-9a-fA-F]{4}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}.\d{1}\S*)`) -func (csh cniServerHandler) configureDpdkNic(podName, podNamespace, provider, netns, containerID, ifName, mac string, mtu int, ip, gateway, ingress, egress, priority, shortSharedDir, socketName string) error { +func (csh cniServerHandler) configureDpdkNic(podName, podNamespace, provider, netns, containerID, ifName, mac string, mtu int, ip, gateway, ingress, egress, shortSharedDir, socketName string) error { sharedDir := filepath.Join("/var", shortSharedDir) hostNicName, _ := generateNicName(containerID, ifName) @@ -50,13 +50,13 @@ func (csh cniServerHandler) configureDpdkNic(podName, podNamespace, provider, ne if err != nil { return fmt.Errorf("add nic to ovs failed %v: %q", err, output) } - if err = ovs.SetInterfaceBandwidth(podName, podNamespace, ifaceID, egress, ingress, priority); err != nil { + if err = ovs.SetInterfaceBandwidth(podName, podNamespace, ifaceID, egress, ingress); err != nil { return err } return nil } -func (csh cniServerHandler) configureNic(podName, podNamespace, provider, netns, containerID, vfDriver, ifName, mac string, mtu int, ip, gateway string, isDefaultRoute, detectIPConflict bool, routes []request.Route, dnsServer, dnsSuffix []string, ingress, egress, priority, DeviceID, nicType, latency, limit, loss string, gwCheckMode int, u2oInterconnectionIP string) error { +func (csh cniServerHandler) configureNic(podName, podNamespace, provider, netns, containerID, vfDriver, ifName, mac string, mtu int, ip, gateway string, isDefaultRoute, detectIPConflict bool, routes []request.Route, dnsServer, dnsSuffix []string, ingress, egress, DeviceID, nicType, latency, limit, loss string, gwCheckMode int, u2oInterconnectionIP string) error { var err error var hostNicName, containerNicName string if DeviceID == "" { @@ -95,7 +95,7 @@ func (csh cniServerHandler) configureNic(podName, podNamespace, provider, netns, if err = configureHostNic(hostNicName); err != nil { return err } - if err = ovs.SetInterfaceBandwidth(podName, podNamespace, ifaceID, egress, ingress, priority); err != nil { + if err = ovs.SetInterfaceBandwidth(podName, podNamespace, ifaceID, egress, ingress); err != nil { return err } @@ -875,7 +875,7 @@ func renameLink(curName, newName string) error { return nil } -func (csh cniServerHandler) configureNicWithInternalPort(podName, podNamespace, provider, netns, containerID, ifName, mac string, mtu int, ip, gateway string, isDefaultRoute, detectIPConflict bool, routes []request.Route, dnsServer, dnsSuffix []string, ingress, egress, priority, DeviceID, nicType, latency, limit, loss string, gwCheckMode int, u2oInterconnectionIP string) (string, error) { +func (csh cniServerHandler) configureNicWithInternalPort(podName, podNamespace, provider, netns, containerID, ifName, mac string, mtu int, ip, gateway string, isDefaultRoute, detectIPConflict bool, routes []request.Route, dnsServer, dnsSuffix []string, ingress, egress, DeviceID, nicType, latency, limit, loss string, gwCheckMode int, u2oInterconnectionIP string) (string, error) { _, containerNicName := generateNicName(containerID, ifName) ipStr := util.GetIpWithoutMask(ip) ifaceID := ovs.PodNameToPortName(podName, podNamespace, provider) @@ -899,7 +899,7 @@ func (csh cniServerHandler) configureNicWithInternalPort(podName, podNamespace, return containerNicName, fmt.Errorf("failed to parse mac %s %v", macAddr, err) } - if err = ovs.SetInterfaceBandwidth(podName, podNamespace, ifaceID, egress, ingress, priority); err != nil { + if err = ovs.SetInterfaceBandwidth(podName, podNamespace, ifaceID, egress, ingress); err != nil { return containerNicName, err } diff --git a/pkg/daemon/ovs_windows.go b/pkg/daemon/ovs_windows.go index 4a00a1e7495..2c356bc4384 100644 --- a/pkg/daemon/ovs_windows.go +++ b/pkg/daemon/ovs_windows.go @@ -18,15 +18,15 @@ import ( "github.com/kubeovn/kube-ovn/pkg/util" ) -func (csh cniServerHandler) configureDpdkNic(podName, podNamespace, provider, netns, containerID, ifName, mac string, mtu int, ip, gateway, ingress, egress, priority, sharedDir, socketName string) error { +func (csh cniServerHandler) configureDpdkNic(podName, podNamespace, provider, netns, containerID, ifName, mac string, mtu int, ip, gateway, ingress, egress, sharedDir, socketName string) error { return errors.New("DPDK is not supported on Windows") } -func (csh cniServerHandler) configureNicWithInternalPort(podName, podNamespace, provider, netns, containerID, ifName, mac string, mtu int, ip, gateway string, isDefaultRoute, detectIPConflict bool, routes []request.Route, dnsServer, dnsSuffix []string, ingress, egress, priority, DeviceID, nicType, latency, limit, loss string, gwCheckMode int, u2oInterconnectionIP string) (string, error) { - return ifName, csh.configureNic(podName, podNamespace, provider, netns, containerID, "", ifName, mac, mtu, ip, gateway, isDefaultRoute, detectIPConflict, routes, dnsServer, dnsSuffix, ingress, egress, priority, DeviceID, nicType, latency, limit, loss, gwCheckMode, u2oInterconnectionIP) +func (csh cniServerHandler) configureNicWithInternalPort(podName, podNamespace, provider, netns, containerID, ifName, mac string, mtu int, ip, gateway string, isDefaultRoute, detectIPConflict bool, routes []request.Route, dnsServer, dnsSuffix []string, ingress, egress, DeviceID, nicType, latency, limit, loss string, gwCheckMode int, u2oInterconnectionIP string) (string, error) { + return ifName, csh.configureNic(podName, podNamespace, provider, netns, containerID, "", ifName, mac, mtu, ip, gateway, isDefaultRoute, detectIPConflict, routes, dnsServer, dnsSuffix, ingress, egress, DeviceID, nicType, latency, limit, loss, gwCheckMode, u2oInterconnectionIP) } -func (csh cniServerHandler) configureNic(podName, podNamespace, provider, netns, containerID, vfDriver, ifName, mac string, mtu int, ip, gateway string, isDefaultRoute, detectIPConflict bool, routes []request.Route, dnsServer, dnsSuffix []string, ingress, egress, priority, DeviceID, nicType, latency, limit, loss string, gwCheckMode int, u2oInterconnectionIP string) error { +func (csh cniServerHandler) configureNic(podName, podNamespace, provider, netns, containerID, vfDriver, ifName, mac string, mtu int, ip, gateway string, isDefaultRoute, detectIPConflict bool, routes []request.Route, dnsServer, dnsSuffix []string, ingress, egress, DeviceID, nicType, latency, limit, loss string, gwCheckMode int, u2oInterconnectionIP string) error { if DeviceID != "" { return errors.New("SR-IOV is not supported on Windows") } @@ -124,7 +124,7 @@ func (csh cniServerHandler) configureNic(podName, podNamespace, provider, netns, return fmt.Errorf("failed to add OVS port %s, %v: %q", epName, err, output) } - if err = ovs.SetInterfaceBandwidth(podName, podNamespace, ifaceID, egress, ingress, priority); err != nil { + if err = ovs.SetInterfaceBandwidth(podName, podNamespace, ifaceID, egress, ingress); err != nil { return err } diff --git a/pkg/ovs/ovs-vsctl_linux.go b/pkg/ovs/ovs-vsctl_linux.go index 7c727c80737..f4e2f1803b0 100644 --- a/pkg/ovs/ovs-vsctl_linux.go +++ b/pkg/ovs/ovs-vsctl_linux.go @@ -12,7 +12,7 @@ import ( // SetInterfaceBandwidth set ingress/egress qos for given pod, annotation values are for node/pod // but ingress/egress parameters here are from the point of ovs port/interface view, so reverse input parameters when call func SetInterfaceBandwidth -func SetInterfaceBandwidth(podName, podNamespace, iface, ingress, egress, podPriority string) error { +func SetInterfaceBandwidth(podName, podNamespace, iface, ingress, egress string) error { ingressMPS, _ := strconv.Atoi(ingress) ingressKPS := ingressMPS * 1000 interfaceList, err := ovsFind("interface", "name", fmt.Sprintf("external-ids:iface-id=%s", iface)) @@ -41,7 +41,7 @@ func SetInterfaceBandwidth(podName, podNamespace, iface, ingress, egress, podPri egressBPS := egressMPS * 1000 * 1000 if egressBPS > 0 { - queueUid, err := SetHtbQosQueueRecord(podName, podNamespace, iface, podPriority, egressBPS, queueIfaceUidMap) + queueUid, err := SetHtbQosQueueRecord(podName, podNamespace, iface, egressBPS, queueIfaceUidMap) if err != nil { return err } @@ -69,10 +69,6 @@ func SetInterfaceBandwidth(podName, podNamespace, iface, ingress, egress, podPri } } - if err = SetHtbQosPriority(podName, podNamespace, iface, ifName, podPriority, qosIfaceUidMap, queueIfaceUidMap); err != nil { - return err - } - // Delete Qos and Queue record if both bandwidth and priority do not exist if err = CheckAndUpdateHtbQos(podName, podNamespace, iface, queueIfaceUidMap); err != nil { klog.Errorf("failed to check htb qos: %v", err) @@ -134,15 +130,12 @@ func IsHtbQos(iface string) (bool, error) { return false, nil } -func SetHtbQosQueueRecord(podName, podNamespace, iface, priority string, maxRateBPS int, queueIfaceUidMap map[string]string) (string, error) { +func SetHtbQosQueueRecord(podName, podNamespace, iface string, maxRateBPS int, queueIfaceUidMap map[string]string) (string, error) { var queueCommandValues []string var err error if maxRateBPS > 0 { queueCommandValues = append(queueCommandValues, fmt.Sprintf("other_config:max-rate=%d", maxRateBPS)) } - if priority != "" { - queueCommandValues = append(queueCommandValues, fmt.Sprintf("other_config:priority=%s", priority)) - } if queueUid, ok := queueIfaceUidMap[iface]; ok { if err := ovsSet("queue", queueUid, queueCommandValues...); err != nil { @@ -164,58 +157,6 @@ func SetHtbQosQueueRecord(podName, podNamespace, iface, priority string, maxRate return queueIfaceUidMap[iface], nil } -// SetPodQosPriority set qos to this pod port. -func SetPodQosPriority(podName, podNamespace, ifaceID, priority string, qosIfaceUidMap, queueIfaceUidMap map[string]string) error { - interfaceList, err := ovsFind("interface", "name", fmt.Sprintf("external-ids:iface-id=%s", ifaceID)) - if err != nil { - return err - } - - for _, ifName := range interfaceList { - if err = SetHtbQosPriority(podName, podNamespace, ifaceID, ifName, priority, qosIfaceUidMap, queueIfaceUidMap); err != nil { - return err - } - } - return nil -} - -func SetHtbQosPriority(podName, podNamespace, iface, ifName, priority string, qosIfaceUidMap, queueIfaceUidMap map[string]string) error { - if priority != "" { - queueUid, err := SetHtbQosQueueRecord(podName, podNamespace, iface, priority, 0, queueIfaceUidMap) - if err != nil { - return err - } - - if err = SetQosQueueBinding(podName, podNamespace, ifName, iface, queueUid, qosIfaceUidMap); err != nil { - return err - } - } else { - var qosUid string - var ok bool - if qosUid, ok = qosIfaceUidMap[iface]; !ok { - return nil - } - - qosType, err := ovsGet("qos", qosUid, "type", "") - if err != nil { - return err - } - if qosType != util.HtbQos { - return nil - } - queueId, err := ovsGet("qos", qosUid, "queues", "0") - if err != nil { - return err - } - - if _, err := Exec("remove", "queue", queueId, "other_config", "priority"); err != nil { - return fmt.Errorf("failed to remove priority for queue in pod %v/%v, %v", podNamespace, podName, err) - } - } - - return nil -} - // SetQosQueueBinding set qos related to queue record. func SetQosQueueBinding(podName, podNamespace, ifName, iface, queueUid string, qosIfaceUidMap map[string]string) error { var qosCommandValues []string @@ -432,7 +373,6 @@ func CheckAndUpdateHtbQos(podName, podNamespace, ifaceID string, queueIfaceUidMa return nil } - // recall clearQos if htbQos, _ := IsHtbQos(ifaceID); !htbQos { return nil } diff --git a/pkg/ovs/ovs-vsctl_windows.go b/pkg/ovs/ovs-vsctl_windows.go index 38eed405833..ab55864545e 100644 --- a/pkg/ovs/ovs-vsctl_windows.go +++ b/pkg/ovs/ovs-vsctl_windows.go @@ -2,7 +2,7 @@ package ovs // SetInterfaceBandwidth set ingress/egress qos for given pod, annotation values are for node/pod // but ingress/egress parameters here are from the point of ovs port/interface view, so reverse input parameters when call func SetInterfaceBandwidth -func SetInterfaceBandwidth(podName, podNamespace, iface, ingress, egress, podPriority string) error { +func SetInterfaceBandwidth(podName, podNamespace, iface, ingress, egress string) error { // TODO return nil } @@ -22,12 +22,6 @@ func SetHtbQosQueueRecord(podName, podNamespace, iface, priority string, maxRate return "", nil } -// SetPodQosPriority set qos to this pod port. -func SetPodQosPriority(podName, podNamespace, ifaceID, priority string, qosIfaceUidMap, queueIfaceUidMap map[string]string) error { - //TODO - return nil -} - // SetQosQueueBinding set qos related to queue record. func SetQosQueueBinding(podName, podNamespace, ifName, iface, queueUid string, qosIfaceUidMap map[string]string) error { // TODO diff --git a/pkg/util/const.go b/pkg/util/const.go index 8a0bce567dd..2921570b8dc 100644 --- a/pkg/util/const.go +++ b/pkg/util/const.go @@ -176,16 +176,10 @@ const ( DenyAllSecurityGroup = "kubeovn_deny_all" - HtbQosHigh = "htbqos-high" - HtbQosMedium = "htbqos-medium" - HtbQosLow = "htbqos-low" - - PriorityAnnotation = "ovn.kubernetes.io/priority" NetemQosLatencyAnnotation = "ovn.kubernetes.io/latency" NetemQosLimitAnnotation = "ovn.kubernetes.io/limit" NetemQosLossAnnotation = "ovn.kubernetes.io/loss" - PriorityAnnotationTemplate = "%s.kubernetes.io/priority" NetemQosLatencyAnnotationTemplate = "%s.kubernetes.io/latency" NetemQosLimitAnnotationTemplate = "%s.kubernetes.io/limit" NetemQosLossAnnotationTemplate = "%s.kubernetes.io/loss" diff --git a/pkg/util/validator_test.go b/pkg/util/validator_test.go index 1f180546419..fd12a8fdb3e 100644 --- a/pkg/util/validator_test.go +++ b/pkg/util/validator_test.go @@ -56,7 +56,6 @@ func TestValidateSubnet(t *testing.T) { Private: false, AllowSubnets: nil, Vlan: "", - HtbQos: "", Vips: nil, LogicalGateway: false, DisableGatewayCheck: false, diff --git a/test/e2e/kube-ovn/qos/qos.go b/test/e2e/kube-ovn/qos/qos.go index 68a98356f78..47921531ea0 100644 --- a/test/e2e/kube-ovn/qos/qos.go +++ b/test/e2e/kube-ovn/qos/qos.go @@ -163,9 +163,8 @@ var _ = framework.Describe("[group:qos]", func() { name := "pod-" + framework.RandomSuffix() ginkgo.By("Creating pod " + name) - priority, ingressRate := 50, 300 + ingressRate := 300 annotations := map[string]string{ - util.PriorityAnnotation: strconv.Itoa(priority), util.IngressRateAnnotation: strconv.Itoa(ingressRate), } pod := framework.MakePod(namespaceName, name, nil, annotations, "", nil, nil) @@ -174,77 +173,11 @@ var _ = framework.Describe("[group:qos]", func() { ginkgo.By("Validating pod annotations") framework.ExpectHaveKeyWithValue(pod.Annotations, util.AllocatedAnnotation, "true") framework.ExpectHaveKeyWithValue(pod.Annotations, util.RoutedAnnotation, "true") - framework.ExpectHaveKeyWithValue(pod.Annotations, util.PriorityAnnotation, strconv.Itoa(priority)) framework.ExpectHaveKeyWithValue(pod.Annotations, util.IngressRateAnnotation, strconv.Itoa(ingressRate)) ginkgo.By("Validating OVS Queue") queue := getOvsQosForPod(cs, "queue", pod) framework.ExpectHaveKeyWithValue(queue, "max-rate", strconv.Itoa(ingressRate*1000*1000)) - framework.ExpectHaveKeyWithValue(queue, "priority", strconv.Itoa(priority)) - - ginkgo.By("Deleting pod " + name) - podClient.DeleteSync(pod.Name) - }) - - framework.ConformanceIt("should be able to update htb QoS", func() { - f.SkipVersionPriorTo(1, 9, "Support for htb QoS with priority was introduced in v1.9") - - subnetName = f.Namespace.Name - ginkgo.By("Creating subnet " + subnetName + " with htb QoS") - cidr := framework.RandomCIDR(f.ClusterIpFamily) - subnet := framework.MakeSubnet(subnetName, "", cidr, "", nil, nil, []string{namespaceName}) - subnet.Spec.HtbQos = util.HtbQosLow - subnetClient.CreateSync(subnet) - - ginkgo.By("Validating subnet .spec.htbqos field") - framework.ExpectEqual(subnet.Spec.HtbQos, util.HtbQosLow) - - name := "pod-" + framework.RandomSuffix() - ginkgo.By("Creating pod " + name) - pod := framework.MakePod(namespaceName, name, nil, nil, "", nil, nil) - pod = podClient.CreateSync(pod) - - ginkgo.By("Validating pod annotations") - framework.ExpectHaveKeyWithValue(pod.Annotations, util.AllocatedAnnotation, "true") - framework.ExpectHaveKeyWithValue(pod.Annotations, util.RoutedAnnotation, "true") - framework.ExpectNotHaveKey(pod.Annotations, util.PriorityAnnotation) - framework.ExpectNotHaveKey(pod.Annotations, util.IngressRateAnnotation) - - ginkgo.By("Validating OVS Queue") - defaultPriority := 5 - queue := getOvsQosForPod(cs, "queue", pod) - framework.ExpectHaveKeyWithValue(queue, "priority", strconv.Itoa(defaultPriority)) - - ginkgo.By("Update htb priority by adding pod annotation") - priority := 2 - modifiedPod := pod.DeepCopy() - modifiedPod.Annotations[util.PriorityAnnotation] = strconv.Itoa(priority) - pod = podClient.PatchPod(pod, modifiedPod) - - ginkgo.By("Validating pod annotations") - framework.ExpectHaveKeyWithValue(pod.Annotations, util.AllocatedAnnotation, "true") - framework.ExpectHaveKeyWithValue(pod.Annotations, util.RoutedAnnotation, "true") - framework.ExpectHaveKeyWithValue(pod.Annotations, util.PriorityAnnotation, strconv.Itoa(priority)) - framework.ExpectNotHaveKey(pod.Annotations, util.IngressRateAnnotation) - - ginkgo.By("Validating OVS Queue") - expected := map[string]string{"priority": strconv.Itoa(priority)} - _ = getOvsQosForPodRetry(cs, "queue", pod, expected) - - ginkgo.By("Update htb priority by deleting pod annotation") - modifiedPod = pod.DeepCopy() - delete(modifiedPod.Annotations, util.PriorityAnnotation) - pod = podClient.PatchPod(pod, modifiedPod) - - ginkgo.By("Validating pod annotations") - framework.ExpectHaveKeyWithValue(pod.Annotations, util.AllocatedAnnotation, "true") - framework.ExpectHaveKeyWithValue(pod.Annotations, util.RoutedAnnotation, "true") - framework.ExpectNotHaveKey(pod.Annotations, util.PriorityAnnotation) - framework.ExpectNotHaveKey(pod.Annotations, util.IngressRateAnnotation) - - ginkgo.By("Validating OVS Queue") - expected = map[string]string{"priority": strconv.Itoa(defaultPriority)} - _ = getOvsQosForPodRetry(cs, "queue", pod, expected) ginkgo.By("Deleting pod " + name) podClient.DeleteSync(pod.Name) diff --git a/yamls/crd.yaml b/yamls/crd.yaml index 764ca74633f..879ffdf6a9f 100644 --- a/yamls/crd.yaml +++ b/yamls/crd.yaml @@ -823,8 +823,6 @@ spec: type: boolean disableInterConnection: type: boolean - htbqos: - type: string enableDHCP: type: boolean dhcpV4Options: @@ -1302,34 +1300,3 @@ spec: status: {} conversion: strategy: None ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: htbqoses.kubeovn.io -spec: - group: kubeovn.io - versions: - - name: v1 - served: true - storage: true - additionalPrinterColumns: - - name: PRIORITY - type: string - jsonPath: .spec.priority - schema: - openAPIV3Schema: - type: object - properties: - spec: - type: object - properties: - priority: - type: string # Value in range 0 to 4,294,967,295. - scope: Cluster - names: - plural: htbqoses - singular: htbqos - kind: HtbQos - shortNames: - - htbqos \ No newline at end of file diff --git a/yamls/ovn-dpdk.yaml b/yamls/ovn-dpdk.yaml index dbf23eee055..1a5f05cb590 100644 --- a/yamls/ovn-dpdk.yaml +++ b/yamls/ovn-dpdk.yaml @@ -29,7 +29,6 @@ rules: - provider-networks/status - security-groups - security-groups/status - - htbqoses - iptables-eips - iptables-fip-rules - iptables-dnat-rules diff --git a/yamls/ovn-ha.yaml b/yamls/ovn-ha.yaml index 854f54557e5..59512850a4a 100644 --- a/yamls/ovn-ha.yaml +++ b/yamls/ovn-ha.yaml @@ -28,7 +28,6 @@ rules: - provider-networks/status - security-groups - security-groups/status - - htbqoses - iptables-eips - iptables-fip-rules - iptables-dnat-rules