3

I have a single yaml file having CustomResourceDefinition and CRD object. But when I am trying to apply the yaml then sometimes crd object creation failed with kind DemoRule not present.

Tried to apply separately and it worked fine. Is there any way to execute both in a single yaml without having any error? Or adding wait between two deployments?

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: server.demo.com
spec:
  group: demo.com
  versions:
  - name: v1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              HOST:
                type: string
  scope: Namespaced
  names:
    plural: servers
    singular: server
    kind: DemoRule
    shortNames:
    - dr
---
apiVersion: demo.com/v1
kind: DemoRule
metadata:
  name: demo-config-rule
  namespace: abc
spec:
  HOST: a.b.c.d

0 Answers0