LoginSignup
1
0

More than 1 year has passed since last update.

Wazi: OpenShift上でのメインフレーム開発環境構築 - (4)OpenShiftクラスターの構成

Last updated at Posted at 2021-04-17

はじめに

Wazi環境構築のログです。
実際にWazi Sandboxをデプロイするためには、事前にOpenShift上にも色々と設定をしておく必要があります。今回はOpenShift周りの事前準備について。

関連記事

Wazi: OpenShift上でのメインフレーム開発環境構築 - (1)事前準備
Wazi: OpenShift上でのメインフレーム開発環境構築 - (2)ライセンス・サーバーの構成
Wazi: OpenShift上でのメインフレーム開発環境構築 - (3)イメージ・ストレージ・サーバーの構成
Wazi: OpenShift上でのメインフレーム開発環境構築 - (4)OpenShiftクラスターの構成
Wazi: OpenShift上でのメインフレーム開発環境構築 - (5)Sandboxインスタンスの作成
Wazi: OpenShift上でのメインフレーム開発環境構築 - (6)Sandboxインスタンスの確認
Wazi: OpenShift上でのメインフレーム開発環境構築 - (7)Sandboxインスタンスへの接続
Wazi: OpenShift上でのメインフレーム開発環境構築 - (8)Sandboxのカスタマイズ
Wazi: OpenShift上でのメインフレーム開発環境構築 - (9)Wazi Developer for Workspacesの作成

全体像

image.png
今回は図の矢印部分のOpenShiftクラスター周りの設定です。Wazi Sandbox作成前の下準備を行います。

OpenShiftクラスターのセットアップ

基本的には、ocコマンド/cloudctlコマンドをセットアップしたPC上のLinux環境(VirtualBox上)、もしくは、OpenShiftのWebコンソールから操作を実行します。

Sandbox CASEのインストール

参考: Installing the Sandbox CASE bundle

この操作はOpenShiftクラスターに対して1度実行すればOKです。

CASE補足
いきなりCASE launcherだのCASE bundleだのっていう用語が出てきて、CASEってなんぞや???というのが謎だったので調べてみると... 参考: [IBM Developer Blog - Introducing a container packaging specification: Container Application Software for Enterprises (CASE)](https://developer.ibm.com/technologies/containers/blogs/container-application-software-for-enterprises-packaging-spec/) [GitHub - IBM/case](https://github.com/IBM/case)

ざっくり理解をまとめると、CASEというのはコンテナ・ベースのアプリケーションのパッケージングの仕組みを提供してくれるものらしいです。位置づけとしてはHelmに近いもののようですが、HelmやOLM(Operator Lifecycle Manager)では対応できない部分があるため、IBMがエンタープライズ向けのパッケージング機能として新たにCASEという仕組みを提供したということのようです。IBM Cloud Pakで使われてるっぽい。
複雑にリソースが絡んだアプリケーションやリソースをデプロイするのに、CASEの仕組みに乗っかると効率よくできるよ、っていうことで、CASEに準ずる形でWaziのインストーラーが提供されれているということだと思われます。そのため、事前にCASE関連のセットアップをしておく必要があるということのようです。
※しかし新しい固有名詞として"case"という一般的によく使われる単語と同じ名前つけられると、ググった時に有用なサイトに辿り着きにくくなるからやめて欲しいんだけどな...

まずはcloudctlコマンドを使って、Cloud Pak GitHub リポジトリーから CASE バンドルをダウンロードします。

[root@Test05 ~/openshift/Wazi]# mkdir -p CASE
[root@Test05 ~/openshift/Wazi]# BUNDLE_PATH=/root/openshift/Wazi/CASE
[root@Test05 ~/openshift/Wazi]# echo ${BUNDLE_PATH}
/root/openshift/Wazi/CASE
[root@Test05 ~/openshift/Wazi]# cloudctl case save --case https://github.com/IBM/cloud-pak/raw/master/repo/case/ibm-wazi-sandbox-1.1.0.tgz --outputdir $BUNDLE_PATH
Downloading and extracting the CASE ...
- Success
Retrieving CASE version ...
- Success
Validating the CASE ...
Validating the signature for the ibm-wazi-sandbox CASE...
- Success
Creating inventory ...
- Success
Finding inventory items
- Success
Resolving inventory items ...
Parsing inventory items
- Success

[root@Test05 ~/openshift/Wazi]# ls -la CASE/
合計 464
drwxr-xr-x. 3 root root    136  1月 14 10:16 .
drwxr-xr-x. 3 root root    115  1月 14 10:15 ..
drwxr-xr-x. 2 root root      6  1月 14 10:16 charts
-rw-r--r--. 1 root root     32  1月 14 10:16 ibm-wazi-sandbox-1.1.0-charts.csv
-rw-r--r--. 1 root root    677  1月 14 10:16 ibm-wazi-sandbox-1.1.0-images.csv
-rw-r--r--. 1 root root 465403  1月 14 10:16 ibm-wazi-sandbox-1.1.0.tgz

ダウンロードしたアーカイブファイルを解凍します。

解凍結果
[root@Test05 ~/openshift/Wazi]# cd CASE

[root@Test05 ~/openshift/Wazi/CASE]# tar -xzvf ibm-wazi-sandbox-1.1.0.tgz
ibm-wazi-sandbox
ibm-wazi-sandbox/LICENSE
ibm-wazi-sandbox/README.md
ibm-wazi-sandbox/case.yaml
ibm-wazi-sandbox/certifications
ibm-wazi-sandbox/certifications/ibmccs.yaml
ibm-wazi-sandbox/digests.yaml
ibm-wazi-sandbox/inventory
ibm-wazi-sandbox/inventory/waziSandboxOperator
ibm-wazi-sandbox/inventory/waziSandboxOperator/README.md
ibm-wazi-sandbox/inventory/waziSandboxOperator/actions.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperator/files
ibm-wazi-sandbox/inventory/waziSandboxOperator/files/deploy
ibm-wazi-sandbox/inventory/waziSandboxOperator/files/deploy/crds
ibm-wazi-sandbox/inventory/waziSandboxOperator/files/deploy/crds/sandbox.wazi.ibm.com_v1alpha1_wazisandboxsystem_cr.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperator/files/deploy/crds/sandbox.wazi.ibm.com_v1alpha1_wazisandboxvolumecopy_cr.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperator/inventory.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperator/resources.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/README.md
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/actions.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/files
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/files/deploy
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/files/deploy/catalog_source.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/files/deploy/crds
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/files/deploy/crds/sandbox.wazi.ibm.com_wazisandboxsystems_crd.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/files/deploy/crds/sandbox.wazi.ibm.com_wazisandboxvolumecopies_crd.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/files/deploy/operator.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/files/deploy/role.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/files/deploy/role_binding.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/files/deploy/service_account.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/files/deploy/subscription_template.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/files/deploy/volume_copy_role.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/files/deploy/volume_copy_role_binding.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/files/deploy/volume_copy_service_account.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/files/launch.sh
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/inventory.yaml
ibm-wazi-sandbox/inventory/waziSandboxOperatorSetup/resources.yaml
ibm-wazi-sandbox/licenses
ibm-wazi-sandbox/licenses/LICENSE
ibm-wazi-sandbox/licenses/Lic_cs.txt
ibm-wazi-sandbox/licenses/Lic_de.txt
ibm-wazi-sandbox/licenses/Lic_el.txt
ibm-wazi-sandbox/licenses/Lic_en.txt
ibm-wazi-sandbox/licenses/Lic_es.txt
ibm-wazi-sandbox/licenses/Lic_fr.txt
ibm-wazi-sandbox/licenses/Lic_in.txt
ibm-wazi-sandbox/licenses/Lic_it.txt
ibm-wazi-sandbox/licenses/Lic_ja.txt
ibm-wazi-sandbox/licenses/Lic_ko.txt
ibm-wazi-sandbox/licenses/Lic_lt.txt
ibm-wazi-sandbox/licenses/Lic_pl.txt
ibm-wazi-sandbox/licenses/Lic_pt.txt
ibm-wazi-sandbox/licenses/Lic_ru.txt
ibm-wazi-sandbox/licenses/Lic_sl.txt
ibm-wazi-sandbox/licenses/Lic_tr.txt
ibm-wazi-sandbox/licenses/Lic_zh.txt
ibm-wazi-sandbox/licenses/Lic_zh_TW.txt
ibm-wazi-sandbox/licenses/non_ibm_license.txt
ibm-wazi-sandbox/licenses/notices.txt
ibm-wazi-sandbox/prereqs.yaml
ibm-wazi-sandbox/roles.yaml
ibm-wazi-sandbox/signature.yaml

OpenShift Clusterにログイン後、CASE bundelをインストールします(OpenShift OperatorHub Marketplaceにオペレーターがデプロイされる)。
※この時のユーザーにはクラスター管理者権限が必要です。

[root@Test05 ~/openshift/Wazi/CASE]# oc login -u apikey -p xxx
Login successful.

You have access to 63 projects, the list has been suppressed. You can list all projects with ' projects'

Using project "tagtest01".

[root@Test05 ~/openshift/Wazi/CASE]# cloudctl case launch --case ibm-wazi-sandbox/ --inventory "waziSandboxOperatorSetup" --action "install" -t 1
Welcome to the CASE launcher
Attempting to retrieve and extract the CASE from the specified location
[?] CASE has been retrieved and extracted
Attempting to validate the CASE
Skipping CASE validation...
Attempting to locate the launch inventory item, script, and action in the specified CASE
[?] Found the specified launch inventory item, action, and script for the CASE
Attempting to check the cluster and machine for required prerequisites for launching the item
Checking for required prereqs...

Prerequisite                                                                            Result
openshift Kubernetes version must be >=1.16.2                                           true
CustomResourceDefinition must have a group and version of apiextensions.k8s.io/v1beta1  true
Client oc CLI must meet the following regex: Client Version: .*4.[0-9]*.[0-9]*.*        true
Cluster Kubernetes version must be >=1.16.2                                             true
CustomResourceDefinition must have a group and version of apiextensions.k8s.io/v1beta1  true
Client kubectl CLI must meet the following regex: GitVersion:"v1.18.[0-9]*              true

Required prereqs result: OK
Checking user permissions...

Kubernetes RBAC Prerequisite            Verbs                                      Result  Reason
namespaces/                             get                                        true
configmaps/                             *                                          true
secrets/                                *                                          true
persistentvolumeclaims/                 *                                          true
events/                                 create                                     true
services/                               *                                          true
apps.deployments/                       *                                          true
monitoring.coreos.com.servicemonitors/  get,create                                 true
apps.deployments/finalizers/            update                                     true
pods/                                   get                                        true
apps.replicasets/                       get                                        true
apps.deployments/                       get                                        true
sandbox.wazi.ibm.com.*/                 create,delete,get,list,patch,update,watch  true

User permissions result: OK
[?] Cluster and Client Prerequisites have been met for the CASE
Running the CASE waziSandboxOperatorSetup launch script with the following action context: install
Parameter does not exist --tolerance
Parameter does not exist 1

=========================================================================
Please read carefully the following License Agreements
=========================================================================
IMPORTANT: READ CAREFULLY

Two license agreements are presented below.

1. IBM International License Agreement for Evaluation of Programs
2. IBM International Program License Agreement

If Licensee is obtaining the Program for purposes of productive use (other than evaluation, testing, trial "try or buy," or demonstration): By clicking on the "Accept" button below, Licensee accepts the IBM International Program License Agreement, without modification.

If Licensee is obtaining the Program for the purpose of evaluation, testing, trial "try or buy," or demonstration (collectively, an "Evaluation"): By clicking on the "Accept" button below, Licensee accepts both (i) the IBM International License Agreement for Evaluation of Programs (the "Evaluation License"), without modification; and (ii) the IBM International Program License Agreement (the "IPLA"), without modification.

The Evaluation License will apply during the term of Licensee's Evaluation.

The IPLA will automatically apply if Licensee elects to retain the Program after the Evaluation (or obtain additional copies of the Program for use after the Evaluation) by entering into a procurement agreement (e.g., the IBM International Passport Advantage or the IBM Passport Advantage Express agreements).

The Evaluation License and the IPLA are not in effect concurrently; neither modifies the other; and each is independent of the other.

The complete text of each of these two license agreements follow.



LICENSE INFORMATION

The Programs listed below are licensed under the following License Information terms and conditions in addition to the Program license terms previously agreed to by Client and IBM. If Client does not have previously agreed to license terms in effect for the Program, the International License Agreement for Evaluation of Programs (Z125-5543-05) applies.

Program Name (Program Number):
IBM Wazi Developer for Red Hat CodeReady Workspaces 1.1 (Evaluation)

The following standard terms apply to Licensee's use of the Program.

Evaluation Period

The evaluation period begins on the date that Licensee agrees to the terms of this Agreement and ends after 90 days.

Prohibited Uses

Licensee may not use or authorize others to use the Program if failure of the Program could lead to death, bodily injury, or property or environmental damage.

Multi-Product Install Image

The Program is provided as part of a multi-product install image. Licensee is authorized to install and use only the Program (and its Bundled or Supporting Programs, if any) for which a valid entitlement is obtained and may not install or use any of the other software included in the image unless Licensee has acquired separate entitlements for that other software.

Supporting Programs

Licensee is authorized to install and use the Supporting Programs identified below only to support Licensee's use of the Principal Program under this Agreement. The phrase "to support Licensee's use" would only include those uses that are necessary or otherwise directly related to a licensed use of the Principal Program or another Supporting Program. The Supporting Programs may not be used for any other purpose. A Supporting Program may be accompanied by license terms, and those terms, if any, apply to Licensee's use of that Supporting Program. In the event of conflict, the terms in this License Information document supersede the Supporting Program's terms. Licensee must obtain sufficient entitlements to the Program, as a whole, to cover Licensee's installation and use of all of the Supporting Programs, unless separate entitlements are provided within this License Information document. For example, if this Program were licensed on a VPC (Virtual Processor Core) basis and Licensee were to install the Principal Program or a Supporting Program on a 10 VPC machine and another Supporting Program on a second 10 VPC machine, Licensee would be required to obtain 20 VPC entitlements to the Program.

Supporting Programs:
Extended z/OS ADCD for Sandbox 1.1
Wazi Developer for Eclipse 1.1
Wazi Developer for Workspaces 1.1
Wazi Developer for VS Code 1.1
Z Distribution for Zowe 1.1

Permitted Components

Licensee is permitted to use only the following components or functions of the identified Bundled or Supporting Program:
Developer for z/OS component (of Developer for z/OS)
Developer for z/OS Host Utilities (of Developer for z/OS)
IBM InfoSphere Optim Data Tools Runtime Client (of OMEGAMON Performance Management Suite for z/OS)
ITCAM for Application Diagnostics (of OMEGAMON Performance Management Suite for z/OS)
ITCAM for Application Diagnostics, Common Services (of OMEGAMON Performance Management Suite for z/OS)
ITCAM for Application Diagnostics, Tivoli Enterprise Monitoring Agent (of OMEGAMON Performance Management Suite for z/OS)
OMEGAMON DE (of OMEGAMON Performance Management Suite for z/OS)
OMEGAMON for IBM Integration Bus Monitoring (of OMEGAMON Performance Management Suite for z/OS)
OMEGAMON for IBM MQ Monitoring (of OMEGAMON Performance Management Suite for z/OS)
OMEGAMON for Networks on z/OS (of OMEGAMON Performance Management Suite for z/OS)
OMEGAMON for Storage on z/OS (of OMEGAMON Performance Management Suite for z/OS)
OMEGAMON for z/OS (of OMEGAMON Performance Management Suite for z/OS)
OMEGAMON Monitoring for JVM (of OMEGAMON Performance Management Suite for z/OS)
OMEGAMON XE for CICS on z/OS (of OMEGAMON Performance Management Suite for z/OS)
OMEGAMON XE for CICS TG on z/OS (of OMEGAMON Performance Management Suite for z/OS)
OMEGAMON XE for DB2 PE BASE (of OMEGAMON Performance Management Suite for z/OS)
OMEGAMON XE for DB2 PE License Key (of OMEGAMON Performance Management Suite for z/OS)
OMEGAMON XE for IMS on z/OS (of OMEGAMON Performance Management Suite for z/OS)
OMEGAMON XE for WebSphere Message Broker Monitoring (of OMEGAMON Performance Management Suite for z/OS)
OMNIMON Base (of OMEGAMON Performance Management Suite for z/OS)
Shared Probes (of OMEGAMON Performance Management Suite for z/OS)
Tivoli Asset Discovery for z/OS (TADz) ID (of OMEGAMON Performance Management Suite for z/OS)
z/OS agent (of Application Discovery for IBM Z)
z/OS DLA (of OMEGAMON Performance Management Suite for z/OS)
z/OS Build agent (of Engineering Workflow Management)
z/OS Build System Toolkit (of Engineering Workflow Management)
z/OS Common components (of Engineering Workflow Management)
z/OS Rational Developer for z/OS subset (of Engineering Workflow Management)

Separately Licensed Code

Each of the components listed in the NON_IBM_LICENSE file is considered "Separately Licensed Code" licensed to Licensee under the terms of the applicable third party license agreement(s) set forth in the NON_IBM_LICENSE file(s) that accompanies the Program, and not this Agreement. Future Program updates or fixes may contain additional Separately Licensed Code. Such additional Separately Licensed Code and related licenses are listed in the applicable NON_IBM_LICENSE file that accompanies the Program update or fix.

Note: Notwithstanding any of the terms in the third party license agreement, the Agreement, or any other agreement Licensee may have with IBM, with respect to the Separately Licensed Code:
(a) IBM provides it to Licensee WITHOUT WARRANTIES OF ANY KIND AND DISCLAIMS ANY AND ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS INCLUDING, BUT NOT LIMITED TO, THE WARRANTY OF TITLE, NON-INFRINGEMENT OR NON-INTERFERENCE, AND THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE;
(b) IBM is not liable for any direct, indirect, incidental, special, exemplary, punitive or consequential damages including, but not limited to, lost data, lost savings, and lost profits.

...(省略)...

=========================================================================
Do you accept the terms in the license agreements? (yes/no):
yes
License accepted. Proceeding with the install...
Now using project "openshift-marketplace" on server "https://c100-e.jp-tok.containers.cloud.ibm.com:30549".
catalogsource.operators.coreos.com/wazi-sandbox-operator-catalog created
[?] CASE launch script completed successfully
OK

正常に完了すると、Waziのカタログ・ソースがOpenShift Clusterにインストールされます。
OpenShift Webコンソールの左のメニューからAdministration - Cluster Settingsを選択し、Global ConfigurationタブからOperatorHubのリンクをクリック
Sourceタブを選択
image.png
wazi-sandbox-operator-catalogというのが追加されています。

また、Operators - OperatorHubを選択し、waziで検索すると「IBM Wazi Developer Sandbox」というOperatorが表示されるようになりました。
image.png

プロジェクト

Openshift Cluster上にWazi Sandboxを配置するためのプロジェクト(namespace)を作成しておきます。
ここでは、wazi-test01 としておきます。
※以降のリソースは基本的に当プロジェクト(Namespace)上に作成する想定です。

[root@Test05 ~/openshift/Wazi]# oc new-project wazi-test01
Now using project "wazi-test01" on server "https://xxx.containers.cloud.ibm.com:xxx".

You can add applications to this project with the 'new-app' command. For example, try:

    oc new-app rails-postgresql-example

to build a new example application in Ruby. Or use kubectl to deploy a simple Kubernetes application:

    kubectl create deployment hello-node --image=k8s.gcr.io/serve_hostname

[root@Test05 ~/openshift/Wazi]# oc get namespaces | grep wazi
wazi-test01                                        Active   74s

Sandbox Operatorのインストール

参考: Installing the Sandbox Operator

OpenShiftクラスターのWebコンソールの左側のメニューからOperators - OperatorHubを選択し、waziでフィルタリングします。
"IBM Wazi Developer Sandbox"をクリックします。
image.png

Installをクリック
image.png

Installをクリック
※以下の例ではデフォルト構成のまま実行しているので、Install Modeのオプションとして"All namepace on the cluster(default)"が選択されています。これはOperatorを特定のNamespaceにインストールするのではなく、全Namespaceに有効にするよう指定するものです。All name spaceを選択すると、後続のService Accountを手動で構成する必要がありましたのでご注意ください。プロジェクト(Namespace)作成後にそのNamespaceを選択してOperatorをインストールするとService Accountの手動設定は不要なのでそちらの方法をおすすめします。
image.png

Operatorがインストールされました。
image.png

Secret

SandboxイメージをPullする際に使用するパスワード用のSecret

参考: How to create an image pull secret

どうやら、SandboxのイメージはIBMのサイトからPullされるようです。この時、Pullしようとしているイメージが許可された製品(購入済みの製品)のものかどうかがチェックされるようです。
IBM Container LibraryのサイトにアクセスしてIBMidでログインすると、そのIDに関連付いた製品のリストが参照できるようです。
image.png
上の例だと"all"になっているので全製品対象になっていると思われますが、通常だとここではログインしたIBMidに紐づいたライセンス購入済の製品がリストされ、その製品のイメージのみPullが許可されることになるものと思われます。

左側のメニューから"ライセンスキーの取得"を選択すると、以下のようにキーの情報が取得できますのでこれをコピーして使用します。
image.png

ガイドに従って、上で取得したキーを指定してSecret "wazi-sandbox-pull-secret"を作成します。(xxx部分がキーを意味しています)

[root@Test05 ~/openshift/Wazi]# oc create secret -n wazi-test01 docker-registry wazi-sandbox-pull-secret --docker-server=cp.icr.io --docker-username=cp --docker-password=xxx --dry-run=client -o yaml | oc apply -f -
secret/wazi-sandbox-pull-secret created

※マニュアル通りのコマンドだと、W0114 12:01:43.291188 10975 helpers.go:553] --dry-run is deprecated and can be replaced with --dry-run=client. という警告が出たので、オプション指定を--dry-run=clientに変更して実行しています。

Sandboxインスタンスで使用するパスワード用のSecret

参考: How to create a Secret for the SFTP server password

コンテナ内で使用される内部パスワード、および、sftpサーバーにアクセスする時に使用するパスワードをSecretとして作成します。
シークレット名は任意ですが、キーはそれぞれzdtAuthPassword、sftpPasswordを指定します。
ここでは以下のように設定します。(xxx, yyyはマスキングした値で、実際の値とは異なります)

シークレット名: wazi-sandbox-pw-secret
キー:zdtAuthPassword / 値:xxx
キー:sftpPassword / 値:yyy

[root@Test05 ~/openshift/Wazi]# oc project
Using project "wazi-test01" on server "https://***.jp-tok.containers.cloud.ibm.com:***".

[root@Test05 ~/openshift/Wazi]# oc create secret generic wazi-sandbox-pw-secret --from-literal=zdtAuthPassword=xxx --from-literal=sftpPassword=yyy
secret/wazi-sandbox-pw-secret created

ConfigMap

参考: How to specify information of the Sandbox License Server and the SFTP server

Sandbox作成に必要な各種情報をConfigMapとして設定しておきます。

まずガラとなるyamlファイルを作成します。

[root@Test05 ~/openshift/Wazi]# oc create configmap wazi-sandbox-config01 --dry-run=client -o yaml > wazi-sandbox-config01.yaml

wazi-sandbox-config01.yamlファイルを以下のように編集します。

wazi-sandbox-config01.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: wazi-sandbox-config01
data:
  licenseServer: "xx.xx.xx.xx"
  sftpHost: "xx.xx.xx.xx"
  sftpPort: "22"
  sftpUser: "ftpuser1"
  sftpPath: "/ftpuser1/adcd/zos24_2020may/volumes"

※"xx.xx.xx.xx"はライセンス・サーバー/イメージ・ストレージ・サーバーのIPアドレスです。ここでは両者は同じサーバー上に構築しているので同じIPアドレスを指定しています。
sftpPathには、sftpサーバー上のADCD DASDイメージ・ファイルが配置されているディレクトリを指定します。このディレクトリ名が違っていると、後続手順のSandboxインスタンス作成時のVolumeコピーの処理でエラーになります。(参考: 試行錯誤ログ - その1)

上の定義を適用してConfgMapを作成します。

[root@Test05 ~/openshift/Wazi]# oc project
Using project "wazi-test01" on server "https://xxx.jp-tok.containers.cloud.ibm.com:xxx".
[root@Test05 ~/openshift/Wazi]# oc apply -f wazi-sandbox-config01.yaml
configmap/wazi-sandbox-config01 created

ネットワーク構成(Service)

参考: Configuring the cluster

The Sandbox Operator creates a Service for each sandbox instance. By default, the Service is of NodePort type, but you can change the type by specifying service information in the Custom Resource file for the sandbox instance.
You can use NodePort without modification if all nodes in the cluster are accessible externally, or if an external proxy was created to proxy traffic into the cluster. Developers need the proxy IP to create a sandbox instance, and connect to the sandbox instance.
...
By default, the Service is of NodePort type, and exposes only encrypted ports. For more information about configuring exposed ports, see Configuration reference.

デフォルトではNodePortタイプのServiceが作成されるようです。また、セキュアポート(SSH, TN3270SecurePort EclipseClientPort, VSCodeClientPort, zOSConnectPort, zOSMFPort)のみServiceとして公開されるようです。
今回Worker Nodeは外部からアクセスできるIPアドレスを持っているので、とりあえずここはデフォルトの構成で作成することとします。

NodePortについてのおさらいはこちら。
参考: コンテナ型仮想化技術 Study08 - Serviceについての整理 - NodePort

永続ストレージ

参考: How to create a PersistentVolumeClaim manually

z/OSのDASDイメージを保持しておくのに永続ストレージが必要になります。ここでは永続ストレージとしてIBM Cloud Block Storageを使用することにします。
参考: クラシック IBM Cloud Block Storage へのデータの保管
これによると、OpenShift CluesterにはデフォルトでBlock Storageを使うためのStorageClassがいくつか用意されているようです。
サイズや速度などの特性でこの辺のストレージ使う場合は有料になるので、まずはお安い構成ということで、ibmc-block-bronzeというStorageClassを使うことにします。

以下のようなPVC定義用のyamlファイルを作成します。

wazi-sandbox-pvc01.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: wazi-sandbox-pvc01
  labels:
    billingType: "hourly"
    region: jp-tok
    zone: tok02
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 300Gi
  storageClassName: ibmc-block-bronze

region, zoneは利用元のOpenShift Clusterの環境に合わせます。サイズはADCDの要件に合わせて300Giを指定します。
※ここでは、製品提供のADCDパッケージを格納するのに必要最低限のサイズとして300Giを指定しています。ユーザーデータのためにDASDイメージファイルを追加する必要がある場合は、その分のサイズを見積もって適宜サイズを増やしてください。

これを、プロジェクト"wazi-test01"に適用してPVCを作成します。

[root@Test05 ~/openshift/Wazi]# oc project
Using project "wazi-test01" on server "https://xxx.jp-tok.containers.cloud.ibm.com:xxx".

[root@Test05 ~/openshift/Wazi]# oc apply -f wazi-sandbox-pvc01.yaml
persistentvolumeclaim/wazi-sandbox-pvc01 created

少し待ってから状況を確認。

[root@Test05 ~/openshift/Wazi]# oc get pvc -o wide
NAME                 STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS        AGE   VOLUMEMODE
wazi-sandbox-pvc01   Bound    pvc-14737ef3-5c7c-4d65-b1ef-288f9936193b   300Gi      RWO            ibmc-block-bronze   90s   Filesystem

[root@Test05 ~/openshift/Wazi]# oc get pv -o wide
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                                             STORAGECLASS     REASON   AGE   VOLUMEMODE
pvc-14737ef3-5c7c-4d65-b1ef-288f9936193b   300Gi      RWO            Delete           Bound    wazi-test01/wazi-sandbox-pvc01                                              44s   Filesystem
pvc-3f9c2a6f-5ad8-4939-b6a7-aed03d7b027b   100Gi      RWX            Delete           Bound    openshift-image-registry/image-registry-storage   ibmc-file-gold            17d   Filesystem

PVC, PVが作成されました。
※この時、CloudDigitalSales@us.ibm.comというアドレスから、以下のSubjectのメールが2通届いていました。
"Your Storage as a Service Order #70634324 was received"
"Your IBM Cloud Order # 70634324 has been approved"

永続ストレージについてのおさらいはこちら。
参考:コンテナ型仮想化技術 Study07 / ストレージ - Dynamic Provisioning

Service Account

※この手順は、Operatorインストール時に、Install Modeに"All namepace on the cluster(default)"を選択した場合に必要な処理です。このオプションを選択してOperatorをインストールすると、必要なService Accountが"openshift-operators"というクラスターが元々提供しているNamespaceに作成されてしまい、その後特定のプロジェクト(Namespace)を作成してそこにSandboxインスタンスを作成しようとするとそのNamespaceにService Accountが無いためにエラーとなります。そのため、手動でService Accountを作成して権限設定しておきます。
Volume Copy用と、Sandboxインスタンスデプロイ用の2つ作成します。(※本来であれば、Sandboxインスタンスのデプロイ時にVolume Copyも行えるのですが、不具合のせいでこの手順を個別に走らせる必要があります。)
特定のNamespaceを指定してOperatorをインストールした場合はいずれも不要です。

Volume Copy用

"wazi-sandbox-volume-copy"というserviceaccountを作成し、privileged権限を設定します。

[root@Test05 ~/openshift/Wazi]# oc create serviceaccount wazi-sandbox-volume-copy
serviceaccount/wazi-sandbox-volume-copy created

[root@Test05 ~/openshift/Wazi]# oc adm policy add-scc-to-user privileged -z wazi-sandbox-volume-copy
clusterrole.rbac.authorization.k8s.io/system:openshift:scc:privileged added: "wazi-sandbox-volume-copy"

Sandboxインスタンスデプロイ用

"wazi-sandbox-operator"というserviceaccountを作成し、privileged権限を設定します。

[root@Test05 ~/openshift/Wazi]# oc create serviceaccount wazi-sandbox-operator
serviceaccount/wazi-sandbox-operator created

[root@Test05 ~/openshift/Wazi]# oc adm policy add-scc-to-user privileged -z wazi-sandbox-operator
clusterrole.rbac.authorization.k8s.io/system:openshift:scc:privileged added: "wazi-sandbox-operator"
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0