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.

Note the following:
  • You can create TimesTenClassic objects in either the v1 or v2 schema. However, to use attributes specific to the latest release of the TimesTen Operator, you must define your object with the v2 schema definitions. For information about these attributes, see TimesTenClassicSpecSpec.

  • Kubernetes uses the v2 schema version as the default version. If you use the kubectl get command to fetch a TimesTenClassic object, Kubernetes returns the object in v2 format, unless you explicitly ask for the v1 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 a v1 version of the object.

  • Kubernetes stores newly created objects using one schema version. Kubernetes stores TimesTenClassic objects in the v2 schema. If you create a v1 TimesTenClassic object, Kubernetes stores the object in v2 format.

  • Use the following syntax to define v2 TimesTenClassic objects:

    apiVersion: timesten.oracle.com/v2
    kind: TimesTenClassic

    Using timesten.oracle.com/v2 for apiVersion instructs Kubernetes to create a v2 object. For more information about apiVersion, 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:

  1. Create a v2 TimesTenClassic object with the .spec.ttspec.rollingUpdatePartition attribute. This attribute only exists in the v2 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 the v2 schema and specifies the .spec.ttspec.rollingUpdatePartition attribute, which only exists in the v2 schema version of the TimesTenClassic CRD.

  2. Deploy the sample TimesTenClassic object in your namespace.
    kubectl create -f sample.yaml
  3. 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.

  4. Attempt to create a v1 TimesTenClassic object with the .spec.ttspec.rollingUpdatePartition attribute. This attribute only exists in the v2 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
    
  5. 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 a v2 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.

  1. Fetch the sample object and specify the v2 format.
    kubectl get timestenclassic.v2.timesten.oracle.com sample -o yaml | grep rollingUpdatePartition
    The output is the following:
    rollingUpdatePartition: 1
    Kubernetes returns the .spec.ttspec.rollingUpdatePartition attribute.
  2. 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:
    rollingUpdatePartition: 1
    Since Kubernetes automatically uses v2 as the default version, Kubernetes returns the object in v2 format. This format includes the .spec.ttspec.rollingUpdatePartition attribute.
  3. Fetch the sample object and specify the v1 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.