Skip to content

Instantly share code, notes, and snippets.

@komuw
Created November 16, 2022 17:26
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 komuw/8bd2b6e9e1c01ee24aa68984a8cb2751 to your computer and use it in GitHub Desktop.
Save komuw/8bd2b6e9e1c01ee24aa68984a8cb2751 to your computer and use it in GitHub Desktop.
fake crd status/health
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
# name must match the spec fields below, and be in the form: <plural>.<group>
name: komucrontabs.stable.example.com
spec:
# group name to use for REST API: /apis/<group>/<version>
group: stable.example.com
# list of versions supported by this CustomResourceDefinition
versions:
- name: v1
# 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
subresources:
status: {}
additionalPrinterColumns:
- name: Image
jsonPath: .spec.image
description: The image of redis cluster
type: string
- name: Status
jsonPath: .spec.somestate
description: somestate
type: string
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
cronSpec:
type: string
image:
type: string
replicas:
type: integer
somestate:
type: string
default: Healthy
# either Namespaced or Cluster
scope: Namespaced
names:
# plural name to be used in the URL: /apis/<group>/<version>/<plural>
plural: komucrontabs
# singular name to be used as an alias on the CLI and for display
singular: komucrontab
# kind is normally the CamelCased singular type. Your resource manifests use this.
kind: KomuCronTab
# shortNames allow shorter string to match your resource on the CLI
shortNames:
- kct
---
apiVersion: "stable.example.com/v1"
kind: KomuCronTab
metadata:
name: my-new-cron-object
spec:
cronSpec: "* * * * */5"
image: redis:5.0.4-alpine
@komuw
Copy link
Author

komuw commented Nov 16, 2022

kubectl get komucrontab --all-namespaces

NAMESPACE   NAME                 IMAGE                STATUS
default     my-new-cron-object   redis:5.0.4-alpine   Healthy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment