From 1d23d2babd00a824de5a088b37677f6f126e325a Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Thu, 4 Jan 2024 23:41:08 +0530 Subject: [PATCH] feat (kubernetes-client-api) : Add DSL for `flowcontrol.apiserver.k8s.io` `v1` apiVersion Add the following DSL entrypoints for KubernetesClient: - `client.flowControl().v1().priorityLevelConfigurations()` - `client.flowControl().v1().flowSchema()` Signed-off-by: Rohan Kumar --- CHANGELOG.md | 7 + .../client/dsl/FlowControlAPIGroupDSL.java | 2 + .../client/dsl/V1FlowControlAPIGroupDSL.java | 38 +++++ .../impl/FlowControlAPIGroupClient.java | 6 + .../client/impl/KubernetesClientImpl.java | 2 + .../impl/V1FlowControlAPIGroupClient.java | 43 ++++++ .../client/mock/V1FlowSchemaTest.java | 141 ++++++++++++++++++ .../V1PriorityLevelConfigurationTest.java | 138 +++++++++++++++++ .../src/test/resources/v1-flowschema.yaml | 36 +++++ .../v1-prioritylevelconfiguration.yaml | 30 ++++ 10 files changed, 443 insertions(+) create mode 100644 kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1FlowControlAPIGroupDSL.java create mode 100644 kubernetes-client/src/main/java/io/fabric8/kubernetes/client/impl/V1FlowControlAPIGroupClient.java create mode 100644 kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1FlowSchemaTest.java create mode 100644 kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1PriorityLevelConfigurationTest.java create mode 100644 kubernetes-tests/src/test/resources/v1-flowschema.yaml create mode 100644 kubernetes-tests/src/test/resources/v1-prioritylevelconfiguration.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cad3d2f96c..ab887f72f84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,12 +15,19 @@ * Fix #5535: Add lombok and sundrio dependencies to the generated bom #### Dependency Upgrade +* Updated Kubernetes Model to Kubernetes `v1.29.0` * Updated okio to version 1.17.6 to avoid CVE-2023-3635 #### New Features * Fix #5608 Support authentication with certificate in exec-credentials #### _**Note**_: Breaking changes +- Deleted resources in Kubernetes 1.29.0 `flowcontrol.apiserver.k8s.io/v1alpha1`, please migrate to `flowcontrol.apiserver.k8s.io/v1` resources (available via `client.flowControl().v1()` DSL) + - `io.fabric8.kubernetes.api.model.flowcontrol.v1alpha1.FlowSchema` removed + - `io.fabric8.kubernetes.api.model.flowcontrol.v1alpha1.PriorityLevelConfiguration` removed +- ClusterCIDR has been removed from Kubernetes 1.29.0 Networking Model + - `io.fabric8.kubernetes.api.model.networking.v1alpha1.ClusterCIDR` removed + - DSL entrypoint `client.network().v1alpha1().clusterCIDRs()` has been removed from KubernetesClient ### 6.9.2 (2023-11-02) diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/FlowControlAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/FlowControlAPIGroupDSL.java index 69bf933c179..970023ffb10 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/FlowControlAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/FlowControlAPIGroupDSL.java @@ -18,6 +18,8 @@ import io.fabric8.kubernetes.client.Client; public interface FlowControlAPIGroupDSL extends Client { + V1FlowControlAPIGroupDSL v1(); + V1beta1FlowControlAPIGroupDSL v1beta1(); V1beta2FlowControlAPIGroupDSL v1beta2(); diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1FlowControlAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1FlowControlAPIGroupDSL.java new file mode 100644 index 00000000000..ca3eb243d09 --- /dev/null +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1FlowControlAPIGroupDSL.java @@ -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.v1.FlowSchema; +import io.fabric8.kubernetes.api.model.flowcontrol.v1.FlowSchemaList; +import io.fabric8.kubernetes.api.model.flowcontrol.v1.PriorityLevelConfiguration; +import io.fabric8.kubernetes.api.model.flowcontrol.v1.PriorityLevelConfigurationList; +import io.fabric8.kubernetes.client.Client; + +public interface V1FlowControlAPIGroupDSL extends Client { + /** + * DSL entrypoint for flowcontrol.apiserver.k8s.io/v1 FlowSchema + * + * @return {@link NonNamespaceOperation} for FlowSchema resource + */ + NonNamespaceOperation> flowSchema(); + + /** + * DSL entrypoint for flowcontrol.apiserver.k8s.io/v1 PriorityLevelConfiguration + * + * @return {@link NonNamespaceOperation} for PriorityLevelConfiguration resource + */ + NonNamespaceOperation> priorityLevelConfigurations(); +} diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/impl/FlowControlAPIGroupClient.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/impl/FlowControlAPIGroupClient.java index d86f06cda5b..19c9919cdcd 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/impl/FlowControlAPIGroupClient.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/impl/FlowControlAPIGroupClient.java @@ -16,6 +16,7 @@ package io.fabric8.kubernetes.client.impl; import io.fabric8.kubernetes.client.dsl.FlowControlAPIGroupDSL; +import io.fabric8.kubernetes.client.dsl.V1FlowControlAPIGroupDSL; import io.fabric8.kubernetes.client.dsl.V1beta1FlowControlAPIGroupDSL; import io.fabric8.kubernetes.client.dsl.V1beta2FlowControlAPIGroupDSL; import io.fabric8.kubernetes.client.dsl.V1beta3FlowControlAPIGroupDSL; @@ -23,6 +24,11 @@ public class FlowControlAPIGroupClient extends ClientAdapter implements FlowControlAPIGroupDSL { + @Override + public V1FlowControlAPIGroupDSL v1() { + return adapt(V1FlowControlAPIGroupClient.class); + } + @Override public V1beta1FlowControlAPIGroupDSL v1beta1() { return adapt(V1beta1FlowControlAPIGroupClient.class); diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/impl/KubernetesClientImpl.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/impl/KubernetesClientImpl.java index 06e082ff2e7..2f4fef91374 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/impl/KubernetesClientImpl.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/impl/KubernetesClientImpl.java @@ -133,6 +133,7 @@ import io.fabric8.kubernetes.client.dsl.V1CertificatesAPIGroupDSL; import io.fabric8.kubernetes.client.dsl.V1DiscoveryAPIGroupDSL; import io.fabric8.kubernetes.client.dsl.V1EventingAPIGroupDSL; +import io.fabric8.kubernetes.client.dsl.V1FlowControlAPIGroupDSL; import io.fabric8.kubernetes.client.dsl.V1PolicyAPIGroupDSL; import io.fabric8.kubernetes.client.dsl.V1SchedulingAPIGroupDSL; import io.fabric8.kubernetes.client.dsl.V1beta1BatchAPIGroupDSL; @@ -234,6 +235,7 @@ protected void registerDefaultAdapters() { adapters.registerClient(V1EventingAPIGroupDSL.class, new V1EventingAPIGroupClient()); adapters.registerClient(V1beta1EventingAPIGroupDSL.class, new V1beta1EventingAPIGroupClient()); adapters.registerClient(FlowControlAPIGroupDSL.class, new FlowControlAPIGroupClient()); + adapters.registerClient(V1FlowControlAPIGroupDSL.class, new V1FlowControlAPIGroupClient()); adapters.registerClient(V1beta1FlowControlAPIGroupDSL.class, new V1beta1FlowControlAPIGroupClient()); adapters.registerClient(V1beta2FlowControlAPIGroupDSL.class, new V1beta2FlowControlAPIGroupClient()); adapters.registerClient(V1beta3FlowControlAPIGroupDSL.class, new V1beta3FlowControlAPIGroupClient()); diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/impl/V1FlowControlAPIGroupClient.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/impl/V1FlowControlAPIGroupClient.java new file mode 100644 index 00000000000..aeba64adcd5 --- /dev/null +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/impl/V1FlowControlAPIGroupClient.java @@ -0,0 +1,43 @@ +/** + * 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.impl; + +import io.fabric8.kubernetes.api.model.flowcontrol.v1.FlowSchema; +import io.fabric8.kubernetes.api.model.flowcontrol.v1.FlowSchemaList; +import io.fabric8.kubernetes.api.model.flowcontrol.v1.PriorityLevelConfiguration; +import io.fabric8.kubernetes.api.model.flowcontrol.v1.PriorityLevelConfigurationList; +import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; +import io.fabric8.kubernetes.client.dsl.Resource; +import io.fabric8.kubernetes.client.dsl.V1FlowControlAPIGroupDSL; +import io.fabric8.kubernetes.client.extension.ClientAdapter; + +public class V1FlowControlAPIGroupClient extends ClientAdapter + implements V1FlowControlAPIGroupDSL { + @Override + public NonNamespaceOperation> flowSchema() { + return resources(FlowSchema.class, FlowSchemaList.class); + } + + @Override + public NonNamespaceOperation> priorityLevelConfigurations() { + return resources(PriorityLevelConfiguration.class, PriorityLevelConfigurationList.class); + } + + @Override + public V1FlowControlAPIGroupClient newInstance() { + return new V1FlowControlAPIGroupClient(); + } +} diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1FlowSchemaTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1FlowSchemaTest.java new file mode 100644 index 00000000000..97750d04fbf --- /dev/null +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1FlowSchemaTest.java @@ -0,0 +1,141 @@ +/** + * 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.mock; + +import io.fabric8.kubernetes.api.model.HasMetadata; +import io.fabric8.kubernetes.api.model.flowcontrol.v1.FlowSchema; +import io.fabric8.kubernetes.api.model.flowcontrol.v1.FlowSchemaBuilder; +import io.fabric8.kubernetes.api.model.flowcontrol.v1.FlowSchemaList; +import io.fabric8.kubernetes.api.model.flowcontrol.v1.FlowSchemaListBuilder; +import io.fabric8.kubernetes.client.KubernetesClient; +import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; +import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; +import org.assertj.core.api.AssertionsForClassTypes; +import org.junit.jupiter.api.Test; + +import java.net.HttpURLConnection; +import java.util.List; + +import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; + +@EnableKubernetesMockClient +class V1FlowSchemaTest { + private KubernetesMockServer server; + private KubernetesClient client; + + @Test + void load() { + List items = client.load(getClass().getResourceAsStream("/v1-flowschema.yaml")).items(); + assertThat(items).isNotNull().hasSize(1); + AssertionsForClassTypes.assertThat(items.get(0)) + .isInstanceOf(FlowSchema.class) + .hasFieldOrPropertyWithValue("metadata.name", "health-for-strangers"); + } + + @Test + void get() { + // Given + server.expect().get().withPath("/apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/exempt") + .andReturn(HttpURLConnection.HTTP_OK, createFlowSchema("exempt")) + .once(); + + // When + FlowSchema flowSchema = client.flowControl().v1().flowSchema().withName("exempt").get(); + + // Then + AssertionsForClassTypes.assertThat(flowSchema) + .isNotNull() + .hasFieldOrPropertyWithValue("metadata.name", "exempt"); + } + + @Test + void list() { + // Given + server.expect().get().withPath("/apis/flowcontrol.apiserver.k8s.io/v1/flowschemas") + .andReturn(HttpURLConnection.HTTP_OK, new FlowSchemaListBuilder() + .addToItems(createFlowSchema("exempt")) + .build()) + .once(); + + // When + FlowSchemaList flowSchemas = client.flowControl().v1().flowSchema().list(); + + // Then + AssertionsForClassTypes.assertThat(flowSchemas).isNotNull(); + assertThat(flowSchemas.getItems()).hasSize(1); + AssertionsForClassTypes.assertThat(flowSchemas.getItems().get(0)) + .hasFieldOrPropertyWithValue("metadata.name", "exempt"); + } + + @Test + void create() { + // Given + FlowSchema flowSchema = createFlowSchema("flowschema1"); + server.expect().post().withPath("/apis/flowcontrol.apiserver.k8s.io/v1/flowschemas") + .andReturn(HttpURLConnection.HTTP_OK, flowSchema) + .once(); + + // When + FlowSchema createdFlowSchema = client.flowControl().v1().flowSchema().resource(flowSchema).create(); + + // Then + AssertionsForClassTypes.assertThat(createdFlowSchema).isNotNull(); + AssertionsForClassTypes.assertThat(createdFlowSchema) + .hasFieldOrPropertyWithValue("metadata.name", "flowschema1"); + } + + @Test + void delete() { + // Given + FlowSchema flowSchema = createFlowSchema("flowschema1"); + server.expect().delete().withPath("/apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/flowschema1") + .andReturn(HttpURLConnection.HTTP_OK, flowSchema) + .once(); + + // When + boolean isDeleted = client.flowControl().v1().flowSchema().withName("flowschema1").delete().size() == 1; + + // Then + AssertionsForClassTypes.assertThat(isDeleted).isTrue(); + } + + private FlowSchema createFlowSchema(String name) { + return new FlowSchemaBuilder() + .withNewMetadata().withName(name).endMetadata() + .withNewSpec() + .withMatchingPrecedence(1) + .withNewPriorityLevelConfiguration() + .withName(name) + .endPriorityLevelConfiguration() + .addNewRule() + .addNewNonResourceRule() + .addToNonResourceURLs("*") + .addToVerbs("*") + .endNonResourceRule() + .addNewResourceRule() + .addToApiGroups("*") + .endResourceRule() + .addNewSubject() + .withNewGroup() + .withName("system:masters") + .endGroup() + .withKind("Group") + .endSubject() + .endRule() + .endSpec() + .build(); + } +} diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1PriorityLevelConfigurationTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1PriorityLevelConfigurationTest.java new file mode 100644 index 00000000000..f2e1cb827f4 --- /dev/null +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1PriorityLevelConfigurationTest.java @@ -0,0 +1,138 @@ +/** + * 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.mock; + +import io.fabric8.kubernetes.api.model.HasMetadata; +import io.fabric8.kubernetes.api.model.flowcontrol.v1.PriorityLevelConfiguration; +import io.fabric8.kubernetes.api.model.flowcontrol.v1.PriorityLevelConfigurationBuilder; +import io.fabric8.kubernetes.api.model.flowcontrol.v1.PriorityLevelConfigurationList; +import io.fabric8.kubernetes.api.model.flowcontrol.v1.PriorityLevelConfigurationListBuilder; +import io.fabric8.kubernetes.client.KubernetesClient; +import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; +import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; +import org.assertj.core.api.AssertionsForClassTypes; +import org.junit.jupiter.api.Test; + +import java.net.HttpURLConnection; +import java.util.List; + +import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; + +@EnableKubernetesMockClient +class V1PriorityLevelConfigurationTest { + private KubernetesMockServer server; + private KubernetesClient client; + + @Test + void load() { + List items = client.load(getClass().getResourceAsStream("/v1-prioritylevelconfiguration.yaml")).items(); + assertThat(items).isNotNull().hasSize(1); + AssertionsForClassTypes.assertThat(items.get(0)) + .isInstanceOf(PriorityLevelConfiguration.class) + .hasFieldOrPropertyWithValue("metadata.name", "my-priority-level-configuration"); + } + + @Test + void get() { + // Given + server.expect().get().withPath("/apis/flowcontrol.apiserver.k8s.io/v1/prioritylevelconfigurations/plc1") + .andReturn(HttpURLConnection.HTTP_OK, createPriorityLevelConfiguration("plc1")) + .once(); + + // When + PriorityLevelConfiguration priorityLevelConfiguration = client.flowControl().v1().priorityLevelConfigurations() + .withName("plc1").get(); + + // Then + AssertionsForClassTypes.assertThat(priorityLevelConfiguration) + .isNotNull() + .hasFieldOrPropertyWithValue("metadata.name", "plc1"); + } + + @Test + void list() { + // Given + server.expect().get().withPath("/apis/flowcontrol.apiserver.k8s.io/v1/prioritylevelconfigurations") + .andReturn(HttpURLConnection.HTTP_OK, new PriorityLevelConfigurationListBuilder() + .addToItems(createPriorityLevelConfiguration("exempt")) + .build()) + .once(); + + // When + PriorityLevelConfigurationList priorityLevelConfigurations = client.flowControl().v1().priorityLevelConfigurations() + .list(); + + // Then + AssertionsForClassTypes.assertThat(priorityLevelConfigurations).isNotNull(); + assertThat(priorityLevelConfigurations.getItems()).hasSize(1); + AssertionsForClassTypes.assertThat(priorityLevelConfigurations.getItems().get(0)) + .hasFieldOrPropertyWithValue("metadata.name", "exempt"); + } + + @Test + void create() { + // Given + PriorityLevelConfiguration priorityLevelConfiguration = createPriorityLevelConfiguration("prioritylevelconfiguration1"); + server.expect().post().withPath("/apis/flowcontrol.apiserver.k8s.io/v1/prioritylevelconfigurations") + .andReturn(HttpURLConnection.HTTP_OK, priorityLevelConfiguration) + .once(); + + // When + PriorityLevelConfiguration createdPriorityLevelConfiguration = client.flowControl().v1().priorityLevelConfigurations() + .resource(priorityLevelConfiguration).create(); + + // Then + AssertionsForClassTypes.assertThat(createdPriorityLevelConfiguration).isNotNull(); + AssertionsForClassTypes.assertThat(createdPriorityLevelConfiguration) + .hasFieldOrPropertyWithValue("metadata.name", "prioritylevelconfiguration1"); + } + + @Test + void delete() { + // Given + PriorityLevelConfiguration priorityLevelConfiguration = createPriorityLevelConfiguration("prioritylevelconfiguration1"); + server.expect().delete() + .withPath("/apis/flowcontrol.apiserver.k8s.io/v1/prioritylevelconfigurations/prioritylevelconfiguration1") + .andReturn(HttpURLConnection.HTTP_OK, priorityLevelConfiguration) + .once(); + + // When + boolean isDeleted = client.flowControl().v1().priorityLevelConfigurations().withName("prioritylevelconfiguration1") + .delete().size() == 1; + + // Then + AssertionsForClassTypes.assertThat(isDeleted).isTrue(); + } + + private PriorityLevelConfiguration createPriorityLevelConfiguration(String name) { + return new PriorityLevelConfigurationBuilder() + .withNewMetadata().withName(name).endMetadata() + .withNewSpec() + .withNewLimited() + .withNewLimitResponse() + .withNewQueuing() + .withHandSize(3) + .withQueueLengthLimit(50) + .withQueues(16) + .endQueuing() + .withType("Queue") + .endLimitResponse() + .endLimited() + .withType("Limited") + .endSpec() + .build(); + } +} diff --git a/kubernetes-tests/src/test/resources/v1-flowschema.yaml b/kubernetes-tests/src/test/resources/v1-flowschema.yaml new file mode 100644 index 00000000000..32c72bae187 --- /dev/null +++ b/kubernetes-tests/src/test/resources/v1-flowschema.yaml @@ -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. +# + +apiVersion: flowcontrol.apiserver.k8s.io/v1 +kind: FlowSchema +metadata: + name: health-for-strangers +spec: + matchingPrecedence: 1000 + priorityLevelConfiguration: + name: exempt + rules: + - nonResourceRules: + - nonResourceURLs: + - "/healthz" + - "/livez" + - "/readyz" + verbs: + - "*" + subjects: + - kind: Group + group: + name: "system:unauthenticated" diff --git a/kubernetes-tests/src/test/resources/v1-prioritylevelconfiguration.yaml b/kubernetes-tests/src/test/resources/v1-prioritylevelconfiguration.yaml new file mode 100644 index 00000000000..c6934928764 --- /dev/null +++ b/kubernetes-tests/src/test/resources/v1-prioritylevelconfiguration.yaml @@ -0,0 +1,30 @@ +# +# 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. +# + +apiVersion: flowcontrol.apiserver.k8s.io/v1 +kind: PriorityLevelConfiguration +metadata: + name: my-priority-level-configuration +spec: + type: Limited + limited: + assuredConcurrencyShares: 5 + limitResponse: + queuing: + handSize: 4 + queueLengthLimit: 50 + queues: 16 + type: Queue