8.4. 製品の APIcast 設定のプロモート
3scale Operator を使用して、製品の APIcast 設定をステージングまたは実稼働に昇格させることができます。ProxyConfigPromote カスタムリソース (CR) は、最新の APIcast 設定をステージング環境にプロモートします。必要に応じて、ProxyConfigPromote CR を設定して、運用環境にも昇格させることができます。
-
ProxyConfigPromoteオブジェクトは、作成されたときにのみ有効になります。作成後、それらの更新は調整されません。 -
proxyConfigPromoteは、実際の設定変更がある場合にのみ設定のプロモーションを処理します。変更が検出されない場合、proxyConfigPromote はエラー状態になります。この状態では、カスタムリソース (CR) にエラーメッセージが表示され、削除対象としてマークされている場合でも、ユーザーは CR を手動で削除する必要があります。
前提条件
以下を含む、一般的な前提条件 に記載されているものと同じインストール要件:
- 製品 CR を作成済みである。
手順
次の内容で YAML ファイルを作成して保存します。
apiVersion: capabilities.3scale.net/v1beta1 kind: ProxyConfigPromote metadata: name: proxyconfigpromote-sample spec: productCRName: product1-sampleAPIcast 設定を本番環境にプロモートするには、オプションのフィールド
spec.productionをtrueに設定します。apiVersion: capabilities.3scale.net/v1beta1 kind: ProxyConfigPromote metadata: name: proxyconfigpromote-sample spec: productCRName: product1-sample production: true昇格が成功した後に
ProxyConfigPromote objectを削除するには、オプションのフィールドspec.deleteCRをtrueに設定します。apiVersion: capabilities.3scale.net/v1beta1 kind: ProxyConfigPromote metadata: name: proxyconfigpromote-sample spec: productCRName: product1-sample deleteCR: trueファイルのステータス条件を確認するには、次のコマンドを入力します。
$ oc get proxyconfigpromote proxyconfigpromote-sample -o yaml出力には、ステータスが
ReadyまたはFailedと表示されます。apiVersion: capabilities.3scale.net/v1beta1 kind: ProxyConfigPromote metadata: name: proxyconfigpromote-sample spec: productCRName: product1-sample status: conditions: - lastTransitionTime: '2023-09-05T07:15:11Z' message: >- 3scale product has been successfully promoted, any further interactions with this CR (apart from deletion) won't be applied status: 'True' type: Ready latestStagingVersion: 1 productId: '7'apiVersion: capabilities.3scale.net/v1beta1 kind: ProxyConfigPromote metadata: name: proxyconfigpromote-sample spec: productCRName: product1-sample status: conditions: - lastTransitionTime: '2023-09-05T07:48:08Z' message: >- cannot promote to production as no product changes detected. Delete this proxyConfigPromote CR, then introduce changes to configuration, and then create a new proxyConfigPromote CR status: 'True' type: Failed latestProductionVersion: 1 latestStagingVersion: 1 productId: '6'注記プロキシー設定に変更を加えないと、ProxyConfigPromote CR の
Failed出力ステータスと、次のいずれかのメッセージが表示されます。-
ステージ環境にプロモートする場合:
cannot promote to staging as no product changes detected.Delete this proxyConfigPromote CR, then introduce changes to configuration, and then create a new proxyConfigPromote CR。 -
実稼働環境にプロモートする場合:
cannot promote to production as no product changes detected.Delete this proxyConfigPromote CR, then introduce changes to configuration, and then create a new proxyConfigPromote CR。
メッセージの指示に従って、手順を完了してください。
-
ステージ環境にプロモートする場合:
カスタムリソースを作成します。
oc create -f proxyconfigpromote-sample.yamlこの例では、出力は以下のようになります。
proxyconfigpromote.capabilities.3scale.net/proxyconfigpromote-sample created