Skip to content

Commit 4c12311

Browse files
authored
K8S Lite (#203)
1 parent db75232 commit 4c12311

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3066
-552
lines changed

charts/ui/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ description: A Helm chart for deploying Unikorn UI
44

55
type: application
66

7-
version: v0.3.15-rc1
8-
appVersion: v0.3.15-rc1
7+
version: v0.3.15-rc2
8+
appVersion: v0.3.15-rc2
99

1010
icon: https://assets.unikorn-cloud.org/assets/images/logos/dark-on-light/icon.png
1111

package-lock.json

Lines changed: 582 additions & 541 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<script lang="ts">
2+
import * as Kubernetes from '$lib/openapi/kubernetes';
3+
4+
import * as Formatters from '$lib/formatters';
5+
import * as Validation from '$lib/validation';
6+
import ShellSection from '$lib/layouts/ShellSection.svelte';
7+
import TextInput from '$lib/forms/TextInput.svelte';
8+
import Select from '$lib/forms/Select.svelte';
9+
import RangeSlider from '$lib/forms/RangeSlider.svelte';
10+
import SelectNew from '$lib/forms/SelectNew.svelte';
11+
import Flavor from '$lib/Flavor.svelte';
12+
13+
interface Props {
14+
/* The pool should be bound to expose the built configuration */
15+
pool: Kubernetes.VirtualKubernetesClusterWorkloadPool;
16+
/* Whether the configuration is valid */
17+
valid: boolean;
18+
/* Flavors allows the pool type to be populated */
19+
flavors: Array<Kubernetes.Flavor>;
20+
}
21+
22+
let { pool = $bindable(), valid = $bindable(), flavors }: Props = $props();
23+
24+
function updateFlavors(flavors: Array<Kubernetes.Flavor>): void {
25+
if (!flavors || flavors.find((x) => x.metadata.id == pool.flavorId)) return;
26+
pool.flavorId = flavors[0].metadata.id;
27+
}
28+
29+
$effect.pre(() => {
30+
updateFlavors(flavors);
31+
});
32+
33+
$effect.pre(() => {
34+
valid = Validation.kubernetesNameValid(pool.name);
35+
});
36+
37+
function lookupFlavor(id: string): Kubernetes.Flavor {
38+
return flavors.find((x) => x.metadata.id == id) as Kubernetes.Flavor;
39+
}
40+
</script>
41+
42+
<ShellSection title="Pool Metadata">
43+
<TextInput
44+
label="Choose a name for your workload pool."
45+
hint="Name should be unique, contain 0-9, a-z, . or - and be at most 63 characters."
46+
validators={Validation.GetKubernetesNameValidators([])}
47+
bind:value={pool.name}
48+
bind:valid
49+
/>
50+
</ShellSection>
51+
52+
<ShellSection title="Pool Topology">
53+
{#if flavors && pool.flavorId}
54+
<SelectNew
55+
value={pool.flavorId}
56+
options={flavors.map((x) => x.metadata.id)}
57+
onValueChange={(e) => (pool.flavorId = e.value)}
58+
label="Choose a pool type."
59+
hint="Allows the selection of the pool's available resources to be used by workloads per pool
60+
member. This includes CPU, GPU and memory."
61+
>
62+
{#snippet contents(id: string)}
63+
<Flavor flavor={lookupFlavor(id)} />
64+
{/snippet}
65+
</SelectNew>
66+
{/if}
67+
68+
{#if pool.replicas !== null}
69+
<RangeSlider
70+
name="size"
71+
label="Select the minimum number of replicas."
72+
min={1}
73+
max={100}
74+
step={1}
75+
value={[pool.replicas]}
76+
onValueChange={(e) => (pool.replicas = e.value[0])}
77+
/>
78+
{/if}
79+
</ShellSection>

src/lib/openapi/compute/.openapi-generator/FILES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apis/DefaultApi.ts
22
apis/index.ts
33
index.ts
4+
models/AllowedAddressPair.ts
45
models/ComputeClusterMachineStatus.ts
56
models/ComputeClusterNetwork.ts
67
models/ComputeClusterRead.ts
@@ -29,6 +30,11 @@ models/OsFamily.ts
2930
models/OsKernel.ts
3031
models/ProjectScopedResourceReadMetadata.ts
3132
models/PublicIPAllocation.ts
33+
models/RegionFeatures.ts
34+
models/RegionKubernetes.ts
35+
models/RegionRead.ts
36+
models/RegionSpec.ts
37+
models/RegionType.ts
3238
models/ResourceMetadata.ts
3339
models/ResourceProvisioningStatus.ts
3440
models/ResourceReadMetadata.ts

src/lib/openapi/compute/apis/DefaultApi.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import type {
2020
Flavor,
2121
Image,
2222
ModelError,
23+
RegionRead,
2324
} from '../models/index';
2425
import {
2526
ComputeClusterReadFromJSON,
@@ -32,6 +33,8 @@ import {
3233
ImageToJSON,
3334
ModelErrorFromJSON,
3435
ModelErrorToJSON,
36+
RegionReadFromJSON,
37+
RegionReadToJSON,
3538
} from '../models/index';
3639

3740
export interface ApiV1OrganizationsOrganizationIDClustersGetRequest {
@@ -57,6 +60,10 @@ export interface ApiV1OrganizationsOrganizationIDProjectsProjectIDClustersPostRe
5760
computeClusterWrite: ComputeClusterWrite;
5861
}
5962

63+
export interface ApiV1OrganizationsOrganizationIDRegionsGetRequest {
64+
organizationID: string;
65+
}
66+
6067
export interface ApiV1OrganizationsOrganizationIDRegionsRegionIDFlavorsGetRequest {
6168
organizationID: string;
6269
regionID: string;
@@ -244,6 +251,41 @@ export class DefaultApi extends runtime.BaseAPI {
244251
return await response.value();
245252
}
246253

254+
/**
255+
* Lists a curated set of regions.
256+
*/
257+
async apiV1OrganizationsOrganizationIDRegionsGetRaw(requestParameters: ApiV1OrganizationsOrganizationIDRegionsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<RegionRead>>> {
258+
if (requestParameters.organizationID === null || requestParameters.organizationID === undefined) {
259+
throw new runtime.RequiredError('organizationID','Required parameter requestParameters.organizationID was null or undefined when calling apiV1OrganizationsOrganizationIDRegionsGet.');
260+
}
261+
262+
const queryParameters: any = {};
263+
264+
const headerParameters: runtime.HTTPHeaders = {};
265+
266+
if (this.configuration && this.configuration.accessToken) {
267+
// oauth required
268+
headerParameters["Authorization"] = await this.configuration.accessToken("oauth2Authentication", []);
269+
}
270+
271+
const response = await this.request({
272+
path: `/api/v1/organizations/{organizationID}/regions`.replace(`{${"organizationID"}}`, encodeURIComponent(String(requestParameters.organizationID))),
273+
method: 'GET',
274+
headers: headerParameters,
275+
query: queryParameters,
276+
}, initOverrides);
277+
278+
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(RegionReadFromJSON));
279+
}
280+
281+
/**
282+
* Lists a curated set of regions.
283+
*/
284+
async apiV1OrganizationsOrganizationIDRegionsGet(requestParameters: ApiV1OrganizationsOrganizationIDRegionsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<RegionRead>> {
285+
const response = await this.apiV1OrganizationsOrganizationIDRegionsGetRaw(requestParameters, initOverrides);
286+
return await response.value();
287+
}
288+
247289
/**
248290
* Lists all compute compatible flavors that the user has access to.
249291
*/
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* Compute Service API
5+
* The Compute Service API provides services that allows provisioning and life cycle management of Compute clusters. Requests must specify the HTML content type header.
6+
*
7+
* The version of the OpenAPI document: 0.1.0
8+
*
9+
*
10+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11+
* https://openapi-generator.tech
12+
* Do not edit the class manually.
13+
*/
14+
15+
import { exists, mapValues } from '../runtime';
16+
/**
17+
* Allow multiple MAC/IP address (range) pairs to pass through this network port.
18+
* @export
19+
* @interface AllowedAddressPair
20+
*/
21+
export interface AllowedAddressPair {
22+
/**
23+
* The CIDR to allow.
24+
* @type {string}
25+
* @memberof AllowedAddressPair
26+
*/
27+
cidr: string;
28+
/**
29+
* The MAC address to allow.
30+
* @type {string}
31+
* @memberof AllowedAddressPair
32+
*/
33+
macAddress?: string;
34+
}
35+
36+
/**
37+
* Check if a given object implements the AllowedAddressPair interface.
38+
*/
39+
export function instanceOfAllowedAddressPair(value: object): boolean {
40+
let isInstance = true;
41+
isInstance = isInstance && "cidr" in value;
42+
43+
return isInstance;
44+
}
45+
46+
export function AllowedAddressPairFromJSON(json: any): AllowedAddressPair {
47+
return AllowedAddressPairFromJSONTyped(json, false);
48+
}
49+
50+
export function AllowedAddressPairFromJSONTyped(json: any, ignoreDiscriminator: boolean): AllowedAddressPair {
51+
if ((json === undefined) || (json === null)) {
52+
return json;
53+
}
54+
return {
55+
56+
'cidr': json['cidr'],
57+
'macAddress': !exists(json, 'macAddress') ? undefined : json['macAddress'],
58+
};
59+
}
60+
61+
export function AllowedAddressPairToJSON(value?: AllowedAddressPair | null): any {
62+
if (value === undefined) {
63+
return undefined;
64+
}
65+
if (value === null) {
66+
return null;
67+
}
68+
return {
69+
70+
'cidr': value.cidr,
71+
'macAddress': value.macAddress,
72+
};
73+
}
74+

src/lib/openapi/compute/models/MachinePool.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
*/
1414

1515
import { exists, mapValues } from '../runtime';
16+
import type { AllowedAddressPair } from './AllowedAddressPair';
17+
import {
18+
AllowedAddressPairFromJSON,
19+
AllowedAddressPairFromJSONTyped,
20+
AllowedAddressPairToJSON,
21+
} from './AllowedAddressPair';
1622
import type { ComputeImage } from './ComputeImage';
1723
import {
1824
ComputeImageFromJSON,
@@ -86,6 +92,12 @@ export interface MachinePool {
8692
* @memberof MachinePool
8793
*/
8894
userData?: string;
95+
/**
96+
* A list of allowed address pairs.
97+
* @type {Array<AllowedAddressPair>}
98+
* @memberof MachinePool
99+
*/
100+
allowedAddressPairs?: Array<AllowedAddressPair>;
89101
}
90102

91103
/**
@@ -117,6 +129,7 @@ export function MachinePoolFromJSONTyped(json: any, ignoreDiscriminator: boolean
117129
'publicIPAllocation': !exists(json, 'publicIPAllocation') ? undefined : PublicIPAllocationFromJSON(json['publicIPAllocation']),
118130
'image': ComputeImageFromJSON(json['image']),
119131
'userData': !exists(json, 'userData') ? undefined : json['userData'],
132+
'allowedAddressPairs': !exists(json, 'allowedAddressPairs') ? undefined : ((json['allowedAddressPairs'] as Array<any>).map(AllowedAddressPairFromJSON)),
120133
};
121134
}
122135

@@ -136,6 +149,7 @@ export function MachinePoolToJSON(value?: MachinePool | null): any {
136149
'publicIPAllocation': PublicIPAllocationToJSON(value.publicIPAllocation),
137150
'image': ComputeImageToJSON(value.image),
138151
'userData': value.userData,
152+
'allowedAddressPairs': value.allowedAddressPairs === undefined ? undefined : ((value.allowedAddressPairs as Array<any>).map(AllowedAddressPairToJSON)),
139153
};
140154
}
141155

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* Compute Service API
5+
* The Compute Service API provides services that allows provisioning and life cycle management of Compute clusters. Requests must specify the HTML content type header.
6+
*
7+
* The version of the OpenAPI document: 0.1.0
8+
*
9+
*
10+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11+
* https://openapi-generator.tech
12+
* Do not edit the class manually.
13+
*/
14+
15+
import { exists, mapValues } from '../runtime';
16+
/**
17+
* A set of features the region may provide to clients.
18+
* @export
19+
* @interface RegionFeatures
20+
*/
21+
export interface RegionFeatures {
22+
/**
23+
* If set, this indicates that the region supports physical networks and
24+
* one should be provisioned for clusters to use. The impliciation here is
25+
* the region supports base-metal machines, and these must be provisioned
26+
* on a physical VLAN etc.
27+
*
28+
* @type {boolean}
29+
* @memberof RegionFeatures
30+
*/
31+
physicalNetworks: boolean;
32+
}
33+
34+
/**
35+
* Check if a given object implements the RegionFeatures interface.
36+
*/
37+
export function instanceOfRegionFeatures(value: object): boolean {
38+
let isInstance = true;
39+
isInstance = isInstance && "physicalNetworks" in value;
40+
41+
return isInstance;
42+
}
43+
44+
export function RegionFeaturesFromJSON(json: any): RegionFeatures {
45+
return RegionFeaturesFromJSONTyped(json, false);
46+
}
47+
48+
export function RegionFeaturesFromJSONTyped(json: any, ignoreDiscriminator: boolean): RegionFeatures {
49+
if ((json === undefined) || (json === null)) {
50+
return json;
51+
}
52+
return {
53+
54+
'physicalNetworks': json['physicalNetworks'],
55+
};
56+
}
57+
58+
export function RegionFeaturesToJSON(value?: RegionFeatures | null): any {
59+
if (value === undefined) {
60+
return undefined;
61+
}
62+
if (value === null) {
63+
return null;
64+
}
65+
return {
66+
67+
'physicalNetworks': value.physicalNetworks,
68+
};
69+
}
70+

0 commit comments

Comments
 (0)