validating failed on creating new drc
Closed this issue · 1 comments
hpxue13 commented
hi, I deployed the operator as cluster-scoped
following the quick start guide, and everything seemed fine, but when I tried to create a DRC by kubectl create -f deploy/example/custom-password.yaml
, it throws an error, saying validating error:
> kubectl create -f deploy/example/custom-password.yaml
error validating "deploy/example/custom-password.yaml": error validating data: [ValidationError(DistributedRedisCluster.spec): unknown field "image" in kun.redis.v1alpha1.DistributedRedisCluster.spec, ValidationError(DistributedRedisCluster.spec): unknown field "passwordSecret" in kun.redis.v1alpha1.DistributedRedisCluster.spec, ValidationError(DistributedRedisCluster.spec): unknown field "resources" in kun.redis.v1alpha1.DistributedRedisCluster.spec]; if you choose to ignore these errors, turn validation off with --validate=false
CRDs I have created:
> kubectl get crd
NAME CREATED AT
distributedredisclusters.redis.kun 2020-07-09T08:56:53Z
redisclusterbackups.redis.kun 2020-07-09T09:03:34Z
> kubectl get deployments -A
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
default redis-cluster-operator 1/1 1 1 5h59m
kube-system coredns 1/1 1 1 21d
kube-system kubernetes-dashboard 1/1 1 1 21d
kube-system metrics-server 1/1 1 1 21d
the crd distributedredisclusters.redis.kun
definition:
> kubectl get crd distributedredisclusters.redis.kun -oyaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"apiextensions.k8s.io/v1beta1","kind":"CustomResourceDefinition","metadata":{"annotations":{},"name":"distributedredisclusters.redis.kun"},"spec":{"additionalPrinterColumns":[{"JSONPath":".spec.masterSize","description":"The number of redis master node in the ensemble","name":"MasterSize","type":"integer"},{"JSONPath":".status.status","description":"The status of redis cluster","name":"Status","type":"string"},{"JSONPath":".metadata.creationTimestamp","name":"Age","type":"date"},{"JSONPath":".status.numberOfMaster","description":"The current master number of redis cluster","name":"CurrentMasters","priority":1,"type":"integer"},{"JSONPath":".spec.image","description":"The image of redis cluster","name":"Images","priority":1,"type":"string"}],"group":"redis.kun","names":{"kind":"DistributedRedisCluster","listKind":"DistributedRedisClusterList","plural":"distributedredisclusters","shortNames":["drc"],"singular":"distributedrediscluster"},"scope":"Namespaced","subresources":{"status":{}},"validation":{"openAPIV3Schema":{"description":"DistributedRedisCluster is the Schema for the distributedredisclusters API","properties":{"apiVersion":{"description":"APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources","type":"string"},"kind":{"description":"Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds","type":"string"},"metadata":{"type":"object"},"spec":{"description":"DistributedRedisClusterSpec defines the desired state of DistributedRedisCluster","properties":{"clusterReplicas":{"format":"int32","maximum":3,"minimum":1,"type":"integer"},"masterSize":{"format":"int32","maximum":12,"minimum":3,"type":"integer"},"serviceName":{"pattern":"[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*","type":"string"}},"type":"object"},"status":{"description":"DistributedRedisClusterStatus defines the observed state of DistributedRedisCluster","type":"object"}},"type":"object"}},"version":"v1alpha1","versions":[{"name":"v1alpha1","served":true,"storage":true}]}}
creationTimestamp: "2020-07-09T08:56:53Z"
generation: 1
name: distributedredisclusters.redis.kun
resourceVersion: "3190816"
selfLink: /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/distributedredisclusters.redis.kun
uid: 2fa61f63-9a31-46b7-b51c-82a2e8c30578
spec:
additionalPrinterColumns:
- JSONPath: .spec.masterSize
description: The number of redis master node in the ensemble
name: MasterSize
type: integer
- JSONPath: .status.status
description: The status of redis cluster
name: Status
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
- JSONPath: .status.numberOfMaster
description: The current master number of redis cluster
name: CurrentMasters
priority: 1
type: integer
- JSONPath: .spec.image
description: The image of redis cluster
name: Images
priority: 1
type: string
conversion:
strategy: None
group: redis.kun
names:
kind: DistributedRedisCluster
listKind: DistributedRedisClusterList
plural: distributedredisclusters
shortNames:
- drc
singular: distributedrediscluster
preserveUnknownFields: true
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: DistributedRedisCluster is the Schema for the distributedredisclusters
API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: DistributedRedisClusterSpec defines the desired state of DistributedRedisCluster
properties:
clusterReplicas:
format: int32
maximum: 3
minimum: 1
type: integer
masterSize:
format: int32
maximum: 12
minimum: 3
type: integer
serviceName:
pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'
type: string
type: object
status:
description: DistributedRedisClusterStatus defines the observed state of
DistributedRedisCluster
type: object
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
status:
acceptedNames:
kind: DistributedRedisCluster
listKind: DistributedRedisClusterList
plural: distributedredisclusters
shortNames:
- drc
singular: distributedrediscluster
conditions:
- lastTransitionTime: "2020-07-09T08:56:53Z"
message: no conflicts found
reason: NoConflicts
status: "True"
type: NamesAccepted
- lastTransitionTime: null
message: the initial names have been accepted
reason: InitialNamesAccepted
status: "True"
type: Established
storedVersions:
- v1alpha1
Kubernetes version being v1.15.0
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.0", GitCommit:"e8462b5b5dc2584fdcd18e6bcfe9f1e4d970a529", GitTreeState:"clean", BuildDate:"2019-06-19T16:32:14Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
hpxue13 commented
it works fine in Kubernetes v1.18 clusters, might be a bug of Kubernetes v1.15.0