Skip to content

Commit

Permalink
add faultDomain to instance metadata (#767)
Browse files Browse the repository at this point in the history
* add faultDomain to instance metadata
  • Loading branch information
n0tl3ss authored Jan 9, 2024
1 parent b7b77c5 commit dd25cce
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,24 @@ public class OracleCloudInstanceMetadata extends AbstractComputeInstanceMetadata

private final ComputePlatform computePlatform = ComputePlatform.ORACLE_CLOUD;

private String faultDomain;

/**
* Getter for faultDomain.
* @return returns the instance metadata faultDomain
*/
public String getFaultDomain() {
return faultDomain;
}

/**
* Setter for faultDomain.
* @param faultDomain The faultDomain from instance metadata
*/
public void setFaultDomain(String faultDomain) {
this.faultDomain = faultDomain;
}

@Override
@JsonIgnore
public ComputePlatform getComputePlatform() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import static io.micronaut.discovery.cloud.oraclecloud.OracleCloudMetadataKeys.AVAILABILITY_DOMAIN;
import static io.micronaut.discovery.cloud.oraclecloud.OracleCloudMetadataKeys.CANONICAL_REGION_NAME;
import static io.micronaut.discovery.cloud.oraclecloud.OracleCloudMetadataKeys.DISPLAY_NAME;
import static io.micronaut.discovery.cloud.oraclecloud.OracleCloudMetadataKeys.FAULT_DOMAIN;
import static io.micronaut.discovery.cloud.oraclecloud.OracleCloudMetadataKeys.ID;
import static io.micronaut.discovery.cloud.oraclecloud.OracleCloudMetadataKeys.IMAGE;
import static io.micronaut.discovery.cloud.oraclecloud.OracleCloudMetadataKeys.MAC;
Expand Down Expand Up @@ -120,6 +121,7 @@ public Optional<ComputeInstanceMetadata> resolve(Environment environment) {
instanceMetadata.setAvailabilityZone(textValue(metadataJson, AVAILABILITY_DOMAIN));
instanceMetadata.setImageId(textValue(metadataJson, IMAGE));
instanceMetadata.setMachineType(textValue(metadataJson, SHAPE));
instanceMetadata.setFaultDomain(textValue(metadataJson, FAULT_DOMAIN));

Map<String, String> metadata = jsonMapper.readValueFromTree(metadataJson, Map.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class OracleCloudMetadataResolverSpec extends Specification {
computeInstanceMetadata.get().instanceId == "ocid1.instance.oc1.phx.abyhqljrg2v5zuydab6r5nbsywedkjvtwd57opwmuhfc5hg5jrxgs3jmg3ga"
computeInstanceMetadata.get().name == "micronaut-env"
computeInstanceMetadata.get().region == "us-phoenix-1"
computeInstanceMetadata.get().faultDomain == "FAULT-DOMAIN-2"
}

private OracleCloudMetadataResolver buildResolver() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;

/** Builder for OkeWorkloadIdentityAuthenticationDetailsProviderBuilder. */
class MicronautOkeWorkloadIdentityAuthenticationDetailsProviderBuilder extends OkeWorkloadIdentityAuthenticationDetailsProvider.OkeWorkloadIdentityAuthenticationDetailsProviderBuilder {
Expand Down

0 comments on commit dd25cce

Please sign in to comment.