From 3c98f110c6c78f76c2a6f481babf3c8f73ebd85b Mon Sep 17 00:00:00 2001 From: Maksym Trofimenko Date: Tue, 31 Dec 2024 00:27:26 +0000 Subject: [PATCH] do not sanitise component name to have a match --- Makefile | 5 ++++ api-docs.md | 24 ++++++++++++++++++-- internal/controller/tinymodule_controller.go | 3 +-- module/component.go | 5 ---- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index fba5e2c..cb27efb 100644 --- a/Makefile +++ b/Makefile @@ -182,6 +182,11 @@ envtest: $(ENVTEST) ## Download setup-envtest locally if necessary. $(ENVTEST): $(LOCALBIN) $(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest,$(ENVTEST_VERSION)) +.PHONY: generate-docs +generate-docs: + crd-ref-docs --source-path ./api --renderer=markdown --config=crd-api-doc-config.yaml --output-path=api-docs.md + + .PHONY: golangci-lint golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary. $(GOLANGCI_LINT): $(LOCALBIN) diff --git a/api-docs.md b/api-docs.md index 1c14b8f..8341a0c 100644 --- a/api-docs.md +++ b/api-docs.md @@ -51,6 +51,23 @@ _Appears in:_ | `status` _[TinyModuleStatus](#tinymodulestatus)_ | | +#### TinyModuleComponentStatus + + + + + +_Appears in:_ +- [TinyModuleStatus](#tinymodulestatus) + +| Field | Description | +| --- | --- | +| `name` _string_ | | +| `description` _string_ | | +| `info` _string_ | | +| `tags` _string array_ | | + + #### TinyModuleList @@ -95,6 +112,9 @@ _Appears in:_ | Field | Description | | --- | --- | | `addr` _string_ | INSERT ADDITIONAL STATUS FIELD - define observed state of cluster

Important: Run "make" to regenerate code after modifying this file | +| `name` _string_ | | +| `version` _string_ | | +| `components` _[TinyModuleComponentStatus](#tinymodulecomponentstatus) array_ | | #### TinyNode @@ -147,7 +167,7 @@ _Appears in:_ | `id` _string_ | Edge id | | `port` _string_ | Current node's port name

Source port | | `to` _string_ | Other node's full port name | -| `extras` _object (keys:string, values:string)_ | | +| `flowID` _string_ | | #### TinyNodeList @@ -198,7 +218,7 @@ _Appears in:_ | `port` _string_ | | | `schema` _[byte](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#byte-v1-meta) array_ | Schema JSON schema of the port | | `configuration` _[byte](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#byte-v1-meta) array_ | Configuration JSON data of the port's configuration | -| `extras` _object (keys:string, values:string)_ | | +| `flowID` _string_ | | #### TinyNodePortStatus diff --git a/internal/controller/tinymodule_controller.go b/internal/controller/tinymodule_controller.go index ed4d216..7913b4e 100644 --- a/internal/controller/tinymodule_controller.go +++ b/internal/controller/tinymodule_controller.go @@ -20,7 +20,6 @@ import ( "context" clientpool "github.com/tiny-systems/module/internal/client" "github.com/tiny-systems/module/module" - "github.com/tiny-systems/module/pkg/utils" "github.com/tiny-systems/module/registry" "k8s.io/apimachinery/pkg/api/errors" "sigs.k8s.io/controller-runtime/pkg/reconcile" @@ -83,7 +82,7 @@ func (r *TinyModuleReconciler) Reconcile(ctx context.Context, req ctrl.Request) for i, cmp := range components { info := cmp.GetInfo() statusComponents[i] = operatorv1alpha1.TinyModuleComponentStatus{ - Name: utils.SanitizeResourceName(info.Name), + Name: info.Name, Description: info.Description, Info: info.Info, Tags: info.Tags, diff --git a/module/component.go b/module/component.go index fb1c055..837a7f2 100644 --- a/module/component.go +++ b/module/component.go @@ -2,7 +2,6 @@ package module import ( "context" - "github.com/tiny-systems/module/pkg/utils" ) type ComponentInfo struct { @@ -12,10 +11,6 @@ type ComponentInfo struct { Tags []string } -func (c ComponentInfo) GetResourceName() string { - return utils.SanitizeResourceName(c.Name) -} - type Component interface { GetInfo() ComponentInfo //Handle handles incoming requests