From fb72aa5ba496b6c9d9cc8b1ca550df983c983523 Mon Sep 17 00:00:00 2001 From: Alex Lewitt <48691328+alewitt2@users.noreply.github.com> Date: Fri, 31 Jan 2020 14:42:53 -0500 Subject: [PATCH] Structural schema (#38) * Schema and readme updates to structural * Update README.md * Update .travis.yml --- .travis.yml | 9 --------- README.md | 28 ++++++++++++++++++++-------- kubernetes/ManagedSet/resource.yaml | 23 +++++++++-------------- 3 files changed, 29 insertions(+), 31 deletions(-) diff --git a/.travis.yml b/.travis.yml index bcffb41..b6e3839 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,15 +35,6 @@ deploy: on: tags: true condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+_[0-9]{3}$ - - provider: releases - file: /tmp/resource.yaml - skip_cleanup: true - draft: true - api_key: - secure: "${GITHUB_TOKEN}" - on: - tags: true - condition: ${TRAVIS_TAG} =~ ^[0-9]+\.[0-9]+\.[0-9]+_[0-9]{3}$ # Deploy released builds - provider: script diff --git a/README.md b/README.md index 0aee1dd..fc4734e 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ kubectl apply -f "https://github.com/razee-io/ManagedSet/releases/latest/downloa ```yaml kind: ManagedSet -apiVersion: deploy.razee.io/v1alpha1 +apiVersion: deploy.razee.io/v1alpha2 metadata: name: namespace: @@ -54,15 +54,27 @@ spec: - containerPort: 80 ``` -### Required Fields +### Spec -- `.spec.resources` - - type: array - - items: - - type: object - - required: [kind, apiVersion, metadata] +**Path:** `.spec` -## Features +**Description:** `spec` is required and **must** include section `resources`, +where each resource is a Kubernetes object with `apiVersion`, `kind`, and `metadata`. + +**Schema:** + +```yaml +spec: + type: object + required: [resources] + properties: + resources: + type: array + items: + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true +``` ### Managed Resource Labels diff --git a/kubernetes/ManagedSet/resource.yaml b/kubernetes/ManagedSet/resource.yaml index a40a4c0..1ffd93d 100644 --- a/kubernetes/ManagedSet/resource.yaml +++ b/kubernetes/ManagedSet/resource.yaml @@ -74,6 +74,11 @@ items: # list of versions supported by this CustomResourceDefinition versions: - name: v1alpha1 + # Each version can be enabled/disabled by Served flag. + served: true + # One and only one version must be marked as the storage version. + storage: false + - name: v1alpha2 # Each version can be enabled/disabled by Served flag. served: true # One and only one version must be marked as the storage version. @@ -96,6 +101,8 @@ items: validation: # openAPIV3Schema is the schema for validating custom objects. openAPIV3Schema: + type: object + required: [spec] properties: spec: type: object @@ -105,17 +112,5 @@ items: type: array items: type: object - required: [kind, apiVersion, metadata] - properties: - kind: - type: string - apiVersion: - type: string - metadata: - type: object - required: [name] - properties: - name: - type: string - namespace: - type: string + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true