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

update k8s 1.25 validation logic #270

Conversation

everettraven
Copy link
Contributor

@everettraven everettraven commented Oct 26, 2022

Description of the change:

  • Updates validation logic for Kubernetes 1.25 deprecated APIs to also look for deprecated APIs in the following CSV fields:
    • ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.ClusterPermissions[].Rules[]
      • if the resource specified could potentially have a deprecated API create a warning
        • If the resource has been specified in the ClusterServiceVersion.Spec.CustomResourceDefinitions a warning is not raised
    • ClusterServiceVersion.Spec.InstallStrategy.StrategySpec.Permissions[].Rules[]
      • if the resource specified could potentially have a deprecated API create a warning
        • If the resource has been specified in the ClusterServiceVersion.Spec.CustomResourceDefinitions a warning is not raised
    • ClusterServiceVersion.Spec.CustomResourceDefinitions.Owned[].Resources[]
      • if an owned resource is of a deprecated API create an error
    • ClusterServiceVersion.Spec.CustomResourceDefinitions.Owned[].Resources[]
      • if an owned resource is of a deprecated API create an error
  • Updates the test logic and testdata as necessary to verify these changes work as expected

Motivation for the change:

  • Check the CSV fields to see if there are any references to APIs deprecated in Kubernetes 1.25

to look for deprecated k8s APIs in various CSV fields

Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
Copy link
Member

@jmrodri jmrodri left a comment

Choose a reason for hiding this comment

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

/lgtm

for i, desc := range crdDescriptions {
for j, res := range desc.Resources {
resFromKind := fmt.Sprintf("%ss", strings.ToLower(res.Kind))
fmt.Println("XXX resFromKind:", resFromKind)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fmt.Println("XXX resFromKind:", resFromKind)

// Check the Required Resources
crdCheck("Required", csv.Spec.CustomResourceDefinitions.Required)

fmt.Println("XXX resInCsvCrds:", resInCsvCrds)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fmt.Println("XXX resInCsvCrds:", resInCsvCrds)

for j, rule := range perm.Rules {
for _, res := range rule.Resources {
if _, ok := resInCsvCrds[res]; ok {
fmt.Println("XXX resource: ", res, "is in resInCsvCrds map!")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fmt.Println("XXX resource: ", res, "is in resInCsvCrds map!")

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 28, 2022
@jmrodri
Copy link
Member

jmrodri commented Oct 28, 2022

@everettraven should probably remove the XXX debug logs now.

@everettraven
Copy link
Contributor Author

should probably remove the XXX debug logs now.
oops, forgot those haha

Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 28, 2022
@jmrodri
Copy link
Member

jmrodri commented Oct 28, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 28, 2022
@jmrodri
Copy link
Member

jmrodri commented Oct 28, 2022

/approved

@jmrodri
Copy link
Member

jmrodri commented Oct 28, 2022

/approve

@openshift-ci
Copy link

openshift-ci bot commented Oct 28, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: everettraven, jmrodri

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 28, 2022
@openshift-merge-robot openshift-merge-robot merged commit b611f6c into operator-framework:master Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants