Compare commits

...

3 Commits

Author SHA1 Message Date
Knut-Erik Johnsen 0f737991a8 Remove temporary naming fix for releases
Signed-off-by: Knut-Erik Johnsen <abstract@knut-erik.org>
2024-12-06 10:35:09 +01:00
Knut-Erik Johnsen 0568ba97c6 Upgrade maven-jar-plugin for providers. Temporary fix for releasing new version of providers
Signed-off-by: Knut-Erik Johnsen <abstract@knut-erik.org>
2024-11-15 07:39:34 +01:00
Knut-Erik Johnsen a7c2105af2 Add methods to extract connectiondetails both from extra resources and observable resources
Signed-off-by: Knut-Erik Johnsen <abstract@knut-erik.org>
2024-11-13 16:26:15 +01:00
10 changed files with 68 additions and 7 deletions

View File

@ -11,10 +11,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
/** /**
* Class that helps with the extra resources map and also to create ResourceSelector in order to get extra resources * Class that helps with the extra resources map and also to create ResourceSelector in order to get extra resources
* to the function * to the function
@ -56,6 +58,39 @@ public class CrossplaneExtraResourcesService {
return result; return result;
} }
public Map<String, String> getConnectionDetails(Map<String, Resources> extraResources, String resourceName) {
List<Map<String, String>> resources = getConnectionDetails(extraResources, resourceName, 1);
if (resources.isEmpty()) {
return new HashMap<>();
}
return resources.get(0);
}
public List<Map<String, String>> getConnectionDetails(Map<String, Resources> extraResources, String resourceName, int expectedResources) {
List<Map<String, String>> result = new ArrayList<>();
Resources resources = extraResources.get(resourceName);
if (resources != null && resources.getItemsCount() == expectedResources) {
for (int i = 0; i < expectedResources; i++) {
try {
logger.debug("We have connectiondetails " + resourceName);
Map<String, String> currentDetails = new HashMap<>();
resources.getItems(i).getConnectionDetailsMap().forEach((key, value) ->
currentDetails.put(key, value.toStringUtf8())
);
result.add(currentDetails);
} catch (Exception e) {
throw new CrossplaneUnmarshallException("Error when unmarshalling the connectionDetails", e);
}
}
}
return result;
}
public Map<String, ResourceSelector> createExtraResourcesSelector(String resourceName, HasMetadata type) { public Map<String, ResourceSelector> createExtraResourcesSelector(String resourceName, HasMetadata type) {
ResourceSelector resourceSelector = ResourceSelector.newBuilder() ResourceSelector resourceSelector = ResourceSelector.newBuilder()
.setApiVersion(type.getApiVersion()) .setApiVersion(type.getApiVersion())

View File

@ -9,6 +9,8 @@ import io.fabric8.kubernetes.client.utils.Serialization;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional; import java.util.Optional;
/** /**
@ -42,4 +44,22 @@ public class CrossplaneObservableService {
return result; return result;
} }
public Map<String, String> getObservableConnectionDetails(String resourceName, State observedState) {
Resource observedResource = observedState.getResourcesOrDefault(resourceName, null);
Map<String, String> result = new HashMap<>();
if (observedResource != null) {
try {
logger.debug("We have an observed connectionDetails for " + resourceName);
observedResource.getConnectionDetailsMap().forEach((key, value) ->
result.put(key, value.toStringUtf8())
);
} catch (Exception e) {
throw new CrossplaneUnmarshallException("Error when unmarshalling the connectionDetails for " + resourceName, e);
}
}
return result;
}
} }

View File

@ -28,6 +28,7 @@
<central-publishing-maven-plugin.version>0.4.0</central-publishing-maven-plugin.version> <central-publishing-maven-plugin.version>0.4.0</central-publishing-maven-plugin.version>
<maven-source-plugin.version>3.3.1</maven-source-plugin.version> <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
<maven-javadoc-plugin.version>3.7.0</maven-javadoc-plugin.version> <maven-javadoc-plugin.version>3.7.0</maven-javadoc-plugin.version>
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
<maven-gpg-plugin.version>3.2.4</maven-gpg-plugin.version> <maven-gpg-plugin.version>3.2.4</maven-gpg-plugin.version>
<build-helper-maven-plugin.version>3.6.0</build-helper-maven-plugin.version> <build-helper-maven-plugin.version>3.6.0</build-helper-maven-plugin.version>
</properties> </properties>
@ -106,6 +107,11 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>io.crossplane.providers</groupId> <groupId>io.crossplane.providers</groupId>
<artifactId>crossplane-providers-parent</artifactId> <artifactId>crossplane-providers-parent</artifactId>
<version>1.17.0-charlie</version> <version>1.18.0-charlie</version>
</parent> </parent>
<artifactId>crossplane-provider-kubernetes-model</artifactId> <artifactId>crossplane-provider-kubernetes-model</artifactId>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>io.crossplane.providers</groupId> <groupId>io.crossplane.providers</groupId>
<artifactId>crossplane-providers-parent</artifactId> <artifactId>crossplane-providers-parent</artifactId>
<version>1.17.0-charlie</version> <version>1.18.0-charlie</version>
</parent> </parent>
<artifactId>crossplane-provider-terraform-model</artifactId> <artifactId>crossplane-provider-terraform-model</artifactId>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>io.crossplane.providers</groupId> <groupId>io.crossplane.providers</groupId>
<artifactId>crossplane-providers-parent</artifactId> <artifactId>crossplane-providers-parent</artifactId>
<version>1.17.0-charlie</version> <version>1.18.0-charlie</version>
</parent> </parent>
<artifactId>crossplane-provider-upjet-aws-model</artifactId> <artifactId>crossplane-provider-upjet-aws-model</artifactId>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>io.crossplane.providers</groupId> <groupId>io.crossplane.providers</groupId>
<artifactId>crossplane-providers-parent</artifactId> <artifactId>crossplane-providers-parent</artifactId>
<version>1.17.0-charlie</version> <version>1.18.0-charlie</version>
</parent> </parent>
<artifactId>crossplane-provider-upjet-azure-model</artifactId> <artifactId>crossplane-provider-upjet-azure-model</artifactId>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>io.crossplane.providers</groupId> <groupId>io.crossplane.providers</groupId>
<artifactId>crossplane-providers-parent</artifactId> <artifactId>crossplane-providers-parent</artifactId>
<version>1.17.0-charlie</version> <version>1.18.0-charlie</version>
</parent> </parent>
<artifactId>crossplane-provider-upjet-azuread-model</artifactId> <artifactId>crossplane-provider-upjet-azuread-model</artifactId>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>io.crossplane.providers</groupId> <groupId>io.crossplane.providers</groupId>
<artifactId>crossplane-providers-parent</artifactId> <artifactId>crossplane-providers-parent</artifactId>
<version>1.17.0-charlie</version> <version>1.18.0-charlie</version>
</parent> </parent>
<artifactId>crossplane-provider-upjet-gcp-model</artifactId> <artifactId>crossplane-provider-upjet-gcp-model</artifactId>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>io.crossplane.providers</groupId> <groupId>io.crossplane.providers</groupId>
<artifactId>crossplane-providers-parent</artifactId> <artifactId>crossplane-providers-parent</artifactId>
<version>1.17.0-charlie</version> <version>1.18.0-charlie</version>
</parent> </parent>
<artifactId>crossplane-provider-upjet-github-model</artifactId> <artifactId>crossplane-provider-upjet-github-model</artifactId>