4.3. サーバーコンポーネントの設定
4.3.1. シークレットまたは ConfigMap をファイルまたは環境変数としての Red Hat OpenShift Dev Spaces コンテナーへのマウント リンクのコピーリンクがクリップボードにコピーされました!
シークレットは、以下のような機密データを格納する OpenShift オブジェクトです。
- ユーザー名
- パスワード
- 認証トークン
(暗号化された形式)。
ユーザーは、機密データを含む OpenShift シークレットまたは設定を含む ConfigMap を、OpenShift Dev Spaces 管理コンテナーに次のようにマウントできます。
- ファイル
- 環境変数
マウントプロセスでは、標準の OpenShift マウントメカニズムを使用しますが、追加のアノテーションとラベル付けが必要です。
4.3.1.1. シークレットまたは ConfigMap を OpenShift Dev Spaces コンテナーにファイルとしてマウントする リンクのコピーリンクがクリップボードにコピーされました!
前提条件
- Red Hat OpenShift Dev Spaces の実行中のインスタンス
手順
OpenShift Dev Spaces がデプロイされている OpenShift プロジェクトに新しい OpenShift シークレットまたは ConfigMap を作成します。作成される予定のオブジェクトのラベルは、ラベルのセットと一致する必要があります。
-
app.kubernetes.io/part-of: che.eclipse.org -
app.kubernetes.io/component: <DEPLOYMENT_NAME>-<OBJECT_KIND> <DEPLOYMENT_NAME>には、以下のデプロイメントのいずれかを使用します。-
devspaces-dashboard -
devfile-registry -
plugin-registry devspacesand
-
<OBJECT_KIND>は以下のいずれかになります。secretor
-
configmap
-
例4.11 例:
apiVersion: v1
kind: Secret
metadata:
name: custom-settings
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-secret
...
or
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-settings
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-configmap
...
アノテーションの値を設定します。アノテーションは、指定されたオブジェクトがファイルとしてマウントされていることを示す必要があります。
-
che.eclipse.org/mount-as: file- オブジェクトをファイルとしてマウントするように指定します。 -
che.eclipse.org/mount-path: <TARGET_PATH>- 必要なマウントパスを指定します。
-
例4.12 例:
apiVersion: v1
kind: Secret
metadata:
name: custom-data
annotations:
che.eclipse.org/mount-as: file
che.eclipse.org/mount-path: /data
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-secret
...
or
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-data
annotations:
che.eclipse.org/mount-as: file
che.eclipse.org/mount-path: /data
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-configmap
...
OpenShift オブジェクトには複数の項目が含まれる可能性があり、その名前はコンテナーにマウントされる必要なファイル名と一致する必要があります。
例4.13 例:
apiVersion: v1
kind: Secret
metadata:
name: custom-data
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-secret
annotations:
che.eclipse.org/mount-as: file
che.eclipse.org/mount-path: /data
data:
ca.crt: <base64 encoded data content here>
or
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-data
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-configmap
annotations:
che.eclipse.org/mount-as: file
che.eclipse.org/mount-path: /data
data:
ca.crt: <data content here>
これにより、ca.crt という名前のファイルが OpenShift Dev Spaces コンテナーの /data パスにマウントされます。
OpenShift Dev Spaces コンテナーでの変更を表示するには、シークレットまたは ConfigMap オブジェクト全体を再作成します。
4.3.1.2. シークレットまたは ConfigMap を subPath として OpenShift Dev Spaces コンテナーにマウントする リンクのコピーリンクがクリップボードにコピーされました!
前提条件
- Red Hat OpenShift Dev Spaces の実行中のインスタンス
手順
OpenShift Dev Spaces がデプロイされている OpenShift プロジェクトに新しい OpenShift シークレットまたは ConfigMap を作成します。作成される予定のオブジェクトのラベルは、ラベルのセットと一致する必要があります。
-
app.kubernetes.io/part-of: che.eclipse.org -
app.kubernetes.io/component: <DEPLOYMENT_NAME>-<OBJECT_KIND> <DEPLOYMENT_NAME>には、以下のデプロイメントのいずれかを使用します。-
devspaces-dashboard -
devfile-registry -
plugin-registry devspacesand
-
<OBJECT_KIND>は以下のいずれかになります。secretor
-
configmap
-
例4.14 例:
apiVersion: v1
kind: Secret
metadata:
name: custom-settings
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-secret
...
or
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-settings
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-configmap
...
アノテーションの値を設定します。アノテーションは、指定されたオブジェクトが subPath としてマウントされていることを示す必要があります。
-
che.eclipse.org/mount-as: subpath- オブジェクトが subPath としてマウントされていることを示します。 -
che.eclipse.org/mount-path: <TARGET_PATH>- 必要なマウントパスを指定します。
-
例4.15 例:
apiVersion: v1
kind: Secret
metadata:
name: custom-data
annotations:
che.eclipse.org/mount-as: subpath
che.eclipse.org/mount-path: /data
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-secret
...
or
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-data
annotations:
che.eclipse.org/mount-as: subpath
che.eclipse.org/mount-path: /data
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-configmap
...
OpenShift オブジェクトには、コンテナーにマウントされたファイル名と名前が一致する必要がある複数の項目を含めることができます。
例4.16 例:
apiVersion: v1
kind: Secret
metadata:
name: custom-data
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-secret
annotations:
che.eclipse.org/mount-as: subpath
che.eclipse.org/mount-path: /data
data:
ca.crt: <base64 encoded data content here>
or
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-data
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-configmap
annotations:
che.eclipse.org/mount-as: subpath
che.eclipse.org/mount-path: /data
data:
ca.crt: <data content here>
これにより、ca.crt という名前のファイルが OpenShift Dev Spaces コンテナーの /data パスにマウントされます。
OpenShift Dev Spaces コンテナーでの変更を表示するには、シークレットまたは ConfigMap オブジェクト全体を再作成します。
4.3.1.3. シークレットまたは ConfigMap を環境変数として OpenShift Dev Spaces コンテナーにマウントする リンクのコピーリンクがクリップボードにコピーされました!
前提条件
- Red Hat OpenShift Dev Spaces の実行中のインスタンス
手順
OpenShift Dev Spaces がデプロイされている OpenShift プロジェクトに新しい OpenShift シークレットまたは ConfigMap を作成します。作成される予定のオブジェクトのラベルは、ラベルのセットと一致する必要があります。
-
app.kubernetes.io/part-of: che.eclipse.org -
app.kubernetes.io/component: <DEPLOYMENT_NAME>-<OBJECT_KIND> <DEPLOYMENT_NAME>には、以下のデプロイメントのいずれかを使用します。-
devspaces-dashboard -
devfile-registry -
plugin-registry devspacesand
-
<OBJECT_KIND>は以下のいずれかになります。secretor
-
configmap
-
例4.17 例:
apiVersion: v1
kind: Secret
metadata:
name: custom-settings
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-secret
...
or
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-settings
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-configmap
...
アノテーションの値を設定します。アノテーションは、指定されたオブジェクトが環境変数としてマウントされていることを示す必要があります。
-
che.eclipse.org/mount-as: env-: オブジェクトを環境変数としてマウントするように指定します。 -
che.eclipse.org/env-name: <FOO_ENV>- オブジェクトキー値のマウントに必要な環境変数名を指定します。
-
例4.18 例:
apiVersion: v1
kind: Secret
metadata:
name: custom-settings
annotations:
che.eclipse.org/env-name: FOO_ENV
che.eclipse.org/mount-as: env
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-secret
data:
mykey: myvalue
or
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-settings
annotations:
che.eclipse.org/env-name: FOO_ENV
che.eclipse.org/mount-as: env
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-configmap
data:
mykey: myvalue
これにより、2 つの環境変数が
-
FOO_ENV -
myvalue
OpenShift Dev Spaces コンテナーにプロビジョニングされている。
オブジェクトに複数のデータ項目がある場合、環境変数の名前は以下のようにそれぞれのデータキーに指定される必要があります。
例4.19 例:
apiVersion: v1
kind: Secret
metadata:
name: custom-settings
annotations:
che.eclipse.org/mount-as: env
che.eclipse.org/mykey_env-name: FOO_ENV
che.eclipse.org/otherkey_env-name: OTHER_ENV
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-secret
stringData:
mykey: <data_content_here>
otherkey: <data_content_here>
or
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-settings
annotations:
che.eclipse.org/mount-as: env
che.eclipse.org/mykey_env-name: FOO_ENV
che.eclipse.org/otherkey_env-name: OTHER_ENV
labels:
app.kubernetes.io/part-of: che.eclipse.org
app.kubernetes.io/component: devspaces-configmap
data:
mykey: <data content here>
otherkey: <data content here>
これにより、2 つの環境変数が
-
FOO_ENV -
OTHER_ENV
OpenShift Dev Spaces コンテナーにプロビジョニングされている。
OpenShift シークレットのアノテーション名の最大長さは 63 文字です。ここで、9 文字は、/ で終わる接頭辞用に予約されます。これは、オブジェクトに使用できるキーの最大長さの制限として機能します。
OpenShift Dev Spaces コンテナーでの変更を表示するには、シークレットまたは ConfigMap オブジェクト全体を再作成します。
4.3.2. Dev Spaces サーバーの高度な設定オプション リンクのコピーリンクがクリップボードにコピーされました!
以下のセクションでは、OpenShift Dev Spaces サーバーコンポーネントの詳細なデプロイメントおよび設定方法を説明します。
4.3.2.1. OpenShift Dev Spaces サーバーの詳細設定について リンクのコピーリンクがクリップボードにコピーされました!
以下のセクションでは、OpenShift Dev Spaces サーバーコンポーネントの詳細な設定方法を説明します。
詳細設定は以下を実行するために必要です。
-
標準の
CheClusterカスタムリソースフィールドから Operator によって自動的に生成されない環境変数を追加します。 -
標準の
CheClusterカスタムリソースフィールドから Operator によって自動的に生成されるプロパティーを上書きします。
CheCluster Custom Resource server 設定の一部である customCheProperties フィールドには、OpenShift Dev Spaces サーバーコンポーネントに適用する追加の環境変数のマップが含まれます。
例4.20 ワークスペースのデフォルトのメモリー制限の上書き
CheClusterカスタムリソースを設定します。「CLI を使用して CheCluster カスタムリソースの設定」 を参照してください。apiVersion: org.eclipse.che/v2 kind: CheCluster spec: components: cheServer: extraProperties: CHE_LOGS_APPENDERS_IMPL: json
OpenShift Dev Spaces Operator の以前のバージョンには、このロールを果たすために custom という名前の ConfigMap がありました。OpenShift Dev Spaces オペレーターが custom という名前の configMap を見つけると、それに含まれるデータを customCheProperties フィールドに追加し、OpenShift Dev Spaces を再デプロイして、custom configMap を削除します。