Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend workload pools to include ingress firewall and ip allocations #6

Merged
merged 6 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 64 additions & 51 deletions pkg/openapi/schema.go

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

234 changes: 233 additions & 1 deletion pkg/openapi/server.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,97 @@ components:
description: Flavor ID.
type: string
minLength: 1
firewall:
description: A list of firewall rules applied to a workload pool.
type: object
properties:
ingress:
$ref: '#/components/schemas/firewallRules'
publicIPAllocation:
$ref: '#/components/schemas/publicIPAllocation'
image:
$ref: '#/components/schemas/imageSelector'
ssh:
description: SSH settings.
type: object
properties:
publicKeys:
description: A list of public SSH keys to allow access to the machine.
type: array
items:
type: string
firewallRules:
description: A list of firewall rules applied to a workload pool.
type: array
items:
$ref: '#/components/schemas/firewallRule'
firewallRule:
description: A firewall rule applied to a workload pool.
type: object
required:
- protocol
- port
- cidr
properties:
protocol:
description: The protocol to allow.
type: string
enum:
- tcp
- udp
port:
$ref: '#/components/schemas/firewallRulePort'
cidr:
description: A list of CIDR blocks to allow, it might be any IPv4 or IPv6 in CIDR notation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprise I've not done this yet, but we should probably have a type definition in core for an IPv4 CIDR with the required regular expression patter matcher too.

type: array
items:
type: string
firewallRulePort:
description: The port definition to allow traffic.
type: object
properties:
number:
description: The port to allow.
type: integer
range:
$ref: '#/components/schemas/firewallRulePortRange'
firewallRulePortRange:
description: The port range to allow traffic.
type: object
required:
- start
- end
properties:
start:
description: The start of the port range.
type: integer
end:
description: The end of the port range.
type: integer
publicIPAllocation:
description: A public IP allocation settings.
type: object
required:
- enabled
properties:
enabled:
description: Enable public IP allocation.
type: boolean
imageSelector:
description: A server image selector.
type: object
required:
- os
- version
properties:
os:
description: The operating system to use.
type: string
version:
description: The operating system version to use.
type: string
computeClusterWorkloadPool:
description: A Kuberntes cluster workload pool.
description: A Compute cluster workload pool.
type: object
required:
- name
Expand Down Expand Up @@ -189,6 +278,59 @@ components:
type: string
workloadPools:
$ref: '#/components/schemas/computeClusterWorkloadPools'
computeClusterStatus:
description: Compute cluster status.
type: object
properties:
workloadPools:
$ref: '#/components/schemas/computeClusterWorkloadPoolsStatus'
computeClusterWorkloadPoolsStatus:
description: A list of Compute cluster workload pools status.
type: array
items:
$ref: '#/components/schemas/computeClusterWorkloadPoolStatus'
computeClusterWorkloadPoolStatus:
description: Compute cluster workload pool status.
type: object
required:
- name
properties:
name:
description: Workload pool name.
type: string
machines:
$ref: '#/components/schemas/computeClusterMachinesStatus'
computeClusterMachinesStatus:
description: A list of Compute cluster machines status.
type: array
items:
$ref: '#/components/schemas/computeClusterMachineStatus'
computeClusterMachineStatus:
description: Compute cluster machine status.
type: object
required:
- hostname
- privateIP
- status
properties:
hostname:
description: Machine hostname.
type: string
privateIP:
description: Machine private IP address.
type: string
publicIP:
description: Machine public IP address.
type: string
status:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

description: Machine status.
type: string
enum:
- unknown
- provisioning
- provisioned
- deprovisioning
- error
computeClusterRead:
description: Compute cluster read.
type: object
Expand All @@ -200,6 +342,8 @@ components:
$ref: 'https://raw.githubusercontent.com/unikorn-cloud/core/main/pkg/openapi/common.spec.yaml#/components/schemas/projectScopedResourceReadMetadata'
spec:
$ref: '#/components/schemas/computeClusterSpec'
status:
$ref: '#/components/schemas/computeClusterStatus'
computeClusterWrite:
description: Compute cluster create or update.
type: object
Expand Down Expand Up @@ -234,6 +378,30 @@ components:
machine:
flavorId: c7568e2d-f9ab-453d-9a3a-51375f78426b
replicas: 3
firewall:
ingress:
- protocol: tcp
port:
number: 80
cidr:
- 192.168.1.0/24
- protocol: tcp
port:
range:
start: 1066
end: 1999
cidr:
- 10.0.0.0/8
- 172.16.0.0/12
publicIPAllocation:
enabled: true
image:
os: ubuntu
version: 20.04
ssh:
publicKeys:
- ssh-rsa AAA3NzC1yc2AAADAQABAABgQDZ6...
- ssh-rsa AAA3NzaC1yc2AADAQAAAABgQDZ7...
responses:
computeClusterResponse:
description: A Compute cluster.
Expand All @@ -256,6 +424,38 @@ components:
machine:
flavorId: c7568e2d-f9ab-453d-9a3a-51375f78426b
replicas: 3
firewall:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Examples are obviously the best illustration to review 😸

Looks good so far. I'd have a word with Adam, the firewall rules may need a description to make the UI happier.

ingress:
- protocol: tcp
port:
number: 80
cidr:
- 192.168.1.0/24
- protocol: tcp
port:
range:
start: 1066
end: 1999
cidr:
- 10.0.0.0/8
- 172.16.0.0/12
publicIPAllocation:
enabled: true
image:
os: ubuntu
version: 20.04
ssh:
publicKeys:
- ssh-rsa AAA3NzC1yc2AAADAQABAABgQDZ6...
- ssh-rsa AAA3NzaC1yc2AADAQAAAABgQDZ7...
status:
workloadPools:
- name: default
machines:
- hostname: machine-1
privateIP: 10.0.0.1
publicIP: 172.16.0.2
status: provisioned
computeClustersResponse:
description: A list of Compute clusters.
content:
Expand All @@ -277,6 +477,38 @@ components:
machine:
flavorId: c7568e2d-f9ab-453d-9a3a-51375f78426b
replicas: 3
firewall:
ingress:
- protocol: tcp
port:
number: 80
cidr:
- 192.168.1.0/24
- protocol: tcp
port:
range:
start: 1066
end: 1999
cidr:
- 10.0.0.0/8
- 172.16.0.0/12
publicIPAllocation:
enabled: true
image:
os: ubuntu
version: 20.04
ssh:
publicKeys:
- ssh-rsa AAA3NzC1yc2AAADAQABAABgQDZ6...
- ssh-rsa AAA3NzaC1yc2AADAQAAAABgQDZ7...
status:
workloadPools:
- name: default
machines:
- hostname: machine-1
privateIP: 10.0.0.1
publicIP: 172.16.0.2
status: provisioned
securitySchemes:
oauth2Authentication:
description: Operation requires OAuth2 bearer token authentication.
Expand Down
Loading
Loading