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

Add openAPI schema for AntreaAgentInfo and AntreaControllerInfo #5206

Merged
merged 1 commit into from
Jul 21, 2023

Conversation

ceclinux
Copy link
Contributor

@ceclinux ceclinux commented Jul 5, 2023

No description provided.

@luolanzone luolanzone added api-review Categorizes an issue or PR as actively needing an API review. action/release-note Indicates a PR that should be included in release notes. labels Jul 5, 2023
@luolanzone luolanzone added this to the Antrea v1.13 release milestone Jul 5, 2023
@ceclinux ceclinux force-pushed the upgrade-aci-and-aai-api branch 6 times, most recently from 68b647b to 656a58b Compare July 6, 2023 06:52
docs/api.md Outdated
Comment on lines 29 to 30
| `AntreaAgentInfo` | v1 | v1.0.0 | N/A | N/A |
| `AntreaControllerInfo` | v1 | v1.0.0 | N/A | N/A |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `AntreaAgentInfo` | v1 | v1.0.0 | N/A | N/A |
| `AntreaControllerInfo` | v1 | v1.0.0 | N/A | N/A |
| `AntreaAgentInfo` | v1 | v1.13.0 | N/A | N/A |
| `AntreaControllerInfo` | v1 | v1.13.0 | N/A | N/A |

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

docs/api.md Outdated
Comment on lines 67 to 68
| `AntreaAgentInfo` | v1beta1 | v1.0.0 | v1.13.0 | v2.0.0 |
| `AntreaControllerInfo` | v1beta1 | v1.0.0 | v1.13.0 | v2.0.0 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `AntreaAgentInfo` | v1beta1 | v1.0.0 | v1.13.0 | v2.0.0 |
| `AntreaControllerInfo` | v1beta1 | v1.0.0 | v1.13.0 | v2.0.0 |
| `AntreaAgentInfo` | v1beta1 | v1.0.0 | v1.13.0 | N/A |
| `AntreaControllerInfo` | v1beta1 | v1.0.0 | v1.13.0 | N/A |

We are probably unable to remove them in 2.0.0 considering we need to follow the K8s deprecation policy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -146,7 +150,7 @@ function generate_antrea_client_code {
--input-dirs "${ANTREA_PKG}/pkg/apis/controlplane/v1beta2" \
--input-dirs "${ANTREA_PKG}/pkg/apis/system/v1beta1" \
--input-dirs "${ANTREA_PKG}/pkg/apis/stats/v1alpha1" \
--input-dirs "${ANTREA_PKG}/pkg/apis/crd/v1beta1" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this shouldn't be removed since we still have v1beta1 crd.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -0,0 +1,20 @@
// Copyright 2019 Antrea Authors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Copyright 2019 Antrea Authors
// Copyright 2023 Antrea Authors

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -0,0 +1,56 @@
// Copyright 2019 Antrea Authors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tnqn should this api be promoted to v1 as controller/agent info?

@@ -2880,8 +2880,8 @@ func retryOnConnectionLostError(backoff wait.Backoff, fn func() error) error {
}

func (data *TestData) checkAntreaAgentInfo(interval time.Duration, timeout time.Duration, name string) error {
err := wait.PollImmediate(interval, timeout, func() (bool, error) {
aai, err := data.crdClient.CrdV1beta1().AntreaAgentInfos().Get(context.TODO(), name, metav1.GetOptions{})
err := wait.Poll(interval, timeout, func() (bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the method changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@ceclinux ceclinux force-pushed the upgrade-aci-and-aai-api branch 2 times, most recently from f93c864 to a140121 Compare July 12, 2023 09:51
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we discussed this API promotion, we said we would add a correct openAPI schema as part of the CRD definition. This PR does not do that. See #5068

@antoninbas
Copy link
Contributor

antoninbas commented Jul 17, 2023

@jianjuns @tnqn just confirming that you are ok with promoting AntreaAgentInfo / AntreaControllerInfo to v1 (instead of another beta version, e.g., v1beta2)?

@jianjuns
Copy link
Contributor

I feel more comfortable with beta, but no strong opinion.

@tnqn
Copy link
Member

tnqn commented Jul 18, 2023

I don't have strong opinion either. If we don't really have a strong reason to do it, should we just enhance the validation in this release? It seems fine to me to just enhance the schema in-place?

@antoninbas
Copy link
Contributor

I don't have strong opinion either. If we don't really have a strong reason to do it, should we just enhance the validation in this release? It seems fine to me to just enhance the schema in-place?

I'm fine with staying in beta and adding the correct openAPI schema. I feel like even if we only add the schema, it is better to increment the version number (v1beta1 -> v1beta2). But then again, this is essentially a "read-only" API, so it probably doesn't matter very much.

@ceclinux
Copy link
Contributor Author

I will update this pr with two modifications:

  1. promoting AntreaAgentInfo / AntreaControllerInfo to v1beta2 instead of v1
  2. add a correct openAPI schema
    Please leave more comments if you have other ideas.Thanks @antoninbas @jianjuns @tnqn

@tnqn
Copy link
Member

tnqn commented Jul 18, 2023

Introducing a new version still comes with some cost: all clients including antrea-ui and nephe need to update their code, but there is no usage change, and no stage change like other API promotions (from alpha to beta). Given the enhancement doesn't break anything and there is no real benefit from v1beta2, should we just keep v1beta1?

@antoninbas
Copy link
Contributor

Introducing a new version still comes with some cost: all clients including antrea-ui and nephe need to update their code, but there is no usage change, and no stage change like other API promotions (from alpha to beta). Given the enhancement doesn't break anything and there is no real benefit from v1beta2, should we just keep v1beta1?

Given this API usage (read-only for clients), I am fine with this

@ceclinux ceclinux changed the title Promote AntreaAgentInfo and AntreaControllerInfo API to v1. Add openAPI schema for AntreaAgentInfo and AntreaControllerInfo Jul 20, 2023
@ceclinux
Copy link
Contributor Author

/test-multicast-e2e

1 similar comment
@ceclinux
Copy link
Contributor Author

/test-multicast-e2e

@ceclinux ceclinux changed the title Add openAPI schema for AntreaAgentInfo and AntreaControllerInfo [WIP]Add openAPI schema for AntreaAgentInfo and AntreaControllerInfo Jul 20, 2023
@ceclinux ceclinux force-pushed the upgrade-aci-and-aai-api branch 2 times, most recently from bd886e9 to 62ba983 Compare July 20, 2023 14:18
@ceclinux ceclinux changed the title [WIP]Add openAPI schema for AntreaAgentInfo and AntreaControllerInfo Add openAPI schema for AntreaAgentInfo and AntreaControllerInfo Jul 20, 2023
items:
type: string
apiCABundle:
type: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should also have a format: byte property, given that the Go type is []byte and it will be base64-encoded when it is serialized.

see https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

type: string
flowTable:
type: object
x-kubernetes-preserve-unknown-fields: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would this work here instead:

flowTable:
  type: object
  additionalProperties:
    type: number
    format: int32

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated. Number represents floating point numbers. I think it should be type: integer?

Comment on lines 65 to 75
networkPolicyNum:
type: integer
addressGroupNum:
type: integer
appliedToGroupNum:
type: integer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add format: in32 for these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more comment, otherwise lgtm

Comment on lines 61 to 68
networkPolicyNum:
type: integer
addressGroupNum:
type: integer
appliedToGroupNum:
type: integer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are missing format: int32

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated. Thanks

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@antoninbas
Copy link
Contributor

/test-all

@antoninbas antoninbas merged commit 396cbd6 into antrea-io:main Jul 21, 2023
@ceclinux ceclinux deleted the upgrade-aci-and-aai-api branch July 25, 2023 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/release-note Indicates a PR that should be included in release notes. api-review Categorizes an issue or PR as actively needing an API review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants