Closed jasirjasir closed 2 years ago
Thanks a lot for reporting this. I think we need to change: https://github.com/googlecloudrobotics/core/blob/master/docs/how-to/examples/charge-service/charge-crd.yaml#L7 to add at least:
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
Alternatively we need to actually define the schema here. You can find examples if you look at the other crds in the repo (e.g. run: git grep CustomResourceDefinition *.yaml
.
Could you test this suggestion and if it works, send a PR?
@ensonic , Thanks a lot . it worked as per your suggestion. My new charge-crd.yaml file will finally look like this
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: chargeactions.example.com
annotations:
cr-syncer.cloudrobotics.com/spec-source: cloud
spec:
group: example.com
names:
kind: ChargeAction
plural: chargeactions
singular: chargeaction
scope: Namespaced
versions:
- name: v1alpha1
served: true
storage: true
subresources:
status: {}
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: cloud-robotics:cr-syncer:chartaction
labels:
cr-syncer.cloudrobotics.com/aggregate-to-robot-service: "true"
rules:
- apiGroups:
- example.com
resources:
- chargeactions
verbs:
- get
- list
- watch
- update
But i have an issue while accessing ChargeAction from robot. Getting the error error: unable to recognize "charge-action.yaml": no matches for kind "ChargeAction" in version "example.com/v1"
while running charge-action.yaml file.
apiVersion: example.com/v1 kind: ChargeAction metadata: name: my-charge-action
Could you please help.
Thanks for verifying, we're followup on the other issue in #92
While trying the example Creating a declarative API , Getting the error
The CustomResourceDefinition "chargeactions.example.com" is invalid: spec.versions[0].schema.openAPIV3Schema: Required value: schemas are required
. This error occurred while deploying the charge-crd.yaml file . Anyone faced similar issue?