Skip to content

Commit dcf89d9

Browse files
committed
feat: update Omni for Talos 1.8 machinery
Add handling for `$patch: delete` in JSON schema. Fix config patch validation. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
1 parent a04b07f commit dcf89d9

File tree

10 files changed

+304
-34
lines changed

10 files changed

+304
-34
lines changed

.kres.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ kind: js.Protobuf
412412
spec:
413413
baseSpecPath: /client/api
414414
files:
415-
- source: https://www.talos.dev/v1.7/schemas/config.schema.json
415+
- source: https://www.talos.dev/v1.8/schemas/config.schema.json
416416
destination: frontend/src/schemas/config.schema.json
417417
destinationRoot: src/api
418418
specs:

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
44
#
5-
# Generated on 2024-09-02T13:39:41Z by kres b5ca957.
5+
# Generated on 2024-09-24T12:08:22Z by kres 8be5fa7.
66

77
ARG JS_TOOLCHAIN
88
ARG TOOLCHAIN
@@ -236,7 +236,7 @@ RUN --mount=type=cache,target=/go/pkg go list -mod=readonly all >/dev/null
236236

237237
# cleaned up specs and compiled versions
238238
FROM scratch AS generate-frontend
239-
ADD https://www.talos.dev/v1.7/schemas/config.schema.json frontend/src/schemas/config.schema.json
239+
ADD https://www.talos.dev/v1.8/schemas/config.schema.json frontend/src/schemas/config.schema.json
240240
COPY --from=proto-compile-frontend frontend/ frontend/
241241

242242
FROM embed-generate AS embed-abbrev-generate

client/go.mod

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ require (
3131
github.com/siderolabs/go-kubeconfig v0.1.0
3232
github.com/siderolabs/go-pointer v1.0.0
3333
github.com/siderolabs/image-factory v0.5.0
34-
github.com/siderolabs/talos/pkg/machinery v1.8.0-alpha.2.0.20240830181738-6f7c3a8e5c63
34+
github.com/siderolabs/talos/pkg/machinery v1.8.0
3535
github.com/spf13/cobra v1.8.1
3636
github.com/stretchr/testify v1.9.0
3737
github.com/xlab/treeprint v1.2.0
@@ -48,6 +48,7 @@ require (
4848
github.com/ProtonMail/go-crypto v1.1.0-alpha.5.0.20240827111422-b5837fa4476e // indirect
4949
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f // indirect
5050
github.com/ProtonMail/gopenpgp/v2 v2.7.5 // indirect
51+
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
5152
github.com/blang/semver/v4 v4.0.0 // indirect
5253
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
5354
github.com/cloudflare/circl v1.3.9 // indirect
@@ -58,6 +59,7 @@ require (
5859
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
5960
github.com/go-logr/logr v1.4.2 // indirect
6061
github.com/gogo/protobuf v1.3.2 // indirect
62+
github.com/google/cel-go v0.21.0 // indirect
6163
github.com/google/go-cmp v0.6.0 // indirect
6264
github.com/google/gofuzz v1.2.0 // indirect
6365
github.com/gosuri/uilive v0.0.4 // indirect
@@ -82,20 +84,22 @@ require (
8284
github.com/ryanuber/go-glob v1.0.0 // indirect
8385
github.com/siderolabs/crypto v0.4.4 // indirect
8486
github.com/siderolabs/go-blockdevice v0.4.7 // indirect
85-
github.com/siderolabs/go-blockdevice/v2 v2.0.1 // indirect
87+
github.com/siderolabs/go-blockdevice/v2 v2.0.2 // indirect
8688
github.com/siderolabs/net v0.4.0 // indirect
8789
github.com/siderolabs/protoenc v0.2.1 // indirect
8890
github.com/spf13/pflag v1.0.5 // indirect
91+
github.com/stoewer/go-strcase v1.3.0 // indirect
8992
github.com/x448/float16 v0.8.4 // indirect
9093
go.uber.org/multierr v1.11.0 // indirect
9194
golang.org/x/crypto v0.26.0 // indirect
95+
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
9296
golang.org/x/net v0.28.0 // indirect
9397
golang.org/x/oauth2 v0.22.0 // indirect
9498
golang.org/x/sys v0.24.0 // indirect
9599
golang.org/x/text v0.17.0 // indirect
96100
golang.org/x/time v0.6.0 // indirect
97-
google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed // indirect
98-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect
101+
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
102+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
99103
gopkg.in/inf.v0 v0.9.1 // indirect
100104
gopkg.in/yaml.v2 v2.4.0 // indirect
101105
k8s.io/apimachinery v0.31.0 // indirect

client/go.sum

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ github.com/ProtonMail/gopenpgp/v2 v2.7.5 h1:STOY3vgES59gNgoOt2w0nyHBjKViB/qSg7Nj
77
github.com/ProtonMail/gopenpgp/v2 v2.7.5/go.mod h1:IhkNEDaxec6NyzSI0PlxapinnwPVIESk8/76da3Ct3g=
88
github.com/adrg/xdg v0.5.0 h1:dDaZvhMXatArP1NPHhnfaQUqWBLBsmx1h1HXQdMoFCY=
99
github.com/adrg/xdg v0.5.0/go.mod h1:dDdY4M4DF9Rjy4kHPeNL+ilVF+p2lK8IdM9/rTSGcI4=
10+
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
11+
github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
1012
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
1113
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
1214
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
@@ -61,6 +63,8 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
6163
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
6264
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
6365
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
66+
github.com/google/cel-go v0.21.0 h1:cl6uW/gxN+Hy50tNYvI691+sXxioCnstFzLp2WO4GCI=
67+
github.com/google/cel-go v0.21.0/go.mod h1:rHUlWCcBKgyEk+eV03RPdZUekPp6YcJwV0FxuUksYxc=
6468
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 h1:0VpGH+cDhbDtdcweoyCVsF3fhN8kejK6rFe/2FFX2nU=
6569
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49/go.mod h1:BkkQ4L1KS1xMt2aWSPStnn55ChGC0DPOn2FQYj+f25M=
6670
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
@@ -164,8 +168,8 @@ github.com/siderolabs/go-api-signature v0.3.6 h1:wDIsXbpl7Oa/FXvxB6uz4VL9INA9fmr
164168
github.com/siderolabs/go-api-signature v0.3.6/go.mod h1:hoH13AfunHflxbXfh+NoploqV13ZTDfQ1mQJWNVSW9U=
165169
github.com/siderolabs/go-blockdevice v0.4.7 h1:2bk4WpEEflGxjrNwp57ye24Pr+cYgAiAeNMWiQOuWbQ=
166170
github.com/siderolabs/go-blockdevice v0.4.7/go.mod h1:4PeOuk71pReJj1JQEXDE7kIIQJPVe8a+HZQa+qjxSEA=
167-
github.com/siderolabs/go-blockdevice/v2 v2.0.1 h1:y97LM3F3Iht9pxk4M0y53ElsNcWg/6i4wjcBck7y1Lg=
168-
github.com/siderolabs/go-blockdevice/v2 v2.0.1/go.mod h1:74htzCV913UzaLZ4H+NBXkwWlYnBJIq5m/379ZEcu8w=
171+
github.com/siderolabs/go-blockdevice/v2 v2.0.2 h1:GIdOBrCLQ7X9jbr0P/+7paw5SIfp/LL+dx9mTOzmw8w=
172+
github.com/siderolabs/go-blockdevice/v2 v2.0.2/go.mod h1:74htzCV913UzaLZ4H+NBXkwWlYnBJIq5m/379ZEcu8w=
169173
github.com/siderolabs/go-kubeconfig v0.1.0 h1:t/2oMWkLSdWHXglKPMz8ySXnx6ZjHckeGY79NaDcBTo=
170174
github.com/siderolabs/go-kubeconfig v0.1.0/go.mod h1:eM3mO02Td6wYDvdi9zTbMrj1Q4WqEFN8XQ6pNjCUWkI=
171175
github.com/siderolabs/go-pointer v1.0.0 h1:6TshPKep2doDQJAAtHUuHWXbca8ZfyRySjSBT/4GsMU=
@@ -178,18 +182,25 @@ github.com/siderolabs/net v0.4.0 h1:1bOgVay/ijPkJz4qct98nHsiB/ysLQU0KLoBC4qLm7I=
178182
github.com/siderolabs/net v0.4.0/go.mod h1:/ibG+Hm9HU27agp5r9Q3eZicEfjquzNzQNux5uEk0kM=
179183
github.com/siderolabs/protoenc v0.2.1 h1:BqxEmeWQeMpNP3R6WrPqDatX8sM/r4t97OP8mFmg6GA=
180184
github.com/siderolabs/protoenc v0.2.1/go.mod h1:StTHxjet1g11GpNAWiATgc8K0HMKiFSEVVFOa/H0otc=
181-
github.com/siderolabs/talos/pkg/machinery v1.8.0-alpha.2.0.20240830181738-6f7c3a8e5c63 h1:lHQoFYXArLj2jIOHsM1czztMfFTB1igfWlJFCLci4Vs=
182-
github.com/siderolabs/talos/pkg/machinery v1.8.0-alpha.2.0.20240830181738-6f7c3a8e5c63/go.mod h1:bhPxE2HxvxKwhl23l4ZpYAbQD165Bh8+Yr8WAc0pINU=
185+
github.com/siderolabs/talos/pkg/machinery v1.8.0 h1:azhBj+Nm9oTgaFgcNaHU8TPS9Oi5OdV1ELNgFAVder8=
186+
github.com/siderolabs/talos/pkg/machinery v1.8.0/go.mod h1:kkrPF7yyhNSg8yJx4RJnk21Hi3APAHm3HQm2M3zfwKI=
183187
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
184188
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
185189
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
186190
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
191+
github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs=
192+
github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo=
187193
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
194+
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
195+
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
188196
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
189197
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
190198
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
191199
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
192200
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
201+
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
202+
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
203+
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
193204
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
194205
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
195206
github.com/unix4ever/yaml v0.0.0-20220527175918-f17b0f05cf2c h1:Vn6nVVu9MdOYvXPkJP83iX5jVIfvxFC9v9xIKb+DlaQ=
@@ -287,10 +298,10 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
287298
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
288299
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
289300
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
290-
google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed h1:3RgNmBoI9MZhsj3QxC+AP/qQhNwpCLOvYDYYsFrhFt0=
291-
google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:OCdP9MfskevB/rbYvHTsXTtKC+3bHWajPdoKgjcYkfo=
292-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg=
293-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
301+
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc=
302+
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I=
303+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ=
304+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
294305
google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c=
295306
google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y=
296307
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=

client/pkg/omni/resources/omni/config_patch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func (ConfigPatchExtension) ResourceDefinition() meta.ResourceDefinitionSpec {
8787
// ValidateConfigPatch parses the config patch data using Talos config loader,
8888
// then validates that the config patch doesn't have fields that are controlled by omni.
8989
func ValidateConfigPatch(data []byte) error {
90-
_, err := configloader.NewFromBytes(data)
90+
_, err := configloader.NewFromBytes(data, configloader.WithAllowPatchDelete())
9191
if err != nil {
9292
return err
9393
}

frontend/src/api/resources.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export const SAMLLabelRuleType = "SAMLLabelRules.omni.sidero.dev";
156156
export const UserType = "Users.omni.sidero.dev";
157157
export const MachineRequestType = "MachineRequests.omni.sidero.dev";
158158
export const MachineRequestStatusType = "MachineRequestStatuses.omni.sidero.dev";
159-
export const InfraProviderStatusType = "InfraInfraProviderStatuses.omni.sidero.dev";
159+
export const InfraProviderStatusType = "InfraProviderStatuses.omni.sidero.dev";
160160
export const KubernetesResourceType = "KubernetesResources.omni.sidero.dev";
161161
export const ConfigType = "Configs.omni.sidero.dev";
162162
export const ConfigID = "siderolink-config";

frontend/src/components/common/CodeEditor/CodeEditor.vue

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,37 @@ let instance: monaco.editor.IStandaloneCodeEditor | undefined;
3535
if (!window['monacoConfigured']) {
3636
window['monacoConfigured'] = true;
3737
38+
// adjust configSchema by copying it first, and adding the $patch property with the value
39+
// "delete" to all definitions which are structs with properties
40+
const schemaCopy = JSON.parse(JSON.stringify(configSchema));
41+
42+
const adjustSchemaPatchDelete = (schema: any) => {
43+
for (const name in schema.$defs) {
44+
const def = schema.$defs[name];
45+
46+
if (def.properties) {
47+
def.properties.$patch = {
48+
type: "string",
49+
title: "$patch",
50+
enum: ["delete"],
51+
description: "Delete the configuration block with a strategic merge delete patch.\nSee https://www.talos.dev/latest/talos-guides/configuration/patching/"
52+
};
53+
}
54+
}
55+
}
56+
57+
adjustSchemaPatchDelete(schemaCopy);
58+
3859
configureMonacoYaml(monaco, {
3960
hover: true,
4061
completion: true,
4162
validate: true,
4263
format: true,
4364
schemas: [
4465
{
45-
uri: configSchema.$id,
66+
uri: schemaCopy.$id,
4667
fileMatch: ["*"],
47-
schema: configSchema,
68+
schema: schemaCopy,
4869
},
4970
],
5071
});

0 commit comments

Comments
 (0)