Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor CRD to support K8s 1.15 specific requirements #6075

Merged
merged 1 commit into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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