How Our Custom Resources Are Defined
To come up with a solution for Example Use Case 3 in the previous section, we have decided that our CRD will define two fields, as mentioned in the preceding example. To accomplish this, our CR object will look as follows.
apiVersion: "controllers.kube.book.au/v1" kind: PodLifecycleConfig metadata:   name: demo-pod-lifecycle spec:   namespaceName: crddemo   podLiveForThisMinutes: 1
The preceding specification defines our target object. As you can see, it looks just like normal Kubernetes objects, but the specifications (the spec
section) are defined as per our requirements. Let's dig a bit deeper into the details.
apiVersion
This is the field required by Kubernetes to group objects. Note that we put the version (v1
) as part of the group key. This grouping technique helps us keep multiple versions of our object. Consider whether you want to add a new property without affecting existing users...