Skip to content

Commit

Permalink
feat: add Turing RK1 SoM to SBCs dropdown
Browse files Browse the repository at this point in the history
This has hardcoded "turingrk1" strings as discussed in
siderolabs/talos#9869

Signed-off-by: Nico Berlee <nico.berlee@on2it.net>
  • Loading branch information
nberlee authored and Unix4ever committed Dec 10, 2024
1 parent d8e3aad commit 8a1fb40
Show file tree
Hide file tree
Showing 8 changed files with 737 additions and 620 deletions.
1,232 changes: 622 additions & 610 deletions client/api/omni/specs/omni.pb.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions client/api/omni/specs/omni.proto
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,8 @@ message InstallationMediaSpec {
bool no_secure_boot = 11;
// Overlay is the overlay to be always used when generating the image of this type.
string overlay = 12;
// MinTalosVersion defines minimum Talos version supported for the supplied configuration.
string min_talos_version = 13;
}

// ConfigPatchSpec represents the machine config patch.
Expand Down
47 changes: 47 additions & 0 deletions client/api/omni/specs/omni_vtproto.pb.go

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

1 change: 1 addition & 0 deletions frontend/src/api/omni/specs/omni.pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ export type InstallationMediaSpec = {
extension?: string
no_secure_boot?: boolean
overlay?: string
min_talos_version?: string
}

export type ConfigPatchSpec = {
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/schemas/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2114,6 +2114,13 @@
"description": "Enable Image Cache feature.\n",
"markdownDescription": "Enable Image Cache feature.",
"x-intellij-html-description": "\u003cp\u003eEnable Image Cache feature.\u003c/p\u003e\n"
},
"nodeAddressSortAlgorithm": {
"type": "string",
"title": "nodeAddressSortAlgorithm",
"description": "Select the node address sort algorithm.\nThe ‘v1’ algorithm sorts addresses by the address itself.\nThe ‘v2’ algorithm prefers more specific prefixes.\nIf unset, defaults to ‘v1’.\n",
"markdownDescription": "Select the node address sort algorithm.\nThe 'v1' algorithm sorts addresses by the address itself.\nThe 'v2' algorithm prefers more specific prefixes.\nIf unset, defaults to 'v1'.",
"x-intellij-html-description": "\u003cp\u003eSelect the node address sort algorithm.\nThe \u0026lsquo;v1\u0026rsquo; algorithm sorts addresses by the address itself.\nThe \u0026lsquo;v2\u0026rsquo; algorithm prefers more specific prefixes.\nIf unset, defaults to \u0026lsquo;v1\u0026rsquo;.\u003c/p\u003e\n"
}
},
"additionalProperties": false,
Expand Down
38 changes: 35 additions & 3 deletions frontend/src/views/omni/Modals/DownloadInstallationMedia.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,23 @@ included in the LICENSE file.
PXE Boot URL
</h3>

<div class="cursor-pointer px-1.5 py-1.5 rounded border border-naturals-N8 text-xs flex gap-2 items-center">
<div class="cursor-pointer px-1.5 py-1.5 rounded border border-naturals-N8 text-xs flex gap-2 items-center" :class="{'pointer-events-none': !supported}">
<icon-button class="min-w-min" icon="refresh" @click="createSchematic" :icon-classes="{'animate-spin': creatingSchematic}" :disabled="!ready"/>
<span v-if="copiedPXEURL" class="flex-1 text-sm">Copied!</span>
<span v-else class="flex-1 break-all" @click="createSchematic">{{ pxeURL ? pxeURL : 'Click to generate' }}</span>
<icon-button class="min-w-min" icon="copy" @click="copyPXEURL"/>
</div>

<div>
<p class="text-xs">The generated image will include the kernel arguments required to register with Omni automatically.</p>
<p v-if="supported" class="text-xs">The generated image will include the kernel arguments required to register with Omni automatically.</p>
<p v-else class="text-xs text-primary-P2">{{ selectedOption }} supports only Talos version >= {{ minTalosVersion }}.</p>
</div>

<div class="flex justify-end gap-4">
<t-button @click="close" class="w-32 h-9">
Cancel
</t-button>
<t-button @click="download" class="w-32 h-9" type="highlighted" :disabled="!ready">
<t-button @click="download" class="w-32 h-9" type="highlighted" :disabled="!ready || !supported">
Download
</t-button>
</div>
Expand Down Expand Up @@ -140,6 +141,8 @@ import Tooltip from "@/components/common/Tooltip/Tooltip.vue";
import { withRuntime } from "@/api/options";
import { ConnectionParamsSpec } from "@/api/omni/specs/siderolink.pb";

import * as semver from "semver";

enum Phase {
Idle = 0,
Generating = 1,
Expand Down Expand Up @@ -221,6 +224,35 @@ const useGrpcTunnel = ref(false);
const useGrpcTunnelDefault = ref(false);
const ready = ref(false);

const minTalosVersion = computed(() => {
const option = options.value.get(selectedOption.value);
if (!option) {
return null;
}

return option.spec.min_talos_version;
});

const supported = computed(() => {
if (minTalosVersion.value === null) {
return false;
}

if (!minTalosVersion.value) {
return true;
}

const selectedVersion = semver.parse(selectedTalosVersion.value, { loose: true });

selectedVersion.prerelease = [];

if (semver.lt(selectedVersion.format(), minTalosVersion.value, { loose: true })) {
return false;
}

return true;
})

watch(() => optionsWatch.items?.value.length, () => {
options.value = watchOptions.value.reduce((map, obj) => {
return map.set(obj.spec.name!, obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ const (
)

type installationMediaSpec struct {
Name string
Architecture string
Profile string
Type string
ContentType string
Overlay string
SBC bool
Name string
Architecture string
Profile string
Type string
ContentType string
Overlay string
MinTalosVersion string
SBC bool
}

var installationMedia = []installationMediaSpec{
Expand Down Expand Up @@ -343,6 +344,15 @@ var installationMedia = []installationMediaSpec{
SBC: true,
ContentType: "application/x-xz",
},
{
Name: "Turing RK1",
Architecture: arm64Arch,
Profile: "turingrk1",
Type: rawType,
SBC: true,
ContentType: "application/x-xz",
MinTalosVersion: "1.9.0",
},
}

// InstallationMediaController manages omni.InstallationMedia.
Expand Down Expand Up @@ -389,6 +399,7 @@ func (ctrl *InstallationMediaController) Run(ctx context.Context, r controller.R
newMedia.TypedSpec().Value.DestFilePrefix = fmt.Sprintf("%s-omni-%s", fname.srcPrefix, config.Config.Name)
newMedia.TypedSpec().Value.Extension = fname.extension
newMedia.TypedSpec().Value.NoSecureBoot = m.SBC
newMedia.TypedSpec().Value.MinTalosVersion = m.MinTalosVersion

overlay := boards.GetOverlay(m.Profile)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ func GetOverlay(board string) *schematic.Overlay {
Name: "rpi_generic",
Image: "siderolabs/sbc-raspberrypi",
}
case "turingrk1":
return &schematic.Overlay{
Name: "turingrk1",
Image: "siderolabs/sbc-rockchip",
}
}

return nil
Expand Down

0 comments on commit 8a1fb40

Please sign in to comment.