Skip to content

Commit

Permalink
Add Region Feature Flags (#46)
Browse files Browse the repository at this point in the history
Some clouds may have baremetal nodes, and some may not, so we need to
make an intelligent descision whether the provision a provider network
for clusters or not.  Imbue the regions API with this power.
  • Loading branch information
spjmurray authored Aug 1, 2024
1 parent 254b921 commit 9fab8f8
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 90 deletions.
4 changes: 2 additions & 2 deletions charts/region/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: A Helm chart for deploying Unikorn's Region Controller

type: application

version: v0.1.30
appVersion: v0.1.30
version: v0.1.31
appVersion: v0.1.31

icon: https://raw.githubusercontent.com/unikorn-cloud/assets/main/images/logos/dark-on-light/icon.png

Expand Down
5 changes: 5 additions & 0 deletions pkg/handler/region/region.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ func convert(in *unikornv1.Region) *openapi.RegionRead {
},
}

// Calculate any region feature flags.
if in.Spec.Openstack != nil && in.Spec.Openstack.Network != nil && in.Spec.Openstack.Network.ProviderNetworks != nil {
out.Spec.Features.PhysicalNetworks = true
}

return out
}

Expand Down
178 changes: 90 additions & 88 deletions pkg/openapi/schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions pkg/openapi/server.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,30 @@ components:
type: string
enum:
- openstack
regionFeatures:
description: A set of features the region may provide to clients.
type: object
required:
- physicalNetworks
properties:
physicalNetworks:
description: |
If set, this indicates that the region supports physical networks and
one should be provisioned for clusters to use. The impliciation here is
the region supports base-metal machines, and these must be provisioned
on a physical VLAN etc.
type: boolean
regionSpec:
description: Information about the region.
type: object
required:
- type
- features
properties:
type:
$ref: '#/components/schemas/regionType'
features:
$ref: '#/components/schemas/regionFeatures'
regionRead:
description: A region.
type: object
Expand Down Expand Up @@ -578,6 +594,8 @@ components:
provisioningStatus: provisioned
spec:
type: openstack
features:
physicalNetworks: true
imagesResponse:
description: A list of images that are compatible with this platform.
content:
Expand Down
12 changes: 12 additions & 0 deletions pkg/openapi/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9fab8f8

Please sign in to comment.