Skip to content

Commit ebb0d2c

Browse files
committed
Add TinyScenario CRD for storing per-port sample data from traces
New CRD enables capturing real trace data as reusable "scenarios" for edge validation, replacing schema-generated mock data with actual payloads. - TinyScenario CRD: project-scoped, owned by TinyProject, stores ScenarioPortData (port full name + JSON payload) per port - Resource manager CRUD: CreateScenario, GetProjectScenarios, GetScenario, UpdateScenario, DeleteScenario - Conversion functions: ScenarioPortsFromTrace (trace → CRD), RuntimeDataFromScenario (CRD → SimulatePortDataFromMaps input) - CRD chart bumped to 0.1.44
1 parent c1195b1 commit ebb0d2c

File tree

10 files changed

+503
-39
lines changed

10 files changed

+503
-39
lines changed

api-docs.md

Lines changed: 62 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@ Package v1alpha1 contains API Schema definitions for the operator v1alpha1 API g
1717
- [TinyNodeList](#tinynodelist)
1818
- [TinyProject](#tinyproject)
1919
- [TinyProjectList](#tinyprojectlist)
20+
- [TinyScenario](#tinyscenario)
21+
- [TinyScenarioList](#tinyscenariolist)
2022
- [TinySignal](#tinysignal)
2123
- [TinySignalList](#tinysignallist)
22-
- [TinyTracker](#tinytracker)
23-
- [TinyTrackerList](#tinytrackerlist)
2424
- [TinyWidgetPage](#tinywidgetpage)
2525
- [TinyWidgetPageList](#tinywidgetpagelist)
2626

2727

2828

29+
30+
2931
#### Position
3032

3133
_Underlying type:_ _integer_
@@ -37,6 +39,21 @@ _Appears in:_
3739

3840

3941

42+
#### ScenarioPortData
43+
44+
45+
46+
ScenarioPortData stores the sample data for a single port
47+
48+
_Appears in:_
49+
- [TinyScenarioSpec](#tinyscenariospec)
50+
51+
| Field | Description |
52+
| --- | --- |
53+
| `port` _string_ | Port is the full port name (e.g., "flowid.module.component-suffix:portname") |
54+
| `data` _[byte](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#byte-v1-meta) array_ | Data is the JSON-encoded sample payload for this port |
55+
56+
4057
#### TinyFlow
4158

4259

@@ -180,6 +197,7 @@ _Appears in:_
180197
| `addr` _string_ | INSERT ADDITIONAL STATUS FIELD - define observed state of cluster<br /><br />Important: Run "make" to regenerate code after modifying this file |
181198
| `name` _string_ | |
182199
| `version` _string_ | |
200+
| `sdkVersion` _string_ | |
183201
| `components` _[TinyModuleComponentStatus](#tinymodulecomponentstatus) array_ | |
184202

185203

@@ -267,6 +285,7 @@ _Appears in:_
267285
| --- | --- |
268286
| `name` _string_ | |
269287
| `version` _string_ | |
288+
| `sdkVersion` _string_ | |
270289

271290

272291
#### TinyNodePortConfig
@@ -318,7 +337,6 @@ _Appears in:_
318337
| Field | Description |
319338
| --- | --- |
320339
| `module` _string_ | Module name - container image repo + tag |
321-
| `module_version` _string_ | Module version semver v2 compatible (without v prefix) |
322340
| `component` _string_ | Component name within a module |
323341
| `ports` _[TinyNodePortConfig](#tinynodeportconfig) array_ | Port configurations |
324342
| `edges` _[TinyNodeEdge](#tinynodeedge) array_ | Edges to send message next |
@@ -392,6 +410,9 @@ TinyProjectSpec defines the desired state of TinyProject
392410
_Appears in:_
393411
- [TinyProject](#tinyproject)
394412

413+
| Field | Description |
414+
| --- | --- |
415+
| `description` _string_ | Description is a markdown description of the project |
395416

396417

397418
#### TinyProjectStatus
@@ -405,128 +426,131 @@ _Appears in:_
405426

406427

407428

408-
#### TinySignal
429+
#### TinyScenario
409430

410431

411432

412-
TinySignal is the Schema for the tinysignals API
433+
TinyScenario is the Schema for the tinyscenarios API
413434

414435
_Appears in:_
415-
- [TinySignalList](#tinysignallist)
436+
- [TinyScenarioList](#tinyscenariolist)
416437

417438
| Field | Description |
418439
| --- | --- |
419440
| `apiVersion` _string_ | `operator.tinysystems.io/v1alpha1`
420-
| `kind` _string_ | `TinySignal`
441+
| `kind` _string_ | `TinyScenario`
421442
| `kind` _string_ | Kind is a string value representing the REST resource this object represents.<br /><br />Servers may infer this from the endpoint the client submits requests to.<br /><br />Cannot be updated.<br /><br />In CamelCase.<br /><br />More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
422443
| `apiVersion` _string_ | APIVersion defines the versioned schema of this representation of an object.<br /><br />Servers should convert recognized schemas to the latest internal value, and<br /><br />may reject unrecognized values.<br /><br />More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources |
423444
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. |
424-
| `spec` _[TinySignalSpec](#tinysignalspec)_ | |
425-
| `status` _[TinySignalStatus](#tinysignalstatus)_ | |
445+
| `spec` _[TinyScenarioSpec](#tinyscenariospec)_ | |
446+
| `status` _[TinyScenarioStatus](#tinyscenariostatus)_ | |
426447

427448

428-
#### TinySignalList
449+
#### TinyScenarioList
429450

430451

431452

432-
TinySignalList contains a list of TinySignal
453+
TinyScenarioList contains a list of TinyScenario
433454

434455

435456

436457
| Field | Description |
437458
| --- | --- |
438459
| `apiVersion` _string_ | `operator.tinysystems.io/v1alpha1`
439-
| `kind` _string_ | `TinySignalList`
460+
| `kind` _string_ | `TinyScenarioList`
440461
| `kind` _string_ | Kind is a string value representing the REST resource this object represents.<br /><br />Servers may infer this from the endpoint the client submits requests to.<br /><br />Cannot be updated.<br /><br />In CamelCase.<br /><br />More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
441462
| `apiVersion` _string_ | APIVersion defines the versioned schema of this representation of an object.<br /><br />Servers should convert recognized schemas to the latest internal value, and<br /><br />may reject unrecognized values.<br /><br />More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources |
442463
| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. |
443-
| `items` _[TinySignal](#tinysignal) array_ | |
464+
| `items` _[TinyScenario](#tinyscenario) array_ | |
444465

445466

446-
#### TinySignalSpec
467+
#### TinyScenarioSpec
447468

448469

449470

450-
TinySignalSpec defines the desired state of TinySignal
471+
TinyScenarioSpec defines the desired state of TinyScenario
451472

452473
_Appears in:_
453-
- [TinySignal](#tinysignal)
474+
- [TinyScenario](#tinyscenario)
454475

455476
| Field | Description |
456477
| --- | --- |
457-
| `node` _string_ | Node is the name of the TinyNode to signal |
458-
| `port` _string_ | Port is the port on the node to send the signal to |
459-
| `data` _[byte](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#byte-v1-meta) array_ | Data is the payload to send with the signal |
478+
| `ports` _[ScenarioPortData](#scenarioportdata) array_ | Ports contains per-port sample data entries |
460479

461480

462-
#### TinySignalStatus
481+
#### TinyScenarioStatus
463482

464483

465484

466-
TinySignalStatus defines the observed state of TinySignal
485+
TinyScenarioStatus defines the observed state of TinyScenario
467486

468487
_Appears in:_
469-
- [TinySignal](#tinysignal)
488+
- [TinyScenario](#tinyscenario)
470489

471490

472491

473-
#### TinyTracker
492+
#### TinySignal
474493

475494

476495

477-
TinyTracker is the Schema for the tinytrackers API
496+
TinySignal is the Schema for the tinysignals API
478497

479498
_Appears in:_
480-
- [TinyTrackerList](#tinytrackerlist)
499+
- [TinySignalList](#tinysignallist)
481500

482501
| Field | Description |
483502
| --- | --- |
484503
| `apiVersion` _string_ | `operator.tinysystems.io/v1alpha1`
485-
| `kind` _string_ | `TinyTracker`
504+
| `kind` _string_ | `TinySignal`
486505
| `kind` _string_ | Kind is a string value representing the REST resource this object represents.<br /><br />Servers may infer this from the endpoint the client submits requests to.<br /><br />Cannot be updated.<br /><br />In CamelCase.<br /><br />More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
487506
| `apiVersion` _string_ | APIVersion defines the versioned schema of this representation of an object.<br /><br />Servers should convert recognized schemas to the latest internal value, and<br /><br />may reject unrecognized values.<br /><br />More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources |
488507
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. |
489-
| `spec` _[TinyTrackerSpec](#tinytrackerspec)_ | |
490-
| `status` _[TinyTrackerStatus](#tinytrackerstatus)_ | |
508+
| `spec` _[TinySignalSpec](#tinysignalspec)_ | |
509+
| `status` _[TinySignalStatus](#tinysignalstatus)_ | |
491510

492511

493-
#### TinyTrackerList
512+
#### TinySignalList
494513

495514

496515

497-
TinyTrackerList contains a list of TinyTracker
516+
TinySignalList contains a list of TinySignal
498517

499518

500519

501520
| Field | Description |
502521
| --- | --- |
503522
| `apiVersion` _string_ | `operator.tinysystems.io/v1alpha1`
504-
| `kind` _string_ | `TinyTrackerList`
523+
| `kind` _string_ | `TinySignalList`
505524
| `kind` _string_ | Kind is a string value representing the REST resource this object represents.<br /><br />Servers may infer this from the endpoint the client submits requests to.<br /><br />Cannot be updated.<br /><br />In CamelCase.<br /><br />More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds |
506525
| `apiVersion` _string_ | APIVersion defines the versioned schema of this representation of an object.<br /><br />Servers should convert recognized schemas to the latest internal value, and<br /><br />may reject unrecognized values.<br /><br />More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources |
507526
| `metadata` _[ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#listmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. |
508-
| `items` _[TinyTracker](#tinytracker) array_ | |
527+
| `items` _[TinySignal](#tinysignal) array_ | |
509528

510529

511-
#### TinyTrackerSpec
530+
#### TinySignalSpec
512531

513532

514533

515-
TinyTrackerSpec defines the desired state of Tracker
534+
TinySignalSpec defines the desired state of TinySignal
516535

517536
_Appears in:_
518-
- [TinyTracker](#tinytracker)
537+
- [TinySignal](#tinysignal)
519538

539+
| Field | Description |
540+
| --- | --- |
541+
| `node` _string_ | Node is the name of the TinyNode to signal |
542+
| `port` _string_ | Port is the port on the node to send the signal to |
543+
| `data` _[byte](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#byte-v1-meta) array_ | Data is the payload to send with the signal |
520544

521545

522-
#### TinyTrackerStatus
546+
#### TinySignalStatus
523547

524548

525549

526-
TinyTrackerStatus defines the observed state of TinyTracker
550+
TinySignalStatus defines the observed state of TinySignal
527551

528552
_Appears in:_
529-
- [TinyTracker](#tinytracker)
553+
- [TinySignal](#tinysignal)
530554

531555

532556

api/v1alpha1/tinynode_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const (
5353
NodeCommentAnnotation = "tinysystems.io/node-comment"
5454

5555
IngressHostNameSuffixAnnotation = "tinysystems.io/ingress-hostname-suffix"
56+
57+
ScenarioNameAnnotation = "tinysystems.io/scenario-name"
5658
)
5759

5860
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!

api/v1alpha1/tinyscenario_types.go

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
Copyright 2023.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// ScenarioPortData stores the sample data for a single port
24+
type ScenarioPortData struct {
25+
// Port is the full port name (e.g., "flowid.module.component-suffix:portname")
26+
// +kubebuilder:validation:Required
27+
Port string `json:"port"`
28+
29+
// Data is the JSON-encoded sample payload for this port
30+
// +kubebuilder:validation:Optional
31+
Data []byte `json:"data,omitempty"`
32+
}
33+
34+
// TinyScenarioSpec defines the desired state of TinyScenario
35+
type TinyScenarioSpec struct {
36+
// Ports contains per-port sample data entries
37+
// +kubebuilder:validation:Optional
38+
Ports []ScenarioPortData `json:"ports,omitempty"`
39+
}
40+
41+
// TinyScenarioStatus defines the observed state of TinyScenario
42+
type TinyScenarioStatus struct {
43+
}
44+
45+
//+kubebuilder:object:root=true
46+
//+kubebuilder:subresource:status
47+
48+
// TinyScenario is the Schema for the tinyscenarios API
49+
type TinyScenario struct {
50+
metav1.TypeMeta `json:",inline"`
51+
metav1.ObjectMeta `json:"metadata,omitempty"`
52+
53+
Spec TinyScenarioSpec `json:"spec,omitempty"`
54+
Status TinyScenarioStatus `json:"status,omitempty"`
55+
}
56+
57+
//+kubebuilder:object:root=true
58+
59+
// TinyScenarioList contains a list of TinyScenario
60+
type TinyScenarioList struct {
61+
metav1.TypeMeta `json:",inline"`
62+
metav1.ListMeta `json:"metadata,omitempty"`
63+
Items []TinyScenario `json:"items"`
64+
}
65+
66+
func init() {
67+
SchemeBuilder.Register(&TinyScenario{}, &TinyScenarioList{})
68+
}

0 commit comments

Comments
 (0)