Skip to content

Commit

Permalink
fix: oralce cloud zone
Browse files Browse the repository at this point in the history
Zone definition misspell.
Native services use uppercase zone.

Signed-off-by: Serge Logvinov <serge.logvinov@sinextra.dev>
Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
(cherry picked from commit f6a86ae)
  • Loading branch information
sergelogvinov authored and smira committed Dec 27, 2022
1 parent 8a9ff25 commit 0d11741
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const (
OracleUserDataEndpoint = "http://169.254.169.254/opc/v2/instance/metadata/user_data"
// OracleNetworkEndpoint is the local network metadata endpoint inside of Oracle Cloud.
OracleNetworkEndpoint = "http://169.254.169.254/opc/v2/vnics/"

oracleResolverServer = "169.254.169.254"
oracleTimeServer = "169.254.169.254"
)

// MetadataConfig represents a metadata Oracle instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"encoding/json"
"fmt"
"log"
"net/netip"
"strings"

"github.com/cosi-project/runtime/pkg/state"
Expand Down Expand Up @@ -73,17 +74,29 @@ func (o *Oracle) ParseMetadata(interfaceAddresses []NetworkConfig, metadata *Met
}
}

dns, _ := netip.ParseAddr(oracleResolverServer) //nolint:errcheck

networkConfig.Resolvers = append(networkConfig.Resolvers, network.ResolverSpecSpec{
DNSServers: []netip.Addr{dns},
ConfigLayer: network.ConfigPlatform,
})

networkConfig.TimeServers = append(networkConfig.TimeServers, network.TimeServerSpecSpec{
NTPServers: []string{oracleTimeServer},
ConfigLayer: network.ConfigPlatform,
})

zone := metadata.AvailabilityDomain

if idx := strings.LastIndex(zone, ":"); idx != -1 {
zone = zone[:idx]
zone = zone[idx+1:]
}

networkConfig.Metadata = &runtimeres.PlatformMetadataSpec{
Platform: o.Name(),
Hostname: metadata.Hostname,
Region: strings.ToLower(metadata.Region),
Zone: strings.ToLower(zone),
Region: metadata.Region,
Zone: zone,
InstanceType: metadata.Shape,
InstanceID: metadata.ID,
ProviderID: fmt.Sprintf("oci://%s", metadata.ID),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ hostnames:
- hostname: talos
domainname: ""
layer: platform
resolvers: []
timeServers: []
resolvers:
- dnsServers:
- 169.254.169.254
layer: platform
timeServers:
- timeServers:
- 169.254.169.254
layer: platform
operators:
- operator: dhcp6
linkName: eth0
Expand All @@ -19,7 +25,7 @@ metadata:
platform: oracle
hostname: talos
region: phx
zone: emir
zone: PHX-AD-1
instanceType: VM.Standard.E3.Flex
instanceId: ocid1.instance.oc1.phx.exampleuniqueID
providerId: oci://ocid1.instance.oc1.phx.exampleuniqueID

0 comments on commit 0d11741

Please sign in to comment.