About TimesTenClassic Schema Versions
In TimesTen releases 22.1.1.27.0
and greater, the TimesTen Operator provides a TimesTenClassic CRD that define both the v1
and v2
schema versions. The TimesTen Operator supports the creation, monitoring, and management of TimesTenClassic objects in these schema versions.
-
You can create TimesTenClassic objects in either the
v1
orv2
schema. However, to use attributes specific to the latest release of the TimesTen Operator, you must define your object with thev2
schema definitions. For information about these attributes, see TimesTenClassicSpecSpec. -
Kubernetes uses the
v2
schema version as the default version. If you use thekubectl
get
command to fetch a TimesTenClassic object, Kubernetes returns the object inv2
format, unless you explicitly ask for thev1
format. -
Not only does Kubernetes support multiple versions of a CRD simultaneously, but it can serve an object in a schema version that is different than the one in which it was created. A TimesTenClassic object that you created with one schema version can be fetched with another schema version. For example, you can create a
v2
TimesTenClassic object and can fetch it as av1
version of the object. -
Kubernetes stores newly created objects using one schema version. Kubernetes stores TimesTenClassic objects in the
v2
schema. If you create av1
TimesTenClassic object, Kubernetes stores the object inv2
format. -
Use the following syntax to define
v2
TimesTenClassic objects:apiVersion: timesten.oracle.com/v2 kind: TimesTenClassic
Using
timesten.oracle.com/v2
forapiVersion
instructs Kubernetes to create av2
object. For more information aboutapiVersion
, see TimesTenClassic.
Let's look at some examples:
Example 1
Let's define a v2
and a v1
TimesTenClassic object. For each definition, let's specify an attribute that only exists in the v2
schema version of the TimesTenClassic CRD:
- Create a
v2
TimesTenClassic object with the.spec.ttspec.rollingUpdatePartition
attribute. This attribute only exists in thev2
schema.vi sample.yaml apiVersion: timesten.oracle.com/v2 kind: TimesTenClassic metadata: name: sample spec: ttspec: storageClassName: oci-bv storageSize: 250Gi image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0 imagePullSecret: sekret imagePullPolicy: Always replicationTopology: none replicas: 2 rollingUpdatePartition: 1
The
sample
TimesTenClassic object uses thev2
schema and specifies the.spec.ttspec.rollingUpdatePartition
attribute, which only exists in thev2
schema version of the TimesTenClassic CRD. - Deploy the
sample
TimesTenClassic object in your namespace.kubectl create -f sample.yaml
- Confirm the TimesTenClassic object is created.
kubectl get ttc
The output is similar to the following:
NAME STATE ACTIVE AGE sample AllReplicasReady N/A 44m
The
sample
TimesTenClassic object is successfully deployed. - Attempt to create a
v1
TimesTenClassic object with the.spec.ttspec.rollingUpdatePartition
attribute. This attribute only exists in thev2
schema.vi samplev1.yaml apiVersion: timesten.oracle.com/v1 kind: TimesTenClassic metadata: name: samplev1 spec: ttspec: storageClassName: oci-bv storageSize: 250Gi image: container-registry.oracle.com/timesten/timesten:22.1.1.27.0 imagePullSecret: sekret imagePullPolicy: Always replicationTopology: none replicas: 2 rollingUpdatePartition: 1
- Deploy the
samplev1
TimesTenClassic object in your namespace.kubectl create -f samplev1.yaml
The output is similar to the following:Error from server (BadRequest): error when creating "samplev1.yaml": TimesTenClassic in version "v1" cannot be handled as a TimesTenClassic: strict decoding error: unknown field "spec.ttspec.rollingUpdatePartition"
As expected, Kubernetes generates an error indicating a
v1
object cannot be created if av2
attribute, such as.spec.ttspec.rollingUpdatePartition
is specified in the object's definition.
Example 2
Let's fetch the sample
v2
object as the v2
version and the v1
version.
- Fetch the
sample
object and specify thev2
format.kubectl get timestenclassic.v2.timesten.oracle.com sample -o yaml | grep rollingUpdatePartition
The output is the following:
Kubernetes returns therollingUpdatePartition: 1
.spec.ttspec.rollingUpdatePartition
attribute. - Fetch the
sample
object and do not specify a format.kubectl get timestenclassic sample -o yaml | grep rollingUpdatePartition rollingUpdatePartition: 1
The output is the following:
Since Kubernetes automatically usesrollingUpdatePartition: 1
v2
as the default version, Kubernetes returns the object inv2
format. This format includes the.spec.ttspec.rollingUpdatePartition
attribute. - Fetch the
sample
object and specify thev1
format.kubectl get timestenclassic.v1.timesten.oracle.com sample -o yaml | grep rollingUpdatePartition
There is output returned, but it does not include the
.spec.ttspec.rollingUpdatePartition
attribute.