-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Changes from all commits
52c5c63
5b8178b
9f1cc2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* 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. | ||
*/ | ||
package io.fabric8.kubernetes.client; | ||
|
||
import io.fabric8.kubernetes.api.model.autoscaling.v2.HorizontalPodAutoscaler; | ||
import io.fabric8.kubernetes.api.model.autoscaling.v2.HorizontalPodAutoscalerList; | ||
import io.fabric8.kubernetes.client.dsl.MixedOperation; | ||
import io.fabric8.kubernetes.client.dsl.Resource; | ||
|
||
public interface V2AutoscalingAPIGroupDSL extends Client { | ||
MixedOperation<HorizontalPodAutoscaler, HorizontalPodAutoscalerList, Resource<HorizontalPodAutoscaler>> horizontalPodAutoscalers(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* 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. | ||
*/ | ||
package io.fabric8.kubernetes.client.dsl; | ||
|
||
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta2.FlowSchema; | ||
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta2.FlowSchemaList; | ||
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta2.PriorityLevelConfiguration; | ||
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta2.PriorityLevelConfigurationList; | ||
import io.fabric8.kubernetes.client.Client; | ||
|
||
public interface V1beta2FlowControlAPIGroupDSL extends Client { | ||
/** | ||
* DSL entrypoint for flowcontrol.apiserver.k8s.io/v1beta2 FlowSchema | ||
* | ||
* @return {@link NonNamespaceOperation} for FlowSchema resource | ||
*/ | ||
NonNamespaceOperation<FlowSchema, FlowSchemaList, Resource<FlowSchema>> flowSchema(); | ||
|
||
/** | ||
* DSL entrypoint for flowcontrol.apiserver.k8s.io/v1beta2 PriorityLevelConfiguration | ||
* | ||
* @return {@link NonNamespaceOperation} for PriorityLevelConfiguration resource | ||
*/ | ||
NonNamespaceOperation<PriorityLevelConfiguration, PriorityLevelConfigurationList, Resource<PriorityLevelConfiguration>> priorityLevelConfigurations(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* 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. | ||
*/ | ||
package io.fabric8.kubernetes.client; | ||
|
||
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta2.FlowSchema; | ||
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta2.FlowSchemaList; | ||
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta2.PriorityLevelConfiguration; | ||
import io.fabric8.kubernetes.api.model.flowcontrol.v1beta2.PriorityLevelConfigurationList; | ||
import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; | ||
import io.fabric8.kubernetes.client.dsl.Resource; | ||
import io.fabric8.kubernetes.client.dsl.V1beta2FlowControlAPIGroupDSL; | ||
import io.fabric8.kubernetes.client.extension.ClientAdapter; | ||
|
||
public class V1beta2FlowControlAPIGroupClient extends ClientAdapter<V1beta2FlowControlAPIGroupClient> | ||
implements V1beta2FlowControlAPIGroupDSL { | ||
|
||
@Override | ||
public NonNamespaceOperation<FlowSchema, FlowSchemaList, Resource<FlowSchema>> flowSchema() { | ||
return resources(FlowSchema.class, FlowSchemaList.class); | ||
} | ||
|
||
@Override | ||
public NonNamespaceOperation<PriorityLevelConfiguration, PriorityLevelConfigurationList, Resource<PriorityLevelConfiguration>> priorityLevelConfigurations() { | ||
return resources(PriorityLevelConfiguration.class, PriorityLevelConfigurationList.class); | ||
} | ||
|
||
@Override | ||
public V1beta2FlowControlAPIGroupClient newInstance() { | ||
return new V1beta2FlowControlAPIGroupClient(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* 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. | ||
*/ | ||
package io.fabric8.kubernetes.client; | ||
|
||
import io.fabric8.kubernetes.api.model.autoscaling.v2.HorizontalPodAutoscaler; | ||
import io.fabric8.kubernetes.api.model.autoscaling.v2.HorizontalPodAutoscalerList; | ||
import io.fabric8.kubernetes.client.dsl.MixedOperation; | ||
import io.fabric8.kubernetes.client.dsl.Resource; | ||
import io.fabric8.kubernetes.client.extension.ClientAdapter; | ||
|
||
public class V2AutoscalingAPIGroupClient extends ClientAdapter<V2AutoscalingAPIGroupClient> | ||
implements V2AutoscalingAPIGroupDSL { | ||
|
||
@Override | ||
public MixedOperation<HorizontalPodAutoscaler, HorizontalPodAutoscalerList, Resource<HorizontalPodAutoscaler>> horizontalPodAutoscalers() { | ||
return resources(HorizontalPodAutoscaler.class, HorizontalPodAutoscalerList.class); | ||
} | ||
|
||
@Override | ||
public V2AutoscalingAPIGroupClient newInstance() { | ||
return new V2AutoscalingAPIGroupClient(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/** | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* 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. | ||
*/ | ||
package io.fabric8.kubernetes; | ||
|
||
import io.fabric8.junit.jupiter.api.LoadKubernetesManifests; | ||
import io.fabric8.junit.jupiter.api.RequireK8sSupport; | ||
import io.fabric8.kubernetes.api.model.IntOrString; | ||
import io.fabric8.kubernetes.api.model.Pod; | ||
import io.fabric8.kubernetes.api.model.PodBuilder; | ||
import io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudget; | ||
import io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudgetBuilder; | ||
import io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudgetSpecBuilder; | ||
import io.fabric8.kubernetes.client.KubernetesClient; | ||
import io.fabric8.kubernetes.client.readiness.Readiness; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
import static org.awaitility.Awaitility.await; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
@LoadKubernetesManifests("/pod-evict-it.yml") | ||
@RequireK8sSupport(PodDisruptionBudget.class) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Follow-up: update this test to use PodDisruptionBudget v1 instead There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue created: #4436 |
||
class PodEvictIT { | ||
private static final int POD_READY_WAIT_IN_SECONDS = 60; | ||
|
||
KubernetesClient client; | ||
|
||
@Test | ||
void evict() { | ||
Pod pod1 = client.pods().withName("pod-standard").get(); | ||
String pdbScope = pod1.getMetadata().getLabels().get("pdb-scope"); | ||
assertNotNull("pdb-scope label is null. is pod1 misconfigured?", pdbScope); | ||
|
||
PodDisruptionBudget pdb = new PodDisruptionBudgetBuilder() | ||
.withNewMetadata() | ||
.withName("test-pdb") | ||
.endMetadata() | ||
.withSpec( | ||
new PodDisruptionBudgetSpecBuilder() | ||
.withMinAvailable(new IntOrString(1)) | ||
.withNewSelector() | ||
.addToMatchLabels("pdb-scope", pdbScope) | ||
.endSelector() | ||
.build()) | ||
.build(); | ||
|
||
Pod pod2 = new PodBuilder() | ||
.withNewMetadata() | ||
.withName("pod2") | ||
.addToLabels("pdb-scope", pdbScope) | ||
.endMetadata() | ||
.withSpec(pod1.getSpec()) | ||
.build(); | ||
|
||
Pod pod3 = new PodBuilder() | ||
.withNewMetadata() | ||
.withName("pod3") | ||
.addToLabels("pdb-scope", pdbScope) | ||
.endMetadata() | ||
.withSpec(pod1.getSpec()) | ||
.build(); | ||
|
||
client.pods().resource(pod1).waitUntilReady(POD_READY_WAIT_IN_SECONDS, TimeUnit.SECONDS); | ||
|
||
client.pods().resource(pod2).createOrReplace(); | ||
client.pods().resource(pod2).waitUntilReady(POD_READY_WAIT_IN_SECONDS, TimeUnit.SECONDS); | ||
|
||
client.resource(pdb).createOrReplace(); | ||
|
||
// the server needs to process the pdb before the eviction can proceed, so we'll need to wait here | ||
await().atMost(5, TimeUnit.MINUTES) | ||
.until(() -> client.pods().withName(pod2.getMetadata().getName()).evict()); | ||
|
||
// cant evict because only one left | ||
assertFalse(client.pods().resource(pod1).evict()); | ||
// ensure it really is still up | ||
assertTrue(Readiness.getInstance().isReady(client.pods().resource(pod1).fromServer().get())); | ||
|
||
// create another pod to satisfy PDB | ||
client.pods().resource(pod3).createOrReplace(); | ||
client.pods().resource(pod3).waitUntilReady(POD_READY_WAIT_IN_SECONDS, TimeUnit.SECONDS); | ||
|
||
// can now evict | ||
assertTrue(client.pods().resource(pod3).evict()); | ||
} | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue created: #4434