Parasoft は、公式の Docker イメージを Docker Hub に公開しています。Extension Designer があるバージョンとないバージョンの 2 種類が利用可能です。以下のリンクから、ニーズに合うバージョンを選択してください。
Docker Hub で Parasoft 公式の Helm チャートが提供されています。完全なインストール手順は readme に含まれています。https://hub.docker.com/r/parasoft/dtp-helm を参照してください。
作業を開始する前に、DTP 用の外部データベースを用意します。新しい空のデータベースを作成することも、既存のデータベースを使用することもできます。いずれの場合も、データベース ユーザーには、データベースへのアクセスに必要な権限が設定されている必要があります。サポートされるデータベースは、MySQL、Oracle、および PostgreSQL です (サポートされるバージョンについては、「要件とサポート」を参照してください)。Docker Hub で入手可能な MySQL、Oracle、PostgreSQL Docker イメージのいずれかを使用できます。
次に、DTP を実行するための名前空間を作成します。例:
kubectl create namespace parasoft-dtp-namespace |
注意: 名前空間名 parasoft-dtp-namespace は、このドキュメント全体のコマンドおよびリソースの例で使用されています。名前空間に別の名前を使用している場合は、parasoft-dtp-namespace をすべて実際の名前空間名に変更してください。
DTP のライセンスが取得されると、たとえ同じ名前空間を再作成した場合でも、名前空間を削除するとマシンロック ライセンスが無効になります。 |
次に、Kubernetes クラスターが必要です。クラスターを起動したら、DTP の Pod と関連リソースが必要とするサービス アカウントと権限を作成します。この目的で使用できる yaml ファイルの例を以下に示します。
# Stable access for clients to license server apiVersion: v1 kind: ServiceAccount metadata: name: parasoft-account namespace: parasoft-dtp-namespace automountServiceAccountToken: true --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: parasoft-read namespace: parasoft-dtp-namespace rules: - apiGroups: - "" resources: - "namespaces" - "pods" verbs: - get --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: parasoft-read-bind namespace: parasoft-dtp-namespace roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: parasoft-read subjects: - kind: ServiceAccount name: parasoft-account namespace: parasoft-dtp-namespace |
DTP 環境を構築する前に、yaml ファイルを使用して、必要とされるサービス アカウントと権限を作成します。
kubectl create -f parasoft-permissions.yaml |
コンソールに以下のような出力が表示されるはずです。
serviceaccount/parasoft-account created role.rbac.authorization.k8s.io/parasoft-read created rolebinding.rbac.authorization.k8s.io/parasoft-read-bind created |
|
DTP を設定するには、以下を定義する yaml ファイルを作成します。
Pod または StatefulSet の yaml ファイルの例 (どちらも parasoft-dtp.yaml) を以下に示します。この例では NFS ボリュームを使用していますが、これは必須ではありません。ニーズに合ったボリュームタイプを使用してください。
下記の dtp-pod.yaml サンプルを変更したり、独自の yaml を作成したりする場合は、安定したマシン ID を確保するために、アップグレードや再デプロイ時に以下のフィールドが一貫している必要があることに注意してください。
さらに、以下の環境変数が必要です。
OIDC の設定でシークレットを使用している場合、下の「OIDC シークレットの使用」セクションも参照してください。 |
apiVersion: v1
kind: Pod
metadata:
name: dtp
namespace: parasoft-dtp-namespace
labels:
app: DTP
spec:
volumes:
- name: dtp-data
nfs:
server: NFS_SERVER_HOST
path: /dtp/
# Uncomment section below if you are setting up a custom keystore; you will also need to uncomment out the associated volumeMounts below
# - name: keystore-cfgmap-volume
# configMap:
# name: keystore-cfgmap
securityContext:
runAsNonRoot: true
containers:
- name: dtp
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
seccompProfile:
type: RuntimeDefault
image: DTP_DOCKER_IMAGE
imagePullPolicy: Always
env:
- name: PARASOFT_POD_NAME #REQUIRED, DO NOT CHANGE
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: PARASOFT_POD_NAMESPACE #REQUIRED, DO NOT CHANGE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
# To configure DTP to connect to your database on startup, please provide your database type, user, user password, and connection URL to the container environment by injecting the values as the DB_TYPE, DB_USER, DB_PASSWORD, and DB_URL environment variables.
# To prevent exposing sensitive data, please create a user password secret to use for the DB_PASSWORD environment variable.
# Note that the database type must be one of the following: mysql | oracle | postgresql
# Note that the environment variable values will override the equivalent persisted values in the PSTRootConfig.xml each time the container or pod is restarted.
# The following are example settings for a MySQL container called "mysql-container", a database called "DTP", a user called "dtp_user", and a user password secret.
# - name: DB_TYPE
# value: "mysql"
# - name: DB_USER
# value: "dtp_user"
# - name: DB_PASSWORD
# valueFrom:
# secretKeyRef:
# name: YOUR_DB_USER_PASSWORD_SECRET
# key: YOUR_DB_USER_PASSWORD_SECRET_KEY
# - name: DB_URL
# value: "jdbc:mysql://mysql-container:3306/DTP"
# To configure DTP to automatically download the driver for your database on startup, please provide the JDBC driver URL to the container environment by injecting the value as the JDBC_DRIVER_URL environment variable.
# The following is an example URL to download the JDBC driver for MySQL 8.0.30.
# - name: JDBC_DRIVER_URL
# value: "https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.30/mysql-connector-java-8.0.30.jar"
# Another option is to download the JDBC driver manually one time.
# See section titled Database and JDBC Client Jar on https://hub.docker.com/r/parasoft/dtp or https://hub.docker.com/r/parasoft/dtp-extension-designer.
# To configure DTP to use JVM arguments, please provide the arguments to the container environment by injecting the value as the JAVA_CONFIG_ARGS environment variable.
# The following is an example JVM argument "com.parasoft.sdm.storage.managers.admin.enable.delete.project.data=true"
# - name: JAVA_CONFIG_ARGS
# value: "-Dcom.parasoft.sdm.storage.managers.admin.enable.delete.project.data=true"
args: ["--run", "dtp"]
ports:
- name: "dtp-http-port"
containerPort: 8080
- name: "dtp-https-port"
containerPort: 8443
volumeMounts:
- mountPath: "/usr/local/parasoft/data"
name: dtp-data
# Uncomment section below if you are setting up a custom keystore. Note that updates made to these files will not be reflected inside the container once it's been deployed; you will need to restart the container for it to contain any updates.
# - name: keystore-cfgmap-volume
# mountPath: "/usr/local/parasoft/dtp/tomcat/conf/.keystore"
# subPath: keystore
# - name: keystore-cfgmap-volume
# mountPath: "/usr/local/parasoft/dtp/tomcat/conf/server.xml"
# subPath: server-config
# To prevent liveness probe failures on environments with low or overly taxed RAM/CPU, we recommend increasing the timeout seconds
livenessProbe:
exec:
command:
- healthcheck.sh
- --verify
- dtp
initialDelaySeconds: 120
periodSeconds: 60
timeoutSeconds: 30
failureThreshold: 5
- name: data-collector
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
seccompProfile:
type: RuntimeDefault
image: DTP_DOCKER_IMAGE
imagePullPolicy: Always
# To inject JVM arguments into the container, specify the "env" property as in the example below, which injects JAVA_DC_CONFIG_ARGS
# env:
# - name: JAVA_DC_CONFIG_ARGS
# value: "-Dcom.parasoft.sdm.dc.traffic.max.length=1000000"
args: ["--run", "datacollector", "--no-copy-data"]
ports:
- name: "dc-port"
containerPort: 8082
volumeMounts:
- mountPath: "/usr/local/parasoft/data"
name: dtp-data
# To prevent liveness probe failures on environments with low or overly taxed RAM/CPU, we recommend increasing the timeout seconds
livenessProbe:
exec:
command:
- healthcheck.sh
- --verify
- datacollector
initialDelaySeconds: 120
periodSeconds: 60
timeoutSeconds: 30
failureThreshold: 5
# Uncomment section below if using DTP with Extension Designer
# - name: extension-designer
# securityContext:
# allowPrivilegeEscalation: false
# capabilities:
# drop: ["ALL"]
# seccompProfile:
# type: RuntimeDefault
# image: DTP_DOCKER_IMAGE
# imagePullPolicy: Always
# To inject JVM arguments into the container, specify the "env" property as in the example below, which injects JAVA_CONFIG_ARGS
# args: ["--run", "dtpservices"]
# ports:
# - name: "dep-port"
# containerPort: 8314
# volumeMounts:
# - mountPath: "/usr/local/parasoft/data"
# name: dtp-data
# To prevent liveness probe failures on environments with low or overly taxed RAM/CPU, we recommend increasing the timeout seconds
# livenessProbe:
# exec:
# command:
# - healthcheck.sh
# - --verify
# - dtpservices
# initialDelaySeconds: 120
# periodSeconds: 60
# timeoutSeconds: 30
# failureThreshold: 5
# Uncomment section below if using Extension Designer with an external MongoDB
# env:
# - name: DEP_USE_REMOTE_DB
# value: "true"
# - name: DEP_DB_HOSTNAME
# value: "mongodb-hostname" # Put your mongodb hostname here
# - name: DEP_DB_PORT
# value: "27017"
restartPolicy: Always
serviceAccountName: parasoft-account
automountServiceAccountToken: true
imagePullSecrets:
- name: YOUR_SECRET |
OIDC の設定でシークレットを使用している場合、下の「OIDC シークレットの使用」セクションも参照してください。 |
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: dtp
namespace: parasoft-dtp-namespace
labels:
app: DTP
spec:
selector:
matchLabels:
app: DTP
serviceName: dtp-service
replicas: 1 #Only 1 is supported
template:
metadata:
labels:
app: DTP
spec:
volumes:
- name: dtp-data
nfs:
server: NFS_SERVER_HOST
path: /dtp/
# persistentVolumeClaim:
# claimName: dtp-pvc
# Uncomment section below if you are setting up a custom keystore; you will also need to uncomment out the associated volumeMounts below
# - name: keystore-cfgmap-volume
# configMap:
# name: keystore-cfgmap
securityContext:
runAsNonRoot: true
containers:
- name: dtp
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
seccompProfile:
type: RuntimeDefault
image: DTP_DOCKER_IMAGE
imagePullPolicy: Always
env:
- name: PARASOFT_POD_NAME #REQUIRED, DO NOT CHANGE
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: PARASOFT_POD_NAMESPACE #REQUIRED, DO NOT CHANGE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
# To configure DTP to connect to your database on startup, please provide your database type, user, user password, and connection URL to the container environment by injecting the values as the DB_TYPE, DB_USER, DB_PASSWORD, and DB_URL environment variables.
# To prevent exposing sensitive data, please create a user password secret to use for the DB_PASSWORD environment variable.
# Note that the database type must be one of the following: mysql | oracle | postgresql
# Note that the environment variable values will override the equivalent persisted values in the PSTRootConfig.xml each time the container or pod is restarted.
# The following are example settings for a MySQL container called "mysql-container", a database called "DTP", a user called "dtp_user", and a user password secret.
# - name: DB_TYPE
# value: "mysql"
# - name: DB_USER
# value: "dtp_user"
# - name: DB_PASSWORD
# valueFrom:
# secretKeyRef:
# name: YOUR_DB_USER_PASSWORD_SECRET
# key: YOUR_DB_USER_PASSWORD_SECRET_KEY
# - name: DB_URL
# value: "jdbc:mysql://mysql-container:3306/DTP"
# To configure DTP to automatically download the driver for your database on startup, please provide the JDBC driver URL to the container environment by injecting the value as the JDBC_DRIVER_URL environment variable.
# The following is an example URL to download the JDBC driver for MySQL 8.0.30.
# - name: JDBC_DRIVER_URL
# value: "https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.30/mysql-connector-java-8.0.30.jar"
# Another option is to download the JDBC driver manually one time.
# See section titled Database and JDBC Client Jar on https://hub.docker.com/r/parasoft/dtp or https://hub.docker.com/r/parasoft/dtp-extension-designer.
# To configure DTP to use JVM arguments, please provide the arguments to the container environment by injecting the value as the JAVA_CONFIG_ARGS environment variable.
# The following is an example JVM argument "com.parasoft.sdm.storage.managers.admin.enable.delete.project.data=true"
# - name: JAVA_CONFIG_ARGS
# value: "-Dcom.parasoft.sdm.storage.managers.admin.enable.delete.project.data=true"
args: ["--run", "dtp"]
ports:
- name: "dtp-http-port"
containerPort: 8080
- name: "dtp-https-port"
containerPort: 8443
volumeMounts:
- mountPath: "/usr/local/parasoft/data"
name: dtp-data
# Uncomment section below if you are setting up a custom keystore. Note that updates made to these files will not be reflected inside the container once it's been deployed; you will need to restart the container for it to contain any updates.
# - name: keystore-cfgmap-volume
# mountPath: "/usr/local/parasoft/dtp/tomcat/conf/.keystore"
# subPath: keystore
# - name: keystore-cfgmap-volume
# mountPath: "/usr/local/parasoft/dtp/tomcat/conf/server.xml"
# subPath: server-config
# To prevent liveness probe failures on environments with low or overly taxed RAM/CPU, we recommend increasing the timeout seconds
livenessProbe:
exec:
command:
- healthcheck.sh
- --verify
- dtp
initialDelaySeconds: 120
periodSeconds: 60
timeoutSeconds: 30
failureThreshold: 5
- name: data-collector
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
seccompProfile:
type: RuntimeDefault
image: DTP_DOCKER_IMAGE
imagePullPolicy: Always
# To inject JVM arguments into the container, specify the "env" property as in the example below, which injects JAVA_DC_CONFIG_ARGS
# env:
# - name: JAVA_DC_CONFIG_ARGS
# value: "-Dcom.parasoft.sdm.dc.traffic.max.length=1000000"
args: ["--run", "datacollector", "--no-copy-data"]
ports:
- name: "dc-port"
containerPort: 8082
volumeMounts:
- mountPath: "/usr/local/parasoft/data"
name: dtp-data
# To prevent liveness probe failures on environments with low or overly taxed RAM/CPU, we recommend increasing the timeout seconds
livenessProbe:
exec:
command:
- healthcheck.sh
- --verify
- datacollector
initialDelaySeconds: 120
periodSeconds: 60
timeoutSeconds: 30
failureThreshold: 5
# Uncomment section below if using DTP with Extension Designer
# - name: extension-designer
# securityContext:
# allowPrivilegeEscalation: false
# capabilities:
# drop: ["ALL"]
# seccompProfile:
# type: RuntimeDefault
# image: DTP_DOCKER_IMAGE
# imagePullPolicy: Always
# To inject JVM arguments into the container, specify the "env" property as in the example below, which injects JAVA_CONFIG_ARGS
# args: ["--run", "dtpservices"]
# ports:
# - name: "dep-port"
# containerPort: 8314
# volumeMounts:
# - mountPath: "/usr/local/parasoft/data"
# name: dtp-data
# To prevent liveness probe failures on environments with low or overly taxed RAM/CPU, we recommend increasing the timeout seconds
# livenessProbe:
# exec:
# command:
# - healthcheck.sh
# - --verify
# - dtpservices
# initialDelaySeconds: 120
# periodSeconds: 60
# timeoutSeconds: 30
# failureThreshold: 5
# Uncomment section below if using Extension Designer with an external MongoDB
# env:
# - name: DEP_USE_REMOTE_DB
# value: "true"
# - name: DEP_DB_HOSTNAME
# value: "mongodb-hostname" # Put your mongodb hostname here
# - name: DEP_DB_PORT
# value: "27017"
restartPolicy: Always
serviceAccountName: parasoft-account
automountServiceAccountToken: true
imagePullSecrets:
- name: YOUR_SECRET |
Kubernetes の DTP サーバーへのアクセスに使用できるサービスを作成します。次のサンプルは、ノード ポートを使用してサービスを公開しています。ノード ポートはアプリケーションがアクセスするための安定的なエンドポイントを提供します。
apiVersion: v1
kind: Service
metadata:
name: dtp-svc
namespace: parasoft-dtp-namespace
spec:
type: NodePort
selector:
app: DTP
ports:
- name: "dtp-http-port"
protocol: TCP
port: 8080
nodePort: 30080
- name: "dc-port"
protocol: TCP
port: 8082
nodePort: 30082
- name: "dtp-https-port"
protocol: TCP
port: 8443
nodePort: 30443
# Uncomment section below if using DTP with Extension Designer
# - name: "dep-port"
# protocol: TCP
# port: 8314
# nodePort: 30314
# SERVICE CONFIG NOTES:
# 'name' can be whatever you want, but must follow the DNS label naming conventions
# 'nodePort' must be between 30000-32768
# 'spec.selector' must match 'metadata.labels' in pod config |
ハードウェアの最小要件が満たされている場合、DTP の起動には最大 2 分かかります。起動中は、ブラウザーから DTP にアクセスできません。 |
クラスター上のボリューム マウントの場所を準備します。デフォルトでは、イメージは UID 1000 および GID 1000 を持つ parasoft ユーザーとして実行されます。このユーザーが読み取り/書き込みできるようにボリュームを準備します。
次に、前に作成した DTP セットアップ yaml ファイルで定義された DTP 環境を作成します。
kubectl create -f parasoft-dtp.yaml |
これで永続ボリュームの内容が初期化されます。
JVM 引数やデータベース構成設定などの環境変数を挿入した場合は、次のコマンドを使用してそのステータスを確認できます。
kubectl exec <POD_NAME> -c <CONTAINER_NAME> -- printenv |
クラスター内で DTP、Data Collector、Extension Designer への外部アクセスを許可するには、Ingress、OpenShift、またはこれらに相当するリソースを使用して、「リバース プロキシのサポート」で説明されているとおり、リバース プロキシとして動作するよう設定してください。Extension Designer で DTP を使用している場合は、期待されるホスト名と、DTP および Extension Designer にアクセスするための公開ポートを反映するために、Extension Designer のリバース プロキシ設定を更新する必要があります。
データベース URL の構造は、外部データベースへのアクセス方法によって異なります。例:
jdbc:mysql://<DB_HOST>:3306/DTPjdbc:mysql://<CONFIGURED-SERVICE-NAME>.<NAMESPACE>:3306/DTPカスタム キーストアをセットアップするには、.keystore および server.xml ファイルのコンフィギュレーション マップを作成する必要があります。以下のコマンドは、カスタムの .keystore および server.xml ファイルのファイル マッピングを含む keystore-cfgmap という構成マップを作成します。この例では、各ファイル マッピングにキーが与えられています。.keystore ファイルに keystore、server.xml ファイルに server-config です。各ファイル マッピングにキーを指定する必要はありませんが、キーをファイル名にしたくない場合に便利です。
~$ kubectl create configmap keystore-cfgmap --from-file=keystore=/path/to/.keystore --from-file=server-config=/path/to/server.xml configmap/keystore-cfgmap created |
注意: コンフィギュレーション マップで使用されているカスタム server.xml は、新しい DTP Docker イメージにアップグレードする際には手動でアップデートする必要がある場合があります。特定のバージョンで必要な変更は、「リリース ノート」に記載されます。必ず現在のバージョンとアップグレードするバージョンの両方のリリース ノートを確認してください。
Kubernetes 環境でのカスタム トラストストアの使用は、上記のカスタム キーストアの使用と同様です。カスタム キーストアの使用手順を適宜読み換えてください。トラストストアの場所は /usr/local/parasoft/dtp/jre/lib/security/cacerts です。
セキュリティ ポリシーによって、アプリケーションがマウントされたボリュームにだけ書き込みを許可される場合、サンプル ポッドですでに設定されている dtp-data ディレクトリに加えて、指定されたコンテナーの次の場所もマウントする必要があります。
dtp-server:
/usr/local/parasoft/dtp/tomcat/temp /usr/local/parasoft/dtp/tomcat/logs /usr/local/parasoft/dtp/tomcat/work /usr/local/parasoft/dtp/tomcat/conf/PST /usr/local/parasoft/dtp/tomcat/conf/Internal |
extension-designer (有効な場合):
/tmp |
注意:
/usr/local/parasoft/data-tmp をマウントしてはいけません。 Kubernetes ログ内の次のような data-tmp に関連するエラーは無視してかまいません。"rm: cannot remove '/usr/local/parasoft/data-tmp/LicenseServer/conf/licserv.enc': Read-only file system"DTP の OICD を設定できます。それには次の操作を行います。
apiVersion: v1
kind: Secret
metadata:
name: dtp-oidc-secret
namespace: parasoft-dtp-namespace
type: Opaque
stringData:
oidc_json: |
{
"enabled": true,
"issuerUri": "your issuer uri",
"clientId": "your client id",
"clientSecret": "your client secret",
"scopes": ["openid", "profile", "email"],
"claimMappings": {
"username": "preferred_username",
"firstName": "given_name",
"lastName": "family_name",
"email": "email"
},
"adminUsers": ["your admin user"]
} |
spec.volumes の下にOICD シークレット ボリュームを追加します。# Adding the OIDC secret as a volume
- name: dtp-oidc-secret-volume
secret:
secretName: dtp-oidc-secret
optional: true
items:
- key: oidc_json
path: oidc.json |
initContainers セクションを spec の下の containers の前に追加します。DTP イメージおよび DTP データ ディレクトリ /usr/local/parasoft/data を使用する必要があります。# Populating the data directory before main container starts
initContainers:
- name: init-dtp-data
image: DTP_DOCKER_IMAGE
command: ["/bin/sh", "-c"]
args:
- |
set -e
if [ ! -f "$DTP_DATADIR/.dtprc" ]; then
touch "$DTP_DATADIR/.dtprc"
cp --preserve=timestamps -rnT "$TMP_DATADIR" "$DTP_DATADIR"
fi
volumeMounts:
- mountPath: "/usr/local/parasoft/data"
name: dtp-data |
spec.containers.name (=dtp and =data-collector).volumeMounts の下に OIDC シークレット ボリュームを追加します。# Mounting the OIDC secret volume to the container
- name: dtp-oidc-secret-volume
mountPath: "/usr/local/parasoft/data/conf/oidc.json"
subPath: oidc.json
readOnly: true |
DTP はデバッグログを自動的にキャプチャします。<DTP_DATA_DIR>/logs/ ディレクトリにある tests.log ファイルで確認できます。
この問題は、根本的な権限に問題がある場合に発生する場合があります。この問題を解決するには、次のオプションを試してください。
<DTP_DATA_DIR>/logs/ ディレクトリにある tests.log ファイルで、次のエラーを検索します: "Kubernetes API call fails with status=403 error"automountServiceAccountToken が false に設定されていないことを確認してください。