From 444a801d2b3e58a5ca634b362eada0e0f2a8a741 Mon Sep 17 00:00:00 2001 From: Andrej Petras Date: Thu, 1 Feb 2024 15:35:48 +0100 Subject: [PATCH] feat: migration org.tkit --- .github/workflows/create-new-build.yml | 9 +++++++ pom.xml | 12 +++++++-- ...l => microfrontends.onecx.tkit.org-v1.yml} | 4 +-- .../helm/templates/product-cluster-role.yaml | 2 +- .../client/mappers/ProductStoreMapper.java | 26 ------------------- .../store/mfe/operator/Microfrontend.java | 4 +-- .../mfe/operator/MicrofrontendController.java | 4 +-- .../operator/MicrofrontendEndpointSpec.java | 2 +- .../store/mfe/operator/MicrofrontendSpec.java | 2 +- .../mfe/operator/MicrofrontendStatus.java | 2 +- .../operator/client/ProductStoreService.java | 12 ++++----- .../client/mappers/ProductStoreMapper.java | 13 ++++++++++ src/main/resources/application.properties | 9 ++++++- .../product/store/mfe/test/AbstractTest.java | 4 --- .../MicrofrontendControllerResponseTest.java | 6 ++--- .../operator/MicrofrontendControllerTest.java | 4 +-- .../product/store/mfe/test/AbstractTest.java | 4 +++ 17 files changed, 65 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/create-new-build.yml rename src/main/helm/crds/{microfrontends.onecx.github.io-v1.yml => microfrontends.onecx.tkit.org-v1.yml} (97%) delete mode 100644 src/main/java/io/github/onecx/product/store/mfe/operator/client/mappers/ProductStoreMapper.java rename src/main/java/{io/github => org/tkit}/onecx/product/store/mfe/operator/Microfrontend.java (81%) rename src/main/java/{io/github => org/tkit}/onecx/product/store/mfe/operator/MicrofrontendController.java (96%) rename src/main/java/{io/github => org/tkit}/onecx/product/store/mfe/operator/MicrofrontendEndpointSpec.java (91%) rename src/main/java/{io/github => org/tkit}/onecx/product/store/mfe/operator/MicrofrontendSpec.java (98%) rename src/main/java/{io/github => org/tkit}/onecx/product/store/mfe/operator/MicrofrontendStatus.java (97%) rename src/main/java/{io/github => org/tkit}/onecx/product/store/mfe/operator/client/ProductStoreService.java (66%) create mode 100644 src/main/java/org/tkit/onecx/product/store/mfe/operator/client/mappers/ProductStoreMapper.java delete mode 100644 src/test/java/io/github/onecx/product/store/mfe/test/AbstractTest.java rename src/test/java/{io/github => org/tkit}/onecx/product/store/mfe/operator/MicrofrontendControllerResponseTest.java (87%) rename src/test/java/{io/github => org/tkit}/onecx/product/store/mfe/operator/MicrofrontendControllerTest.java (98%) create mode 100644 src/test/java/org/tkit/onecx/product/store/mfe/test/AbstractTest.java diff --git a/.github/workflows/create-new-build.yml b/.github/workflows/create-new-build.yml new file mode 100644 index 0000000..1404492 --- /dev/null +++ b/.github/workflows/create-new-build.yml @@ -0,0 +1,9 @@ +name: Create new build + +on: + workflow_dispatch: + +jobs: + build: + uses: onecx/ci-common/.github/workflows/create-new-build.yml@v1 + secrets: inherit diff --git a/pom.xml b/pom.xml index e82b5f1..cc9c1b8 100644 --- a/pom.xml +++ b/pom.xml @@ -5,9 +5,9 @@ 4.0.0 - io.github.onecx + org.tkit.onecx onecx-quarkus3-parent - 0.29.0 + 0.31.0 onecx-product-store-mfe-operator @@ -62,6 +62,14 @@ io.quarkus quarkus-rest-client-reactive-jackson + + io.quarkus + quarkus-oidc-client + + + io.quarkus + quarkus-oidc-client-reactive-filter + diff --git a/src/main/helm/crds/microfrontends.onecx.github.io-v1.yml b/src/main/helm/crds/microfrontends.onecx.tkit.org-v1.yml similarity index 97% rename from src/main/helm/crds/microfrontends.onecx.github.io-v1.yml rename to src/main/helm/crds/microfrontends.onecx.tkit.org-v1.yml index 06161ac..840b1ac 100644 --- a/src/main/helm/crds/microfrontends.onecx.github.io-v1.yml +++ b/src/main/helm/crds/microfrontends.onecx.tkit.org-v1.yml @@ -2,9 +2,9 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: microfrontends.onecx.github.io + name: microfrontends.onecx.tkit.org spec: - group: onecx.github.io + group: onecx.tkit.org names: kind: Microfrontend plural: microfrontends diff --git a/src/main/helm/templates/product-cluster-role.yaml b/src/main/helm/templates/product-cluster-role.yaml index 33b0b07..0591ac6 100644 --- a/src/main/helm/templates/product-cluster-role.yaml +++ b/src/main/helm/templates/product-cluster-role.yaml @@ -4,7 +4,7 @@ metadata: name: {{ .Release.Name }}-{{ .Values.app.name }}-cluster-role rules: - apiGroups: - - "onecx.github.io" + - "onecx.tkit.org" resources: - "microfrontends" - "microfrontends/status" diff --git a/src/main/java/io/github/onecx/product/store/mfe/operator/client/mappers/ProductStoreMapper.java b/src/main/java/io/github/onecx/product/store/mfe/operator/client/mappers/ProductStoreMapper.java deleted file mode 100644 index be656d2..0000000 --- a/src/main/java/io/github/onecx/product/store/mfe/operator/client/mappers/ProductStoreMapper.java +++ /dev/null @@ -1,26 +0,0 @@ -package io.github.onecx.product.store.mfe.operator.client.mappers; - -import java.util.Set; -import java.util.stream.Collectors; - -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.Named; - -import gen.io.github.onecx.product.store.mfe.v1.model.UpdateMfeRequest; -import io.github.onecx.product.store.mfe.operator.MicrofrontendSpec; - -@Mapper -public interface ProductStoreMapper { - - @Mapping(target = "classifications", qualifiedByName = "setToString") - UpdateMfeRequest map(MicrofrontendSpec spec); - - @Named("setToString") - default String setToString(Set classifications) { - if (classifications != null && !classifications.isEmpty()) { - return classifications.stream().map(Object::toString).collect(Collectors.joining(",")); - } - return ""; - } -} diff --git a/src/main/java/io/github/onecx/product/store/mfe/operator/Microfrontend.java b/src/main/java/org/tkit/onecx/product/store/mfe/operator/Microfrontend.java similarity index 81% rename from src/main/java/io/github/onecx/product/store/mfe/operator/Microfrontend.java rename to src/main/java/org/tkit/onecx/product/store/mfe/operator/Microfrontend.java index add6487..797e4b3 100644 --- a/src/main/java/io/github/onecx/product/store/mfe/operator/Microfrontend.java +++ b/src/main/java/org/tkit/onecx/product/store/mfe/operator/Microfrontend.java @@ -1,4 +1,4 @@ -package io.github.onecx.product.store.mfe.operator; +package org.tkit.onecx.product.store.mfe.operator; import io.fabric8.kubernetes.api.model.Namespaced; import io.fabric8.kubernetes.client.CustomResource; @@ -6,6 +6,6 @@ import io.fabric8.kubernetes.model.annotation.Version; @Version("v1") -@Group("onecx.github.io") +@Group("onecx.tkit.org") public class Microfrontend extends CustomResource implements Namespaced { } diff --git a/src/main/java/io/github/onecx/product/store/mfe/operator/MicrofrontendController.java b/src/main/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendController.java similarity index 96% rename from src/main/java/io/github/onecx/product/store/mfe/operator/MicrofrontendController.java rename to src/main/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendController.java index 2df258f..aa42894 100644 --- a/src/main/java/io/github/onecx/product/store/mfe/operator/MicrofrontendController.java +++ b/src/main/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendController.java @@ -1,4 +1,4 @@ -package io.github.onecx.product.store.mfe.operator; +package org.tkit.onecx.product.store.mfe.operator; import static io.javaoperatorsdk.operator.api.reconciler.Constants.WATCH_CURRENT_NAMESPACE; @@ -7,8 +7,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.tkit.onecx.product.store.mfe.operator.client.ProductStoreService; -import io.github.onecx.product.store.mfe.operator.client.ProductStoreService; import io.javaoperatorsdk.operator.api.reconciler.*; import io.javaoperatorsdk.operator.processing.event.source.filter.OnAddFilter; import io.javaoperatorsdk.operator.processing.event.source.filter.OnUpdateFilter; diff --git a/src/main/java/io/github/onecx/product/store/mfe/operator/MicrofrontendEndpointSpec.java b/src/main/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendEndpointSpec.java similarity index 91% rename from src/main/java/io/github/onecx/product/store/mfe/operator/MicrofrontendEndpointSpec.java rename to src/main/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendEndpointSpec.java index 9b841c4..4325cfb 100644 --- a/src/main/java/io/github/onecx/product/store/mfe/operator/MicrofrontendEndpointSpec.java +++ b/src/main/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendEndpointSpec.java @@ -1,4 +1,4 @@ -package io.github.onecx.product.store.mfe.operator; +package org.tkit.onecx.product.store.mfe.operator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/src/main/java/io/github/onecx/product/store/mfe/operator/MicrofrontendSpec.java b/src/main/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendSpec.java similarity index 98% rename from src/main/java/io/github/onecx/product/store/mfe/operator/MicrofrontendSpec.java rename to src/main/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendSpec.java index 036dbc7..d7064f7 100644 --- a/src/main/java/io/github/onecx/product/store/mfe/operator/MicrofrontendSpec.java +++ b/src/main/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendSpec.java @@ -1,4 +1,4 @@ -package io.github.onecx.product.store.mfe.operator; +package org.tkit.onecx.product.store.mfe.operator; import java.util.List; import java.util.Set; diff --git a/src/main/java/io/github/onecx/product/store/mfe/operator/MicrofrontendStatus.java b/src/main/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendStatus.java similarity index 97% rename from src/main/java/io/github/onecx/product/store/mfe/operator/MicrofrontendStatus.java rename to src/main/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendStatus.java index 1947285..8588e42 100644 --- a/src/main/java/io/github/onecx/product/store/mfe/operator/MicrofrontendStatus.java +++ b/src/main/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendStatus.java @@ -1,4 +1,4 @@ -package io.github.onecx.product.store.mfe.operator; +package org.tkit.onecx.product.store.mfe.operator; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/src/main/java/io/github/onecx/product/store/mfe/operator/client/ProductStoreService.java b/src/main/java/org/tkit/onecx/product/store/mfe/operator/client/ProductStoreService.java similarity index 66% rename from src/main/java/io/github/onecx/product/store/mfe/operator/client/ProductStoreService.java rename to src/main/java/org/tkit/onecx/product/store/mfe/operator/client/ProductStoreService.java index 0a0b970..d2857b4 100644 --- a/src/main/java/io/github/onecx/product/store/mfe/operator/client/ProductStoreService.java +++ b/src/main/java/org/tkit/onecx/product/store/mfe/operator/client/ProductStoreService.java @@ -1,4 +1,4 @@ -package io.github.onecx.product.store.mfe.operator.client; +package org.tkit.onecx.product.store.mfe.operator.client; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; @@ -6,12 +6,12 @@ import org.eclipse.microprofile.rest.client.inject.RestClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.tkit.onecx.product.store.mfe.operator.Microfrontend; +import org.tkit.onecx.product.store.mfe.operator.MicrofrontendSpec; +import org.tkit.onecx.product.store.mfe.operator.client.mappers.ProductStoreMapper; -import gen.io.github.onecx.product.store.mfe.v1.api.OperatorMfeApi; -import gen.io.github.onecx.product.store.mfe.v1.model.UpdateMfeRequest; -import io.github.onecx.product.store.mfe.operator.Microfrontend; -import io.github.onecx.product.store.mfe.operator.MicrofrontendSpec; -import io.github.onecx.product.store.mfe.operator.client.mappers.ProductStoreMapper; +import gen.org.tkit.onecx.product.store.mfe.v1.api.OperatorMfeApi; +import gen.org.tkit.onecx.product.store.mfe.v1.model.UpdateMfeRequest; @ApplicationScoped public class ProductStoreService { diff --git a/src/main/java/org/tkit/onecx/product/store/mfe/operator/client/mappers/ProductStoreMapper.java b/src/main/java/org/tkit/onecx/product/store/mfe/operator/client/mappers/ProductStoreMapper.java new file mode 100644 index 0000000..6e48b06 --- /dev/null +++ b/src/main/java/org/tkit/onecx/product/store/mfe/operator/client/mappers/ProductStoreMapper.java @@ -0,0 +1,13 @@ +package org.tkit.onecx.product.store.mfe.operator.client.mappers; + +import org.mapstruct.Mapper; +import org.tkit.onecx.product.store.mfe.operator.MicrofrontendSpec; + +import gen.org.tkit.onecx.product.store.mfe.v1.model.UpdateMfeRequest; + +@Mapper +public interface ProductStoreMapper { + + UpdateMfeRequest map(MicrofrontendSpec spec); + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index dc350d8..9caf073 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,10 +1,17 @@ # PROD %prod.quarkus.rest-client.product_store_client.url=http://onecx-product-store-svc:8080 +# OIDC +#quarkus.rest-client.product_store_client.providers=io.quarkus.oidc.client.reactive.filter.OidcClientRequestReactiveFilter +#quarkus.oidc-client.client-id=${quarkus.application.name} +#quarkus.oidc-client.credentials.secret= +#quarkus.oidc-client.auth-server-url= + # BUILD +quarkus.operator-sdk.helm.enabled=true quarkus.openapi-generator.codegen.input-base-dir=target/tmp/openapi quarkus.openapi-generator.codegen.spec.onecx_product_store_operator_mfe_v1_yaml.config-key=product_store_client -quarkus.openapi-generator.codegen.spec.onecx_product_store_operator_mfe_v1_yaml.base-package=gen.io.github.onecx.product.store.mfe.v1 +quarkus.openapi-generator.codegen.spec.onecx_product_store_operator_mfe_v1_yaml.base-package=gen.org.tkit.onecx.product.store.mfe.v1 quarkus.openapi-generator.codegen.spec.onecx_product_store_operator_mfe_v1_yaml.return-response=true # CONFIG diff --git a/src/test/java/io/github/onecx/product/store/mfe/test/AbstractTest.java b/src/test/java/io/github/onecx/product/store/mfe/test/AbstractTest.java deleted file mode 100644 index cefe337..0000000 --- a/src/test/java/io/github/onecx/product/store/mfe/test/AbstractTest.java +++ /dev/null @@ -1,4 +0,0 @@ -package io.github.onecx.product.store.mfe.test; - -public abstract class AbstractTest { -} diff --git a/src/test/java/io/github/onecx/product/store/mfe/operator/MicrofrontendControllerResponseTest.java b/src/test/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendControllerResponseTest.java similarity index 87% rename from src/test/java/io/github/onecx/product/store/mfe/operator/MicrofrontendControllerResponseTest.java rename to src/test/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendControllerResponseTest.java index 06f6af2..b58d275 100644 --- a/src/test/java/io/github/onecx/product/store/mfe/operator/MicrofrontendControllerResponseTest.java +++ b/src/test/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendControllerResponseTest.java @@ -1,4 +1,4 @@ -package io.github.onecx.product.store.mfe.operator; +package org.tkit.onecx.product.store.mfe.operator; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; @@ -8,9 +8,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; +import org.tkit.onecx.product.store.mfe.operator.client.ProductStoreService; +import org.tkit.onecx.product.store.mfe.test.AbstractTest; -import io.github.onecx.product.store.mfe.operator.client.ProductStoreService; -import io.github.onecx.product.store.mfe.test.AbstractTest; import io.javaoperatorsdk.operator.api.reconciler.UpdateControl; import io.quarkus.test.InjectMock; import io.quarkus.test.junit.QuarkusTest; diff --git a/src/test/java/io/github/onecx/product/store/mfe/operator/MicrofrontendControllerTest.java b/src/test/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendControllerTest.java similarity index 98% rename from src/test/java/io/github/onecx/product/store/mfe/operator/MicrofrontendControllerTest.java rename to src/test/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendControllerTest.java index 86082a6..33a99b2 100644 --- a/src/test/java/io/github/onecx/product/store/mfe/operator/MicrofrontendControllerTest.java +++ b/src/test/java/org/tkit/onecx/product/store/mfe/operator/MicrofrontendControllerTest.java @@ -1,4 +1,4 @@ -package io.github.onecx.product.store.mfe.operator; +package org.tkit.onecx.product.store.mfe.operator; import static java.util.concurrent.TimeUnit.SECONDS; import static org.assertj.core.api.Assertions.assertThat; @@ -18,10 +18,10 @@ import org.junit.jupiter.params.provider.MethodSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.tkit.onecx.product.store.mfe.test.AbstractTest; import io.fabric8.kubernetes.api.model.ObjectMetaBuilder; import io.fabric8.kubernetes.client.KubernetesClient; -import io.github.onecx.product.store.mfe.test.AbstractTest; import io.javaoperatorsdk.operator.Operator; import io.quarkus.test.junit.QuarkusTest; diff --git a/src/test/java/org/tkit/onecx/product/store/mfe/test/AbstractTest.java b/src/test/java/org/tkit/onecx/product/store/mfe/test/AbstractTest.java new file mode 100644 index 0000000..6c7dfb5 --- /dev/null +++ b/src/test/java/org/tkit/onecx/product/store/mfe/test/AbstractTest.java @@ -0,0 +1,4 @@ +package org.tkit.onecx.product.store.mfe.test; + +public abstract class AbstractTest { +}