Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Tier API version to v1beta1 #5172

Merged
merged 2 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions build/charts/antrea/crds/tier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,32 @@ spec:
group: crd.antrea.io
versions:
- name: v1alpha1
served: true
storage: false
additionalPrinterColumns:
- name: Priority
type: integer
description: The Priority of this Tier relative to other Tiers.
jsonPath: .spec.priority
- name: Age
type: date
jsonPath: .metadata.creationTimestamp
schema:
openAPIV3Schema:
type: object
properties:
spec:
required:
- priority
type: object
properties:
priority:
type: integer
minimum: 0
maximum: 255
description:
type: string
- name: v1beta1
served: true
storage: true
additionalPrinterColumns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ webhooks:
rules:
- operations: ["CREATE", "UPDATE", "DELETE"]
apiGroups: ["crd.antrea.io"]
apiVersions: ["v1alpha1"]
apiVersions: ["v1alpha1", "v1beta1"]
resources: ["tiers"]
scope: "Cluster"
admissionReviewVersions: ["v1", "v1beta1"]
Expand Down
28 changes: 27 additions & 1 deletion build/yamls/antrea-aks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2338,6 +2338,32 @@ spec:
group: crd.antrea.io
versions:
- name: v1alpha1
served: true
storage: false
additionalPrinterColumns:
- name: Priority
type: integer
description: The Priority of this Tier relative to other Tiers.
jsonPath: .spec.priority
- name: Age
type: date
jsonPath: .metadata.creationTimestamp
schema:
openAPIV3Schema:
type: object
properties:
spec:
required:
- priority
type: object
properties:
priority:
type: integer
minimum: 0
maximum: 255
description:
type: string
- name: v1beta1
served: true
storage: true
additionalPrinterColumns:
Expand Down Expand Up @@ -4878,7 +4904,7 @@ webhooks:
rules:
- operations: ["CREATE", "UPDATE", "DELETE"]
apiGroups: ["crd.antrea.io"]
apiVersions: ["v1alpha1"]
apiVersions: ["v1alpha1", "v1beta1"]
resources: ["tiers"]
scope: "Cluster"
admissionReviewVersions: ["v1", "v1beta1"]
Expand Down
26 changes: 26 additions & 0 deletions build/yamls/antrea-crds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2315,6 +2315,32 @@ spec:
group: crd.antrea.io
versions:
- name: v1alpha1
served: true
storage: false
additionalPrinterColumns:
- name: Priority
type: integer
description: The Priority of this Tier relative to other Tiers.
jsonPath: .spec.priority
- name: Age
type: date
jsonPath: .metadata.creationTimestamp
schema:
openAPIV3Schema:
type: object
properties:
spec:
required:
- priority
type: object
properties:
priority:
type: integer
minimum: 0
maximum: 255
description:
type: string
- name: v1beta1
served: true
storage: true
additionalPrinterColumns:
Expand Down
28 changes: 27 additions & 1 deletion build/yamls/antrea-eks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2338,6 +2338,32 @@ spec:
group: crd.antrea.io
versions:
- name: v1alpha1
served: true
storage: false
additionalPrinterColumns:
- name: Priority
type: integer
description: The Priority of this Tier relative to other Tiers.
jsonPath: .spec.priority
- name: Age
type: date
jsonPath: .metadata.creationTimestamp
schema:
openAPIV3Schema:
type: object
properties:
spec:
required:
- priority
type: object
properties:
priority:
type: integer
minimum: 0
maximum: 255
description:
type: string
- name: v1beta1
served: true
storage: true
additionalPrinterColumns:
Expand Down Expand Up @@ -4879,7 +4905,7 @@ webhooks:
rules:
- operations: ["CREATE", "UPDATE", "DELETE"]
apiGroups: ["crd.antrea.io"]
apiVersions: ["v1alpha1"]
apiVersions: ["v1alpha1", "v1beta1"]
resources: ["tiers"]
scope: "Cluster"
admissionReviewVersions: ["v1", "v1beta1"]
Expand Down
28 changes: 27 additions & 1 deletion build/yamls/antrea-gke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2338,6 +2338,32 @@ spec:
group: crd.antrea.io
versions:
- name: v1alpha1
served: true
storage: false
additionalPrinterColumns:
- name: Priority
type: integer
description: The Priority of this Tier relative to other Tiers.
jsonPath: .spec.priority
- name: Age
type: date
jsonPath: .metadata.creationTimestamp
schema:
openAPIV3Schema:
type: object
properties:
spec:
required:
- priority
type: object
properties:
priority:
type: integer
minimum: 0
maximum: 255
description:
type: string
- name: v1beta1
served: true
storage: true
additionalPrinterColumns:
Expand Down Expand Up @@ -4876,7 +4902,7 @@ webhooks:
rules:
- operations: ["CREATE", "UPDATE", "DELETE"]
apiGroups: ["crd.antrea.io"]
apiVersions: ["v1alpha1"]
apiVersions: ["v1alpha1", "v1beta1"]
resources: ["tiers"]
scope: "Cluster"
admissionReviewVersions: ["v1", "v1beta1"]
Expand Down
28 changes: 27 additions & 1 deletion build/yamls/antrea-ipsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2338,6 +2338,32 @@ spec:
group: crd.antrea.io
versions:
- name: v1alpha1
served: true
storage: false
additionalPrinterColumns:
- name: Priority
type: integer
description: The Priority of this Tier relative to other Tiers.
jsonPath: .spec.priority
- name: Age
type: date
jsonPath: .metadata.creationTimestamp
schema:
openAPIV3Schema:
type: object
properties:
spec:
required:
- priority
type: object
properties:
priority:
type: integer
minimum: 0
maximum: 255
description:
type: string
- name: v1beta1
served: true
storage: true
additionalPrinterColumns:
Expand Down Expand Up @@ -4935,7 +4961,7 @@ webhooks:
rules:
- operations: ["CREATE", "UPDATE", "DELETE"]
apiGroups: ["crd.antrea.io"]
apiVersions: ["v1alpha1"]
apiVersions: ["v1alpha1", "v1beta1"]
resources: ["tiers"]
scope: "Cluster"
admissionReviewVersions: ["v1", "v1beta1"]
Expand Down
28 changes: 27 additions & 1 deletion build/yamls/antrea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2338,6 +2338,32 @@ spec:
group: crd.antrea.io
versions:
- name: v1alpha1
served: true
storage: false
additionalPrinterColumns:
- name: Priority
type: integer
description: The Priority of this Tier relative to other Tiers.
jsonPath: .spec.priority
- name: Age
type: date
jsonPath: .metadata.creationTimestamp
schema:
openAPIV3Schema:
type: object
properties:
spec:
required:
- priority
type: object
properties:
priority:
type: integer
minimum: 0
maximum: 255
description:
type: string
- name: v1beta1
served: true
storage: true
additionalPrinterColumns:
Expand Down Expand Up @@ -4876,7 +4902,7 @@ webhooks:
rules:
- operations: ["CREATE", "UPDATE", "DELETE"]
apiGroups: ["crd.antrea.io"]
apiVersions: ["v1alpha1"]
apiVersions: ["v1alpha1", "v1beta1"]
resources: ["tiers"]
scope: "Cluster"
admissionReviewVersions: ["v1", "v1beta1"]
Expand Down
2 changes: 1 addition & 1 deletion cmd/antrea-controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func run(o *Options) error {
acnpInformer := crdInformerFactory.Crd().V1alpha1().ClusterNetworkPolicies()
eeInformer := crdInformerFactory.Crd().V1alpha2().ExternalEntities()
annpInformer := crdInformerFactory.Crd().V1alpha1().NetworkPolicies()
tierInformer := crdInformerFactory.Crd().V1alpha1().Tiers()
tierInformer := crdInformerFactory.Crd().V1beta1().Tiers()
tfInformer := crdInformerFactory.Crd().V1alpha1().Traceflows()
cgInformer := crdInformerFactory.Crd().V1alpha3().ClusterGroups()
grpInformer := crdInformerFactory.Crd().V1alpha3().Groups()
Expand Down
2 changes: 1 addition & 1 deletion docs/antrea-network-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ as was the case initially.
An example Tier might look like this:

```yaml
apiVersion: crd.antrea.io/v1alpha1
apiVersion: crd.antrea.io/v1beta1
kind: Tier
metadata:
name: mytier
Expand Down
3 changes: 2 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ These are the CRDs currently available in `crd.antrea.io`.
| `ExternalIPPool` | v1alpha2 | v1.2.0 | N/A | N/A |
| `Group` | v1alpha3 | v1.8.0 | N/A | N/A |
| `NetworkPolicy` | v1alpha1 | v1.0.0 | N/A | N/A |
| `Tier` | v1alpha1 | v1.0.0 | N/A | N/A |
| `Tier` | v1alpha1 | v1.0.0 | v1.13.0 | v2.0.0 |
| `Tier` | v1beta1 | v1.13.0 | N/A | N/A |
| `Traceflow` | v1alpha1 | v1.0.0 | N/A | N/A |

### Other API groups
Expand Down
6 changes: 4 additions & 2 deletions multicluster/cmd/multicluster-controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ import (
mcv1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1"
mcv1alpha2 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha2"
"antrea.io/antrea/multicluster/controllers/multicluster/common"
antreacrd "antrea.io/antrea/pkg/apis/crd/v1alpha1"
antreacrdv1alpha1 "antrea.io/antrea/pkg/apis/crd/v1alpha1"
antreacrdv1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1"
"antrea.io/antrea/pkg/apiserver/certificate"
"antrea.io/antrea/pkg/util/env"
k8sutil "antrea.io/antrea/pkg/util/k8s"
Expand Down Expand Up @@ -74,7 +75,8 @@ func init() {
utilruntime.Must(k8smcsv1alpha1.AddToScheme(scheme))
utilruntime.Must(mcv1alpha1.AddToScheme(scheme))
utilruntime.Must(mcv1alpha2.AddToScheme(scheme))
utilruntime.Must(antreacrd.AddToScheme(scheme))
utilruntime.Must(antreacrdv1alpha1.AddToScheme(scheme))
utilruntime.Must(antreacrdv1beta1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
multiclusterv1alpha1 "antrea.io/antrea/multicluster/apis/multicluster/v1alpha1"
"antrea.io/antrea/multicluster/controllers/multicluster/common"
"antrea.io/antrea/pkg/apis/crd/v1alpha1"
"antrea.io/antrea/pkg/apis/crd/v1beta1"
)

const acnpImportFailed string = "ACNPImportFailed"
Expand Down Expand Up @@ -69,7 +70,7 @@ func (r *ResourceImportReconciler) handleResImpUpdateForClusterNetworkPolicy(ctx
}
}
acnpObj := getMCAntreaClusterPolicy(resImp)
tierObj, tierName := &v1alpha1.Tier{}, acnpObj.Spec.Tier
tierObj, tierName := &v1beta1.Tier{}, acnpObj.Spec.Tier
err = r.localClusterClient.Get(ctx, types.NamespacedName{Namespace: "", Name: tierName}, tierObj)
tierNotFound := apierrors.IsNotFound(err)
if err != nil && !tierNotFound {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"antrea.io/antrea/multicluster/controllers/multicluster/common"
"antrea.io/antrea/multicluster/controllers/multicluster/commonarea"
"antrea.io/antrea/pkg/apis/crd/v1alpha1"
"antrea.io/antrea/pkg/apis/crd/v1beta1"
)

var (
Expand All @@ -55,11 +56,11 @@ var (

allowAction = v1alpha1.RuleActionAllow
dropAction = v1alpha1.RuleActionDrop
securityOpsTier = &v1alpha1.Tier{
securityOpsTier = &v1beta1.Tier{
ObjectMeta: metav1.ObjectMeta{
Name: "securityops",
},
Spec: v1alpha1.TierSpec{
Spec: v1beta1.TierSpec{
Priority: int32(100),
Description: "[READ-ONLY]: System generated SecurityOps Tier",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"antrea.io/antrea/multicluster/controllers/multicluster/common"
"antrea.io/antrea/multicluster/controllers/multicluster/commonarea"
"antrea.io/antrea/pkg/apis/crd/v1alpha1"
"antrea.io/antrea/pkg/apis/crd/v1beta1"
)

var (
Expand Down Expand Up @@ -121,6 +122,7 @@ var (
func init() {
utilruntime.Must(mcsv1alpha1.AddToScheme(scheme))
utilruntime.Must(v1alpha1.AddToScheme(scheme))
utilruntime.Must(v1beta1.AddToScheme(scheme))
utilruntime.Must(k8smcsapi.AddToScheme(scheme))
utilruntime.Must(k8sscheme.AddToScheme(scheme))
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/crd/v1beta1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&AntreaControllerInfoList{},
&AntreaAgentInfo{},
&AntreaAgentInfoList{},
&Tier{},
&TierList{},
)

metav1.AddToGroupVersion(
Expand Down