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

fix (kubernetes-model-generator) : Update Kubernetes Model to v1.25.0 (#4347) #4377

Merged

Conversation

rohanKanojia
Copy link
Member

@rohanKanojia rohanKanojia commented Sep 1, 2022

Description

Fix #4327 #4347

  • Update Kubernetes Model to v1.25.0
    • clusterName removed from ObjectMeta
    • Add a test for CustomResourceDefinition validation expression language
    • Add resources in k8s.io/api/flowcontrol/v1beta2 API (they were present earlier too, just realized it a bit late)
    • Add autoscaling/v2 HorizontalPodAutoscaler model and DSL
  • Force containerd/containerd, docker/distribution and
    opencontainers/image-spec to not use vulnerable versions (Fix Dependabot reported alerts in go modules #4327)
  • Kubernetes Model Generator script currently converted all byte, integer lists to string (since there is no byte reflect.type in GoLang , it's alias to uint8). This seems to be incorrectly generating PodFailurePolicyOnExitCodesRequirement.values field as String. Add a switch case in javaType() to treat reflect.Uint8 to byte. Limit javaTypeArrayList() to only convert byte array/ reflect.Uint8 array to string.
  • Update E2E test matrix suite to add Kubernetes 1.25.0

Signed-off-by: Rohan Kumar rohaan@redhat.com

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

@rohanKanojia rohanKanojia linked an issue Sep 1, 2022 that may be closed by this pull request
2 tasks
@rohanKanojia rohanKanojia force-pushed the pr/issue4327-kubernetes-model-generator branch 5 times, most recently from f39133d to e64c331 Compare September 2, 2022 06:20
@rohanKanojia rohanKanojia marked this pull request as ready for review September 2, 2022 07:35
@yelowstar
Copy link

Please add support for apiVersion autoscaling/v2 since now is using Fabric8 Kubernetes Client 5.11.2 which doesn't seem to have it.

@rohanKanojia rohanKanojia force-pushed the pr/issue4327-kubernetes-model-generator branch from e64c331 to f977a14 Compare September 7, 2022 16:11
…ert integer array to string

Kubernetes Model Generator script currently converted all byte, integer
lists to string (since there is no byte reflect.type in GoLang , it's
alias to `uint8`). This seems to be incorrectly generating
PodFailurePolicyOnExitCodesRequirement.values field as String.

Add a switch case in `javaType()` to treat `reflect.Uint8` to byte. Limit
`javaTypeArrayList()` to only convert byte array/ `reflect.Uint8` array
to string.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
+ Update Kubernetes Model to v1.25.0
+ Add autoscaling/v2 HorizontalPodAutoscaler model and DSL
+ Force `containerd/containerd`, `docker/distribution` and
  `opencontainers/image-spec` to not use vulnerable versions (fabric8io#4327)

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
Run integration tests on Kubernetes 1.25.0 as well

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@rohanKanojia rohanKanojia force-pushed the pr/issue4327-kubernetes-model-generator branch from f977a14 to 9f1cc2d Compare September 9, 2022 10:53
@sonarcloud
Copy link

sonarcloud bot commented Sep 9, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

36.4% 36.4% Coverage
0.0% 0.0% Duplication

@@ -29,6 +30,7 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

@LoadKubernetesManifests("/cronjob-it.yml")
@RequireK8sSupport(CronJob.class)
Copy link
Member

Choose a reason for hiding this comment

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

Follow-up update this test to use CronJob v1 instead

Copy link
Member

Choose a reason for hiding this comment

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

Issue created: #4434

import static org.junit.jupiter.api.Assertions.assertTrue;

@LoadKubernetesManifests("/pod-evict-it.yml")
@RequireK8sSupport(PodDisruptionBudget.class)
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason why this new test is based on v1beta1 of PodDisruptionBudget?

Copy link
Member Author

Choose a reason for hiding this comment

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

This isn't a new test. This was earlier part of PodIT . This test was breaking on Kubernetes 1.25 hence I moved it to separate class with a RequireK8sSupport condition

Copy link
Member

Choose a reason for hiding this comment

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

Follow-up: update this test to use PodDisruptionBudget v1 instead

Copy link
Member

Choose a reason for hiding this comment

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

Issue created: #4436

@manusa manusa added this to the 6.2.0 milestone Sep 21, 2022
@manusa manusa merged commit 962de1d into fabric8io:master Sep 21, 2022
@rohanKanojia rohanKanojia deleted the pr/issue4327-kubernetes-model-generator branch September 21, 2022 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade Fabric8 Kubernetes Model to Kubernetes 1.25.0 Fix Dependabot reported alerts in go modules
4 participants