Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request vitessio#6075 from carsonoid/carsonoid-helm-crd
Browse files Browse the repository at this point in the history
Refactor CRD to support K8s 1.15 specific requirements
  • Loading branch information
morgo authored Apr 16, 2020
2 parents 0dc337b + 6f00b12 commit 843bde4
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 62 deletions.
55 changes: 26 additions & 29 deletions go/vt/topo/k8stopo/VitessTopoNodes-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,35 @@ metadata:
name: vitesstoponodes.topo.vitess.io
spec:
group: topo.vitess.io
versions:
- name: v1beta1
served: true
storage: true
additionalPrinterColumns:
- name: Key
type: string
description: The full key path
jsonPath: .data.key
schema:
openAPIV3Schema:
additionalPrinterColumns:
- name: Key
type: string
description: The full key path
JSONPath: .data.key
validation:
openAPIV3Schema:
type: object
required:
- data
properties:
data:
type: object
required:
- data
- key
- value
properties:
data:
type: object
required:
- key
- value
properties:
key:
description: A file-path like key. Must be an absolute path. Must not end with a /.
type: string
pattern: '^\/.+[^\/]$'
value:
description: A base64 encoded value. Must be a base64 encoded string or empty string.
type: string
pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"
ephemeral:
description: Whether or not the node is considered ephemeral. True for lock and election nodes.
type: boolean
key:
description: A file-path like key. Must be an absolute path. Must not end with a /.
type: string
pattern: '^\/.+[^\/]$'
value:
description: A base64 encoded value. Must be a base64 encoded string or empty string.
type: string
pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"
ephemeral:
description: Whether or not the node is considered ephemeral. True for lock and election nodes.
type: boolean
version: v1beta1
scope: Namespaced
names:
plural: vitesstoponodes
Expand Down
8 changes: 4 additions & 4 deletions go/vt/topo/k8stopo/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

"testing"

extensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
extensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
kubeyaml "k8s.io/apimachinery/pkg/util/yaml"
"k8s.io/client-go/tools/clientcmd"
Expand Down Expand Up @@ -102,16 +102,16 @@ func TestKubernetesTopo(t *testing.T) {
}

crdFile, err := os.Open("./VitessTopoNodes-crd.yaml")
defer crdFile.Close()
if err != nil {
t.Fatal(err)
defer crdFile.Close()
}

crd := &extensionsv1.CustomResourceDefinition{}
crd := &extensionsv1beta1.CustomResourceDefinition{}

kubeyaml.NewYAMLOrJSONDecoder(crdFile, 2048).Decode(crd)

_, err = apiextensionsClientSet.ApiextensionsV1().CustomResourceDefinitions().Create(crd)
_, err = apiextensionsClientSet.ApiextensionsV1beta1().CustomResourceDefinitions().Create(crd)
if err != nil {
t.Fatal(err)
}
Expand Down
55 changes: 26 additions & 29 deletions helm/vitess/crds/VitessTopoNodes-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,35 @@ metadata:
name: vitesstoponodes.topo.vitess.io
spec:
group: topo.vitess.io
versions:
- name: v1beta1
served: true
storage: true
additionalPrinterColumns:
- name: Key
type: string
description: The full key path
jsonPath: .data.key
schema:
openAPIV3Schema:
additionalPrinterColumns:
- name: Key
type: string
description: The full key path
JSONPath: .data.key
validation:
openAPIV3Schema:
type: object
required:
- data
properties:
data:
type: object
required:
- data
- key
- value
properties:
data:
type: object
required:
- key
- value
properties:
key:
description: A file-path like key. Must be an absolute path. Must not end with a /.
type: string
pattern: '^\/.+[^\/]$'
value:
description: A base64 encoded value. Must be a base64 encoded string or empty string.
type: string
pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"
ephemeral:
description: Whether or not the node is considered ephemeral. True for lock and election nodes.
type: boolean
key:
description: A file-path like key. Must be an absolute path. Must not end with a /.
type: string
pattern: '^\/.+[^\/]$'
value:
description: A base64 encoded value. Must be a base64 encoded string or empty string.
type: string
pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"
ephemeral:
description: Whether or not the node is considered ephemeral. True for lock and election nodes.
type: boolean
version: v1beta1
scope: Namespaced
names:
plural: vitesstoponodes
Expand Down

0 comments on commit 843bde4

Please sign in to comment.