SOAtest および Virtualize サーバー (または SOAVirt サーバー) は、手動で、または Helm チャートを使用してデプロイできます。
Kubernetes への SOAVirt サーバーの手動デプロイ
SOAVirt サーバーを Kubernetes にデプロイするには、以下で説明するプロセスに従ってください。このドキュメントでは、Virtualize サーバー イベントを監視するためにデフォルトの組み込み WebSocket プロバイダーを使用していることを前提としています。従来の ActiveMQ ベースのプロバイダーを使用している場合は、このページの以前のバージョン を参照して、環境に適した情報と手順を確認してください。
前提条件
まず、SOAVirt サーバーを実行するための名前空間を作成します。例:
kubectl create namespace parasoft-sv-namespace
注意: 名前空間名 parasoft-sv-namespace は、このドキュメント全体のコマンドおよびリソースの例で使用されています。名前空間に別の名前を使用している場合は、parasoft-sv-namespace をすべて実際の名前空間名に変更してください。
SOAVirt サーバーのライセンスが取得されると、たとえ同じ名前空間を再作成した場合でも、名前空間を削除するとマシンロック ライセンスが無効になります。
次に、Persistent Volume と Persistent Volume Claim が必要です。複数のノードで共有できる Persistent Volume を作成します。300GB の容量をプロビジョニングし、ReadWriteMany のアクセス モードを設定する必要があります。この領域は SOAVirt サーバーのワークスペースに使用され、構成設定と仮想アセットが格納されます。
デフォルトの Persistent Volume Claim 名は soavirt-pvc であり、SOAVirt サーバーの yaml 定義を更新することでカスタマイズできます。以下に示すサンプルは、NFS Persistent Volume と Persistent Volume Claim を設定する構成です。この例では NFS を使用していますが、これは必須ではありません。ニーズに合った Persistent Volume タイプを使用してください。
警告: ボリュームには、Parasoft ユーザーがボリュームの読み取りと書き込みを行える権限が必要です。たとえば、コマンド chown 1000:0 <shared_path> を実行します。
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs-pv
namespace: parasoft-sv-namespace
spec:
capacity:
storage: 300Gi
volumeMode: Filesystem
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: nfs
mountOptions:
- hard
- nfsvers=4.1
nfs:
path: <path>
server: <ip_address>
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: soavirt-pvc
namespace: parasoft-sv-namespace
spec:
storageClassName: nfs
accessModes:
- ReadWriteMany
resources:
requests:
storage: 300Gi
yaml ファイルを使用して、Persistent Volume と Persistent Volume Claim を作成します。
kubectl create -f soavirt-pv.yaml
SOAVirt のセットアップ
Kubernetes で SOAVirt サーバーにアクセスするために使用できるサービスを作成します。以下に示す例では、ノード ポートを使用してこれを公開し、アプリケーションが仮想アセットにアクセスするための安定したエンドポイントを提供します。
kind: Service
apiVersion: v1
metadata:
name: soavirt-service
namespace: parasoft-sv-namespace
spec:
selector:
app: soavirt
type: NodePort
ports:
- name: http
protocol: TCP
port: 9080
targetPort: 9080
nodePort: 30080
- name: https
protocol: TCP
port: 9443
targetPort: 9443
nodePort: 30083
yaml ファイルを使用して、Kubernetes で SOAVirt サーバーにアクセスするために使用できるサービスを作成します。
kubectl create -f soavirt-service.yaml
Ingress ユーザーのためのオプション: Ingress でサービスを公開するには、Ingress の設定に基づいていくつかの変更を加えて次のルールを使用できます。
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: soavirt-ingress
namespace: parasoft-sv-namespace
spec:
rules:
- host: soavirt.company.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: soavirt-service
port:
number: 9080
yaml ファイルを使用して、Ingress ルールを作成します。
kubectl create -f soavirt-ingress.yaml
サービスが作成されたら、SOAVirt サーバーの設定マップを作成し、ネットワーク ライセンスまたはローカル ライセンスを構成する必要があります。注意: 単一のレプリカセットを使用する場合はローカル ライセンスを使用できますが、複数のレプリカセットを使用する場合は License Server が必要です。ローカル ライセンスの取得と適用の詳細については、「ローカル ライセンスの使用」を参照してください。
ConfigMap で parasoft.eula.accept=true を設定し、サーバー EULA を受け入れる必要があります。
警告: CTP に接続するときは、プロパティ server.hostname にサービスのアドレスを設定する必要があります。
apiVersion: v1
kind: ConfigMap
metadata:
name: soavirt-config
namespace: parasoft-sv-namespace
data:
config.properties: |
# Configuration properties for soavirt server
# === END USER LICENSE AGREEMENT ===
# Set to true to accept the end user license agreement
# Please review the EULA.txt file included in the distribution zip for soavirt.war
parasoft.eula.accepted=false
# === WORKING DIRECTORY ===
# Specifies workspace location
#working.dir=C:/Users/../workspace
# === LOGGING CONFIGURATION ===
# Specifies configuration file for logging
logging.config.file=/WEB-INF/default.logging.xml
# Replace with the following line to enable debug information
#logging.config.file=/WEB-INF/debug.logging.xml
# === CTP SERVER ===
# Specifies CTP server endpoint
#env.manager.server=http\://[CTP Server Host]\:8080
# Specifies the server name that will be displayed in CTP
#env.manager.server.name=[Server Name]
# Specifies username for CTP authentication
#env.manager.username=[CTP Server Username]
# Specifies password for CTP authentication
#env.manager.password=[CTP Server Password]
# Enables notifications to CTP for deployments
#env.manager.notify=true
# === SERVLET CONTAINER ===
# Specifies the hostname to use for remote access to this server
# Useful when a name or address must be strictly used for CTP connectivity
# If empty, the address will be auto-detected
#server.hostname=[Server Hostname]
# Specifies port for http
# Port should match your servlet container
server.port.http=9080
# Specifies port for https
# Port should match your servlet container
server.port.https=9443
# === PRODUCT LICENSING ===
# Enables virtualize functionality
virtualize.license.enabled=true
# Enables soatest functionality
soatest.license.enabled=true
# === NODE-LOCK LICENSE ===
# Specifies password for virtualize local license
#virtualize.license.local.password=[Virtualize License Password]
# Specifies password for soatest local license
#soatest.license.local.password=[Soatest License Password]
# === NETWORK LICENSE ===
# Enables network licensing for virtualize
virtualize.license.use_network=true
# Specifies the type of network license for virtualize ['performance_server_edition', 'runtime_server_edition', 'custom_edition']
virtualize.license.network.edition=custom_edition
# Specifies features for virtualize 'custom_edition' license
virtualize.license.custom_edition_features=Service Enabled, Performance, Extension Pack, Validate, Message Packs, Developer Sandbox 1000 Hits/Day, 10000 Hits/Day, 25000 Hits/Day, 50000 Hits/Day, 100000 Hits/Day, 500000 Hits/Day, 1 Million Hits/Day, Unlimited Hits/Day, 30 HPS, 100 HPS
# Enables network licensing for soatest
soatest.license.use_network=true
# Specifies the type of network license for soatest ['server_edition', 'custom_edition']
soatest.license.network.edition=custom_edition
# Specifies features for soatest 'custom_edition' license
soatest.license.custom_edition_features=RuleWizard, Command Line, SOA, Web, Server API Enabled, Message Packs, Advanced Test Generation Desktop, Advanced Test Generation 5 Users, Advanced Test Generation 25 Users, Advanced Test Generation 100 Users, Requirements Traceability, API Security Testing
# === LICENSE SERVER ===
# Enables using a specific license server
# If true, the license network properties below will be used to retrieve a license
# If false, the DTP server properties will be used to retrieve a license
license.network.use.specified.server=true
# Specifies license server URL, e.g., https://host[:port][/context-path]
license.network.url=https\://[License Server Host]\:8443
# Enables http authentication for the license server
license.network.auth.enabled=false
# Specifies username for license server authentication
#license.network.user=[License Server Username]
# Specifies password for license server authentication
#license.network.password=[License Server Password]
# === DTP SERVER ===
# Specifies DTP server URL, e.g., https://host[:port][/context-path]
#dtp.url=https\://[DTP Server Host]\:8443
# Specifies username for DTP authentication
#dtp.user=[DTP Server Username]
# Specifies password for DTP authentication
#dtp.password=[DTP Server Password]
# Specifies the name of the DTP project that you want to link to
#dtp.project=[DTP Project]
# === MISC ===
# Specifies scripting timeout in minutes
#scripting.timeout.minutes=10
# Enables logging telemetry data
#usage.reporting.enabled=true
# === OIDC ===
# Enables or disables user authentication via OpenID Connect
#oidc.enabled=false
# Specifies the URI of the OpenID Connect server
#oidc.issuer.uri=
# Specifies the ID provided by your OpenID Connect server
#oidc.client.id=
# Specifies the method that will be used to authenticate the user on the OpenID Connect server
#oidc.cli.mode=devicecode
# Specifies the path to the token file containing user authentication information
#oidc.devicecode.token.file=
# === REPORTS ===
# Specifies a tag that represents a unique identifier for each run
# e.g., ${config_name}-${project_module}-${scontrol_branch}-${exec_env}
#session.tag=${config_name}
# Specifies a build identifier used to label results
#build.id=${dtp_project}-yyyy-MM-dd
# Specifies data that should be included in the report
#report.developer_errors=true
#report.developer_reports=true
#report.authors_details=true
#report.testcases_details=false
#report.test_suites_only=true
#report.failed_tests_only=false
#report.output_details=false
#report.env_details=false
#report.organize_security_findings_by=CWE
#report.associations=false
#report.assoc.url.pr=
#report.assoc.url.fr=
#report.assoc.url.task=
#report.assoc.url.req=
#report.assoc.url.test=
# Specifies report format configuration ['html', 'pdf', 'xml', 'custom']
report.format=html
#report.custom.extension=
#report.custom.xsl.file=
# Specifies installation directory for Jtest or dotTEST that generates coverage report
#jtest.install.dir=
#dottest.install.dir=
yaml ファイルを使用して、SOAVirt サーバーの構成マップを作成します。
kubectl create -f soavirt-config.yaml
構成マップを作成した後、サーバーのシークレットを設定することを選択できます。このステップはオプションです。
apiVersion: v1 kind: Secret metadata: name: soavirt-secret namespace: parasoft-sv-namespace type: Opaque # It is recommended to encrypt password values using the -encodepass CLI option or the encodepass.sh script. # After encryption, both username and password values must be base64 encoded. # Example: echo -n "[string]" | base64 # For additional security, see https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/. data: # Specifies username for CTP authentication #env.manager.username: [CTP Server Username] # Specifies password for CTP authentication #env.manager.password: [CTP Server Password] # Specifies username for license server authentication #license.network.user: [License Server Username] # Specifies password for license server authentication #license.network.password: [License Server Password] # Specifies username for DTP authentication #dtp.user: [DTP Server Username] # Specifies password for DTP authentication #dtp.password: [DTP Server Password] # Specifies the client secret that will be used to authenticate the user on the OpenID Connect server #oidc.client.secret: [OIDC client secret] # Specifies the password to the keystore file used for OpenID Connect authentication #oidc.keystore.password: [OIDC keystore password]
yaml ファイルを使用して、SOAVirt サーバーのシークレットを作成します。
kubectl create -f soavirt-secret.yaml
パスワードの暗号化
パスワードを暗号化するには、サーバーを起動せずに、以下のコマンドを実行して parasoft/soavirt-server イメージを含むポッドを作成します。
kubectl run soavirt-encodepass -n parasoft-sv-namespace --image parasoft/soavirt-server --command -- tail -f /dev/null
ポッドを作成したら、以下のコマンドを実行してポッド内で encodepass.sh スクリプトを実行します。パスワードは適切なものに置き換えてください。
kubectl exec -n parasoft-sv-namespace --stdin --tty soavirt-encodepass -- /usr/local/parasoft/soavirt/webapps/ROOT/scripts/encodepass.sh <YOUR_PASSWORD>
パスワードが暗号化されたら、ポッドを削除します。
kubectl delete pod soavirt-encodepass -n parasoft-sv-namespace
サーバーの構成マップとシークレットを設定したら、サービス アカウントと必要な権限を作成する必要があります。
apiVersion: v1 kind: ServiceAccount metadata: name: parasoft-account namespace: parasoft-sv-namespace automountServiceAccountToken: true --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: parasoft-read namespace: parasoft-sv-namespace rules: - apiGroups: - "" resources: - "namespaces" - "pods" verbs: - get --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: parasoft-read-bind namespace: parasoft-sv-namespace roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: parasoft-read subjects: - kind: ServiceAccount name: parasoft-account namespace: parasoft-sv-namespace
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
以下の yaml は SOAVirt サーバーを作成します。前の手順でカスタムの Persistent Volume Claim 名を使用した場合は、カスタム名と一致するように claimName フィールドを更新してください。
安定したマシン ID のために必要な設定
以下に示す soavirt-pod.yaml サンプルを変更する場合、または独自の yaml を作成する場合は、安定したマシン ID を確保するために、アップグレードおよび再デプロイ全体で次のフィールドが一貫している必要があることに注意してください。
- metadata: name
- metadata: namespace
- containers: name
さらに、以下の環境変数が必要です。
- env: name: PARASOFT_POD_NAME
- env: name: PARASOFT_POD_NAMESPACE
注意: kind: Deployment はサポートされません。kind: Pod または kind: StatefulSet のいずれかを使用してください。
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: soavirt
namespace: parasoft-sv-namespace
labels:
app: soavirt
spec:
replicas: 1
selector:
matchLabels:
app: soavirt
serviceName: soavirt
template:
metadata:
labels:
app: soavirt
spec:
securityContext:
runAsNonRoot: true
serviceAccountName: parasoft-account
automountServiceAccountToken: true
volumes:
- name: soavirt-pv
persistentVolumeClaim:
claimName: soavirt-pvc
- name: soavirt-config
configMap:
name: soavirt-config
containers:
- name: soavirt
image: parasoft/soavirt-server
imagePullPolicy: IfNotPresent
# When running on Kubernetes nodes with more than 32 CPU cores the product will print the following in the logs: This machine exceeds the licensed number of CPU cores
# To reduce the number of cores available, uncomment the following resource specification (if you are using OpenShift, see the note below) or contact Parasoft to enable running on higher core counts.
# resources:
# limits:
# cpu: "4"
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
seccompProfile:
type: RuntimeDefault
volumeMounts:
- name: soavirt-pv
mountPath: /usr/local/parasoft/soavirt/webapps/ROOT/workspace
- name: soavirt-config
mountPath: /usr/local/parasoft/soavirt/webapps/config.properties
subPath: config.properties
ports:
- name: http
containerPort: 9080
- name: https
containerPort: 9443
startupProbe:
httpGet:
path: /soavirt/api/v6/healthcheck
port: 9080
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 30
failureThreshold: 3
livenessProbe:
httpGet:
path: /soavirt/api/v6/healthcheck
port: 9080
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 30
envFrom:
- secretRef:
name: soavirt-secret
optional: true
env:
- name: CATALINA_OPTS
value: "-Dparasoft.auto.deploy.new=false
-Dparasoft.cloudvm=true
-Dparasoft.cloudvm.config=Kubernetes"
- name: PARASOFT_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: PARASOFT_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
OpenShift ユーザー
OpenShift を使用しており、ホストが 32 コア以上を使用している場合は、バージョン間で大きな違いがあるため、CPU のクォータと制限範囲に関する OpenShift バージョンのドキュメントを確認する必要があります。このリンクはバージョン 4.16 のドキュメントですが、正確なバージョンのドキュメントを参照してください: https://docs.openshift.com/container-platform/4.16/nodes/clusters/nodes-cluster-limit-ranges.html
yaml ファイルを使用して、SOAVirt サーバーを作成します。
kubectl create -f soavirt-pod.yaml
ローカル ライセンスの使用ノードロック ライセンスを使用するには、デプロイされたサーバーからマシン ID を取得し、Parasoft からライセンスを取得する必要があります。
実行中のコンテナへのシェルを開きます。
kubectl exec --stdin --tty soavirt-0 -n parasoft-sv-namespace -- /bin/bash
SOAVirt REST API に対して curl 呼び出しを実行し、マシン ID を取得します。
curl http://localhost:9080/soavirt/api/v6/status?fields=machineId
- レスポンスに含まれるマシン ID を Parasoft の担当者に提供すると、ライセンス パスワードが送信されます。
- ライセンス パスワードを受け取ったら、それを soavirt-config.yaml に適用します。
更新した soavirt-config.yaml を実行中のコンテナに適用します。
kubectl apply -f soavirt-config.yaml
ライセンスは、ポッドが自動的に再起動されるときに適用されます。あるいは、ポッドを削除して再作成し、変更を有効にすることもできます。
kubectl delete -f soavirt-pod.yaml kubectl create -f soavirt-pod.yaml
ボリューム マウントのセキュリティ ポリシー (オプション)
セキュリティ ポリシーで、アプリケーションがマウントされたボリュームにのみ書き込むように要求されている場合は、ワークスペース (サンプル ポッドで設定済み) に加えて、次の場所をマウントする必要があります。
/usr/local/parasoft/soavirt/logs /usr/local/parasoft/soavirt/temp /usr/local/parasoft/soavirt/webapps/ROOT/WEB-INF/configs/builtin /usr/local/parasoft/soavirt/webapps/ROOT/felix-cache /usr/local/parasoft/soavirt/webapps/ROOT/apifiles /usr/local/parasoft/soavirt/work/Catalina/localhost/ROOT /usr/local/tomcat/logs/
java.security ファイルの変更 (オプション)
たとえば、特定の SSL 暗号スイートを有効化または無効化したり、その他の関連するセキュリティ設定を行ったりする場合、変更済みの java.security ファイルを使用することを推奨します。これを行うには、java.security ファイルの変更済みのコピーを作成し、ConfigMap に保存して、/usr/local/parasoft/java.security のポッドにマウントします。
変更を適用する際には、いくつかの点に留意する必要があります。
- 変更した java.security 設定を使用する場合は、グローバルプロパティを無効にすることが重要です。無効にしないと、変更内容が上書きされます:
-Djava.security.disableSystemPropertiesFile=true - デフォルトのセキュリティ ファイルをオーバーライドするには、JVM がカスタム セキュリティ プロパティ ファイルを使用するように明示的に指定します。
-Djava.security.properties==/usr/local/parasoft/java.security二重の等号 (==) は、通常は JVM からロードされる java.security 設定を Java に完全に置き換えるよう指示します。 - どの java.security プロパティがロードされたかをデバッグするには、
java.security.debugプロパティを追加します。-Djava.security.debug=properties
これらをすべてまとめると、soavirt コンテナの env: セクションに次のコードを追加します。
- name: JAVA_OPTS
value: "-Djava.security.disableSystemPropertiesFile=true
-Djava.security.properties==/usr/local/parasoft/java.security
-Djava.security.debug=properties"
Helm チャートを使用した Kubernetes での SOAVirt サーバーのデプロイ
Docker Hub で Parasoft 公式の Helm チャートが提供されています。完全なインストール手順は概要に含まれています。https://hub.docker.com/r/parasoft/soavirt-server-helm を参照してください。