using multiple SchemaSwap annotations instead of the schell script
Closes #10736
This commit is contained in:
parent
ecf52285bc
commit
7e2565c9fe
3 changed files with 36 additions and 91 deletions
|
@ -1,56 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
sedCommand="sed"
|
||||
if [ "$(uname)" == "Darwin" ]; then
|
||||
if hash gsed 2>/dev/null; then
|
||||
sedCommand="gsed"
|
||||
fi
|
||||
fi
|
||||
|
||||
function addAnnotation() {
|
||||
local match=$1
|
||||
local annotation=$2
|
||||
local file=$3
|
||||
|
||||
$sedCommand -i "/^.*${match}.*/i ${annotation}" ${file}
|
||||
}
|
||||
|
||||
addAnnotation \
|
||||
"protected List<GroupRepresentation> subGroups;" \
|
||||
"@io.fabric8.crd.generator.annotation.SchemaFrom(type = org.keycloak.representations.overrides.NoSubGroupsGroupRepresentationList.class)" \
|
||||
target/keycloak-core/org/keycloak/representations/idm/GroupRepresentation.java
|
||||
|
||||
addAnnotation \
|
||||
"private MultivaluedHashMap<String, ComponentExportRepresentation> components;" \
|
||||
"@io.fabric8.crd.generator.annotation.SchemaFrom(type = org.keycloak.representations.overrides.ComponentExportRepresentationMap.class)" \
|
||||
target/keycloak-core/org/keycloak/representations/idm/RealmRepresentation.java
|
||||
|
||||
addAnnotation \
|
||||
"private MultivaluedHashMap<String, String> config;" \
|
||||
"@io.fabric8.crd.generator.annotation.SchemaFrom(type = org.keycloak.representations.overrides.MultivaluedStringStringHashMap.class)" \
|
||||
target/keycloak-core/org/keycloak/representations/idm/CredentialRepresentation.java
|
||||
|
||||
addAnnotation \
|
||||
"private MultivaluedHashMap<String, String> config;" \
|
||||
"@io.fabric8.crd.generator.annotation.SchemaFrom(type = org.keycloak.representations.overrides.MultivaluedStringStringHashMap.class)" \
|
||||
target/keycloak-core/org/keycloak/representations/idm/ComponentRepresentation.java
|
||||
|
||||
addAnnotation \
|
||||
"private MultivaluedHashMap<String, ComponentExportRepresentation> subComponents = new MultivaluedHashMap<>();" \
|
||||
"@io.fabric8.crd.generator.annotation.SchemaFrom(type = org.keycloak.representations.overrides.NoSubcomponentsComponentExportRepresentationMap.class)" \
|
||||
target/keycloak-core/org/keycloak/representations/idm/ComponentExportRepresentation.java
|
||||
|
||||
addAnnotation \
|
||||
"private MultivaluedHashMap<String, String> config = new MultivaluedHashMap<>();" \
|
||||
"@io.fabric8.crd.generator.annotation.SchemaFrom(type = org.keycloak.representations.overrides.MultivaluedStringStringHashMap.class)" \
|
||||
target/keycloak-core/org/keycloak/representations/idm/ComponentExportRepresentation.java
|
||||
|
||||
addAnnotation \
|
||||
"private List<PolicyRepresentation> policies;" \
|
||||
"@com.fasterxml.jackson.annotation.JsonIgnore" \
|
||||
target/keycloak-core/org/keycloak/representations/idm/authorization/ScopeRepresentation.java
|
||||
|
||||
addAnnotation \
|
||||
"private List<ResourceRepresentation> resources;" \
|
||||
"@com.fasterxml.jackson.annotation.JsonIgnore" \
|
||||
target/keycloak-core/org/keycloak/representations/idm/authorization/ScopeRepresentation.java
|
|
@ -103,7 +103,7 @@
|
|||
<!-- Keycloak -->
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-common</artifactId>
|
||||
<artifactId>keycloak-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- FIXME: Adding BC for now as removing the Bouncycastle dependencies from the operator makes it unusable on K3s and possibly on other kubernetes distributions (e.g. Rancher is based on K3s). -->
|
||||
|
@ -192,22 +192,6 @@
|
|||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>import-keycloak-core</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${basedir}/target/keycloak-core</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${basedir}/../core/src/main/java</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-ubi-null</id>
|
||||
<phase>validate</phase>
|
||||
|
@ -241,7 +225,6 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>${basedir}/target/keycloak-core</source>
|
||||
<source>${basedir}/target/generated-sources/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
|
@ -249,23 +232,6 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<version>1.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>patch-core-sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>${basedir}/patch-sources.sh</executable>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<executions>
|
||||
|
@ -289,6 +255,27 @@
|
|||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>filterEnum</id>
|
||||
<phase>package</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<replaceregexp file="${project.build.directory}/kubernetes/keycloakrealmimports.k8s.keycloak.org-v1.yml"
|
||||
match="[^\n]*- ENUM\$VALUES\s*\n"
|
||||
flags="g"
|
||||
replace=""/>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
|
|
|
@ -16,13 +16,20 @@
|
|||
*/
|
||||
package org.keycloak.operator.crds.v2alpha1.realmimport;
|
||||
|
||||
import io.fabric8.crd.generator.annotation.SchemaSwap;
|
||||
import io.fabric8.kubernetes.api.model.Namespaced;
|
||||
import io.fabric8.kubernetes.client.CustomResource;
|
||||
import io.fabric8.kubernetes.model.annotation.Group;
|
||||
import io.fabric8.kubernetes.model.annotation.Version;
|
||||
import io.sundr.builder.annotations.Buildable;
|
||||
import io.sundr.builder.annotations.BuildableReference;
|
||||
|
||||
import org.keycloak.operator.Constants;
|
||||
import org.keycloak.representations.idm.ComponentExportRepresentation;
|
||||
import org.keycloak.representations.idm.CredentialRepresentation;
|
||||
import org.keycloak.representations.idm.GroupRepresentation;
|
||||
import org.keycloak.representations.idm.RealmRepresentation;
|
||||
import org.keycloak.representations.idm.authorization.ScopeRepresentation;
|
||||
|
||||
@Group(Constants.CRDS_GROUP)
|
||||
@Version(Constants.CRDS_VERSION)
|
||||
|
@ -32,6 +39,13 @@ import org.keycloak.operator.Constants;
|
|||
@BuildableReference(io.fabric8.kubernetes.client.CustomResource.class),
|
||||
@BuildableReference(KeycloakRealmImportSpec.class)
|
||||
})
|
||||
@SchemaSwap(originalType = GroupRepresentation.class, fieldName = "subGroups", targetType = org.keycloak.representations.overrides.NoSubGroupsGroupRepresentationList.class)
|
||||
@SchemaSwap(originalType = RealmRepresentation.class, fieldName = "components", targetType = org.keycloak.representations.overrides.ComponentExportRepresentationMap.class)
|
||||
@SchemaSwap(originalType = CredentialRepresentation.class, fieldName = "config", targetType = org.keycloak.representations.overrides.MultivaluedStringStringHashMap.class)
|
||||
@SchemaSwap(originalType = ComponentExportRepresentation.class, fieldName = "subComponents", targetType = org.keycloak.representations.overrides.NoSubcomponentsComponentExportRepresentationMap.class)
|
||||
@SchemaSwap(originalType = ComponentExportRepresentation.class, fieldName = "config", targetType = org.keycloak.representations.overrides.MultivaluedStringStringHashMap.class)
|
||||
@SchemaSwap(originalType = ScopeRepresentation.class, fieldName = "policies")
|
||||
@SchemaSwap(originalType = ScopeRepresentation.class, fieldName = "resources")
|
||||
public class KeycloakRealmImport extends CustomResource<KeycloakRealmImportSpec, KeycloakRealmImportStatus> implements Namespaced {
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue