From 89163a2ebe9302262cb242d45cf0f2784779cf11 Mon Sep 17 00:00:00 2001 From: Rodrigo Queiro Date: Mon, 14 Mar 2022 08:26:37 +0000 Subject: [PATCH] Revert "Remove RobotType from Registry API" This reverts commit 069b80187c808b35b370afb450b9374b0765c95b. Reason for revert: https://github.com/SAP/ewm-cloud-robotics/issues/37 Change-Id: I2e29df5d43be8423bf28d7abb17583312456f683 GitOrigin-RevId: d27f4070dc4ee7ebda7bae5a649133e5f8616d2c --- deploy.sh | 1 - .../base/cloud/cr-syncer-policy.yaml | 3 +- src/app_charts/base/cloud/registry-crd.yaml | 32 +++++++++++++++++++ src/bootstrap/robot/setup_robot.sh | 1 - src/proto/registry/registry.proto | 20 ++++++++++++ 5 files changed, 54 insertions(+), 3 deletions(-) diff --git a/deploy.sh b/deploy.sh index 0c7b255f..1c757765 100755 --- a/deploy.sh +++ b/deploy.sh @@ -290,7 +290,6 @@ function cleanup_old_cert_manager { function helm_cleanup { cleanup_helm_data cleanup_old_cert_manager - kc delete crd robottypes.registry.cloudrobotics.com 2> /dev/null || true } function helm_charts { diff --git a/src/app_charts/base/cloud/cr-syncer-policy.yaml b/src/app_charts/base/cloud/cr-syncer-policy.yaml index 54ea193f..12b7f58c 100644 --- a/src/app_charts/base/cloud/cr-syncer-policy.yaml +++ b/src/app_charts/base/cloud/cr-syncer-policy.yaml @@ -9,12 +9,13 @@ rules: # To sync the specs from the cloud to the robot, the cr-syncer needs to read # the resources in the cloud cluster. Note that the Robot and ChartAssignment -# CRDs enable the /status subresource. +# CRDs enable the /status subresource, whereas the RobotType does not. - apiGroups: - registry.cloudrobotics.com resources: - robots - robots/status + - robottypes verbs: - get - list diff --git a/src/app_charts/base/cloud/registry-crd.yaml b/src/app_charts/base/cloud/registry-crd.yaml index 20e82b9d..a6eea572 100644 --- a/src/app_charts/base/cloud/registry-crd.yaml +++ b/src/app_charts/base/cloud/registry-crd.yaml @@ -1,5 +1,37 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition +metadata: + name: robottypes.registry.cloudrobotics.com + annotations: + cr-syncer.cloudrobotics.com/spec-source: cloud + helm.sh/resource-policy: keep +spec: + group: registry.cloudrobotics.com + names: + kind: RobotType + plural: robottypes + singular: robottype + scope: Namespaced + versions: + - name: v1alpha1 + served: true + storage: true + schema: + openAPIV3Schema: + type: object + properties: + spec: + type: object + required: ['make', 'model'] + maxProperties: 2 + properties: + make: + type: string + model: + type: string +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition metadata: name: robots.registry.cloudrobotics.com annotations: diff --git a/src/bootstrap/robot/setup_robot.sh b/src/bootstrap/robot/setup_robot.sh index 0c3625ac..8a2a28d7 100755 --- a/src/bootstrap/robot/setup_robot.sh +++ b/src/bootstrap/robot/setup_robot.sh @@ -150,7 +150,6 @@ kc -n kube-system delete sa tiller 2> /dev/null || true kc -n kube-system delete cm -l OWNER=TILLER 2> /dev/null # Cleanup old resources kc -n default delete secret robot-master-tls 2> /dev/null || true -kc delete crd robottypes.registry.cloudrobotics.com 2> /dev/null || true # Remove previous instance, in case installation was canceled kc delete pod setup-robot 2> /dev/null || true diff --git a/src/proto/registry/registry.proto b/src/proto/registry/registry.proto index ab4aa654..8972b6a4 100644 --- a/src/proto/registry/registry.proto +++ b/src/proto/registry/registry.proto @@ -44,6 +44,26 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { }; }; +/* Information about the robot model. + * + * RobotType contains shared information about a specific robot model. + */ +message RobotTypeSpec { + // Manufacturer name of the robot. + // Output only + string make = 1; + + // Model name of the robot. + // Output only + string model = 2; + + // TODO(ensonic): consider more details, such as icons, urdf, ... +} + +message RobotTypeStatus { + // Types aren't actuated. +} + message RobotSpec { string type = 1; string project = 3;