From dbf1afd5057ce072404e0a3290de03316a65c1d4 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Wed, 4 Oct 2023 19:11:43 +0530 Subject: [PATCH] feat (openshift-client-api) : Add DSL for new OpenShift 4.13.12 resources to OpenShiftClient (#5286) Add DSL support for the following endpoints: - openShiftClient.metal3RemediationTemplates() - openShiftClient.metal3Remediations() - openShiftClient.projectHelmChartRepositories() - openShiftClient.operatorHub().olmConfigs() - openShiftClient.config().imageTagMirrorSets() - openShiftClient.config().imageDigestMirrorSets() - openShiftClient.machine().controlPlaneMachineSets() Signed-off-by: Rohan Kumar --- .../mock/ControlPlaneMachineSetTest.java | 137 ++++++++++++++++++ .../server/mock/ImageDigestMirrorSetTest.java | 99 +++++++++++++ .../server/mock/ImageTagMirrorSetTest.java | 99 +++++++++++++ .../mock/Metal3RemediationTemplateTest.java | 129 +++++++++++++++++ .../server/mock/Metal3RemediationTest.java | 120 +++++++++++++++ .../client/server/mock/OLMConfigTest.java | 97 +++++++++++++ .../mock/ProjectHelmChartRepositoryTest.java | 120 +++++++++++++++ .../NamespacedOpenShiftClientAdapter.java | 21 +++ .../openshift/client/OpenShiftClient.java | 27 ++++ .../dsl/OpenShiftConfigAPIGroupDSL.java | 18 +++ .../dsl/OpenShiftMachineAPIGroupDSL.java | 9 ++ .../dsl/OpenShiftOperatorHubAPIGroupDSL.java | 9 ++ .../client/impl/OpenShiftClientImpl.java | 21 +++ .../impl/OpenShiftConfigAPIGroupClient.java | 14 ++ .../impl/OpenShiftMachineAPIGroupClient.java | 7 + .../OpenShiftOperatorHubAPIGroupClient.java | 7 + 16 files changed, 934 insertions(+) create mode 100644 kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ControlPlaneMachineSetTest.java create mode 100644 kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageDigestMirrorSetTest.java create mode 100644 kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageTagMirrorSetTest.java create mode 100644 kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/Metal3RemediationTemplateTest.java create mode 100644 kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/Metal3RemediationTest.java create mode 100644 kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/OLMConfigTest.java create mode 100644 kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ProjectHelmChartRepositoryTest.java diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ControlPlaneMachineSetTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ControlPlaneMachineSetTest.java new file mode 100644 index 00000000000..9c0c0967841 --- /dev/null +++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ControlPlaneMachineSetTest.java @@ -0,0 +1,137 @@ +/** + * 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.openshift.client.server.mock; + +import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; +import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; +import io.fabric8.openshift.api.model.machine.v1.ControlPlaneMachineSet; +import io.fabric8.openshift.api.model.machine.v1.ControlPlaneMachineSetBuilder; +import io.fabric8.openshift.api.model.machine.v1.ControlPlaneMachineSetList; +import io.fabric8.openshift.api.model.machine.v1.ControlPlaneMachineSetListBuilder; +import io.fabric8.openshift.client.OpenShiftClient; +import org.junit.jupiter.api.Test; + +import java.net.HttpURLConnection; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +@EnableKubernetesMockClient +class ControlPlaneMachineSetTest { + KubernetesMockServer server; + OpenShiftClient client; + + @Test + void create() { + // Given + ControlPlaneMachineSet controlPlaneMachineSet = getControlPlaneMachineSet(); + server.expect().post() + .withPath("/apis/machine.openshift.io/v1/namespaces/ns1/controlplanemachinesets") + .andReturn(HttpURLConnection.HTTP_OK, controlPlaneMachineSet) + .once(); + + // When + controlPlaneMachineSet = client.machine().controlPlaneMachineSets().inNamespace("ns1").resource(controlPlaneMachineSet) + .create(); + + // Then + assertNotNull(controlPlaneMachineSet); + assertEquals("cluster", controlPlaneMachineSet.getMetadata().getName()); + } + + @Test + void get() { + // Given + server.expect().get() + .withPath("/apis/machine.openshift.io/v1/namespaces/ns1/controlplanemachinesets/cluster") + .andReturn(HttpURLConnection.HTTP_OK, getControlPlaneMachineSet()) + .once(); + + // When + ControlPlaneMachineSet controlPlaneMachineSet = client.machine().controlPlaneMachineSets().inNamespace("ns1") + .withName("cluster").get(); + + // Then + assertNotNull(controlPlaneMachineSet); + assertEquals("cluster", controlPlaneMachineSet.getMetadata().getName()); + } + + @Test + void list() { + // Given + server.expect().get() + .withPath("/apis/machine.openshift.io/v1/namespaces/ns1/controlplanemachinesets") + .andReturn(HttpURLConnection.HTTP_OK, + new ControlPlaneMachineSetListBuilder().withItems(getControlPlaneMachineSet()).build()) + .once(); + + // When + ControlPlaneMachineSetList controlPlaneMachineSetList = client.machine().controlPlaneMachineSets().inNamespace("ns1") + .list(); + + // Then + assertNotNull(controlPlaneMachineSetList); + assertNotNull(controlPlaneMachineSetList.getItems()); + assertEquals(1, controlPlaneMachineSetList.getItems().size()); + } + + @Test + void delete() { + // Given + server.expect().delete() + .withPath("/apis/machine.openshift.io/v1/namespaces/ns1/controlplanemachinesets/cluster") + .andReturn(HttpURLConnection.HTTP_OK, getControlPlaneMachineSet()) + .once(); + + // When + boolean deleted = client.machine().controlPlaneMachineSets().inNamespace("ns1").withName("cluster").delete().size() == 1; + + // Then + assertTrue(deleted); + } + + private ControlPlaneMachineSet getControlPlaneMachineSet() { + return new ControlPlaneMachineSetBuilder() + .withNewMetadata() + .withName("cluster") + .endMetadata() + .withNewSpec() + .withReplicas(3) + .withState("Active") + .withNewStrategy().withType("RollingUpdate").endStrategy() + .withNewSelector() + .addToMatchLabels("machine.openshift.io/cluster-api-machine-role", "master") + .addToMatchLabels("machine.openshift.io/cluster-api-machine-type", "master") + .endSelector() + .withNewTemplate() + .withMachineType("machines_v1beta1_machine_openshift_io") + .withNewMachinesV1beta1MachineOpenshiftIo() + .withNewMetadata() + .addToLabels("machine.openshift.io/cluster-api-machine-role", "master") + .addToLabels("machine.openshift.io/cluster-api-machine-type", "master") + .addToLabels("machine.openshift.io/cluster-api-cluster", "cluster") + .endMetadata() + .withNewSpec() + .withNewProviderSpec() + .endProviderSpec() + .endSpec() + .endMachinesV1beta1MachineOpenshiftIo() + .endTemplate() + .endSpec() + .build(); + } +} diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageDigestMirrorSetTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageDigestMirrorSetTest.java new file mode 100644 index 00000000000..204ce626392 --- /dev/null +++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageDigestMirrorSetTest.java @@ -0,0 +1,99 @@ +/** + * 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.openshift.client.server.mock; + +import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; +import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; +import io.fabric8.openshift.api.model.config.v1.ImageDigestMirrorSet; +import io.fabric8.openshift.api.model.config.v1.ImageDigestMirrorSetBuilder; +import io.fabric8.openshift.api.model.config.v1.ImageDigestMirrorSetList; +import io.fabric8.openshift.api.model.config.v1.ImageDigestMirrorSetListBuilder; +import io.fabric8.openshift.client.OpenShiftClient; +import org.junit.jupiter.api.Test; + +import java.net.HttpURLConnection; + +import static org.assertj.core.api.Assertions.assertThat; + +@EnableKubernetesMockClient +class ImageDigestMirrorSetTest { + private OpenShiftClient client; + private KubernetesMockServer server; + + @Test + void get() { + // Given + server.expect().get().withPath("/apis/config.openshift.io/v1/imagedigestmirrorsets/test-get") + .andReturn(HttpURLConnection.HTTP_OK, createNewImageDigestMirrorSet("test-get")) + .once(); + + // When + ImageDigestMirrorSet imageDigestMirrorSet = client.config().imageDigestMirrorSets().withName("test-get").get(); + + // Then + assertThat(imageDigestMirrorSet) + .isNotNull() + .hasFieldOrPropertyWithValue("metadata.name", "test-get"); + } + + @Test + void list() { + // Given + server.expect().get().withPath("/apis/config.openshift.io/v1/imagedigestmirrorsets") + .andReturn(HttpURLConnection.HTTP_OK, new ImageDigestMirrorSetListBuilder() + .addToItems(createNewImageDigestMirrorSet("test-list")) + .build()) + .once(); + + // When + ImageDigestMirrorSetList imageDigestMirrorSetList = client.config().imageDigestMirrorSets().list(); + + // Then + assertThat(imageDigestMirrorSetList).isNotNull(); + assertThat(imageDigestMirrorSetList.getItems()).hasSize(1); + assertThat(imageDigestMirrorSetList.getItems().get(0)) + .hasFieldOrPropertyWithValue("metadata.name", "test-list"); + } + + @Test + void delete() { + // Given + server.expect().delete().withPath("/apis/config.openshift.io/v1/imagedigestmirrorsets/cluster") + .andReturn(HttpURLConnection.HTTP_OK, createNewImageDigestMirrorSet("cluster")) + .once(); + + // When + boolean isDeleted = client.config().imageDigestMirrorSets().withName("cluster").delete().size() == 1; + + // Then + assertThat(isDeleted).isTrue(); + } + + private ImageDigestMirrorSet createNewImageDigestMirrorSet(String name) { + return new ImageDigestMirrorSetBuilder() + .withNewMetadata() + .withName(name) + .endMetadata() + .withNewSpec() + .addNewImageDigestMirror() + .withMirrors("example.com/example/ubi-minimal") + .withSource("registry.access.redhat.com/ubi9/ubi-minimal") + .withMirrorSourcePolicy("AllowContactingSource") + .endImageDigestMirror() + .endSpec() + .build(); + } +} diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageTagMirrorSetTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageTagMirrorSetTest.java new file mode 100644 index 00000000000..a150f5d9f33 --- /dev/null +++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageTagMirrorSetTest.java @@ -0,0 +1,99 @@ +/** + * 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.openshift.client.server.mock; + +import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; +import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; +import io.fabric8.openshift.api.model.config.v1.ImageTagMirrorSet; +import io.fabric8.openshift.api.model.config.v1.ImageTagMirrorSetBuilder; +import io.fabric8.openshift.api.model.config.v1.ImageTagMirrorSetList; +import io.fabric8.openshift.api.model.config.v1.ImageTagMirrorSetListBuilder; +import io.fabric8.openshift.client.OpenShiftClient; +import org.junit.jupiter.api.Test; + +import java.net.HttpURLConnection; + +import static org.assertj.core.api.Assertions.assertThat; + +@EnableKubernetesMockClient +class ImageTagMirrorSetTest { + private OpenShiftClient client; + private KubernetesMockServer server; + + @Test + void get() { + // Given + server.expect().get().withPath("/apis/config.openshift.io/v1/imagetagmirrorsets/test-get") + .andReturn(HttpURLConnection.HTTP_OK, createNewImageTagMirrorSet("test-get")) + .once(); + + // When + ImageTagMirrorSet imageTagMirrorSet = client.config().imageTagMirrorSets().withName("test-get").get(); + + // Then + assertThat(imageTagMirrorSet) + .isNotNull() + .hasFieldOrPropertyWithValue("metadata.name", "test-get"); + } + + @Test + void list() { + // Given + server.expect().get().withPath("/apis/config.openshift.io/v1/imagetagmirrorsets") + .andReturn(HttpURLConnection.HTTP_OK, new ImageTagMirrorSetListBuilder() + .addToItems(createNewImageTagMirrorSet("test-list")) + .build()) + .once(); + + // When + ImageTagMirrorSetList imageTagMirrorSetList = client.config().imageTagMirrorSets().list(); + + // Then + assertThat(imageTagMirrorSetList).isNotNull(); + assertThat(imageTagMirrorSetList.getItems()).hasSize(1); + assertThat(imageTagMirrorSetList.getItems().get(0)) + .hasFieldOrPropertyWithValue("metadata.name", "test-list"); + } + + @Test + void delete() { + // Given + server.expect().delete().withPath("/apis/config.openshift.io/v1/imagetagmirrorsets/cluster") + .andReturn(HttpURLConnection.HTTP_OK, createNewImageTagMirrorSet("cluster")) + .once(); + + // When + boolean isDeleted = client.config().imageTagMirrorSets().withName("cluster").delete().size() == 1; + + // Then + assertThat(isDeleted).isTrue(); + } + + private ImageTagMirrorSet createNewImageTagMirrorSet(String name) { + return new ImageTagMirrorSetBuilder() + .withNewMetadata() + .withName(name) + .endMetadata() + .withNewSpec() + .addNewImageTagMirror() + .withMirrors("example.com/example/ubi-minimal") + .withSource("registry.access.redhat.com/ubi9/ubi-minimal") + .withMirrorSourcePolicy("AllowContactingSource") + .endImageTagMirror() + .endSpec() + .build(); + } +} diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/Metal3RemediationTemplateTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/Metal3RemediationTemplateTest.java new file mode 100644 index 00000000000..0b764c70e46 --- /dev/null +++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/Metal3RemediationTemplateTest.java @@ -0,0 +1,129 @@ +/** + * 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.openshift.client.server.mock; + +import io.fabric8.kubernetes.api.model.Duration; +import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; +import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplate; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplateBuilder; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplateList; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplateListBuilder; +import io.fabric8.openshift.client.OpenShiftClient; +import org.junit.jupiter.api.Test; + +import java.net.HttpURLConnection; +import java.text.ParseException; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +@EnableKubernetesMockClient +class Metal3RemediationTemplateTest { + KubernetesMockServer server; + OpenShiftClient client; + + @Test + void create() throws ParseException { + // Given + Metal3RemediationTemplate metal3RemediationTemplate = getMetal3RemediationTemplate(); + server.expect().post() + .withPath("/apis/infrastructure.cluster.x-k8s.io/v1beta1/namespaces/ns1/metal3remediationtemplates") + .andReturn(HttpURLConnection.HTTP_OK, metal3RemediationTemplate) + .once(); + + // When + metal3RemediationTemplate = client.metal3RemediationTemplates().inNamespace("ns1").resource(metal3RemediationTemplate) + .create(); + + // Then + assertNotNull(metal3RemediationTemplate); + assertEquals("test-remediation-template", metal3RemediationTemplate.getMetadata().getName()); + } + + @Test + void get() throws ParseException { + // Given + server.expect().get() + .withPath( + "/apis/infrastructure.cluster.x-k8s.io/v1beta1/namespaces/ns1/metal3remediationtemplates/test-remediation-template") + .andReturn(HttpURLConnection.HTTP_OK, getMetal3RemediationTemplate()) + .once(); + + // When + Metal3RemediationTemplate controlPlaneMachineSet = client.metal3RemediationTemplates().inNamespace("ns1") + .withName("test-remediation-template").get(); + + // Then + assertNotNull(controlPlaneMachineSet); + assertEquals("test-remediation-template", controlPlaneMachineSet.getMetadata().getName()); + } + + @Test + void list() throws ParseException { + // Given + server.expect().get() + .withPath("/apis/infrastructure.cluster.x-k8s.io/v1beta1/namespaces/ns1/metal3remediationtemplates") + .andReturn(HttpURLConnection.HTTP_OK, + new Metal3RemediationTemplateListBuilder().withItems(getMetal3RemediationTemplate()).build()) + .once(); + + // When + Metal3RemediationTemplateList controlPlaneMachineSetList = client.metal3RemediationTemplates().inNamespace("ns1").list(); + + // Then + assertNotNull(controlPlaneMachineSetList); + assertNotNull(controlPlaneMachineSetList.getItems()); + assertEquals(1, controlPlaneMachineSetList.getItems().size()); + } + + @Test + void delete() throws ParseException { + // Given + server.expect().delete() + .withPath( + "/apis/infrastructure.cluster.x-k8s.io/v1beta1/namespaces/ns1/metal3remediationtemplates/test-remediation-template") + .andReturn(HttpURLConnection.HTTP_OK, getMetal3RemediationTemplate()) + .once(); + + // When + boolean deleted = client.metal3RemediationTemplates().inNamespace("ns1").withName("test-remediation-template").delete() + .size() == 1; + + // Then + assertTrue(deleted); + } + + private Metal3RemediationTemplate getMetal3RemediationTemplate() throws ParseException { + return new Metal3RemediationTemplateBuilder() + .withNewMetadata() + .withName("test-remediation-template") + .endMetadata() + .withNewSpec() + .withNewTemplate() + .withNewSpec() + .withNewStrategy() + .withTimeout(Duration.parse("5s")) + .withRetryLimit(5) + .withType("Done") + .endStrategy() + .endSpec() + .endTemplate() + .endSpec() + .build(); + } +} diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/Metal3RemediationTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/Metal3RemediationTest.java new file mode 100644 index 00000000000..e1c8177c7ba --- /dev/null +++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/Metal3RemediationTest.java @@ -0,0 +1,120 @@ +/** + * 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.openshift.client.server.mock; + +import io.fabric8.kubernetes.api.model.Duration; +import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; +import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3Remediation; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationBuilder; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationList; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationListBuilder; +import io.fabric8.openshift.client.OpenShiftClient; +import org.junit.jupiter.api.Test; + +import java.net.HttpURLConnection; +import java.text.ParseException; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +@EnableKubernetesMockClient +class Metal3RemediationTest { + KubernetesMockServer server; + OpenShiftClient client; + + @Test + void create() throws ParseException { + // Given + Metal3Remediation metal3Remediation = getMetal3Remediation(); + server.expect().post() + .withPath("/apis/infrastructure.cluster.x-k8s.io/v1beta1/namespaces/ns1/metal3remediations") + .andReturn(HttpURLConnection.HTTP_OK, metal3Remediation) + .once(); + + // When + metal3Remediation = client.metal3Remediations().inNamespace("ns1").resource(metal3Remediation).create(); + + // Then + assertNotNull(metal3Remediation); + assertEquals("test-remediation", metal3Remediation.getMetadata().getName()); + } + + @Test + void get() throws ParseException { + // Given + server.expect().get() + .withPath("/apis/infrastructure.cluster.x-k8s.io/v1beta1/namespaces/ns1/metal3remediations/test-remediation") + .andReturn(HttpURLConnection.HTTP_OK, getMetal3Remediation()) + .once(); + + // When + Metal3Remediation controlPlaneMachineSet = client.metal3Remediations().inNamespace("ns1").withName("test-remediation") + .get(); + + // Then + assertNotNull(controlPlaneMachineSet); + assertEquals("test-remediation", controlPlaneMachineSet.getMetadata().getName()); + } + + @Test + void list() throws ParseException { + // Given + server.expect().get() + .withPath("/apis/infrastructure.cluster.x-k8s.io/v1beta1/namespaces/ns1/metal3remediations") + .andReturn(HttpURLConnection.HTTP_OK, new Metal3RemediationListBuilder().withItems(getMetal3Remediation()).build()) + .once(); + + // When + Metal3RemediationList controlPlaneMachineSetList = client.metal3Remediations().inNamespace("ns1").list(); + + // Then + assertNotNull(controlPlaneMachineSetList); + assertNotNull(controlPlaneMachineSetList.getItems()); + assertEquals(1, controlPlaneMachineSetList.getItems().size()); + } + + @Test + void delete() throws ParseException { + // Given + server.expect().delete() + .withPath("/apis/infrastructure.cluster.x-k8s.io/v1beta1/namespaces/ns1/metal3remediations/test-remediation") + .andReturn(HttpURLConnection.HTTP_OK, getMetal3Remediation()) + .once(); + + // When + boolean deleted = client.metal3Remediations().inNamespace("ns1").withName("test-remediation").delete().size() == 1; + + // Then + assertTrue(deleted); + } + + private Metal3Remediation getMetal3Remediation() throws ParseException { + return new Metal3RemediationBuilder() + .withNewMetadata() + .withName("test-remediation") + .endMetadata() + .withNewSpec() + .withNewStrategy() + .withTimeout(Duration.parse("5s")) + .withRetryLimit(5) + .withType("Done") + .endStrategy() + .endSpec() + .build(); + } +} diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/OLMConfigTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/OLMConfigTest.java new file mode 100644 index 00000000000..ab23e9c1d8d --- /dev/null +++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/OLMConfigTest.java @@ -0,0 +1,97 @@ +/** + * 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.openshift.client.server.mock; + +import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; +import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; +import io.fabric8.openshift.api.model.operatorhub.v1.OLMConfig; +import io.fabric8.openshift.api.model.operatorhub.v1.OLMConfigBuilder; +import io.fabric8.openshift.api.model.operatorhub.v1.OLMConfigList; +import io.fabric8.openshift.api.model.operatorhub.v1.OLMConfigListBuilder; +import io.fabric8.openshift.client.OpenShiftClient; +import org.junit.jupiter.api.Test; + +import java.net.HttpURLConnection; + +import static org.assertj.core.api.Assertions.assertThat; + +@EnableKubernetesMockClient +class OLMConfigTest { + private OpenShiftClient client; + private KubernetesMockServer server; + + @Test + void get() { + // Given + server.expect().get().withPath("/apis/operators.coreos.com/v1/olmconfigs/test-get") + .andReturn(HttpURLConnection.HTTP_OK, createNewOLMConfig("test-get")) + .once(); + + // When + OLMConfig olmConfig = client.operatorHub().olmConfigs().withName("test-get").get(); + + // Then + assertThat(olmConfig) + .isNotNull() + .hasFieldOrPropertyWithValue("metadata.name", "test-get"); + } + + @Test + void list() { + // Given + server.expect().get().withPath("/apis/operators.coreos.com/v1/olmconfigs") + .andReturn(HttpURLConnection.HTTP_OK, new OLMConfigListBuilder() + .addToItems(createNewOLMConfig("test-list")) + .build()) + .once(); + + // When + OLMConfigList olmConfigList = client.operatorHub().olmConfigs().list(); + + // Then + assertThat(olmConfigList).isNotNull(); + assertThat(olmConfigList.getItems()).hasSize(1); + assertThat(olmConfigList.getItems().get(0)) + .hasFieldOrPropertyWithValue("metadata.name", "test-list"); + } + + @Test + void delete() { + // Given + server.expect().delete().withPath("/apis/operators.coreos.com/v1/olmconfigs/cluster") + .andReturn(HttpURLConnection.HTTP_OK, createNewOLMConfig("cluster")) + .once(); + + // When + boolean isDeleted = client.operatorHub().olmConfigs().withName("cluster").delete().size() == 1; + + // Then + assertThat(isDeleted).isTrue(); + } + + private OLMConfig createNewOLMConfig(String name) { + return new OLMConfigBuilder() + .withNewMetadata() + .withName(name) + .endMetadata() + .withNewSpec() + .withNewFeatures() + .withDisableCopiedCSVs(true) + .endFeatures() + .endSpec() + .build(); + } +} diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ProjectHelmChartRepositoryTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ProjectHelmChartRepositoryTest.java new file mode 100644 index 00000000000..1998e6e5a4d --- /dev/null +++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ProjectHelmChartRepositoryTest.java @@ -0,0 +1,120 @@ +/** + * 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.openshift.client.server.mock; + +import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; +import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; +import io.fabric8.openshift.api.model.ProjectHelmChartRepository; +import io.fabric8.openshift.api.model.ProjectHelmChartRepositoryBuilder; +import io.fabric8.openshift.api.model.ProjectHelmChartRepositoryList; +import io.fabric8.openshift.api.model.ProjectHelmChartRepositoryListBuilder; +import io.fabric8.openshift.client.OpenShiftClient; +import org.junit.jupiter.api.Test; + +import java.net.HttpURLConnection; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +@EnableKubernetesMockClient +class ProjectHelmChartRepositoryTest { + KubernetesMockServer server; + OpenShiftClient client; + + @Test + void create() { + // Given + ProjectHelmChartRepository projectHelmChartRepository = getProjectHelmChartRepository(); + server.expect().post() + .withPath("/apis/helm.openshift.io/v1beta1/namespaces/ns1/projecthelmchartrepositories") + .andReturn(HttpURLConnection.HTTP_OK, projectHelmChartRepository) + .once(); + + // When + projectHelmChartRepository = client.projectHelmChartRepositories().inNamespace("ns1").resource(projectHelmChartRepository) + .create(); + + // Then + assertNotNull(projectHelmChartRepository); + assertEquals("foo", projectHelmChartRepository.getMetadata().getName()); + } + + @Test + void get() { + // Given + server.expect().get() + .withPath("/apis/helm.openshift.io/v1beta1/namespaces/ns1/projecthelmchartrepositories/foo") + .andReturn(HttpURLConnection.HTTP_OK, getProjectHelmChartRepository()) + .once(); + + // When + ProjectHelmChartRepository projectHelmChartRepository = client.projectHelmChartRepositories().inNamespace("ns1") + .withName("foo").get(); + + // Then + assertNotNull(projectHelmChartRepository); + assertEquals("foo", projectHelmChartRepository.getMetadata().getName()); + } + + @Test + void list() { + // Given + server.expect().get() + .withPath("/apis/helm.openshift.io/v1beta1/namespaces/ns1/projecthelmchartrepositories") + .andReturn(HttpURLConnection.HTTP_OK, + new ProjectHelmChartRepositoryListBuilder().withItems(getProjectHelmChartRepository()).build()) + .once(); + + // When + ProjectHelmChartRepositoryList projectHelmChartRepositoryList = client.projectHelmChartRepositories().inNamespace("ns1") + .list(); + + // Then + assertNotNull(projectHelmChartRepositoryList); + assertNotNull(projectHelmChartRepositoryList.getItems()); + assertEquals(1, projectHelmChartRepositoryList.getItems().size()); + } + + @Test + void delete() { + // Given + server.expect().delete() + .withPath("/apis/helm.openshift.io/v1beta1/namespaces/ns1/projecthelmchartrepositories/foo") + .andReturn(HttpURLConnection.HTTP_OK, getProjectHelmChartRepository()) + .once(); + + // When + boolean deleted = client.projectHelmChartRepositories().inNamespace("ns1").withName("foo").delete().size() == 1; + + // Then + assertTrue(deleted); + } + + private ProjectHelmChartRepository getProjectHelmChartRepository() { + return new ProjectHelmChartRepositoryBuilder() + .withNewMetadata() + .withName("foo") + .endMetadata() + .withNewSpec() + .withName("azure-sample-repo") + .withNewConnectionConfig() + .withUrl("https://example.com/Azure-Samples/helm-charts/master/docs") + .endConnectionConfig() + .endSpec() + .build(); + } +} diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/NamespacedOpenShiftClientAdapter.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/NamespacedOpenShiftClientAdapter.java index 686c16e066b..e8dbfb92ec0 100644 --- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/NamespacedOpenShiftClientAdapter.java +++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/NamespacedOpenShiftClientAdapter.java @@ -81,6 +81,8 @@ import io.fabric8.openshift.api.model.PodSecurityPolicyReview; import io.fabric8.openshift.api.model.PodSecurityPolicySelfSubjectReview; import io.fabric8.openshift.api.model.PodSecurityPolicySubjectReview; +import io.fabric8.openshift.api.model.ProjectHelmChartRepository; +import io.fabric8.openshift.api.model.ProjectHelmChartRepositoryList; import io.fabric8.openshift.api.model.RangeAllocation; import io.fabric8.openshift.api.model.RangeAllocationList; import io.fabric8.openshift.api.model.ResourceAccessReview; @@ -117,6 +119,10 @@ import io.fabric8.openshift.api.model.miscellaneous.imageregistry.operator.v1.ConfigList; import io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.BareMetalHost; import io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.BareMetalHostList; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3Remediation; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationList; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplate; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplateList; import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.EgressRouter; import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.EgressRouterList; import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.OperatorPKI; @@ -266,6 +272,16 @@ public NonNamespaceOperation> metal3Remediations() { + return getClient().metal3Remediations(); + } + + @Override + public MixedOperation> metal3RemediationTemplates() { + return getClient().metal3RemediationTemplates(); + } + @Override public MixedOperation> networkAttachmentDefinitions() { return getClient().networkAttachmentDefinitions(); @@ -326,6 +342,11 @@ public ProjectOperation projects() { return getClient().projects(); } + @Override + public MixedOperation> projectHelmChartRepositories() { + return getClient().projectHelmChartRepositories(); + } + @Override public ProjectRequestOperation projectrequests() { return getClient().projectrequests(); diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/OpenShiftClient.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/OpenShiftClient.java index 78ddb467ed7..9b2b75f7a54 100644 --- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/OpenShiftClient.java +++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/OpenShiftClient.java @@ -88,6 +88,8 @@ import io.fabric8.openshift.api.model.PodSecurityPolicyReview; import io.fabric8.openshift.api.model.PodSecurityPolicySelfSubjectReview; import io.fabric8.openshift.api.model.PodSecurityPolicySubjectReview; +import io.fabric8.openshift.api.model.ProjectHelmChartRepository; +import io.fabric8.openshift.api.model.ProjectHelmChartRepositoryList; import io.fabric8.openshift.api.model.RangeAllocation; import io.fabric8.openshift.api.model.RangeAllocationList; import io.fabric8.openshift.api.model.ResourceAccessReview; @@ -123,6 +125,10 @@ import io.fabric8.openshift.api.model.miscellaneous.cncf.cni.v1.NetworkAttachmentDefinitionList; import io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.BareMetalHost; import io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.BareMetalHostList; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3Remediation; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationList; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplate; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplateList; import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.EgressRouter; import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.EgressRouterList; import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.OperatorPKI; @@ -442,6 +448,20 @@ public interface OpenShiftClient extends KubernetesClient, SupportTestingClient */ NonNamespaceOperation> imageRegistryOperatorConfigs(); + /** + * API entrypoint for Metal3Remediation (infrastructure.cluster.x-k8s.io/v1beta1) + * + * @return {@link MixedOperation} for Metal3Remediation + */ + MixedOperation> metal3Remediations(); + + /** + * API entrypoint for Metal3RemediationTemplate (infrastructure.cluster.x-k8s.io/v1beta1) + * + * @return {@link MixedOperation} for Metal3RemediationTemplate + */ + MixedOperation> metal3RemediationTemplates(); + /** * API entrypoint for accessing NetworkAttachmentDefinition(k8s.cni.cncf.io/v1) * @@ -519,6 +539,13 @@ public interface OpenShiftClient extends KubernetesClient, SupportTestingClient */ ProjectOperation projects(); + /** + * API entrypoint for handling ProjectHelmChartRepository (helm.openshift.io/v1beta1) + * + * @return {@link NonNamespaceOperation} for ProjectHelmChartRepository + */ + MixedOperation> projectHelmChartRepositories(); + /** * API entrypoint for accessing ProjectRequest operations(project.openshift.io/v1) * diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftConfigAPIGroupDSL.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftConfigAPIGroupDSL.java index 7907171189a..88bf44fb4b4 100644 --- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftConfigAPIGroupDSL.java +++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftConfigAPIGroupDSL.java @@ -37,7 +37,11 @@ import io.fabric8.openshift.api.model.config.v1.Image; import io.fabric8.openshift.api.model.config.v1.ImageContentPolicy; import io.fabric8.openshift.api.model.config.v1.ImageContentPolicyList; +import io.fabric8.openshift.api.model.config.v1.ImageDigestMirrorSet; +import io.fabric8.openshift.api.model.config.v1.ImageDigestMirrorSetList; import io.fabric8.openshift.api.model.config.v1.ImageList; +import io.fabric8.openshift.api.model.config.v1.ImageTagMirrorSet; +import io.fabric8.openshift.api.model.config.v1.ImageTagMirrorSetList; import io.fabric8.openshift.api.model.config.v1.Infrastructure; import io.fabric8.openshift.api.model.config.v1.InfrastructureList; import io.fabric8.openshift.api.model.config.v1.Ingress; @@ -140,6 +144,20 @@ public interface OpenShiftConfigAPIGroupDSL extends Client { */ NonNamespaceOperation> imageContentPolicies(); + /** + * API entrypoint for ImageDigestMirrorSet related operations (config.openshift.io/v1) + * + * @return {@link NonNamespaceOperation} for ImageDigestMirrorSet + */ + NonNamespaceOperation> imageDigestMirrorSets(); + + /** + * API entrypoint for ImageTagMirrorSet related operations (config.openshift.io/v1) + * + * @return {@link NonNamespaceOperation} for ImageTagMirrorSet + */ + NonNamespaceOperation> imageTagMirrorSets(); + /** * API entrypoint for Network (config.openshift.io/v1) * diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftMachineAPIGroupDSL.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftMachineAPIGroupDSL.java index 9bc9b54af32..c85c77b9d91 100644 --- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftMachineAPIGroupDSL.java +++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftMachineAPIGroupDSL.java @@ -18,6 +18,8 @@ import io.fabric8.kubernetes.client.Client; import io.fabric8.kubernetes.client.dsl.MixedOperation; import io.fabric8.kubernetes.client.dsl.Resource; +import io.fabric8.openshift.api.model.machine.v1.ControlPlaneMachineSet; +import io.fabric8.openshift.api.model.machine.v1.ControlPlaneMachineSetList; import io.fabric8.openshift.api.model.machine.v1beta1.Machine; import io.fabric8.openshift.api.model.machine.v1beta1.MachineHealthCheck; import io.fabric8.openshift.api.model.machine.v1beta1.MachineHealthCheckList; @@ -46,4 +48,11 @@ public interface OpenShiftMachineAPIGroupDSL extends Client { * @return {@link MixedOperation} for MachineHealthCheck */ MixedOperation> machineHealthChecks(); + + /** + * DSL entrypoint for ControlPlaneMachineSet (machine.openshift.io/v1) + * + * @return {@link MixedOperation} for ControlPlaneMachineSet + */ + MixedOperation> controlPlaneMachineSets(); } diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftOperatorHubAPIGroupDSL.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftOperatorHubAPIGroupDSL.java index 0a2a6e2fe1e..a51dc6d668a 100644 --- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftOperatorHubAPIGroupDSL.java +++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftOperatorHubAPIGroupDSL.java @@ -21,6 +21,8 @@ import io.fabric8.kubernetes.client.dsl.Resource; import io.fabric8.openshift.api.model.operatorhub.lifecyclemanager.v1.PackageManifest; import io.fabric8.openshift.api.model.operatorhub.lifecyclemanager.v1.PackageManifestList; +import io.fabric8.openshift.api.model.operatorhub.v1.OLMConfig; +import io.fabric8.openshift.api.model.operatorhub.v1.OLMConfigList; import io.fabric8.openshift.api.model.operatorhub.v1.Operator; import io.fabric8.openshift.api.model.operatorhub.v1.OperatorCondition; import io.fabric8.openshift.api.model.operatorhub.v1.OperatorConditionList; @@ -92,4 +94,11 @@ public interface OpenShiftOperatorHubAPIGroupDSL extends Client { * @return NonNamespaceOperation for Operator */ NonNamespaceOperation> operators(); + + /** + * API entrypoint for OLMConfig (operators.coreos.com/v1) + * + * @return NonNamespaceOperation for OLMConfig + */ + NonNamespaceOperation> olmConfigs(); } diff --git a/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftClientImpl.java b/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftClientImpl.java index 5c88dac52dd..61c0992d5fd 100644 --- a/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftClientImpl.java +++ b/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftClientImpl.java @@ -92,6 +92,8 @@ import io.fabric8.openshift.api.model.PodSecurityPolicyReview; import io.fabric8.openshift.api.model.PodSecurityPolicySelfSubjectReview; import io.fabric8.openshift.api.model.PodSecurityPolicySubjectReview; +import io.fabric8.openshift.api.model.ProjectHelmChartRepository; +import io.fabric8.openshift.api.model.ProjectHelmChartRepositoryList; import io.fabric8.openshift.api.model.ProjectRequest; import io.fabric8.openshift.api.model.RangeAllocation; import io.fabric8.openshift.api.model.RangeAllocationList; @@ -130,6 +132,10 @@ import io.fabric8.openshift.api.model.miscellaneous.imageregistry.operator.v1.ConfigList; import io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.BareMetalHost; import io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.BareMetalHostList; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3Remediation; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationList; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplate; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplateList; import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.EgressRouter; import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.EgressRouterList; import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.OperatorPKI; @@ -354,6 +360,16 @@ public NonNamespaceOperation> metal3Remediations() { + return resources(Metal3Remediation.class, Metal3RemediationList.class); + } + + @Override + public MixedOperation> metal3RemediationTemplates() { + return resources(Metal3RemediationTemplate.class, Metal3RemediationTemplateList.class); + } + @Override public MixedOperation> networkAttachmentDefinitions() { return resources(NetworkAttachmentDefinition.class, NetworkAttachmentDefinitionList.class); @@ -411,6 +427,11 @@ public ProjectOperation projects() { return new ProjectOperationsImpl(this); } + @Override + public MixedOperation> projectHelmChartRepositories() { + return resources(ProjectHelmChartRepository.class, ProjectHelmChartRepositoryList.class); + } + @Override public OpenShiftQuotaAPIGroupDSL quotas() { return adapt(OpenShiftQuotaAPIGroupClient.class); diff --git a/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftConfigAPIGroupClient.java b/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftConfigAPIGroupClient.java index 19bc478b0bd..702f022cbc9 100644 --- a/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftConfigAPIGroupClient.java +++ b/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftConfigAPIGroupClient.java @@ -37,7 +37,11 @@ import io.fabric8.openshift.api.model.config.v1.Image; import io.fabric8.openshift.api.model.config.v1.ImageContentPolicy; import io.fabric8.openshift.api.model.config.v1.ImageContentPolicyList; +import io.fabric8.openshift.api.model.config.v1.ImageDigestMirrorSet; +import io.fabric8.openshift.api.model.config.v1.ImageDigestMirrorSetList; import io.fabric8.openshift.api.model.config.v1.ImageList; +import io.fabric8.openshift.api.model.config.v1.ImageTagMirrorSet; +import io.fabric8.openshift.api.model.config.v1.ImageTagMirrorSetList; import io.fabric8.openshift.api.model.config.v1.Infrastructure; import io.fabric8.openshift.api.model.config.v1.InfrastructureList; import io.fabric8.openshift.api.model.config.v1.Ingress; @@ -124,6 +128,16 @@ public NonNamespaceOperation> imageDigestMirrorSets() { + return resources(ImageDigestMirrorSet.class, ImageDigestMirrorSetList.class); + } + + @Override + public NonNamespaceOperation> imageTagMirrorSets() { + return resources(ImageTagMirrorSet.class, ImageTagMirrorSetList.class); + } + @Override public NonNamespaceOperation> networks() { return resources(Network.class, NetworkList.class); diff --git a/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftMachineAPIGroupClient.java b/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftMachineAPIGroupClient.java index 80d85c56ab1..1ee5ee6c526 100644 --- a/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftMachineAPIGroupClient.java +++ b/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftMachineAPIGroupClient.java @@ -18,6 +18,8 @@ import io.fabric8.kubernetes.client.dsl.MixedOperation; import io.fabric8.kubernetes.client.dsl.Resource; import io.fabric8.kubernetes.client.extension.ClientAdapter; +import io.fabric8.openshift.api.model.machine.v1.ControlPlaneMachineSet; +import io.fabric8.openshift.api.model.machine.v1.ControlPlaneMachineSetList; import io.fabric8.openshift.api.model.machine.v1beta1.Machine; import io.fabric8.openshift.api.model.machine.v1beta1.MachineHealthCheck; import io.fabric8.openshift.api.model.machine.v1beta1.MachineHealthCheckList; @@ -44,6 +46,11 @@ public MixedOperation> controlPlaneMachineSets() { + return resources(ControlPlaneMachineSet.class, ControlPlaneMachineSetList.class); + } + @Override public OpenShiftMachineAPIGroupClient newInstance() { return new OpenShiftMachineAPIGroupClient(); diff --git a/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftOperatorHubAPIGroupClient.java b/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftOperatorHubAPIGroupClient.java index 192334cb98c..04087cf6269 100644 --- a/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftOperatorHubAPIGroupClient.java +++ b/openshift-client/src/main/java/io/fabric8/openshift/client/impl/OpenShiftOperatorHubAPIGroupClient.java @@ -21,6 +21,8 @@ import io.fabric8.kubernetes.client.extension.ClientAdapter; import io.fabric8.openshift.api.model.operatorhub.lifecyclemanager.v1.PackageManifest; import io.fabric8.openshift.api.model.operatorhub.lifecyclemanager.v1.PackageManifestList; +import io.fabric8.openshift.api.model.operatorhub.v1.OLMConfig; +import io.fabric8.openshift.api.model.operatorhub.v1.OLMConfigList; import io.fabric8.openshift.api.model.operatorhub.v1.Operator; import io.fabric8.openshift.api.model.operatorhub.v1.OperatorCondition; import io.fabric8.openshift.api.model.operatorhub.v1.OperatorConditionList; @@ -80,6 +82,11 @@ public NonNamespaceOperation> operato return resources(Operator.class, OperatorList.class); } + @Override + public NonNamespaceOperation> olmConfigs() { + return resources(OLMConfig.class, OLMConfigList.class); + } + @Override public OpenShiftOperatorHubAPIGroupClient newInstance() { return new OpenShiftOperatorHubAPIGroupClient();