diff --git a/pom.xml b/pom.xml index 07d5cc5..7a82e4d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,9 +5,9 @@ 4.0.0 - io.github.onecx + org.tkit.onecx onecx-quarkus3-parent - 0.26.0 + 0.31.0 onecx-permission-operator @@ -62,7 +62,15 @@ io.quarkus quarkus-rest-client-reactive-jackson - + + io.quarkus + quarkus-oidc-client + + + io.quarkus + quarkus-oidc-client-reactive-filter + + org.mapstruct diff --git a/src/main/helm/crds/permissions.onecx.github.io-v1.yml b/src/main/helm/crds/permissions.onecx.github.io-v1.yml deleted file mode 100644 index 56da198..0000000 --- a/src/main/helm/crds/permissions.onecx.github.io-v1.yml +++ /dev/null @@ -1,50 +0,0 @@ -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: permissions.onecx.github.io -spec: - group: onecx.github.io - names: - kind: Permission - plural: permissions - singular: permission - scope: Namespaced - versions: - - name: v1 - schema: - openAPIV3Schema: - properties: - spec: - properties: - appId: - type: string - permissions: - additionalProperties: - additionalProperties: - type: string - type: object - type: object - type: object - status: - properties: - appId: - type: string - message: - type: string - observedGeneration: - type: integer - response-code: - type: integer - status: - enum: - - ERROR - - UNDEFINED - - UPDATED - type: string - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/src/main/helm/crds/permissions.onecx.tkit.org-v1.yml b/src/main/helm/crds/permissions.onecx.tkit.org-v1.yml new file mode 100644 index 0000000..947be67 --- /dev/null +++ b/src/main/helm/crds/permissions.onecx.tkit.org-v1.yml @@ -0,0 +1,54 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: permissions.onecx.tkit.org +spec: + group: onecx.tkit.org + names: + kind: Permission + plural: permissions + singular: permission + scope: Namespaced + versions: + - name: v1 + schema: + openAPIV3Schema: + properties: + spec: + properties: + appId: + type: string + description: + type: string + name: + type: string + permissions: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + type: object + status: + properties: + appId: + type: string + message: + type: string + observedGeneration: + type: integer + response-code: + type: integer + status: + enum: + - ERROR + - UNDEFINED + - UPDATED + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/src/main/helm/templates/product-cluster-role.yaml b/src/main/helm/templates/product-cluster-role.yaml index b026399..d53627d 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: - permissions - permissions/status diff --git a/src/main/java/io/github/onecx/permission/operator/Permission.java b/src/main/java/org/tkit/onecx/permission/operator/Permission.java similarity index 82% rename from src/main/java/io/github/onecx/permission/operator/Permission.java rename to src/main/java/org/tkit/onecx/permission/operator/Permission.java index 3f41272..7891586 100644 --- a/src/main/java/io/github/onecx/permission/operator/Permission.java +++ b/src/main/java/org/tkit/onecx/permission/operator/Permission.java @@ -1,4 +1,4 @@ -package io.github.onecx.permission.operator; +package org.tkit.onecx.permission.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 Permission extends CustomResource implements Namespaced { } diff --git a/src/main/java/io/github/onecx/permission/operator/PermissionController.java b/src/main/java/org/tkit/onecx/permission/operator/PermissionController.java similarity index 96% rename from src/main/java/io/github/onecx/permission/operator/PermissionController.java rename to src/main/java/org/tkit/onecx/permission/operator/PermissionController.java index 87a0035..76f5cce 100644 --- a/src/main/java/io/github/onecx/permission/operator/PermissionController.java +++ b/src/main/java/org/tkit/onecx/permission/operator/PermissionController.java @@ -1,12 +1,12 @@ -package io.github.onecx.permission.operator; +package org.tkit.onecx.permission.operator; import jakarta.inject.Inject; import jakarta.ws.rs.WebApplicationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.tkit.onecx.permission.operator.client.PermissionService; -import io.github.onecx.permission.operator.client.PermissionService; 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/permission/operator/PermissionSpec.java b/src/main/java/org/tkit/onecx/permission/operator/PermissionSpec.java similarity index 58% rename from src/main/java/io/github/onecx/permission/operator/PermissionSpec.java rename to src/main/java/org/tkit/onecx/permission/operator/PermissionSpec.java index 1a69ea0..39e1dc9 100644 --- a/src/main/java/io/github/onecx/permission/operator/PermissionSpec.java +++ b/src/main/java/org/tkit/onecx/permission/operator/PermissionSpec.java @@ -1,4 +1,4 @@ -package io.github.onecx.permission.operator; +package org.tkit.onecx.permission.operator; import java.util.Map; @@ -11,6 +11,12 @@ public class PermissionSpec { @JsonProperty(value = "appId", required = true) private String appId; + @JsonProperty(value = "name", required = true) + private String name; + + @JsonProperty(value = "description", required = true) + private String description; + @JsonProperty("permissions") private Map> permissions; @@ -22,6 +28,22 @@ public void setAppId(String appId) { this.appId = appId; } + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + public Map> getPermissions() { return permissions; } diff --git a/src/main/java/io/github/onecx/permission/operator/PermissionStatus.java b/src/main/java/org/tkit/onecx/permission/operator/PermissionStatus.java similarity index 96% rename from src/main/java/io/github/onecx/permission/operator/PermissionStatus.java rename to src/main/java/org/tkit/onecx/permission/operator/PermissionStatus.java index 515c214..8332d73 100644 --- a/src/main/java/io/github/onecx/permission/operator/PermissionStatus.java +++ b/src/main/java/org/tkit/onecx/permission/operator/PermissionStatus.java @@ -1,4 +1,4 @@ -package io.github.onecx.permission.operator; +package org.tkit.onecx.permission.operator; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/src/main/java/io/github/onecx/permission/operator/client/PermissionService.java b/src/main/java/org/tkit/onecx/permission/operator/client/PermissionService.java similarity index 75% rename from src/main/java/io/github/onecx/permission/operator/client/PermissionService.java rename to src/main/java/org/tkit/onecx/permission/operator/client/PermissionService.java index e117b78..2ba8283 100644 --- a/src/main/java/io/github/onecx/permission/operator/client/PermissionService.java +++ b/src/main/java/org/tkit/onecx/permission/operator/client/PermissionService.java @@ -1,4 +1,4 @@ -package io.github.onecx.permission.operator.client; +package org.tkit.onecx.permission.operator.client; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; @@ -6,10 +6,10 @@ import org.eclipse.microprofile.rest.client.inject.RestClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.tkit.onecx.permission.operator.Permission; +import org.tkit.onecx.permission.operator.client.mappers.PermissionClientMapper; -import gen.io.github.onecx.permission.operator.v1.api.PermissionOperatorApi; -import io.github.onecx.permission.operator.Permission; -import io.github.onecx.permission.operator.client.mappers.PermissionClientMapper; +import gen.org.tkit.onecx.permission.operator.v1.api.PermissionOperatorApi; @ApplicationScoped public class PermissionService { diff --git a/src/main/java/io/github/onecx/permission/operator/client/mappers/PermissionClientMapper.java b/src/main/java/org/tkit/onecx/permission/operator/client/mappers/PermissionClientMapper.java similarity index 81% rename from src/main/java/io/github/onecx/permission/operator/client/mappers/PermissionClientMapper.java rename to src/main/java/org/tkit/onecx/permission/operator/client/mappers/PermissionClientMapper.java index 93ab4e7..23cae54 100644 --- a/src/main/java/io/github/onecx/permission/operator/client/mappers/PermissionClientMapper.java +++ b/src/main/java/org/tkit/onecx/permission/operator/client/mappers/PermissionClientMapper.java @@ -1,14 +1,14 @@ -package io.github.onecx.permission.operator.client.mappers; +package org.tkit.onecx.permission.operator.client.mappers; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.mapstruct.Mapper; +import org.tkit.onecx.permission.operator.PermissionSpec; -import gen.io.github.onecx.permission.operator.v1.model.Permission; -import gen.io.github.onecx.permission.operator.v1.model.PermissionRequest; -import io.github.onecx.permission.operator.PermissionSpec; +import gen.org.tkit.onecx.permission.operator.v1.model.Permission; +import gen.org.tkit.onecx.permission.operator.v1.model.PermissionRequest; @Mapper public interface PermissionClientMapper { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 7c359a6..73217e3 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -8,7 +8,7 @@ quarkus.kubernetes-client.devservices.override-kubeconfig=true quarkus.operator-sdk.helm.enabled=true quarkus.openapi-generator.codegen.input-base-dir=target/tmp/openapi quarkus.openapi-generator.codegen.spec.onecx_permission_operator_v1_yaml.config-key=permission_client -quarkus.openapi-generator.codegen.spec.onecx_permission_operator_v1_yaml.base-package=gen.io.github.onecx.permission.operator.v1 +quarkus.openapi-generator.codegen.spec.onecx_permission_operator_v1_yaml.base-package=gen.org.tkit.onecx.permission.operator.v1 quarkus.openapi-generator.codegen.spec.onecx_permission_operator_v1_yaml.return-response=true diff --git a/src/test/java/io/github/onecx/permission/test/AbstractTest.java b/src/test/java/io/github/onecx/permission/test/AbstractTest.java deleted file mode 100644 index 8026a95..0000000 --- a/src/test/java/io/github/onecx/permission/test/AbstractTest.java +++ /dev/null @@ -1,4 +0,0 @@ -package io.github.onecx.permission.test; - -public abstract class AbstractTest { -} diff --git a/src/test/java/io/github/onecx/permission/operator/PermissionControllerResponseTest.java b/src/test/java/org/tkit/onecx/permission/operator/PermissionControllerResponseTest.java similarity index 89% rename from src/test/java/io/github/onecx/permission/operator/PermissionControllerResponseTest.java rename to src/test/java/org/tkit/onecx/permission/operator/PermissionControllerResponseTest.java index 9000b94..0278189 100644 --- a/src/test/java/io/github/onecx/permission/operator/PermissionControllerResponseTest.java +++ b/src/test/java/org/tkit/onecx/permission/operator/PermissionControllerResponseTest.java @@ -1,4 +1,4 @@ -package io.github.onecx.permission.operator; +package org.tkit.onecx.permission.operator; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; @@ -11,9 +11,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; +import org.tkit.onecx.permission.operator.client.PermissionService; +import org.tkit.onecx.permission.test.AbstractTest; -import io.github.onecx.permission.operator.client.PermissionService; -import io.github.onecx.permission.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/permission/operator/PermissionControllerTest.java b/src/test/java/org/tkit/onecx/permission/operator/PermissionControllerTest.java similarity index 97% rename from src/test/java/io/github/onecx/permission/operator/PermissionControllerTest.java rename to src/test/java/org/tkit/onecx/permission/operator/PermissionControllerTest.java index 60eef23..d42f3ee 100644 --- a/src/test/java/io/github/onecx/permission/operator/PermissionControllerTest.java +++ b/src/test/java/org/tkit/onecx/permission/operator/PermissionControllerTest.java @@ -1,4 +1,4 @@ -package io.github.onecx.permission.operator; +package org.tkit.onecx.permission.operator; import static java.util.concurrent.TimeUnit.SECONDS; import static org.assertj.core.api.Assertions.assertThat; @@ -15,11 +15,11 @@ import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.tkit.onecx.permission.test.AbstractTest; import io.fabric8.kubernetes.api.model.ObjectMetaBuilder; import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.KubernetesClientException; -import io.github.onecx.permission.test.AbstractTest; import io.javaoperatorsdk.operator.Operator; import io.quarkus.test.junit.QuarkusTest; @@ -136,6 +136,8 @@ void productUpdateNoDescriptionTest() { var m = new PermissionSpec(); m.setAppId("test-3"); + m.setName("test-3"); + m.setDescription("description"); m.setPermissions(p1); var data = new Permission(); diff --git a/src/test/java/org/tkit/onecx/permission/test/AbstractTest.java b/src/test/java/org/tkit/onecx/permission/test/AbstractTest.java new file mode 100644 index 0000000..6c73773 --- /dev/null +++ b/src/test/java/org/tkit/onecx/permission/test/AbstractTest.java @@ -0,0 +1,4 @@ +package org.tkit.onecx.permission.test; + +public abstract class AbstractTest { +}