Skip to content

Instantly share code, notes, and snippets.

@DexterPOSH
Last active October 16, 2021 05:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DexterPOSH/36b392b6ac294d9de0ecf3580b337ee0 to your computer and use it in GitHub Desktop.
Save DexterPOSH/36b392b6ac294d9de0ecf3580b337ee0 to your computer and use it in GitHub Desktop.
Sample CRD
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
# name must match the spec fields below, and be in the form: <plural>.<group>
name: myplatforms.contoso.com
spec:
# group name to use for REST API: /apis/<group>/<version>
group: contoso.com
names:
# plural name to be used in the URL: /apis/<group>/<version>/<plural>
plural: myplatforms
# singular name to be used as an alias on the CLI and for display
singular: myplatform
# kind is normally the CamelCased singular type. Your resource manifests use this.
kind: MyPlatform
# shortNames allow shorter string to match your resource on the CLI
shortNames:
- myp
# either Namespaced or Cluster
scope: Namespaced
versions:
- name: v1alpha
# Each version can be enabled/disabled by Served flag.
served: true
# One and only one version must be marked as the storage version.
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
language:
type: string
enum:
- csharp
- python
- go
environmentType:
type: string
enum:
- dev
- test
- prod
replicas:
type: integer
default: 2
minimum: 1
maximum: 10
requiresIngress:
type: boolean
required: ["language", "environmentType"]
required: ["spec"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment