Prompt:
Explain this text code:

cd <web-base>/update-imported-docs
./update-imported-docs.py <configuration-file.yml> <release-version>

Response: This text code Reference Documentation Quickstart | For example:


Prompt:
Complete this yaml code:

apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo
spec:
  containers:

Response:
  - name: extended-resource-demo-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 3
      limits:
        example.com/dongle: 3

Context: Assign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.


Prompt:
Explain this yaml code:

apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo
spec:
  containers:
  - name: extended-resource-demo-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 3
      limits:
        example.com/dongle: 3

Response: This yaml code Assign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.


Prompt:
Explain this bash code:

kubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod.yaml

Response: This bash code Assign Extended Resources to a Container | Verify that the Pod is running:

Context: Assign Extended Resources to a Container | Verify that the Pod is running:


Prompt:
Complete this text code:

Limits:
  example.com/dongle: 3

Response:
Requests:
  example.com/dongle: 3

Context: Assign Extended Resources to a Container | Here is the configuration file for a Pod that has one Container. The Container requests two dongles.


Prompt:
Explain this text code:

Limits:
  example.com/dongle: 3
Requests:
  example.com/dongle: 3

Response: This text code Assign Extended Resources to a Container | Here is the configuration file for a Pod that has one Container. The Container requests two dongles.


Prompt:
Complete this yaml code:

apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo-2
spec:
  containers:

Response:
  - name: extended-resource-demo-2-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 2
      limits:
        example.com/dongle: 2

Context: Assign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.


Prompt:
Explain this yaml code:

apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo-2
spec:
  containers:
  - name: extended-resource-demo-2-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 2
      limits:
        example.com/dongle: 2

Response: This yaml code Assign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.


Prompt:
Explain this bash code:

kubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod-2.yaml

Response: This bash code Assign Extended Resources to a Container | Describe the Pod

Context: Assign Extended Resources to a Container | Describe the Pod


Prompt:
Complete this text code:

Conditions:
  Type    Status
  PodScheduled  False
...

Response:
Events:
  ...
  ... Warning   FailedScheduling  pod (extended-resource-demo-2) failed to fit in any node
fit failure summary on nodes : Insufficient example.com/dongle (1)

Context: Assign Extended Resources to a Container | View the Pod status:


Prompt:
Explain this text code:

Conditions:
  Type    Status
  PodScheduled  False
...
Events:
  ...
  ... Warning   FailedScheduling  pod (extended-resource-demo-2) failed to fit in any node
fit failure summary on nodes : Insufficient example.com/dongle (1)

Response: This text code Assign Extended Resources to a Container | View the Pod status:


Prompt:
Explain this text code:

NAME                       READY     STATUS    RESTARTS   AGE
extended-resource-demo-2   0/1       Pending   0          6m

Response: This text code Assign Extended Resources to a Container | Delete the Pods that you created for this exercise:

Context: Assign Extended Resources to a Container | Delete the Pods that you created for this exercise:


Prompt:
Explain this bash code:

kubectl delete pod extended-resource-demo
kubectl delete pod extended-resource-demo-2

Response: This bash code Assign Extended Resources to a Container |

Context: Assign Extended Resources to a Container |


Prompt:
Complete this yaml code:

apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo
spec:
  containers:

Response:
  - name: extended-resource-demo-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 3
      limits:
        example.com/dongle: 3


Prompt:
Explain this yaml code:

apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo
spec:
  containers:
  - name: extended-resource-demo-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 3
      limits:
        example.com/dongle: 3

Response: This yaml code Assign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.


Prompt:
Explain this shell code:

kubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod.yaml

Response: This shell code Assign Extended Resources to a Container | Verify that the Pod is running:


Prompt:
Complete this yaml code:

Limits:
  example.com/dongle: 3

Response:
Requests:
  example.com/dongle: 3


Prompt:
Explain this yaml code:

Limits:
  example.com/dongle: 3
Requests:
  example.com/dongle: 3

Response: This yaml code Assign Extended Resources to a Container | Here is the configuration file for a Pod that has one Container. The Container requests two dongles.


Prompt:
Complete this yaml code:

apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo-2
spec:
  containers:

Response:
  - name: extended-resource-demo-2-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 2
      limits:
        example.com/dongle: 2


Prompt:
Explain this yaml code:

apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo-2
spec:
  containers:
  - name: extended-resource-demo-2-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 2
      limits:
        example.com/dongle: 2

Response: This yaml code Assign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.


Prompt:
Explain this shell code:

kubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod-2.yaml

Response: This shell code Assign Extended Resources to a Container | Describe the Pod


Prompt:
Complete this text code:

Conditions:
  Type    Status
  PodScheduled  False
...

Response:
Events:
  ...
  ... Warning   FailedScheduling  pod (extended-resource-demo-2) failed to fit in any node
fit failure summary on nodes : Insufficient example.com/dongle (1)


Prompt:
Explain this text code:

Conditions:
  Type    Status
  PodScheduled  False
...
Events:
  ...
  ... Warning   FailedScheduling  pod (extended-resource-demo-2) failed to fit in any node
fit failure summary on nodes : Insufficient example.com/dongle (1)

Response: This text code Assign Extended Resources to a Container | View the Pod status:


Prompt:
Explain this yaml code:

NAME                       READY     STATUS    RESTARTS   AGE
extended-resource-demo-2   0/1       Pending   0          6m

Response: This yaml code Assign Extended Resources to a Container | Delete the Pods that you created for this exercise:


Prompt:
Explain this shell code:

kubectl delete pod extended-resource-demo
kubectl delete pod extended-resource-demo-2

Response: This shell code Assign Extended Resources to a Container |


Prompt:
Complete this yaml code:

pods/resource/extended-resource-pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo
spec:
  containers:

Response:
  - name: extended-resource-demo-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 3
      limits:
        example.com/dongle: 3


Prompt:
Explain this yaml code:

pods/resource/extended-resource-pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo
spec:
  containers:
  - name: extended-resource-demo-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 3
      limits:
        example.com/dongle: 3

Response: This yaml code Assign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.


Prompt:
Complete this yaml code:

apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo
spec:
  containers:

Response:
  - name: extended-resource-demo-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 3
      limits:
        example.com/dongle: 3


Prompt:
Explain this yaml code:

apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo
spec:
  containers:
  - name: extended-resource-demo-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 3
      limits:
        example.com/dongle: 3

Response: This yaml code Assign Extended Resources to a Container | In the configuration file, you can see that the Container requests 3 dongles.


Prompt:
Explain this bash code:

kubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod.yaml

Response: This bash code Assign Extended Resources to a Container | Verify that the Pod is running:


Prompt:
Complete this text code:

Limits:
  example.com/dongle: 3

Response:
Requests:
  example.com/dongle: 3


Prompt:
Explain this text code:

Limits:
  example.com/dongle: 3
Requests:
  example.com/dongle: 3

Response: This text code Assign Extended Resources to a Container | Here is the configuration file for a Pod that has one Container. The Container requests two dongles.


Prompt:
Complete this yaml code:

pods/resource/extended-resource-pod-2.yaml
apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo-2
spec:
  containers:

Response:
  - name: extended-resource-demo-2-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 2
      limits:
        example.com/dongle: 2


Prompt:
Explain this yaml code:

pods/resource/extended-resource-pod-2.yaml
apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo-2
spec:
  containers:
  - name: extended-resource-demo-2-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 2
      limits:
        example.com/dongle: 2

Response: This yaml code Assign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.


Prompt:
Complete this yaml code:

apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo-2
spec:
  containers:

Response:
  - name: extended-resource-demo-2-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 2
      limits:
        example.com/dongle: 2


Prompt:
Explain this yaml code:

apiVersion: v1
kind: Pod
metadata:
  name: extended-resource-demo-2
spec:
  containers:
  - name: extended-resource-demo-2-ctr
    image: nginx
    resources:
      requests:
        example.com/dongle: 2
      limits:
        example.com/dongle: 2

Response: This yaml code Assign Extended Resources to a Container | Kubernetes will not be able to satisfy the request for two dongles, because the first Pod used three of the four available dongles.


Prompt:
Explain this bash code:

kubectl apply -f https://k8s.io/examples/pods/resource/extended-resource-pod-2.yaml

Response: This bash code Assign Extended Resources to a Container | Describe the Pod


Prompt:
Explain this text code:

NAME                       READY     STATUS    RESTARTS   AGE
extended-resource-demo-2   0/1       Pending   0          6m

Response: This text code Assign Extended Resources to a Container | Delete the Pods that you created for this exercise:


Prompt:
Explain this bash code:

kubectl delete pod extended-resource-demo
kubectl delete pod extended-resource-demo-2

Response: This bash code Assign Extended Resources to a Container |


Prompt:
Complete this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  # name must match the spec fields below, and be in the form: <plural>.<group>
  name: crontabs.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
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:

Response:
              type: object
              properties:
                cronSpec:
                  type: string
                image:
                  type: string
                replicas:
                  type: integer
  # either Namespaced or Cluster
  scope: Namespaced
  names:
    # plural name to be used in the URL: /apis/<group>/<version>/<plural>
    plural: crontabs
    # singular name to be used as an alias on the CLI and for display
    singular: crontab
    # kind is normally the CamelCased singular type. Your resource manifests use this.
    kind: CronTab
    # shortNames allow shorter string to match your resource on the CLI
    shortNames:
    - ct

Context: Extend the Kubernetes API with CustomResourceDefinitions | and create it:


Prompt:
Explain this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  # name must match the spec fields below, and be in the form: <plural>.<group>
  name: crontabs.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
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                cronSpec:
                  type: string
                image:
                  type: string
                replicas:
                  type: integer
  # either Namespaced or Cluster
  scope: Namespaced
  names:
    # plural name to be used in the URL: /apis/<group>/<version>/<plural>
    plural: crontabs
    # singular name to be used as an alias on the CLI and for display
    singular: crontab
    # kind is normally the CamelCased singular type. Your resource manifests use this.
    kind: CronTab
    # shortNames allow shorter string to match your resource on the CLI
    shortNames:
    - ct

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | and create it:


Prompt:
Explain this text code:

/apis/stable.example.com/v1/namespaces/*/crontabs/...

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | This endpoint URL can then be used to create and manage custom objects. The kind of these objects will be CronTab from the spec of the CustomResourceDefinition object you created above.

Context: Extend the Kubernetes API with CustomResourceDefinitions | This endpoint URL can then be used to create and manage custom objects. The kind of these objects will be CronTab from the spec of the CustomResourceDefinition object you created above.


Prompt:
Complete this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:

Response:
  name: my-new-cron-object
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image


Prompt:
Explain this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | and create it:


Prompt:
Complete this yaml code:

apiVersion: v1
items:
- apiVersion: stable.example.com/v1
  kind: CronTab
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"stable.example.com/v1","kind":"CronTab","metadata":{"annotations":{},"name":"my-new-cron-object","namespace":"default"},"spec":{"cronSpec":"* * * * */5","image":"my-awesome-cron-image"}}
    creationTimestamp: "2021-06-20T07:35:27Z"
    generation: 1

Response:
    name: my-new-cron-object
    namespace: default
    resourceVersion: "1326"
    uid: 9aab1d66-628e-41bb-a422-57b8b3b1f5a9
  spec:
    cronSpec: '* * * * */5'
    image: my-awesome-cron-image
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""

Context: Extend the Kubernetes API with CustomResourceDefinitions | When you delete a CustomResourceDefinition, the server will uninstall the RESTful API endpoint and delete all custom objects stored in it.


Prompt:
Explain this yaml code:

apiVersion: v1
items:
- apiVersion: stable.example.com/v1
  kind: CronTab
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"stable.example.com/v1","kind":"CronTab","metadata":{"annotations":{},"name":"my-new-cron-object","namespace":"default"},"spec":{"cronSpec":"* * * * */5","image":"my-awesome-cron-image"}}
    creationTimestamp: "2021-06-20T07:35:27Z"
    generation: 1
    name: my-new-cron-object
    namespace: default
    resourceVersion: "1326"
    uid: 9aab1d66-628e-41bb-a422-57b8b3b1f5a9
  spec:
    cronSpec: '* * * * */5'
    image: my-awesome-cron-image
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | When you delete a CustomResourceDefinition, the server will uninstall the RESTful API endpoint and delete all custom objects stored in it.


Prompt:
Explain this bash code:

kubectl delete -f resourcedefinition.yaml
kubectl get crontabs

Response: This bash code Extend the Kubernetes API with CustomResourceDefinitions | If you later recreate the same CustomResourceDefinition, it will start out empty.

Context: Extend the Kubernetes API with CustomResourceDefinitions | If you later recreate the same CustomResourceDefinition, it will start out empty.


Prompt:
Explain this text code:

Error from server (NotFound): Unable to list {"stable.example.com" "v1" "crontabs"}: the server could not
find the requested resource (get crontabs.stable.example.com)

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | If you later recreate the same CustomResourceDefinition, it will start out empty.


Prompt:
Complete this text code:

properties:
  foo:
    # ...

Response:
allOf:
- properties:
    foo:
      # ...

Context: Extend the Kubernetes API with CustomResourceDefinitions | Non-structural example 2:


Prompt:
Explain this text code:

properties:
  foo:
    # ...
allOf:
- properties:
    foo:
      # ...

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | Non-structural example 2:


Prompt:
Complete this text code:

allOf:
- items:

Response:
    properties:
      foo:
        # ...

Context: Extend the Kubernetes API with CustomResourceDefinitions | conflicts with rule 2. The following would be correct:


Prompt:
Explain this text code:

allOf:
- items:
    properties:
      foo:
        # ...

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | conflicts with rule 2. The following would be correct:


Prompt:
Complete this text code:

items:
  properties:
    foo:
      # ...

Response:
allOf:
- items:
    properties:
      foo:
        # ...

Context: Extend the Kubernetes API with CustomResourceDefinitions | Non-structural example 3:


Prompt:
Explain this text code:

items:
  properties:
    foo:
      # ...
allOf:
- items:
    properties:
      foo:
        # ...

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | Non-structural example 3:


Prompt:
Complete this text code:

properties:
  foo:
    pattern: "abc"
  metadata:
    type: object
    properties:
      name:
        type: string
        pattern: "^a"
      finalizers:

Response:
        type: array
        items:
          type: string
          pattern: "my-finalizer"
anyOf:
- properties:
    bar:
      type: integer
      minimum: 42
  required: ["bar"]
  description: "foo bar object"

Context: Extend the Kubernetes API with CustomResourceDefinitions | is not a structural schema because of the following violations:


Prompt:
Explain this text code:

properties:
  foo:
    pattern: "abc"
  metadata:
    type: object
    properties:
      name:
        type: string
        pattern: "^a"
      finalizers:
        type: array
        items:
          type: string
          pattern: "my-finalizer"
anyOf:
- properties:
    bar:
      type: integer
      minimum: 42
  required: ["bar"]
  description: "foo bar object"

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | is not a structural schema because of the following violations:


Prompt:
Complete this text code:

type: object
description: "foo bar object"
properties:
  foo:
    type: string
    pattern: "abc"
  bar:
    type: integer
  metadata:

Response:
    type: object
    properties:
      name:
        type: string
        pattern: "^a"
anyOf:
- properties:
    bar:
      minimum: 42
  required: ["bar"]

Context: Extend the Kubernetes API with CustomResourceDefinitions | Violations of the structural schema rules are reported in the NonStructural condition in the CustomResourceDefinition.


Prompt:
Explain this text code:

type: object
description: "foo bar object"
properties:
  foo:
    type: string
    pattern: "abc"
  bar:
    type: integer
  metadata:
    type: object
    properties:
      name:
        type: string
        pattern: "^a"
anyOf:
- properties:
    bar:
      minimum: 42
  required: ["bar"]

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | Violations of the structural schema rules are reported in the NonStructural condition in the CustomResourceDefinition.


Prompt:
Complete this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object

Response:
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image
  someRandomField: 42


Prompt:
Explain this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image
  someRandomField: 42

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | and create it:


Prompt:
Explain this bash code:

kubectl create --validate=false -f my-crontab.yaml -o yaml

Response: This bash code Extend the Kubernetes API with CustomResourceDefinitions | Your output is similar to:

Context: Extend the Kubernetes API with CustomResourceDefinitions | Your output is similar to:


Prompt:
Complete this yaml code:

apiVersion: stable.example.com/v1
kind: CronTab
metadata:
  creationTimestamp: 2017-05-31T12:56:35Z
  generation: 1
  name: my-new-cron-object

Response:
  namespace: default
  resourceVersion: "285"
  uid: 9423255b-4600-11e7-af6a-28d2447dc82b
spec:
  cronSpec: '* * * * */5'
  image: my-awesome-cron-image

Context: Extend the Kubernetes API with CustomResourceDefinitions | Notice that the field someRandomField was pruned.


Prompt:
Explain this yaml code:

apiVersion: stable.example.com/v1
kind: CronTab
metadata:
  creationTimestamp: 2017-05-31T12:56:35Z
  generation: 1
  name: my-new-cron-object
  namespace: default
  resourceVersion: "285"
  uid: 9423255b-4600-11e7-af6a-28d2447dc82b
spec:
  cronSpec: '* * * * */5'
  image: my-awesome-cron-image

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | Notice that the field someRandomField was pruned.


Prompt:
Complete this text code:

type: object
properties:

Response:
  json:
    x-kubernetes-preserve-unknown-fields: true

Context: Extend the Kubernetes API with CustomResourceDefinitions | The field json can store any JSON value, without anything being pruned.


Prompt:
Explain this text code:

type: object
properties:
  json:
    x-kubernetes-preserve-unknown-fields: true

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | The field json can store any JSON value, without anything being pruned.


Prompt:
Complete this text code:

type: object
properties:
  json:

Response:
    x-kubernetes-preserve-unknown-fields: true
    type: object
    description: this is arbitrary JSON

Context: Extend the Kubernetes API with CustomResourceDefinitions | With this, only object type values are allowed.


Prompt:
Explain this text code:

type: object
properties:
  json:
    x-kubernetes-preserve-unknown-fields: true
    type: object
    description: this is arbitrary JSON

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | With this, only object type values are allowed.


Prompt:
Complete this text code:

type: object
properties:
  json:
    x-kubernetes-preserve-unknown-fields: true
    type: object
    properties:

Response:
      spec:
        type: object
        properties:
          foo:
            type: string
          bar:
            type: string

Context: Extend the Kubernetes API with CustomResourceDefinitions | With this, the value:


Prompt:
Explain this text code:

type: object
properties:
  json:
    x-kubernetes-preserve-unknown-fields: true
    type: object
    properties:
      spec:
        type: object
        properties:
          foo:
            type: string
          bar:
            type: string

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | With this, the value:


Prompt:
Complete this text code:

json:
  spec:
    foo: abc

Response:
    bar: def
    something: x
  status:
    something: x

Context: Extend the Kubernetes API with CustomResourceDefinitions | is pruned to:


Prompt:
Explain this text code:

json:
  spec:
    foo: abc
    bar: def
    something: x
  status:
    something: x

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | is pruned to:


Prompt:
Complete this text code:

json:
  spec:
    foo: abc

Response:
    bar: def
  status:
    something: x

Context: Extend the Kubernetes API with CustomResourceDefinitions | This means that the something field in the specified spec object is pruned, but everything outside is not.


Prompt:
Explain this text code:

json:
  spec:
    foo: abc
    bar: def
  status:
    something: x

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | This means that the something field in the specified spec object is pruned, but everything outside is not.


Prompt:
Complete this text code:

type: object
properties:

Response:
  foo:
    x-kubernetes-int-or-string: true

Context: Extend the Kubernetes API with CustomResourceDefinitions | Also those nodes are partially excluded from rule 3 in the sense that the following two patterns are allowed (exactly those, without variations in order to additional fields):


Prompt:
Explain this text code:

type: object
properties:
  foo:
    x-kubernetes-int-or-string: true

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | Also those nodes are partially excluded from rule 3 in the sense that the following two patterns are allowed (exactly those, without variations in order to additional fields):


Prompt:
Complete this text code:

x-kubernetes-int-or-string: true
anyOf:

Response:
  - type: integer
  - type: string
...

Context: Extend the Kubernetes API with CustomResourceDefinitions | and


Prompt:
Explain this text code:

x-kubernetes-int-or-string: true
anyOf:
  - type: integer
  - type: string
...

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | and


Prompt:
Complete this text code:

x-kubernetes-int-or-string: true
allOf:
  - anyOf:

Response:
      - type: integer
      - type: string
  - # ... zero or more
...

Context: Extend the Kubernetes API with CustomResourceDefinitions | With one of those specification, both an integer and a string validate.


Prompt:
Explain this text code:

x-kubernetes-int-or-string: true
allOf:
  - anyOf:
      - type: integer
      - type: string
  - # ... zero or more
...

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | With one of those specification, both an integer and a string validate.


Prompt:
Complete this text code:

type: object
properties:

Response:
  foo:
    x-kubernetes-embedded-resource: true
    x-kubernetes-preserve-unknown-fields: true

Context: Extend the Kubernetes API with CustomResourceDefinitions | Here, the field foo holds a complete object, e.g.:


Prompt:
Explain this text code:

type: object
properties:
  foo:
    x-kubernetes-embedded-resource: true
    x-kubernetes-preserve-unknown-fields: true

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | Here, the field foo holds a complete object, e.g.:


Prompt:
Complete this yaml code:

foo:
  apiVersion: v1

Response:
  kind: Pod
  spec:
    # ...

Context: Extend the Kubernetes API with CustomResourceDefinitions | Because x-kubernetes-preserve-unknown-fields: true is specified alongside, nothing is pruned. The use of x-kubernetes-preserve-unknown-fields: true is optional though.


Prompt:
Explain this yaml code:

foo:
  apiVersion: v1
  kind: Pod
  spec:
    # ...

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | Because x-kubernetes-preserve-unknown-fields: true is specified alongside, nothing is pruned. The use of x-kubernetes-preserve-unknown-fields: true is optional though.


Prompt:
Complete this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab

Response:
metadata:
  finalizers:
  - stable.example.com/finalizer

Context: Extend the Kubernetes API with CustomResourceDefinitions | Identifiers of custom finalizers consist of a domain name, a forward slash and the name of the finalizer. Any controller can add a finalizer to any object's list of finalizers.


Prompt:
Explain this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  finalizers:
  - stable.example.com/finalizer

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | Identifiers of custom finalizers consist of a domain name, a forward slash and the name of the finalizer. Any controller can add a finalizer to any object's list of finalizers.


Prompt:
Complete this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: crontabs.stable.example.com
spec:
  group: stable.example.com
  versions:
    - name: v1
      served: true
      storage: true
      schema:
        # openAPIV3Schema is the schema for validating custom objects.
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object

Response:
              properties:
                cronSpec:
                  type: string
                  pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
                image:
                  type: string
                replicas:
                  type: integer
                  minimum: 1
                  maximum: 10
  scope: Namespaced
  names:
    plural: crontabs
    singular: crontab
    kind: CronTab
    shortNames:
    - ct

Context: Extend the Kubernetes API with CustomResourceDefinitions | and create it:


Prompt:
Explain this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: crontabs.stable.example.com
spec:
  group: stable.example.com
  versions:
    - name: v1
      served: true
      storage: true
      schema:
        # openAPIV3Schema is the schema for validating custom objects.
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                cronSpec:
                  type: string
                  pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
                image:
                  type: string
                replicas:
                  type: integer
                  minimum: 1
                  maximum: 10
  scope: Namespaced
  names:
    plural: crontabs
    singular: crontab
    kind: CronTab
    shortNames:
    - ct

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | and create it:


Prompt:
Complete this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object

Response:
spec:
  cronSpec: "* * * *"
  image: my-awesome-cron-image
  replicas: 15

Context: Extend the Kubernetes API with CustomResourceDefinitions | and attempt to create it:


Prompt:
Explain this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object
spec:
  cronSpec: "* * * *"
  image: my-awesome-cron-image
  replicas: 15

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | and attempt to create it:


Prompt:
Complete this text code:

The CronTab "my-new-cron-object" is invalid: []: Invalid value: map[string]interface {}{"apiVersion":"stable.example.com/v1", "kind":"CronTab", "metadata":map[string]interface {}{"name":"my-new-cron-object", "namespace":"default", "deletionTimestamp":interface {}(nil), "deletionGracePeriodSeconds":(*int64)(nil), "creationTimestamp":"2017-09-05T05:20:07Z", "uid":"e14d79e7-91f9-11e7-a598-f0761cb232d1", "clusterName":""}, "spec":map[string]interface {}{"cronSpec":"* * * *", "image":"my-awesome-cron-image", "replicas":15}}:
validation failure list:

Response:
spec.cronSpec in body should match '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
spec.replicas in body should be less than or equal to 10

Context: Extend the Kubernetes API with CustomResourceDefinitions | If the fields contain valid values, the object creation request is accepted.


Prompt:
Explain this text code:

The CronTab "my-new-cron-object" is invalid: []: Invalid value: map[string]interface {}{"apiVersion":"stable.example.com/v1", "kind":"CronTab", "metadata":map[string]interface {}{"name":"my-new-cron-object", "namespace":"default", "deletionTimestamp":interface {}(nil), "deletionGracePeriodSeconds":(*int64)(nil), "creationTimestamp":"2017-09-05T05:20:07Z", "uid":"e14d79e7-91f9-11e7-a598-f0761cb232d1", "clusterName":""}, "spec":map[string]interface {}{"cronSpec":"* * * *", "image":"my-awesome-cron-image", "replicas":15}}:
validation failure list:
spec.cronSpec in body should match '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
spec.replicas in body should be less than or equal to 10

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | If the fields contain valid values, the object creation request is accepted.


Prompt:
Complete this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object

Response:
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image
  replicas: 5

Context: Extend the Kubernetes API with CustomResourceDefinitions | And create it:


Prompt:
Explain this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image
  replicas: 5

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | And create it:


Prompt:
Explain this bash code:

kubectl apply -f my-crontab.yaml
crontab "my-new-cron-object" created

Response: This bash code Extend the Kubernetes API with CustomResourceDefinitions | If you are using a version of Kubernetes older than v1.30, you need to explicitly enable the CRDValidationRatcheting feature gate to use this behavior, which then applies to all CustomResourceDefiniti

Context: Extend the Kubernetes API with CustomResourceDefinitions | If you are using a version of Kubernetes older than v1.30, you need to explicitly enable the CRDValidationRatcheting feature gate to use this behavior, which then applies to all CustomResourceDefiniti


Prompt:
Complete this text code:

# ...
  openAPIV3Schema:
    type: object
    properties:
      spec:
        type: object
        x-kubernetes-validations:
          - rule: "self.minReplicas <= self.replicas"
            message: "replicas should be greater than or equal to minReplicas."
          - rule: "self.replicas <= self.maxReplicas"
            message: "replicas should be smaller than or equal to maxReplicas."

Response:
        properties:
          # ...
          minReplicas:
            type: integer
          replicas:
            type: integer
          maxReplicas:
            type: integer
        required:
          - minReplicas
          - replicas
          - maxReplicas

Context: Extend the Kubernetes API with CustomResourceDefinitions | will reject a request to create this custom resource:


Prompt:
Explain this text code:

# ...
  openAPIV3Schema:
    type: object
    properties:
      spec:
        type: object
        x-kubernetes-validations:
          - rule: "self.minReplicas <= self.replicas"
            message: "replicas should be greater than or equal to minReplicas."
          - rule: "self.replicas <= self.maxReplicas"
            message: "replicas should be smaller than or equal to maxReplicas."
        properties:
          # ...
          minReplicas:
            type: integer
          replicas:
            type: integer
          maxReplicas:
            type: integer
        required:
          - minReplicas
          - replicas
          - maxReplicas

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | will reject a request to create this custom resource:


Prompt:
Complete this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object

Response:
spec:
  minReplicas: 0
  replicas: 20
  maxReplicas: 10

Context: Extend the Kubernetes API with CustomResourceDefinitions | with the response:


Prompt:
Explain this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object
spec:
  minReplicas: 0
  replicas: 20
  maxReplicas: 10

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | with the response:


Prompt:
Explain this text code:

The CronTab "my-new-cron-object" is invalid:
* spec: Invalid value: map[string]interface {}{"maxReplicas":10, "minReplicas":0, "replicas":20}: replicas should be smaller than or equal to maxReplicas.

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | x-kubernetes-validations could have multiple rules. The rule under x-kubernetes-validations represents the expression which will be evaluated by CEL. The message represents the message displayed when

Context: Extend the Kubernetes API with CustomResourceDefinitions | x-kubernetes-validations could have multiple rules. The rule under x-kubernetes-validations represents the expression which will be evaluated by CEL. The message represents the message displayed when


Prompt:
Explain this text code:

The CronTab "my-new-cron-object" is invalid:
* spec: Invalid value: map[string]interface {}{"maxReplicas":10, "minReplicas":0, "replicas":20}: failed rule: self.replicas <= self.maxReplicas

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | Validation rules are compiled when CRDs are created/updated. The request of CRDs create/update will fail if compilation of validation rules fail. Compilation process includes type checking as well.

Context: Extend the Kubernetes API with CustomResourceDefinitions | Validation rules are compiled when CRDs are created/updated. The request of CRDs create/update will fail if compilation of validation rules fail. Compilation process includes type checking as well.


Prompt:
Explain this text code:

Invalid value: apiextensions.ValidationRule{Rule:"self == true", Message:""}: compilation failed: ERROR: \<input>:1:6: found no matching overload for '_==_' applied to '(int, bool)'

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | no_such_field: does not contain the desired field.

Context: Extend the Kubernetes API with CustomResourceDefinitions | no_such_field: does not contain the desired field.


Prompt:
Explain this text code:

Invalid value: apiextensions.ValidationRule{Rule:"self.nonExistingField > 0", Message:""}: compilation failed: ERROR: \<input>:1:5: undefined field 'nonExistingField'

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | invalid argument: invalid argument to macros.

Context: Extend the Kubernetes API with CustomResourceDefinitions | invalid argument: invalid argument to macros.


Prompt:
Explain this text code:

Invalid value: apiextensions.ValidationRule{Rule:"has(self)", Message:""}: compilation failed: ERROR: <input>:1:4: invalid argument to has() macro

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | Validation Rules Examples:

Context: Extend the Kubernetes API with CustomResourceDefinitions | Validation Rules Examples:


Prompt:
Complete this text code:

# ...
  openAPIV3Schema:
    type: object
    x-kubernetes-validations:
      - rule: "self.status.availableReplicas >= self.spec.minReplicas"
    properties:
        spec:
          type: object

Response:
          properties:
            minReplicas:
              type: integer
            # ...
        status:
          type: object
          properties:
            availableReplicas:
              type: integer

Context: Extend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to an object with properties, the accessible properties of the object are field selectable via self.field and field presence can be checked via has(self.field). Null valued field


Prompt:
Explain this text code:

# ...
  openAPIV3Schema:
    type: object
    x-kubernetes-validations:
      - rule: "self.status.availableReplicas >= self.spec.minReplicas"
    properties:
        spec:
          type: object
          properties:
            minReplicas:
              type: integer
            # ...
        status:
          type: object
          properties:
            availableReplicas:
              type: integer

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to an object with properties, the accessible properties of the object are field selectable via self.field and field presence can be checked via has(self.field). Null valued field


Prompt:
Complete this text code:

# ...
  openAPIV3Schema:
    type: object
    properties:
      spec:
        type: object

Response:
        x-kubernetes-validations:
          - rule: "has(self.foo)"
        properties:
          # ...
          foo:
            type: integer

Context: Extend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map are accessible via self[mapKey], map containment can be checked via mapKey in self and all entries of the


Prompt:
Explain this text code:

# ...
  openAPIV3Schema:
    type: object
    properties:
      spec:
        type: object
        x-kubernetes-validations:
          - rule: "has(self.foo)"
        properties:
          # ...
          foo:
            type: integer

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map are accessible via self[mapKey], map containment can be checked via mapKey in self and all entries of the


Prompt:
Complete this text code:

# ...
  openAPIV3Schema:
    type: object
    properties:
      spec:
        type: object
        x-kubernetes-validations:

Response:
          - rule: "self['xyz'].foo > 0"
        additionalProperties:
          # ...
          type: object
          properties:
            foo:
              type: integer

Context: Extend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to an array, the elements of the array are accessible via self[i] and also by macros and functions.


Prompt:
Explain this text code:

# ...
  openAPIV3Schema:
    type: object
    properties:
      spec:
        type: object
        x-kubernetes-validations:
          - rule: "self['xyz'].foo > 0"
        additionalProperties:
          # ...
          type: object
          properties:
            foo:
              type: integer

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to an array, the elements of the array are accessible via self[i] and also by macros and functions.


Prompt:
Complete this text code:

# ...
  openAPIV3Schema:
    type: object
    properties:
      # ...

Response:
      foo:
        type: array
        x-kubernetes-validations:
          - rule: "size(self) == 1"
        items:
          type: string

Context: Extend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to a scalar, self is bound to the scalar value.


Prompt:
Explain this text code:

# ...
  openAPIV3Schema:
    type: object
    properties:
      # ...
      foo:
        type: array
        x-kubernetes-validations:
          - rule: "size(self) == 1"
        items:
          type: string

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | If the Rule is scoped to a scalar, self is bound to the scalar value.


Prompt:
Complete this text code:

# ...
  openAPIV3Schema:
    type: object
    properties:
      spec:
        type: object

Response:
        properties:
          # ...
          foo:
            type: integer
            x-kubernetes-validations:
            - rule: "self > 0"

Context: Extend the Kubernetes API with CustomResourceDefinitions | Examples:


Prompt:
Explain this text code:

# ...
  openAPIV3Schema:
    type: object
    properties:
      spec:
        type: object
        properties:
          # ...
          foo:
            type: integer
            x-kubernetes-validations:
            - rule: "self > 0"

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | Examples:


Prompt:
Explain this text code:

x-kubernetes-validations:
- rule: "self.x <= self.maxLimit"
  messageExpression: '"x exceeded max limit of " + string(self.maxLimit)'

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | Keep in mind that CEL string concatenation (+ operator) does not auto-cast to string. If you have a non-string scalar, use the string(<value>) function to cast the scalar to a string like shown in the

Context: Extend the Kubernetes API with CustomResourceDefinitions | Keep in mind that CEL string concatenation (+ operator) does not auto-cast to string. If you have a non-string scalar, use the string(<value>) function to cast the scalar to a string like shown in the


Prompt:
Explain this text code:

x-kubernetes-validations:
- rule: "self.x <= self.maxLimit"
  reason: "FieldValueInvalid"

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | The HTTP status code returned to the caller will match the reason of the first failed validation rule. The currently supported reasons are: "FieldValueInvalid", "FieldValueForbidden", "FieldValueRequi

Context: Extend the Kubernetes API with CustomResourceDefinitions | The HTTP status code returned to the caller will match the reason of the first failed validation rule. The currently supported reasons are: "FieldValueInvalid", "FieldValueForbidden", "FieldValueRequi


Prompt:
Explain this text code:

x-kubernetes-validations:
- rule: "self.foo.test.x <= self.maxLimit"
  fieldPath: ".foo.test.x"

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | In the example above, the validation checks the value of field x should be less than the value of maxLimit. If no fieldPath specified, when validation fails, the fieldPath would be default to wherever

Context: Extend the Kubernetes API with CustomResourceDefinitions | In the example above, the validation checks the value of field x should be less than the value of maxLimit. If no fieldPath specified, when validation fails, the fieldPath would be default to wherever


Prompt:
Complete this text code:

type: string
enum: ["low", "medium", "high"]

Response:
x-kubernetes-validations:
- rule: "!(self == 'high' && oldSelf == 'low') && !(self == 'low' && oldSelf == 'high')"
  message: cannot transition directly between 'low' and 'high'

Context: Extend the Kubernetes API with CustomResourceDefinitions | Unlike other rules, transition rules apply only to operations meeting the following criteria:


Prompt:
Explain this text code:

type: string
enum: ["low", "medium", "high"]
x-kubernetes-validations:
- rule: "!(self == 'high' && oldSelf == 'low') && !(self == 'low' && oldSelf == 'high')"
  message: cannot transition directly between 'low' and 'high'

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | Unlike other rules, transition rules apply only to operations meeting the following criteria:


Prompt:
Complete this text code:

openAPIV3Schema:
  type: object
  properties:
    foo:

Response:
      type: array
      items:
        type: string
      x-kubernetes-validations:
        - rule: "self.all(x, x.contains('a string'))"

Context: Extend the Kubernetes API with CustomResourceDefinitions | then the API server rejects this rule on validation budget grounds with error:


Prompt:
Explain this text code:

openAPIV3Schema:
  type: object
  properties:
    foo:
      type: array
      items:
        type: string
      x-kubernetes-validations:
        - rule: "self.all(x, x.contains('a string'))"

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | then the API server rejects this rule on validation budget grounds with error:


Prompt:
Explain this text code:

spec.validation.openAPIV3Schema.properties[spec].properties[foo].x-kubernetes-validations[0].rule: Forbidden:
CEL rule exceeded budget by more than 100x (try simplifying the rule, or adding maxItems, maxProperties, and
maxLength where arrays, maps, and strings are used)

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | The rejection happens because self.all implies calling contains() on every string in foo, which in turn will check the given string to see if it contains 'a string'. Without limits, this is a very exp

Context: Extend the Kubernetes API with CustomResourceDefinitions | The rejection happens because self.all implies calling contains() on every string in foo, which in turn will check the given string to see if it contains 'a string'. Without limits, this is a very exp


Prompt:
Complete this text code:

openAPIV3Schema:
  type: object
  properties:
    foo:
      type: array

Response:
      maxItems: 25
      items:
        type: string
        maxLength: 10
      x-kubernetes-validations:
        - rule: "self.all(x, x.contains('a string'))"

Context: Extend the Kubernetes API with CustomResourceDefinitions | The cost estimation system takes into account how many times the rule will be executed in addition to the estimated cost of the rule itself. For instance, the following rule will have the same estimat


Prompt:
Explain this text code:

openAPIV3Schema:
  type: object
  properties:
    foo:
      type: array
      maxItems: 25
      items:
        type: string
        maxLength: 10
      x-kubernetes-validations:
        - rule: "self.all(x, x.contains('a string'))"

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | The cost estimation system takes into account how many times the rule will be executed in addition to the estimated cost of the rule itself. For instance, the following rule will have the same estimat


Prompt:
Complete this text code:

openAPIV3Schema:
  type: object
  properties:
    foo:
      type: array

Response:
      maxItems: 25
      items:
        type: string
        x-kubernetes-validations:
          - rule: "self.contains('a string'))"
        maxLength: 10

Context: Extend the Kubernetes API with CustomResourceDefinitions | If a list inside of a list has a validation rule that uses self.all, that is significantly more expensive than a non-nested list with the same rule. A rule that would have been allowed on a non-nested


Prompt:
Explain this text code:

openAPIV3Schema:
  type: object
  properties:
    foo:
      type: array
      maxItems: 25
      items:
        type: string
        x-kubernetes-validations:
          - rule: "self.contains('a string'))"
        maxLength: 10

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | If a list inside of a list has a validation rule that uses self.all, that is significantly more expensive than a non-nested list with the same rule. A rule that would have been allowed on a non-nested


Prompt:
Complete this text code:

openAPIV3Schema:
  type: object
  properties:
    foo:

Response:
      type: array
      items:
        type: integer
    x-kubernetes-validations:
      - rule: "self.all(x, x == 5)"

Context: Extend the Kubernetes API with CustomResourceDefinitions | But the same rule on the following schema (with a nested array added) produces a validation error:


Prompt:
Explain this text code:

openAPIV3Schema:
  type: object
  properties:
    foo:
      type: array
      items:
        type: integer
    x-kubernetes-validations:
      - rule: "self.all(x, x == 5)"

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | But the same rule on the following schema (with a nested array added) produces a validation error:


Prompt:
Complete this text code:

openAPIV3Schema:
  type: object
  properties:
    foo:
      type: array

Response:
      items:
        type: array
        items:
          type: integer
        x-kubernetes-validations:
          - rule: "self.all(x, x == 5)"

Context: Extend the Kubernetes API with CustomResourceDefinitions | This is because each item of foo is itself an array, and each subarray in turn calls self.all. Avoid nested lists and maps if possible where validation rules are used.


Prompt:
Explain this text code:

openAPIV3Schema:
  type: object
  properties:
    foo:
      type: array
      items:
        type: array
        items:
          type: integer
        x-kubernetes-validations:
          - rule: "self.all(x, x == 5)"

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | This is because each item of foo is itself an array, and each subarray in turn calls self.all. Avoid nested lists and maps if possible where validation rules are used.


Prompt:
Complete this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: crontabs.stable.example.com
spec:
  group: stable.example.com
  versions:
    - name: v1
      served: true
      storage: true
      schema:
        # openAPIV3Schema is the schema for validating custom objects.
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:

Response:
                cronSpec:
                  type: string
                  pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
                  default: "5 0 * * *"
                image:
                  type: string
                replicas:
                  type: integer
                  minimum: 1
                  maximum: 10
                  default: 1
  scope: Namespaced
  names:
    plural: crontabs
    singular: crontab
    kind: CronTab
    shortNames:
    - ct

Context: Extend the Kubernetes API with CustomResourceDefinitions | With this both cronSpec and replicas are defaulted:


Prompt:
Explain this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: crontabs.stable.example.com
spec:
  group: stable.example.com
  versions:
    - name: v1
      served: true
      storage: true
      schema:
        # openAPIV3Schema is the schema for validating custom objects.
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                cronSpec:
                  type: string
                  pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
                  default: "5 0 * * *"
                image:
                  type: string
                replicas:
                  type: integer
                  minimum: 1
                  maximum: 10
                  default: 1
  scope: Namespaced
  names:
    plural: crontabs
    singular: crontab
    kind: CronTab
    shortNames:
    - ct

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | With this both cronSpec and replicas are defaulted:


Prompt:
Complete this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:

Response:
  name: my-new-cron-object
spec:
  image: my-awesome-cron-image

Context: Extend the Kubernetes API with CustomResourceDefinitions | leads to


Prompt:
Explain this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object
spec:
  image: my-awesome-cron-image

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | leads to


Prompt:
Complete this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object

Response:
spec:
  cronSpec: "5 0 * * *"
  image: my-awesome-cron-image
  replicas: 1

Context: Extend the Kubernetes API with CustomResourceDefinitions | Defaulting happens on the object


Prompt:
Explain this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object
spec:
  cronSpec: "5 0 * * *"
  image: my-awesome-cron-image
  replicas: 1

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | Defaulting happens on the object


Prompt:
Complete this text code:

type: object
properties:
  spec:
    type: object
    properties:
      foo:
        type: string

Response:
        nullable: false
        default: "default"
      bar:
        type: string
        nullable: true
      baz:
        type: string

Context: Extend the Kubernetes API with CustomResourceDefinitions | creating an object with null values for foo and bar and baz


Prompt:
Explain this text code:

type: object
properties:
  spec:
    type: object
    properties:
      foo:
        type: string
        nullable: false
        default: "default"
      bar:
        type: string
        nullable: true
      baz:
        type: string

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | creating an object with null values for foo and bar and baz


Prompt:
Complete this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: crontabs.stable.example.com
spec:
  group: stable.example.com
  scope: Namespaced
  names:
    plural: crontabs
    singular: crontab
    kind: CronTab
    shortNames:
    - ct
  versions:
  - name: v1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        type: object
        properties:

Response:
          spec:
            type: object
            properties:
              cronSpec:
                type: string
              image:
                type: string
              replicas:
                type: integer
    additionalPrinterColumns:
    - name: Spec
      type: string
      description: The cron spec defining the interval a CronJob is run
      jsonPath: .spec.cronSpec
    - name: Replicas
      type: integer
      description: The number of jobs launched by the CronJob
      jsonPath: .spec.replicas
    - name: Age
      type: date
      jsonPath: .metadata.creationTimestamp

Context: Extend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:


Prompt:
Explain this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: crontabs.stable.example.com
spec:
  group: stable.example.com
  scope: Namespaced
  names:
    plural: crontabs
    singular: crontab
    kind: CronTab
    shortNames:
    - ct
  versions:
  - name: v1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              cronSpec:
                type: string
              image:
                type: string
              replicas:
                type: integer
    additionalPrinterColumns:
    - name: Spec
      type: string
      description: The cron spec defining the interval a CronJob is run
      jsonPath: .spec.cronSpec
    - name: Replicas
      type: integer
      description: The number of jobs launched by the CronJob
      jsonPath: .spec.replicas
    - name: Age
      type: date
      jsonPath: .metadata.creationTimestamp

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:


Prompt:
Explain this text code:

NAME                 SPEC        REPLICAS   AGE
my-new-cron-object   * * * * *   1          7s

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | Each column includes a priority field. Currently, the priority differentiates between columns shown in standard view or wide view (using the -o wide flag).

Context: Extend the Kubernetes API with CustomResourceDefinitions | Each column includes a priority field. Currently, the priority differentiates between columns shown in standard view or wide view (using the -o wide flag).


Prompt:
Complete this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: shirts.stable.example.com
spec:
  group: stable.example.com
  scope: Namespaced
  names:
    plural: shirts
    singular: shirt
    kind: Shirt
  versions:
  - name: v1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        type: object

Response:
        properties:
          spec:
            type: object
            properties:
              color:
                type: string
              size:
                type: string
    selectableFields:
    - jsonPath: .spec.color
    - jsonPath: .spec.size
    additionalPrinterColumns:
    - jsonPath: .spec.color
      name: Color
      type: string
    - jsonPath: .spec.size
      name: Size
      type: string


Prompt:
Explain this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: shirts.stable.example.com
spec:
  group: stable.example.com
  scope: Namespaced
  names:
    plural: shirts
    singular: shirt
    kind: Shirt
  versions:
  - name: v1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              color:
                type: string
              size:
                type: string
    selectableFields:
    - jsonPath: .spec.color
    - jsonPath: .spec.size
    additionalPrinterColumns:
    - jsonPath: .spec.color
      name: Color
      type: string
    - jsonPath: .spec.size
      name: Size
      type: string

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | Create the CustomResourceDefinition:


Prompt:
Explain this bash code:

kubectl apply -f https://k8s.io/examples/customresourcedefinition/shirt-resource-definition.yaml

Response: This bash code Extend the Kubernetes API with CustomResourceDefinitions | Define some Shirts by editing shirt-resources.yaml; for example:

Context: Extend the Kubernetes API with CustomResourceDefinitions | Define some Shirts by editing shirt-resources.yaml; for example:


Prompt:
Complete this yaml code:

---
apiVersion: stable.example.com/v1
kind: Shirt
metadata:
  name: example1
spec:
  color: blue
  size: S
---
apiVersion: stable.example.com/v1
kind: Shirt
metadata:

Response:
  name: example2
spec:
  color: blue
  size: M
---
apiVersion: stable.example.com/v1
kind: Shirt
metadata:
  name: example3
spec:
  color: green
  size: M

Context: Extend the Kubernetes API with CustomResourceDefinitions | Create the custom resources:


Prompt:
Explain this yaml code:

---
apiVersion: stable.example.com/v1
kind: Shirt
metadata:
  name: example1
spec:
  color: blue
  size: S
---
apiVersion: stable.example.com/v1
kind: Shirt
metadata:
  name: example2
spec:
  color: blue
  size: M
---
apiVersion: stable.example.com/v1
kind: Shirt
metadata:
  name: example3
spec:
  color: green
  size: M

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | Create the custom resources:


Prompt:
Explain this bash code:

kubectl apply -f https://k8s.io/examples/customresourcedefinition/shirt-resources.yaml

Response: This bash code Extend the Kubernetes API with CustomResourceDefinitions | Get all the resources:

Context: Extend the Kubernetes API with CustomResourceDefinitions | Get all the resources:


Prompt:
Complete this text code:

NAME       COLOR  SIZE
example1   blue   S

Response:
example2   blue   M
example3   green  M

Context: Extend the Kubernetes API with CustomResourceDefinitions | Fetch blue shirts (retrieve Shirts with a color of blue):


Prompt:
Explain this text code:

NAME       COLOR  SIZE
example1   blue   S
example2   blue   M
example3   green  M

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | Fetch blue shirts (retrieve Shirts with a color of blue):


Prompt:
Explain this bash code:

kubectl get shirts.stable.example.com --field-selector spec.color=blue

Response: This bash code Extend the Kubernetes API with CustomResourceDefinitions | Should output:

Context: Extend the Kubernetes API with CustomResourceDefinitions | Should output:


Prompt:
Explain this text code:

NAME       COLOR  SIZE
example1   blue   S
example2   blue   M

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | Get only resources with a color of green and a size of M:

Context: Extend the Kubernetes API with CustomResourceDefinitions | Get only resources with a color of green and a size of M:


Prompt:
Explain this bash code:

kubectl get shirts.stable.example.com --field-selector spec.color=green,spec.size=M

Response: This bash code Extend the Kubernetes API with CustomResourceDefinitions | Should output:


Prompt:
Complete this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: crontabs.stable.example.com
spec:
  group: stable.example.com
  versions:
    - name: v1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                cronSpec:
                  type: string
                image:
                  type: string
                replicas:
                  type: integer
            status:

Response:
              type: object
              properties:
                replicas:
                  type: integer
                labelSelector:
                  type: string
      # subresources describes the subresources for custom resources.
      subresources:
        # status enables the status subresource.
        status: {}
        # scale enables the scale subresource.
        scale:
          # specReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Spec.Replicas.
          specReplicasPath: .spec.replicas
          # statusReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Replicas.
          statusReplicasPath: .status.replicas
          # labelSelectorPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Selector.
          labelSelectorPath: .status.labelSelector
  scope: Namespaced
  names:
    plural: crontabs
    singular: crontab
    kind: CronTab
    shortNames:
    - ct

Context: Extend the Kubernetes API with CustomResourceDefinitions | And create it:


Prompt:
Explain this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: crontabs.stable.example.com
spec:
  group: stable.example.com
  versions:
    - name: v1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                cronSpec:
                  type: string
                image:
                  type: string
                replicas:
                  type: integer
            status:
              type: object
              properties:
                replicas:
                  type: integer
                labelSelector:
                  type: string
      # subresources describes the subresources for custom resources.
      subresources:
        # status enables the status subresource.
        status: {}
        # scale enables the scale subresource.
        scale:
          # specReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Spec.Replicas.
          specReplicasPath: .spec.replicas
          # statusReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Replicas.
          statusReplicasPath: .status.replicas
          # labelSelectorPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Selector.
          labelSelectorPath: .status.labelSelector
  scope: Namespaced
  names:
    plural: crontabs
    singular: crontab
    kind: CronTab
    shortNames:
    - ct

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | And create it:


Prompt:
Complete this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object

Response:
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image
  replicas: 3

Context: Extend the Kubernetes API with CustomResourceDefinitions | and create it:


Prompt:
Explain this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image
  replicas: 3

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | and create it:


Prompt:
Explain this text code:

/apis/stable.example.com/v1/namespaces/*/crontabs/status

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | and

Context: Extend the Kubernetes API with CustomResourceDefinitions | and


Prompt:
Explain this text code:

/apis/stable.example.com/v1/namespaces/*/crontabs/scale

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | A custom resource can be scaled using the kubectl scale command. For example, the following command sets .spec.replicas of the custom resource created above to 5:

Context: Extend the Kubernetes API with CustomResourceDefinitions | A custom resource can be scaled using the kubectl scale command. For example, the following command sets .spec.replicas of the custom resource created above to 5:


Prompt:
Complete this bash code:

kubectl scale --replicas=5 crontabs/my-new-cron-object
crontabs "my-new-cron-object" scaled

Response:
kubectl get crontabs my-new-cron-object -o jsonpath='{.spec.replicas}'
5

Context: Extend the Kubernetes API with CustomResourceDefinitions | You can use a PodDisruptionBudget to protect custom resources that have the scale subresource enabled.


Prompt:
Explain this bash code:

kubectl scale --replicas=5 crontabs/my-new-cron-object
crontabs "my-new-cron-object" scaled

kubectl get crontabs my-new-cron-object -o jsonpath='{.spec.replicas}'
5

Response: This bash code Extend the Kubernetes API with CustomResourceDefinitions | You can use a PodDisruptionBudget to protect custom resources that have the scale subresource enabled.


Prompt:
Complete this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: crontabs.stable.example.com
spec:
  group: stable.example.com
  versions:
    - name: v1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object

Response:
              properties:
                cronSpec:
                  type: string
                image:
                  type: string
                replicas:
                  type: integer
  scope: Namespaced
  names:
    plural: crontabs
    singular: crontab
    kind: CronTab
    shortNames:
    - ct
    # categories is a list of grouped resources the custom resource belongs to.
    categories:
    - all


Prompt:
Explain this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: crontabs.stable.example.com
spec:
  group: stable.example.com
  versions:
    - name: v1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                cronSpec:
                  type: string
                image:
                  type: string
                replicas:
                  type: integer
  scope: Namespaced
  names:
    plural: crontabs
    singular: crontab
    kind: CronTab
    shortNames:
    - ct
    # categories is a list of grouped resources the custom resource belongs to.
    categories:
    - all

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | and create it:


Prompt:
Complete this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:

Response:
  name: my-new-cron-object
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image


Prompt:
Explain this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | and create it:


Prompt:
Explain this text code:

NAME                          AGE
crontabs/my-new-cron-object   3s

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | Read about custom resources.

Context: Extend the Kubernetes API with CustomResourceDefinitions | Read about custom resources.


Prompt:
Complete this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  # name must match the spec fields below, and be in the form: <plural>.<group>
  name: crontabs.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
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:

Response:
              type: object
              properties:
                cronSpec:
                  type: string
                image:
                  type: string
                replicas:
                  type: integer
  # either Namespaced or Cluster
  scope: Namespaced
  names:
    # plural name to be used in the URL: /apis/<group>/<version>/<plural>
    plural: crontabs
    # singular name to be used as an alias on the CLI and for display
    singular: crontab
    # kind is normally the CamelCased singular type. Your resource manifests use this.
    kind: CronTab
    # shortNames allow shorter string to match your resource on the CLI
    shortNames:
    - ct


Prompt:
Explain this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  # name must match the spec fields below, and be in the form: <plural>.<group>
  name: crontabs.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
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                cronSpec:
                  type: string
                image:
                  type: string
                replicas:
                  type: integer
  # either Namespaced or Cluster
  scope: Namespaced
  names:
    # plural name to be used in the URL: /apis/<group>/<version>/<plural>
    plural: crontabs
    # singular name to be used as an alias on the CLI and for display
    singular: crontab
    # kind is normally the CamelCased singular type. Your resource manifests use this.
    kind: CronTab
    # shortNames allow shorter string to match your resource on the CLI
    shortNames:
    - ct

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | and create it:


Prompt:
Explain this text code:

/apis/stable.example.com/v1/namespaces/*/crontabs/...

Response: This text code Extend the Kubernetes API with CustomResourceDefinitions | This endpoint URL can then be used to create and manage custom objects. The kind of these objects will be CronTab from the spec of the CustomResourceDefinition object you created above.

Context: Extend the Kubernetes API with CustomResourceDefinitions | This endpoint URL can then be used to create and manage custom objects. The kind of these objects will be CronTab from the spec of the CustomResourceDefinition object you created above.


Prompt:
Complete this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:

Response:
  name: my-new-cron-object
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image


Prompt:
Explain this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | and create it:


Prompt:
Complete this yaml code:

apiVersion: v1
items:
- apiVersion: stable.example.com/v1
  kind: CronTab
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"stable.example.com/v1","kind":"CronTab","metadata":{"annotations":{},"name":"my-new-cron-object","namespace":"default"},"spec":{"cronSpec":"* * * * */5","image":"my-awesome-cron-image"}}
    creationTimestamp: "2021-06-20T07:35:27Z"
    generation: 1

Response:
    name: my-new-cron-object
    namespace: default
    resourceVersion: "1326"
    uid: 9aab1d66-628e-41bb-a422-57b8b3b1f5a9
  spec:
    cronSpec: '* * * * */5'
    image: my-awesome-cron-image
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""

Context: Extend the Kubernetes API with CustomResourceDefinitions | When you delete a CustomResourceDefinition, the server will uninstall the RESTful API endpoint and delete all custom objects stored in it.


Prompt:
Explain this yaml code:

apiVersion: v1
items:
- apiVersion: stable.example.com/v1
  kind: CronTab
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"stable.example.com/v1","kind":"CronTab","metadata":{"annotations":{},"name":"my-new-cron-object","namespace":"default"},"spec":{"cronSpec":"* * * * */5","image":"my-awesome-cron-image"}}
    creationTimestamp: "2021-06-20T07:35:27Z"
    generation: 1
    name: my-new-cron-object
    namespace: default
    resourceVersion: "1326"
    uid: 9aab1d66-628e-41bb-a422-57b8b3b1f5a9
  spec:
    cronSpec: '* * * * */5'
    image: my-awesome-cron-image
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | When you delete a CustomResourceDefinition, the server will uninstall the RESTful API endpoint and delete all custom objects stored in it.


Prompt:
Explain this shell code:

kubectl delete -f resourcedefinition.yaml
kubectl get crontabs

Response: This shell code Extend the Kubernetes API with CustomResourceDefinitions | If you later recreate the same CustomResourceDefinition, it will start out empty.

Context: Extend the Kubernetes API with CustomResourceDefinitions | If you later recreate the same CustomResourceDefinition, it will start out empty.


Prompt:
Explain this none code:

Error from server (NotFound): Unable to list {"stable.example.com" "v1" "crontabs"}: the server could not
find the requested resource (get crontabs.stable.example.com)

Response: This none code Extend the Kubernetes API with CustomResourceDefinitions | If you later recreate the same CustomResourceDefinition, it will start out empty.


Prompt:
Complete this yaml code:

properties:
  foo:
    # ...

Response:
allOf:
- properties:
    foo:
      # ...

Context: Extend the Kubernetes API with CustomResourceDefinitions | Non-structural example 2:


Prompt:
Explain this yaml code:

properties:
  foo:
    # ...
allOf:
- properties:
    foo:
      # ...

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | Non-structural example 2:


Prompt:
Complete this yaml code:

allOf:
- items:

Response:
    properties:
      foo:
        # ...

Context: Extend the Kubernetes API with CustomResourceDefinitions | conflicts with rule 2. The following would be correct:


Prompt:
Explain this yaml code:

allOf:
- items:
    properties:
      foo:
        # ...

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | conflicts with rule 2. The following would be correct:


Prompt:
Complete this yaml code:

items:
  properties:
    foo:
      # ...

Response:
allOf:
- items:
    properties:
      foo:
        # ...

Context: Extend the Kubernetes API with CustomResourceDefinitions | Non-structural example 3:


Prompt:
Explain this yaml code:

items:
  properties:
    foo:
      # ...
allOf:
- items:
    properties:
      foo:
        # ...

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | Non-structural example 3:


Prompt:
Complete this yaml code:

properties:
  foo:
    pattern: "abc"
  metadata:
    type: object
    properties:
      name:
        type: string
        pattern: "^a"
      finalizers:

Response:
        type: array
        items:
          type: string
          pattern: "my-finalizer"
anyOf:
- properties:
    bar:
      type: integer
      minimum: 42
  required: ["bar"]
  description: "foo bar object"

Context: Extend the Kubernetes API with CustomResourceDefinitions | is not a structural schema because of the following violations:


Prompt:
Explain this yaml code:

properties:
  foo:
    pattern: "abc"
  metadata:
    type: object
    properties:
      name:
        type: string
        pattern: "^a"
      finalizers:
        type: array
        items:
          type: string
          pattern: "my-finalizer"
anyOf:
- properties:
    bar:
      type: integer
      minimum: 42
  required: ["bar"]
  description: "foo bar object"

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | is not a structural schema because of the following violations:


Prompt:
Complete this yaml code:

type: object
description: "foo bar object"
properties:
  foo:
    type: string
    pattern: "abc"
  bar:
    type: integer
  metadata:

Response:
    type: object
    properties:
      name:
        type: string
        pattern: "^a"
anyOf:
- properties:
    bar:
      minimum: 42
  required: ["bar"]

Context: Extend the Kubernetes API with CustomResourceDefinitions | Violations of the structural schema rules are reported in the NonStructural condition in the CustomResourceDefinition.


Prompt:
Explain this yaml code:

type: object
description: "foo bar object"
properties:
  foo:
    type: string
    pattern: "abc"
  bar:
    type: integer
  metadata:
    type: object
    properties:
      name:
        type: string
        pattern: "^a"
anyOf:
- properties:
    bar:
      minimum: 42
  required: ["bar"]

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | Violations of the structural schema rules are reported in the NonStructural condition in the CustomResourceDefinition.


Prompt:
Complete this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object

Response:
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image
  someRandomField: 42


Prompt:
Explain this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image
  someRandomField: 42

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | and create it:


Prompt:
Explain this shell code:

kubectl create --validate=false -f my-crontab.yaml -o yaml

Response: This shell code Extend the Kubernetes API with CustomResourceDefinitions | Your output is similar to:

Context: Extend the Kubernetes API with CustomResourceDefinitions | Your output is similar to:


Prompt:
Complete this yaml code:

apiVersion: stable.example.com/v1
kind: CronTab
metadata:
  creationTimestamp: 2017-05-31T12:56:35Z
  generation: 1
  name: my-new-cron-object

Response:
  namespace: default
  resourceVersion: "285"
  uid: 9423255b-4600-11e7-af6a-28d2447dc82b
spec:
  cronSpec: '* * * * */5'
  image: my-awesome-cron-image

Context: Extend the Kubernetes API with CustomResourceDefinitions | Notice that the field someRandomField was pruned.


Prompt:
Explain this yaml code:

apiVersion: stable.example.com/v1
kind: CronTab
metadata:
  creationTimestamp: 2017-05-31T12:56:35Z
  generation: 1
  name: my-new-cron-object
  namespace: default
  resourceVersion: "285"
  uid: 9423255b-4600-11e7-af6a-28d2447dc82b
spec:
  cronSpec: '* * * * */5'
  image: my-awesome-cron-image

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | Notice that the field someRandomField was pruned.


Prompt:
Complete this yaml code:

type: object
properties:

Response:
  json:
    x-kubernetes-preserve-unknown-fields: true

Context: Extend the Kubernetes API with CustomResourceDefinitions | The field json can store any JSON value, without anything being pruned.


Prompt:
Explain this yaml code:

type: object
properties:
  json:
    x-kubernetes-preserve-unknown-fields: true

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | The field json can store any JSON value, without anything being pruned.


Prompt:
Complete this yaml code:

type: object
properties:
  json:

Response:
    x-kubernetes-preserve-unknown-fields: true
    type: object
    description: this is arbitrary JSON

Context: Extend the Kubernetes API with CustomResourceDefinitions | With this, only object type values are allowed.


Prompt:
Explain this yaml code:

type: object
properties:
  json:
    x-kubernetes-preserve-unknown-fields: true
    type: object
    description: this is arbitrary JSON

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | With this, only object type values are allowed.


Prompt:
Complete this yaml code:

type: object
properties:
  json:
    x-kubernetes-preserve-unknown-fields: true
    type: object
    properties:

Response:
      spec:
        type: object
        properties:
          foo:
            type: string
          bar:
            type: string

Context: Extend the Kubernetes API with CustomResourceDefinitions | With this, the value:


Prompt:
Explain this yaml code:

type: object
properties:
  json:
    x-kubernetes-preserve-unknown-fields: true
    type: object
    properties:
      spec:
        type: object
        properties:
          foo:
            type: string
          bar:
            type: string

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | With this, the value:


Prompt:
Complete this yaml code:

json:
  spec:
    foo: abc

Response:
    bar: def
    something: x
  status:
    something: x

Context: Extend the Kubernetes API with CustomResourceDefinitions | is pruned to:


Prompt:
Explain this yaml code:

json:
  spec:
    foo: abc
    bar: def
    something: x
  status:
    something: x

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | is pruned to:


Prompt:
Complete this yaml code:

json:
  spec:
    foo: abc

Response:
    bar: def
  status:
    something: x

Context: Extend the Kubernetes API with CustomResourceDefinitions | This means that the something field in the specified spec object is pruned, but everything outside is not.


Prompt:
Explain this yaml code:

json:
  spec:
    foo: abc
    bar: def
  status:
    something: x

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | This means that the something field in the specified spec object is pruned, but everything outside is not.


Prompt:
Complete this yaml code:

type: object
properties:

Response:
  foo:
    x-kubernetes-int-or-string: true

Context: Extend the Kubernetes API with CustomResourceDefinitions | Also those nodes are partially excluded from rule 3 in the sense that the following two patterns are allowed (exactly those, without variations in order to additional fields):


Prompt:
Explain this yaml code:

type: object
properties:
  foo:
    x-kubernetes-int-or-string: true

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | Also those nodes are partially excluded from rule 3 in the sense that the following two patterns are allowed (exactly those, without variations in order to additional fields):


Prompt:
Complete this yaml code:

x-kubernetes-int-or-string: true
anyOf:

Response:
  - type: integer
  - type: string
...

Context: Extend the Kubernetes API with CustomResourceDefinitions | and


Prompt:
Explain this yaml code:

x-kubernetes-int-or-string: true
anyOf:
  - type: integer
  - type: string
...

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | and


Prompt:
Complete this yaml code:

x-kubernetes-int-or-string: true
allOf:
  - anyOf:

Response:
      - type: integer
      - type: string
  - # ... zero or more
...

Context: Extend the Kubernetes API with CustomResourceDefinitions | With one of those specification, both an integer and a string validate.


Prompt:
Explain this yaml code:

x-kubernetes-int-or-string: true
allOf:
  - anyOf:
      - type: integer
      - type: string
  - # ... zero or more
...

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | With one of those specification, both an integer and a string validate.


Prompt:
Complete this yaml code:

type: object
properties:

Response:
  foo:
    x-kubernetes-embedded-resource: true
    x-kubernetes-preserve-unknown-fields: true

Context: Extend the Kubernetes API with CustomResourceDefinitions | Here, the field foo holds a complete object, e.g.:


Prompt:
Explain this yaml code:

type: object
properties:
  foo:
    x-kubernetes-embedded-resource: true
    x-kubernetes-preserve-unknown-fields: true

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | Here, the field foo holds a complete object, e.g.:


Prompt:
Complete this yaml code:

foo:
  apiVersion: v1

Response:
  kind: Pod
  spec:
    # ...

Context: Extend the Kubernetes API with CustomResourceDefinitions | Because x-kubernetes-preserve-unknown-fields: true is specified alongside, nothing is pruned. The use of x-kubernetes-preserve-unknown-fields: true is optional though.


Prompt:
Explain this yaml code:

foo:
  apiVersion: v1
  kind: Pod
  spec:
    # ...

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | Because x-kubernetes-preserve-unknown-fields: true is specified alongside, nothing is pruned. The use of x-kubernetes-preserve-unknown-fields: true is optional though.


Prompt:
Complete this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab

Response:
metadata:
  finalizers:
  - stable.example.com/finalizer

Context: Extend the Kubernetes API with CustomResourceDefinitions | Identifiers of custom finalizers consist of a domain name, a forward slash and the name of the finalizer. Any controller can add a finalizer to any object's list of finalizers.


Prompt:
Explain this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  finalizers:
  - stable.example.com/finalizer

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | Identifiers of custom finalizers consist of a domain name, a forward slash and the name of the finalizer. Any controller can add a finalizer to any object's list of finalizers.


Prompt:
Complete this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: crontabs.stable.example.com
spec:
  group: stable.example.com
  versions:
    - name: v1
      served: true
      storage: true
      schema:
        # openAPIV3Schema is the schema for validating custom objects.
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object

Response:
              properties:
                cronSpec:
                  type: string
                  pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
                image:
                  type: string
                replicas:
                  type: integer
                  minimum: 1
                  maximum: 10
  scope: Namespaced
  names:
    plural: crontabs
    singular: crontab
    kind: CronTab
    shortNames:
    - ct

Context: Extend the Kubernetes API with CustomResourceDefinitions | and create it:


Prompt:
Explain this yaml code:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: crontabs.stable.example.com
spec:
  group: stable.example.com
  versions:
    - name: v1
      served: true
      storage: true
      schema:
        # openAPIV3Schema is the schema for validating custom objects.
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                cronSpec:
                  type: string
                  pattern: '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
                image:
                  type: string
                replicas:
                  type: integer
                  minimum: 1
                  maximum: 10
  scope: Namespaced
  names:
    plural: crontabs
    singular: crontab
    kind: CronTab
    shortNames:
    - ct

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | and create it:


Prompt:
Complete this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object

Response:
spec:
  cronSpec: "* * * *"
  image: my-awesome-cron-image
  replicas: 15

Context: Extend the Kubernetes API with CustomResourceDefinitions | and attempt to create it:


Prompt:
Explain this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object
spec:
  cronSpec: "* * * *"
  image: my-awesome-cron-image
  replicas: 15

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | and attempt to create it:


Prompt:
Complete this console code:

The CronTab "my-new-cron-object" is invalid: []: Invalid value: map[string]interface {}{"apiVersion":"stable.example.com/v1", "kind":"CronTab", "metadata":map[string]interface {}{"name":"my-new-cron-object", "namespace":"default", "deletionTimestamp":interface {}(nil), "deletionGracePeriodSeconds":(*int64)(nil), "creationTimestamp":"2017-09-05T05:20:07Z", "uid":"e14d79e7-91f9-11e7-a598-f0761cb232d1", "clusterName":""}, "spec":map[string]interface {}{"cronSpec":"* * * *", "image":"my-awesome-cron-image", "replicas":15}}:
validation failure list:

Response:
spec.cronSpec in body should match '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
spec.replicas in body should be less than or equal to 10

Context: Extend the Kubernetes API with CustomResourceDefinitions | If the fields contain valid values, the object creation request is accepted.


Prompt:
Explain this console code:

The CronTab "my-new-cron-object" is invalid: []: Invalid value: map[string]interface {}{"apiVersion":"stable.example.com/v1", "kind":"CronTab", "metadata":map[string]interface {}{"name":"my-new-cron-object", "namespace":"default", "deletionTimestamp":interface {}(nil), "deletionGracePeriodSeconds":(*int64)(nil), "creationTimestamp":"2017-09-05T05:20:07Z", "uid":"e14d79e7-91f9-11e7-a598-f0761cb232d1", "clusterName":""}, "spec":map[string]interface {}{"cronSpec":"* * * *", "image":"my-awesome-cron-image", "replicas":15}}:
validation failure list:
spec.cronSpec in body should match '^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$'
spec.replicas in body should be less than or equal to 10

Response: This console code Extend the Kubernetes API with CustomResourceDefinitions | If the fields contain valid values, the object creation request is accepted.


Prompt:
Complete this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object

Response:
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image
  replicas: 5

Context: Extend the Kubernetes API with CustomResourceDefinitions | And create it:


Prompt:
Explain this yaml code:

apiVersion: "stable.example.com/v1"
kind: CronTab
metadata:
  name: my-new-cron-object
spec:
  cronSpec: "* * * * */5"
  image: my-awesome-cron-image
  replicas: 5

Response: This yaml code Extend the Kubernetes API with CustomResourceDefinitions | And create it:


Prompt:
Explain this shell code:

kubectl apply -f my-crontab.yaml
crontab "my-new-cron-object" created

Response: This shell code Extend the Kubernetes API with CustomResourceDefinitions | If you are using a version of Kubernetes older than v1.30, you need to explicitly enable the CRDValidationRatcheting feature gate to use this behavior, which then applies to all CustomResourceDefiniti

Context: Extend the Kubernetes API with CustomResourceDefinitions | If you are using a version of Kubernetes older than v1.30, you need to explicitly enable the CRDValidationRatcheting feature gate to use this behavior, which then applies to all CustomResourceDefiniti