From a42b0a1f5b9e8a7386f5d908da251258269f824f Mon Sep 17 00:00:00 2001 From: Antonin Bas Date: Thu, 18 Apr 2024 10:18:23 -0700 Subject: [PATCH] Remove v1alpha2.Egress API While the API was not officially marked as deprecated in the documentation (docs/api.md), we did mention its deprecation in the CHANGELOG for the 1.13 release. It makes sense to delete this API at the same time as the other deprecated Alpha APIs, for Antrea 2.0. Signed-off-by: Antonin Bas --- build/charts/antrea/crds/egress.yaml | 131 ------------- .../webhooks/validating/crdvalidator.yaml | 2 +- build/yamls/antrea-aks.yml | 133 +------------ build/yamls/antrea-crds.yml | 131 ------------- build/yamls/antrea-eks.yml | 133 +------------ build/yamls/antrea-gke.yml | 133 +------------ build/yamls/antrea-ipsec.yml | 133 +------------ build/yamls/antrea.yml | 133 +------------ docs/api.md | 2 +- pkg/apis/crd/v1alpha2/register.go | 2 - pkg/apis/crd/v1alpha2/types.go | 81 -------- .../crd/v1alpha2/zz_generated.deepcopy.go | 128 ------------ .../typed/crd/v1alpha2/crd_client.go | 5 - .../versioned/typed/crd/v1alpha2/egress.go | 182 ------------------ .../crd/v1alpha2/fake/fake_crd_client.go | 4 - .../typed/crd/v1alpha2/fake/fake_egress.go | 130 ------------- .../typed/crd/v1alpha2/generated_expansion.go | 2 - .../externalversions/crd/v1alpha2/egress.go | 87 --------- .../crd/v1alpha2/interface.go | 7 - .../informers/externalversions/generic.go | 2 - pkg/client/listers/crd/v1alpha2/egress.go | 66 ------- .../crd/v1alpha2/expansion_generated.go | 4 - 22 files changed, 7 insertions(+), 1624 deletions(-) delete mode 100644 pkg/client/clientset/versioned/typed/crd/v1alpha2/egress.go delete mode 100644 pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_egress.go delete mode 100644 pkg/client/informers/externalversions/crd/v1alpha2/egress.go delete mode 100644 pkg/client/listers/crd/v1alpha2/egress.go diff --git a/build/charts/antrea/crds/egress.yaml b/build/charts/antrea/crds/egress.yaml index 9953be258d4..6bf1d3eb99c 100644 --- a/build/charts/antrea/crds/egress.yaml +++ b/build/charts/antrea/crds/egress.yaml @@ -7,137 +7,6 @@ metadata: spec: group: crd.antrea.io versions: - - name: v1alpha2 - served: true - storage: false - schema: - openAPIV3Schema: - type: object - required: - - spec - properties: - spec: - type: object - required: - - appliedTo - oneOf: - - anyOf: - - required: - - egressIP - - required: - - externalIPPool - - anyOf: - - required: - - egressIPs - - required: - - externalIPPools - properties: - appliedTo: - type: object - properties: - podSelector: - type: object - properties: - matchExpressions: - type: array - items: - type: object - properties: - key: - type: string - operator: - enum: - - In - - NotIn - - Exists - - DoesNotExist - type: string - values: - type: array - items: - type: string - pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" - matchLabels: - x-kubernetes-preserve-unknown-fields: true - namespaceSelector: - type: object - properties: - matchExpressions: - type: array - items: - type: object - properties: - key: - type: string - operator: - enum: - - In - - NotIn - - Exists - - DoesNotExist - type: string - values: - type: array - items: - type: string - pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" - matchLabels: - x-kubernetes-preserve-unknown-fields: true - egressIP: - type: string - oneOf: - - format: ipv4 - - format: ipv6 - egressIPs: - type: array - items: - type: string - oneOf: - - maxLength: 0 - - format: ipv4 - - format: ipv6 - externalIPPool: - type: string - externalIPPools: - type: array - items: - type: string - status: - type: object - properties: - egressNode: - type: string - egressIP: - type: string - conditions: - type: array - items: - type: object - properties: - type: - type: string - status: - type: string - lastTransitionTime: - type: string - reason: - type: string - message: - type: string - additionalPrinterColumns: - - description: The effective SNAT IP address for the selected workloads. - jsonPath: .status.egressIP - name: EgressIP - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - description: The Owner Node of egress IP - jsonPath: .status.egressNode - name: Node - type: string - subresources: - status: {} - name: v1beta1 served: true storage: true diff --git a/build/charts/antrea/templates/webhooks/validating/crdvalidator.yaml b/build/charts/antrea/templates/webhooks/validating/crdvalidator.yaml index 9f98ff1e1cb..0470ce63215 100644 --- a/build/charts/antrea/templates/webhooks/validating/crdvalidator.yaml +++ b/build/charts/antrea/templates/webhooks/validating/crdvalidator.yaml @@ -133,7 +133,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["crd.antrea.io"] - apiVersions: ["v1alpha2"] + apiVersions: ["v1beta1"] resources: ["egresses"] scope: "Cluster" admissionReviewVersions: ["v1", "v1beta1"] diff --git a/build/yamls/antrea-aks.yml b/build/yamls/antrea-aks.yml index bc7a3c7dd71..3009c58e3a1 100644 --- a/build/yamls/antrea-aks.yml +++ b/build/yamls/antrea-aks.yml @@ -1934,137 +1934,6 @@ metadata: spec: group: crd.antrea.io versions: - - name: v1alpha2 - served: true - storage: false - schema: - openAPIV3Schema: - type: object - required: - - spec - properties: - spec: - type: object - required: - - appliedTo - oneOf: - - anyOf: - - required: - - egressIP - - required: - - externalIPPool - - anyOf: - - required: - - egressIPs - - required: - - externalIPPools - properties: - appliedTo: - type: object - properties: - podSelector: - type: object - properties: - matchExpressions: - type: array - items: - type: object - properties: - key: - type: string - operator: - enum: - - In - - NotIn - - Exists - - DoesNotExist - type: string - values: - type: array - items: - type: string - pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" - matchLabels: - x-kubernetes-preserve-unknown-fields: true - namespaceSelector: - type: object - properties: - matchExpressions: - type: array - items: - type: object - properties: - key: - type: string - operator: - enum: - - In - - NotIn - - Exists - - DoesNotExist - type: string - values: - type: array - items: - type: string - pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" - matchLabels: - x-kubernetes-preserve-unknown-fields: true - egressIP: - type: string - oneOf: - - format: ipv4 - - format: ipv6 - egressIPs: - type: array - items: - type: string - oneOf: - - maxLength: 0 - - format: ipv4 - - format: ipv6 - externalIPPool: - type: string - externalIPPools: - type: array - items: - type: string - status: - type: object - properties: - egressNode: - type: string - egressIP: - type: string - conditions: - type: array - items: - type: object - properties: - type: - type: string - status: - type: string - lastTransitionTime: - type: string - reason: - type: string - message: - type: string - additionalPrinterColumns: - - description: The effective SNAT IP address for the selected workloads. - jsonPath: .status.egressIP - name: EgressIP - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - description: The Owner Node of egress IP - jsonPath: .status.egressNode - name: Node - type: string - subresources: - status: {} - name: v1beta1 served: true storage: true @@ -7031,7 +6900,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["crd.antrea.io"] - apiVersions: ["v1alpha2"] + apiVersions: ["v1beta1"] resources: ["egresses"] scope: "Cluster" admissionReviewVersions: ["v1", "v1beta1"] diff --git a/build/yamls/antrea-crds.yml b/build/yamls/antrea-crds.yml index 3d7085b578c..f0bfe05ab8c 100644 --- a/build/yamls/antrea-crds.yml +++ b/build/yamls/antrea-crds.yml @@ -1925,137 +1925,6 @@ metadata: spec: group: crd.antrea.io versions: - - name: v1alpha2 - served: true - storage: false - schema: - openAPIV3Schema: - type: object - required: - - spec - properties: - spec: - type: object - required: - - appliedTo - oneOf: - - anyOf: - - required: - - egressIP - - required: - - externalIPPool - - anyOf: - - required: - - egressIPs - - required: - - externalIPPools - properties: - appliedTo: - type: object - properties: - podSelector: - type: object - properties: - matchExpressions: - type: array - items: - type: object - properties: - key: - type: string - operator: - enum: - - In - - NotIn - - Exists - - DoesNotExist - type: string - values: - type: array - items: - type: string - pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" - matchLabels: - x-kubernetes-preserve-unknown-fields: true - namespaceSelector: - type: object - properties: - matchExpressions: - type: array - items: - type: object - properties: - key: - type: string - operator: - enum: - - In - - NotIn - - Exists - - DoesNotExist - type: string - values: - type: array - items: - type: string - pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" - matchLabels: - x-kubernetes-preserve-unknown-fields: true - egressIP: - type: string - oneOf: - - format: ipv4 - - format: ipv6 - egressIPs: - type: array - items: - type: string - oneOf: - - maxLength: 0 - - format: ipv4 - - format: ipv6 - externalIPPool: - type: string - externalIPPools: - type: array - items: - type: string - status: - type: object - properties: - egressNode: - type: string - egressIP: - type: string - conditions: - type: array - items: - type: object - properties: - type: - type: string - status: - type: string - lastTransitionTime: - type: string - reason: - type: string - message: - type: string - additionalPrinterColumns: - - description: The effective SNAT IP address for the selected workloads. - jsonPath: .status.egressIP - name: EgressIP - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - description: The Owner Node of egress IP - jsonPath: .status.egressNode - name: Node - type: string - subresources: - status: {} - name: v1beta1 served: true storage: true diff --git a/build/yamls/antrea-eks.yml b/build/yamls/antrea-eks.yml index ee81093c2d7..6dbcf0fde56 100644 --- a/build/yamls/antrea-eks.yml +++ b/build/yamls/antrea-eks.yml @@ -1934,137 +1934,6 @@ metadata: spec: group: crd.antrea.io versions: - - name: v1alpha2 - served: true - storage: false - schema: - openAPIV3Schema: - type: object - required: - - spec - properties: - spec: - type: object - required: - - appliedTo - oneOf: - - anyOf: - - required: - - egressIP - - required: - - externalIPPool - - anyOf: - - required: - - egressIPs - - required: - - externalIPPools - properties: - appliedTo: - type: object - properties: - podSelector: - type: object - properties: - matchExpressions: - type: array - items: - type: object - properties: - key: - type: string - operator: - enum: - - In - - NotIn - - Exists - - DoesNotExist - type: string - values: - type: array - items: - type: string - pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" - matchLabels: - x-kubernetes-preserve-unknown-fields: true - namespaceSelector: - type: object - properties: - matchExpressions: - type: array - items: - type: object - properties: - key: - type: string - operator: - enum: - - In - - NotIn - - Exists - - DoesNotExist - type: string - values: - type: array - items: - type: string - pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" - matchLabels: - x-kubernetes-preserve-unknown-fields: true - egressIP: - type: string - oneOf: - - format: ipv4 - - format: ipv6 - egressIPs: - type: array - items: - type: string - oneOf: - - maxLength: 0 - - format: ipv4 - - format: ipv6 - externalIPPool: - type: string - externalIPPools: - type: array - items: - type: string - status: - type: object - properties: - egressNode: - type: string - egressIP: - type: string - conditions: - type: array - items: - type: object - properties: - type: - type: string - status: - type: string - lastTransitionTime: - type: string - reason: - type: string - message: - type: string - additionalPrinterColumns: - - description: The effective SNAT IP address for the selected workloads. - jsonPath: .status.egressIP - name: EgressIP - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - description: The Owner Node of egress IP - jsonPath: .status.egressNode - name: Node - type: string - subresources: - status: {} - name: v1beta1 served: true storage: true @@ -7032,7 +6901,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["crd.antrea.io"] - apiVersions: ["v1alpha2"] + apiVersions: ["v1beta1"] resources: ["egresses"] scope: "Cluster" admissionReviewVersions: ["v1", "v1beta1"] diff --git a/build/yamls/antrea-gke.yml b/build/yamls/antrea-gke.yml index 02d87590233..eb473a139ce 100644 --- a/build/yamls/antrea-gke.yml +++ b/build/yamls/antrea-gke.yml @@ -1934,137 +1934,6 @@ metadata: spec: group: crd.antrea.io versions: - - name: v1alpha2 - served: true - storage: false - schema: - openAPIV3Schema: - type: object - required: - - spec - properties: - spec: - type: object - required: - - appliedTo - oneOf: - - anyOf: - - required: - - egressIP - - required: - - externalIPPool - - anyOf: - - required: - - egressIPs - - required: - - externalIPPools - properties: - appliedTo: - type: object - properties: - podSelector: - type: object - properties: - matchExpressions: - type: array - items: - type: object - properties: - key: - type: string - operator: - enum: - - In - - NotIn - - Exists - - DoesNotExist - type: string - values: - type: array - items: - type: string - pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" - matchLabels: - x-kubernetes-preserve-unknown-fields: true - namespaceSelector: - type: object - properties: - matchExpressions: - type: array - items: - type: object - properties: - key: - type: string - operator: - enum: - - In - - NotIn - - Exists - - DoesNotExist - type: string - values: - type: array - items: - type: string - pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" - matchLabels: - x-kubernetes-preserve-unknown-fields: true - egressIP: - type: string - oneOf: - - format: ipv4 - - format: ipv6 - egressIPs: - type: array - items: - type: string - oneOf: - - maxLength: 0 - - format: ipv4 - - format: ipv6 - externalIPPool: - type: string - externalIPPools: - type: array - items: - type: string - status: - type: object - properties: - egressNode: - type: string - egressIP: - type: string - conditions: - type: array - items: - type: object - properties: - type: - type: string - status: - type: string - lastTransitionTime: - type: string - reason: - type: string - message: - type: string - additionalPrinterColumns: - - description: The effective SNAT IP address for the selected workloads. - jsonPath: .status.egressIP - name: EgressIP - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - description: The Owner Node of egress IP - jsonPath: .status.egressNode - name: Node - type: string - subresources: - status: {} - name: v1beta1 served: true storage: true @@ -7029,7 +6898,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["crd.antrea.io"] - apiVersions: ["v1alpha2"] + apiVersions: ["v1beta1"] resources: ["egresses"] scope: "Cluster" admissionReviewVersions: ["v1", "v1beta1"] diff --git a/build/yamls/antrea-ipsec.yml b/build/yamls/antrea-ipsec.yml index 7d44fa19cf0..98f5ea23171 100644 --- a/build/yamls/antrea-ipsec.yml +++ b/build/yamls/antrea-ipsec.yml @@ -1934,137 +1934,6 @@ metadata: spec: group: crd.antrea.io versions: - - name: v1alpha2 - served: true - storage: false - schema: - openAPIV3Schema: - type: object - required: - - spec - properties: - spec: - type: object - required: - - appliedTo - oneOf: - - anyOf: - - required: - - egressIP - - required: - - externalIPPool - - anyOf: - - required: - - egressIPs - - required: - - externalIPPools - properties: - appliedTo: - type: object - properties: - podSelector: - type: object - properties: - matchExpressions: - type: array - items: - type: object - properties: - key: - type: string - operator: - enum: - - In - - NotIn - - Exists - - DoesNotExist - type: string - values: - type: array - items: - type: string - pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" - matchLabels: - x-kubernetes-preserve-unknown-fields: true - namespaceSelector: - type: object - properties: - matchExpressions: - type: array - items: - type: object - properties: - key: - type: string - operator: - enum: - - In - - NotIn - - Exists - - DoesNotExist - type: string - values: - type: array - items: - type: string - pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" - matchLabels: - x-kubernetes-preserve-unknown-fields: true - egressIP: - type: string - oneOf: - - format: ipv4 - - format: ipv6 - egressIPs: - type: array - items: - type: string - oneOf: - - maxLength: 0 - - format: ipv4 - - format: ipv6 - externalIPPool: - type: string - externalIPPools: - type: array - items: - type: string - status: - type: object - properties: - egressNode: - type: string - egressIP: - type: string - conditions: - type: array - items: - type: object - properties: - type: - type: string - status: - type: string - lastTransitionTime: - type: string - reason: - type: string - message: - type: string - additionalPrinterColumns: - - description: The effective SNAT IP address for the selected workloads. - jsonPath: .status.egressIP - name: EgressIP - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - description: The Owner Node of egress IP - jsonPath: .status.egressNode - name: Node - type: string - subresources: - status: {} - name: v1beta1 served: true storage: true @@ -7088,7 +6957,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["crd.antrea.io"] - apiVersions: ["v1alpha2"] + apiVersions: ["v1beta1"] resources: ["egresses"] scope: "Cluster" admissionReviewVersions: ["v1", "v1beta1"] diff --git a/build/yamls/antrea.yml b/build/yamls/antrea.yml index c9cebb40aa1..f754b13b067 100644 --- a/build/yamls/antrea.yml +++ b/build/yamls/antrea.yml @@ -1934,137 +1934,6 @@ metadata: spec: group: crd.antrea.io versions: - - name: v1alpha2 - served: true - storage: false - schema: - openAPIV3Schema: - type: object - required: - - spec - properties: - spec: - type: object - required: - - appliedTo - oneOf: - - anyOf: - - required: - - egressIP - - required: - - externalIPPool - - anyOf: - - required: - - egressIPs - - required: - - externalIPPools - properties: - appliedTo: - type: object - properties: - podSelector: - type: object - properties: - matchExpressions: - type: array - items: - type: object - properties: - key: - type: string - operator: - enum: - - In - - NotIn - - Exists - - DoesNotExist - type: string - values: - type: array - items: - type: string - pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" - matchLabels: - x-kubernetes-preserve-unknown-fields: true - namespaceSelector: - type: object - properties: - matchExpressions: - type: array - items: - type: object - properties: - key: - type: string - operator: - enum: - - In - - NotIn - - Exists - - DoesNotExist - type: string - values: - type: array - items: - type: string - pattern: "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$" - matchLabels: - x-kubernetes-preserve-unknown-fields: true - egressIP: - type: string - oneOf: - - format: ipv4 - - format: ipv6 - egressIPs: - type: array - items: - type: string - oneOf: - - maxLength: 0 - - format: ipv4 - - format: ipv6 - externalIPPool: - type: string - externalIPPools: - type: array - items: - type: string - status: - type: object - properties: - egressNode: - type: string - egressIP: - type: string - conditions: - type: array - items: - type: object - properties: - type: - type: string - status: - type: string - lastTransitionTime: - type: string - reason: - type: string - message: - type: string - additionalPrinterColumns: - - description: The effective SNAT IP address for the selected workloads. - jsonPath: .status.egressIP - name: EgressIP - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - - description: The Owner Node of egress IP - jsonPath: .status.egressNode - name: Node - type: string - subresources: - status: {} - name: v1beta1 served: true storage: true @@ -7029,7 +6898,7 @@ webhooks: rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["crd.antrea.io"] - apiVersions: ["v1alpha2"] + apiVersions: ["v1beta1"] resources: ["egresses"] scope: "Cluster" admissionReviewVersions: ["v1", "v1beta1"] diff --git a/docs/api.md b/docs/api.md index f859917395b..774c683e410 100644 --- a/docs/api.md +++ b/docs/api.md @@ -30,7 +30,6 @@ These are the CRDs currently available in `crd.antrea.io`. | `AntreaControllerInfo` | v1beta1 | v1.0.0 | N/A | N/A | | `ClusterGroup` | v1beta1 | v1.13.0 | N/A | N/A | | `ClusterNetworkPolicy` | v1beta1 | v1.13.0 | N/A | N/A | -| `Egress` | v1alpha2 | v1.0.0 | N/A | N/A | | `Egress` | v1beta1 | v1.13.0 | N/A | N/A | | `ExternalEntity` | v1alpha2 | v1.0.0 | N/A | N/A | | `ExternalIPPool` | v1beta1 | v1.13.0 | N/A | N/A | @@ -76,6 +75,7 @@ These are the API group versions which are currently available when using Antrea | `ClusterGroup` | v1alpha2 | v1.0.0 | v1.1.0 | v2.0.0 | | `ClusterGroup` | v1alpha3 | v1.1.0 | v1.13.0 | v2.0.0 | | `ClusterNetworkPolicy` | v1alpha1 | v1.0.0 | v1.13.0 | v2.0.0 | +| `Egress` | v1alpha2 | v1.0.0 | v1.13.0 | v2.0.0 | | `ExternalEntity` | v1alpha1 | v0.10.0 | v0.11.0 | v2.0.0 | | `ExternalIPPool` | v1alpha2 | v1.2.0 | v1.13.0 | v2.0.0 | | `Group` | v1alpha3 | v1.8.0 | v1.13.0 | v2.0.0 | diff --git a/pkg/apis/crd/v1alpha2/register.go b/pkg/apis/crd/v1alpha2/register.go index 139211176f2..0f47477115e 100644 --- a/pkg/apis/crd/v1alpha2/register.go +++ b/pkg/apis/crd/v1alpha2/register.go @@ -46,8 +46,6 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &ExternalEntity{}, &ExternalEntityList{}, - &Egress{}, - &EgressList{}, &IPPool{}, &IPPoolList{}, &TrafficControl{}, diff --git a/pkg/apis/crd/v1alpha2/types.go b/pkg/apis/crd/v1alpha2/types.go index ea6875d9d1f..37578504ded 100644 --- a/pkg/apis/crd/v1alpha2/types.go +++ b/pkg/apis/crd/v1alpha2/types.go @@ -96,87 +96,6 @@ type AppliedTo struct { // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// Egress defines which egress (SNAT) IP the traffic from the selected Pods to -// the external network should use. -type Egress struct { - metav1.TypeMeta `json:",inline"` - // Standard metadata of the object. - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Specification of the desired behavior of Egress. - Spec EgressSpec `json:"spec"` - - // EgressStatus represents the current status of an Egress. - Status EgressStatus `json:"status"` -} - -// EgressStatus represents the current status of an Egress. -type EgressStatus struct { - // The name of the Node that holds the Egress IP. - EgressNode string `json:"egressNode"` - // EgressIP indicates the effective Egress IP for the selected workloads. It could be empty if the Egress IP in spec - // is not assigned to any Node. It's also useful when there are more than one Egress IP specified in spec. - EgressIP string `json:"egressIP"` - - Conditions []EgressCondition `json:"conditions,omitempty"` -} - -type EgressConditionType string - -const ( - // IPAllocated means at least one IP has been allocated to the Egress from ExternalIPPool. - // It is not applicable for Egresses with empty ExternalIPPool. - IPAllocated EgressConditionType = "IPAllocated" - // IPAssigned means the Egress has been assigned to a Node. - // It is not applicable for Egresses with empty ExternalIPPool. - IPAssigned EgressConditionType = "IPAssigned" -) - -type EgressCondition struct { - Type EgressConditionType `json:"type"` - Status v1.ConditionStatus `json:"status"` - LastTransitionTime metav1.Time `json:"lastTransitionTime"` - Reason string `json:"reason,omitempty"` - Message string `json:"message,omitempty"` -} - -// EgressSpec defines the desired state for Egress. -type EgressSpec struct { - // AppliedTo selects Pods to which the Egress will be applied. - AppliedTo AppliedTo `json:"appliedTo"` - // EgressIP specifies the SNAT IP address for the selected workloads. - // If ExternalIPPool is empty, it must be specified manually. - // If ExternalIPPool is non-empty, it can be empty and will be assigned by Antrea automatically. - // If both ExternalIPPool and EgressIP are non-empty, the IP must be in the pool. - EgressIP string `json:"egressIP,omitempty"` - // EgressIPs specifies multiple SNAT IP addresses for the selected workloads. - // Cannot be set with EgressIP. - EgressIPs []string `json:"egressIPs,omitempty"` - // ExternalIPPool specifies the IP Pool that the EgressIP should be allocated from. - // If it is empty, the specified EgressIP must be assigned to a Node manually. - // If it is non-empty, the EgressIP will be assigned to a Node specified by the pool automatically and will failover - // to a different Node when the Node becomes unreachable. - ExternalIPPool string `json:"externalIPPool,omitempty"` - // ExternalIPPools specifies multiple unique IP Pools that the EgressIPs should be allocated from. Entries with the - // same index in EgressIPs and ExternalIPPools are correlated. - // Cannot be set with ExternalIPPool. - ExternalIPPools []string `json:"externalIPPools,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -type EgressList struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ListMeta `json:"metadata,omitempty"` - - Items []Egress `json:"items"` -} - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - // IPPool defines one or multiple IP sets that can be used for flexible IPAM feature. For instance, the IPs can be // allocated to Pods according to IP pool specified in Deployment annotation. type IPPool struct { diff --git a/pkg/apis/crd/v1alpha2/zz_generated.deepcopy.go b/pkg/apis/crd/v1alpha2/zz_generated.deepcopy.go index 02d0289ec28..9ba6d61b486 100644 --- a/pkg/apis/crd/v1alpha2/zz_generated.deepcopy.go +++ b/pkg/apis/crd/v1alpha2/zz_generated.deepcopy.go @@ -91,134 +91,6 @@ func (in *ERSPANTunnel) DeepCopy() *ERSPANTunnel { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Egress) DeepCopyInto(out *Egress) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Egress. -func (in *Egress) DeepCopy() *Egress { - if in == nil { - return nil - } - out := new(Egress) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Egress) 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 *EgressCondition) DeepCopyInto(out *EgressCondition) { - *out = *in - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EgressCondition. -func (in *EgressCondition) DeepCopy() *EgressCondition { - if in == nil { - return nil - } - out := new(EgressCondition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EgressList) DeepCopyInto(out *EgressList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Egress, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EgressList. -func (in *EgressList) DeepCopy() *EgressList { - if in == nil { - return nil - } - out := new(EgressList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *EgressList) 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 *EgressSpec) DeepCopyInto(out *EgressSpec) { - *out = *in - in.AppliedTo.DeepCopyInto(&out.AppliedTo) - if in.EgressIPs != nil { - in, out := &in.EgressIPs, &out.EgressIPs - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.ExternalIPPools != nil { - in, out := &in.ExternalIPPools, &out.ExternalIPPools - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EgressSpec. -func (in *EgressSpec) DeepCopy() *EgressSpec { - if in == nil { - return nil - } - out := new(EgressSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *EgressStatus) DeepCopyInto(out *EgressStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]EgressCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EgressStatus. -func (in *EgressStatus) DeepCopy() *EgressStatus { - if in == nil { - return nil - } - out := new(EgressStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Endpoint) DeepCopyInto(out *Endpoint) { *out = *in diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha2/crd_client.go b/pkg/client/clientset/versioned/typed/crd/v1alpha2/crd_client.go index 2a486a6576f..210fe1702c1 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha2/crd_client.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha2/crd_client.go @@ -26,7 +26,6 @@ import ( type CrdV1alpha2Interface interface { RESTClient() rest.Interface - EgressesGetter ExternalEntitiesGetter IPPoolsGetter TrafficControlsGetter @@ -37,10 +36,6 @@ type CrdV1alpha2Client struct { restClient rest.Interface } -func (c *CrdV1alpha2Client) Egresses() EgressInterface { - return newEgresses(c) -} - func (c *CrdV1alpha2Client) ExternalEntities(namespace string) ExternalEntityInterface { return newExternalEntities(c, namespace) } diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha2/egress.go b/pkg/client/clientset/versioned/typed/crd/v1alpha2/egress.go deleted file mode 100644 index 52326a2f0ce..00000000000 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha2/egress.go +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright 2021 Antrea 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 v1alpha2 - -import ( - "context" - "time" - - v1alpha2 "antrea.io/antrea/pkg/apis/crd/v1alpha2" - scheme "antrea.io/antrea/pkg/client/clientset/versioned/scheme" - v1 "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" -) - -// EgressesGetter has a method to return a EgressInterface. -// A group's client should implement this interface. -type EgressesGetter interface { - Egresses() EgressInterface -} - -// EgressInterface has methods to work with Egress resources. -type EgressInterface interface { - Create(ctx context.Context, egress *v1alpha2.Egress, opts v1.CreateOptions) (*v1alpha2.Egress, error) - Update(ctx context.Context, egress *v1alpha2.Egress, opts v1.UpdateOptions) (*v1alpha2.Egress, error) - UpdateStatus(ctx context.Context, egress *v1alpha2.Egress, opts v1.UpdateOptions) (*v1alpha2.Egress, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha2.Egress, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.EgressList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.Egress, err error) - EgressExpansion -} - -// egresses implements EgressInterface -type egresses struct { - client rest.Interface -} - -// newEgresses returns a Egresses -func newEgresses(c *CrdV1alpha2Client) *egresses { - return &egresses{ - client: c.RESTClient(), - } -} - -// Get takes name of the egress, and returns the corresponding egress object, and an error if there is any. -func (c *egresses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.Egress, err error) { - result = &v1alpha2.Egress{} - err = c.client.Get(). - Resource("egresses"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Egresses that match those selectors. -func (c *egresses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.EgressList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.EgressList{} - err = c.client.Get(). - Resource("egresses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested egresses. -func (c *egresses) Watch(ctx context.Context, opts v1.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("egresses"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a egress and creates it. Returns the server's representation of the egress, and an error, if there is any. -func (c *egresses) Create(ctx context.Context, egress *v1alpha2.Egress, opts v1.CreateOptions) (result *v1alpha2.Egress, err error) { - result = &v1alpha2.Egress{} - err = c.client.Post(). - Resource("egresses"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(egress). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a egress and updates it. Returns the server's representation of the egress, and an error, if there is any. -func (c *egresses) Update(ctx context.Context, egress *v1alpha2.Egress, opts v1.UpdateOptions) (result *v1alpha2.Egress, err error) { - result = &v1alpha2.Egress{} - err = c.client.Put(). - Resource("egresses"). - Name(egress.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(egress). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *egresses) UpdateStatus(ctx context.Context, egress *v1alpha2.Egress, opts v1.UpdateOptions) (result *v1alpha2.Egress, err error) { - result = &v1alpha2.Egress{} - err = c.client.Put(). - Resource("egresses"). - Name(egress.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(egress). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the egress and deletes it. Returns an error if one occurs. -func (c *egresses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("egresses"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *egresses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("egresses"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched egress. -func (c *egresses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.Egress, err error) { - result = &v1alpha2.Egress{} - err = c.client.Patch(pt). - Resource("egresses"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_crd_client.go b/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_crd_client.go index 7b3fbfb667f..9066478c12a 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_crd_client.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_crd_client.go @@ -26,10 +26,6 @@ type FakeCrdV1alpha2 struct { *testing.Fake } -func (c *FakeCrdV1alpha2) Egresses() v1alpha2.EgressInterface { - return &FakeEgresses{c} -} - func (c *FakeCrdV1alpha2) ExternalEntities(namespace string) v1alpha2.ExternalEntityInterface { return &FakeExternalEntities{c, namespace} } diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_egress.go b/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_egress.go deleted file mode 100644 index d860fcf738f..00000000000 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha2/fake/fake_egress.go +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2024 Antrea 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" - - v1alpha2 "antrea.io/antrea/pkg/apis/crd/v1alpha2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeEgresses implements EgressInterface -type FakeEgresses struct { - Fake *FakeCrdV1alpha2 -} - -var egressesResource = v1alpha2.SchemeGroupVersion.WithResource("egresses") - -var egressesKind = v1alpha2.SchemeGroupVersion.WithKind("Egress") - -// Get takes name of the egress, and returns the corresponding egress object, and an error if there is any. -func (c *FakeEgresses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.Egress, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootGetAction(egressesResource, name), &v1alpha2.Egress{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.Egress), err -} - -// List takes label and field selectors, and returns the list of Egresses that match those selectors. -func (c *FakeEgresses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.EgressList, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootListAction(egressesResource, egressesKind, opts), &v1alpha2.EgressList{}) - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha2.EgressList{ListMeta: obj.(*v1alpha2.EgressList).ListMeta} - for _, item := range obj.(*v1alpha2.EgressList).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 egresses. -func (c *FakeEgresses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchAction(egressesResource, opts)) -} - -// Create takes the representation of a egress and creates it. Returns the server's representation of the egress, and an error, if there is any. -func (c *FakeEgresses) Create(ctx context.Context, egress *v1alpha2.Egress, opts v1.CreateOptions) (result *v1alpha2.Egress, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(egressesResource, egress), &v1alpha2.Egress{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.Egress), err -} - -// Update takes the representation of a egress and updates it. Returns the server's representation of the egress, and an error, if there is any. -func (c *FakeEgresses) Update(ctx context.Context, egress *v1alpha2.Egress, opts v1.UpdateOptions) (result *v1alpha2.Egress, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(egressesResource, egress), &v1alpha2.Egress{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.Egress), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeEgresses) UpdateStatus(ctx context.Context, egress *v1alpha2.Egress, opts v1.UpdateOptions) (*v1alpha2.Egress, error) { - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(egressesResource, "status", egress), &v1alpha2.Egress{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.Egress), err -} - -// Delete takes name of the egress and deletes it. Returns an error if one occurs. -func (c *FakeEgresses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(egressesResource, name, opts), &v1alpha2.Egress{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeEgresses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(egressesResource, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha2.EgressList{}) - return err -} - -// Patch applies the patch and returns the patched egress. -func (c *FakeEgresses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.Egress, err error) { - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(egressesResource, name, pt, data, subresources...), &v1alpha2.Egress{}) - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.Egress), err -} diff --git a/pkg/client/clientset/versioned/typed/crd/v1alpha2/generated_expansion.go b/pkg/client/clientset/versioned/typed/crd/v1alpha2/generated_expansion.go index b3308bbdfc9..f69d4f9709c 100644 --- a/pkg/client/clientset/versioned/typed/crd/v1alpha2/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/crd/v1alpha2/generated_expansion.go @@ -16,8 +16,6 @@ package v1alpha2 -type EgressExpansion interface{} - type ExternalEntityExpansion interface{} type IPPoolExpansion interface{} diff --git a/pkg/client/informers/externalversions/crd/v1alpha2/egress.go b/pkg/client/informers/externalversions/crd/v1alpha2/egress.go deleted file mode 100644 index 36cb1d1c4f8..00000000000 --- a/pkg/client/informers/externalversions/crd/v1alpha2/egress.go +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2021 Antrea 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 v1alpha2 - -import ( - "context" - time "time" - - crdv1alpha2 "antrea.io/antrea/pkg/apis/crd/v1alpha2" - versioned "antrea.io/antrea/pkg/client/clientset/versioned" - internalinterfaces "antrea.io/antrea/pkg/client/informers/externalversions/internalinterfaces" - v1alpha2 "antrea.io/antrea/pkg/client/listers/crd/v1alpha2" - v1 "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" -) - -// EgressInformer provides access to a shared informer and lister for -// Egresses. -type EgressInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha2.EgressLister -} - -type egressInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewEgressInformer constructs a new informer for Egress 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 NewEgressInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEgressInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredEgressInformer constructs a new informer for Egress 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 NewFilteredEgressInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.CrdV1alpha2().Egresses().List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.CrdV1alpha2().Egresses().Watch(context.TODO(), options) - }, - }, - &crdv1alpha2.Egress{}, - resyncPeriod, - indexers, - ) -} - -func (f *egressInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEgressInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *egressInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&crdv1alpha2.Egress{}, f.defaultInformer) -} - -func (f *egressInformer) Lister() v1alpha2.EgressLister { - return v1alpha2.NewEgressLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/crd/v1alpha2/interface.go b/pkg/client/informers/externalversions/crd/v1alpha2/interface.go index 9976e054d11..97f8f4dbd1c 100644 --- a/pkg/client/informers/externalversions/crd/v1alpha2/interface.go +++ b/pkg/client/informers/externalversions/crd/v1alpha2/interface.go @@ -22,8 +22,6 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { - // Egresses returns a EgressInformer. - Egresses() EgressInformer // ExternalEntities returns a ExternalEntityInformer. ExternalEntities() ExternalEntityInformer // IPPools returns a IPPoolInformer. @@ -43,11 +41,6 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// Egresses returns a EgressInformer. -func (v *version) Egresses() EgressInformer { - return &egressInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} -} - // ExternalEntities returns a ExternalEntityInformer. func (v *version) ExternalEntities() ExternalEntityInformer { return &externalEntityInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 14579edbd39..ef3f63d1380 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -59,8 +59,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha1().SupportBundleCollections().Informer()}, nil // Group=crd.antrea.io, Version=v1alpha2 - case v1alpha2.SchemeGroupVersion.WithResource("egresses"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha2().Egresses().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("externalentities"): return &genericInformer{resource: resource.GroupResource(), informer: f.Crd().V1alpha2().ExternalEntities().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("ippools"): diff --git a/pkg/client/listers/crd/v1alpha2/egress.go b/pkg/client/listers/crd/v1alpha2/egress.go deleted file mode 100644 index 4d91310ad65..00000000000 --- a/pkg/client/listers/crd/v1alpha2/egress.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2021 Antrea 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 v1alpha2 - -import ( - v1alpha2 "antrea.io/antrea/pkg/apis/crd/v1alpha2" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// EgressLister helps list Egresses. -// All objects returned here must be treated as read-only. -type EgressLister interface { - // List lists all Egresses in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha2.Egress, err error) - // Get retrieves the Egress from the index for a given name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha2.Egress, error) - EgressListerExpansion -} - -// egressLister implements the EgressLister interface. -type egressLister struct { - indexer cache.Indexer -} - -// NewEgressLister returns a new EgressLister. -func NewEgressLister(indexer cache.Indexer) EgressLister { - return &egressLister{indexer: indexer} -} - -// List lists all Egresses in the indexer. -func (s *egressLister) List(selector labels.Selector) (ret []*v1alpha2.Egress, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.Egress)) - }) - return ret, err -} - -// Get retrieves the Egress from the index for a given name. -func (s *egressLister) Get(name string) (*v1alpha2.Egress, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("egress"), name) - } - return obj.(*v1alpha2.Egress), nil -} diff --git a/pkg/client/listers/crd/v1alpha2/expansion_generated.go b/pkg/client/listers/crd/v1alpha2/expansion_generated.go index 7eb2083323e..9137c36d992 100644 --- a/pkg/client/listers/crd/v1alpha2/expansion_generated.go +++ b/pkg/client/listers/crd/v1alpha2/expansion_generated.go @@ -16,10 +16,6 @@ package v1alpha2 -// EgressListerExpansion allows custom methods to be added to -// EgressLister. -type EgressListerExpansion interface{} - // ExternalEntityListerExpansion allows custom methods to be added to // ExternalEntityLister. type ExternalEntityListerExpansion interface{}