Skip to content

Commit

Permalink
Add support for Oracle OKE environment (#1387)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmccampbell committed Nov 2, 2023
1 parent 08c3fcf commit a7bb9ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/preflight/sample-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ spec:
- pass:
when: "== k3s"
message: K3S is a supported distribution
- pass:
when: "== oke"
message: OKE is a supported distribution
- warn:
message: Unable to determine the distribution of Kubernetes
- nodeResources:
Expand Down
11 changes: 11 additions & 0 deletions pkg/analyze/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type providers struct {
minikube bool
rke2 bool
k3s bool
oke bool
}

type Provider int
Expand All @@ -45,6 +46,7 @@ const (
minikube Provider = iota
rke2 Provider = iota
k3s Provider = iota
oke Provider = iota
)

type AnalyzeDistribution struct {
Expand Down Expand Up @@ -125,6 +127,11 @@ func ParseNodesForProviders(nodes []corev1.Node) (providers, string) {
foundProviders.k3s = true
stringProvider = "k3s"
}
if k == "oci.oraclecloud.com/fault-domain" {
// Based on: https://docs.oracle.com/en-us/iaas/Content/ContEng/Reference/contengsupportedlabelsusecases.htm
foundProviders.oke = true
stringProvider = "oke"
}
}

for k := range node.ObjectMeta.Annotations {
Expand Down Expand Up @@ -326,6 +333,8 @@ func compareDistributionConditionalToActual(conditional string, actual providers
isMatch = actual.rke2
case k3s:
isMatch = actual.k3s
case oke:
isMatch = actual.oke
}

switch parts[0] {
Expand Down Expand Up @@ -366,6 +375,8 @@ func mustNormalizeDistributionName(raw string) Provider {
return rke2
case "k3s":
return k3s
case "oke":
return oke
}

return unknown
Expand Down

0 comments on commit a7bb9ea

Please sign in to comment.