TimesTenオペレータのアップグレード

TimesTenオペレータは、ネームスペース内でTimesTenClassicオブジェクトが実行されているときにアップグレードできます。ネームスペース内のTimesTenオペレータをアップグレードするには、ttoperatorチャートの新しいリリースを使用します。

アップグレード・プロセスでは、次のステップを完了する必要があります:
  • 新しいYAMLファイルを作成します。このファイルでは、TimesTenの新しいリリースを含むコンテナ・イメージを指定します。

  • アップグレードに、helm get valuesコマンドを使用します。この例は、この方法を示しています。

この例では、new_kube_files/helm/customyamlディレクトリが作成されていることを前提としています。

  1. 開発ホストで、新しいHelmチャートを含むhelmディレクトリに移動します。
    cd new_kube_files/helm
  2. YAMLファイルを作成し、そのファイルにアップグレードに使用するTimesTenイメージの名前を指定します。
    vi customyaml/upgradeoperator.yaml
    
    image:
      repository: container-registry.oracle.com/timesten/timesten
      tag: "22.1.1.28.0"
  3. アップグレードの前に、次の手順を実行します:
    1. TimesTenオペレータが実行されていることを確認します。
      kubectl get pods

      出力は次のようになります。

      
      NAME                              READY   STATUS    RESTARTS   AGE
      norepsamplehelm-0                 3/3     Running   0          6h19m
      norepsamplehelm-1                 3/3     Running   0          6h19m
      norepsamplehelm-2                 3/3     Running   0          6h19m
      repsamplehelm-0                   3/3     Running   0          9h
      repsamplehelm-1                   2/3     Running   0          9h
      timesten-operator-55c6f99-zqlct   1/1     Running   0          2d21h
    2. TimesTenオペレータが実行しているイメージを確認します。
      kubectl describe deployment timesten-operator | grep Image

      出力は次のようになります。

      Image:       container-registry.oracle.com/timesten/timesten:22.1.1.27.0
    3. TimesTenClassicオブジェクトの状態を確認します。
      kubectl get ttc

      出力は、次のようになります。

      NAME              STATE              ACTIVE            AGE
      norepsamplehelm   AllReplicasReady   N/A               6h28m
      repsamplehelm     Normal             repsamplehelm-0   9h
      

      TimesTenClassicオブジェクトおよび関連付けられたデータベースが正しく機能しています。

  4. Helmチャートのリリースを確認します。
    helm list
    出力は、次のようになります。
    
    NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                   APP VERSION
    ...
    ttoper          default         1               2024-08-02 02:54:39.916210368 +0000 UTC deployed        ttoperator-2211270.1.0  22.1.1.27.0
  5. TimesTenオペレータを新しいリリースにアップグレードします。TimesTenオペレータをアップグレードするには、新しいリリースのttoperatorチャートを使用し、新しいイメージを参照するカスタマイズされたYAMLファイルを使用します。

    ノート:

    この構文をお薦めします。これにより、既存のカスタマイズが保持されます。
    helm get values ttoper --all > prev-values-ttop.yaml
    helm upgrade -f prev-values-ttop.yaml -f customyaml/upgradeoperator.yaml  ttoper ./ttoperator
    次のhelm upgradeコマンドを見てみましょう。
    • get values ttoper Helmコマンドは、既存のカスタマイズを含む現在のリリースの値を取得します。このコマンドの結果は、prev-values-ttop.yamlファイルにパイプされます。このファイルには任意の名前を選択できます。

    • helm upgradeコマンドは、カスタマイズされたupgradeoperator.yamlファイルとともにprev-values-ttop.yamlファイルを使用してアップグレードを実行します。具体的には、prev-values-ttop.yamlファイルの値が、カスタマイズしたupgradeoperator.yamlファイルの値によってオーバーライドされる場合を除いて使用されます。upgradeoperator.yamlファイルは、コマンドラインで最後にリストされたため、prev-values-ttop.yamlファイルよりも優先されます。

    helm upgradeコマンドの出力を見てみましょう。

    Release "ttoper" has been upgraded. Happy Helming!
    NAME: ttoper
    LAST DEPLOYED: Mon Aug  5 00:20:34 2024
    NAMESPACE: default
    STATUS: deployed
    REVISION: 2
    NOTES:
    Version 2211280.1.0 of the ttoperator chart has been installed.
    
    This release is named "ttoper".
    
    To learn more about the release, try:
    
      $ helm status ttoper
      $ helm get all ttoper
      $ helm history ttoper
    
    To rollback to a previous version of the chart, run:
    
      $ helm rollback ttoper <REVISION>
        - run 'helm history ttoper' for a list of revisions.
    
    To test the operator, run:
    
    次の点に注目してください。
    • ttoperリリースがアップグレードされています。リリース・リビジョンは2です。

    • リリースのステータスはdeployedです。

    • ttoperatorチャートのversionは、TimesTenリリース22.1.1.28.0に対応する2211280.1.0です。

  6. TimesTenオペレータが実行されていることをテストします。
    helm test ttoper

    出力は、次のようになります。

    NAME: ttoper
    LAST DEPLOYED: Mon Aug  5 00:20:34 2024
    NAMESPACE: default
    STATUS: deployed
    REVISION: 2
    TEST SUITE:     ttoper-ttoperator-test
    Last Started:   Mon Aug  5 00:20:54 2024
    Last Completed: Mon Aug  5 00:20:57 2024
    Phase:          Succeeded
    NOTES:
    Version 2211280.1.0 of the ttoperator chart has been installed.
    
    This release is named "ttoper".
    
    To learn more about the release, try:
    
      $ helm status ttoper
      $ helm get all ttoper
      $ helm history ttoper
    
    To rollback to a previous version of the chart, run:
    
      $ helm rollback ttoper <REVISION>
        - run 'helm history ttoper' for a list of revisions.
    
    To test the operator, run:
    
      $ helm test ttoper
  7. アップグレード後、次の手順を実行します:
    1. TimesTenオペレータが実行されていることを確認します。
      kubectl get pods

      出力は次のようになります。

      NAME                                 READY   STATUS    RESTARTS   AGE
      norepsamplehelm-0                    3/3     Running   0          6h38m
      norepsamplehelm-1                    3/3     Running   0          6h38m
      norepsamplehelm-2                    3/3     Running   0          6h38m
      repsamplehelm-0                      3/3     Running   0          9h
      repsamplehelm-1                      2/3     Running   0          9h
      timesten-operator-57b7949f97-xdlwl   1/1     Running   0          31s

      新しいTimesTenオペレータが実行されています。

    2. TimesTenオペレータが新しいイメージを実行していることを確認します。
      kubectl describe deployment timesten-operator | grep Image

      出力は次のようになります。

      Image:       container-registry.oracle.com/timesten/timesten:22.1.1.28.0

      TimesTenオペレータでは、新しいリリースが実行されています。

    3. TimesTenClassicオブジェクトの状態を確認します。
      kubectl get ttc

      出力は、次のようになります。

      NAME              STATE              ACTIVE            AGE
      norepsamplehelm   AllReplicasReady   N/A               6h39m
      repsamplehelm     Normal             repsamplehelm-0   9h

      TimesTenオペレータにより、TimesTenClassicオブジェクトの管理および監視が再開されます。オブジェクトおよび関連するTimesTenデータベースは正しく機能しています。

おめでとうございます。ttoperatorチャートが正常にアップグレードされました。新しいTimesTenオペレータがネームスペース内で実行され、新しいイメージを使用しています。