...
Example yaml files for a Pod or a StatefulSet (both called "parasoft-dtp.yaml") are shown below. These examples use an NFS volume, but this is not required; use whatever volume type fits your needs.
Required Settings for a Stable Machine ID
Anchor | ||||
---|---|---|---|---|
|
As you modify either of the parasoft-dtp.yaml samples shown below or craft your own yaml, be aware that the following fields need to be consistent across upgrades and redeployments in order to assure a stable machine ID:
...
- env: name: PARASOFT_POD_NAME
- env: name: PARASOFT_POD_NAMESPACE
Example yaml using 'kind: Pod'
Code Block | ||||
---|---|---|---|---|
| ||||
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-server 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-serverport" containerPort: 8080 - name: "dtp-https-serverport" 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: - containerPortname: 8082 "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 --- |
Example yaml using 'kind: StatefulSet'
Code Block | ||||
---|---|---|---|---|
| ||||
apiVersion: apps/v1 kind: ServiceStatefulSet metadata: name: dtp namespace: parasoft-dtp-namespace spec: selector labels: app: DTP spec: portsselector: - name: "http-server"matchLabels: protocolapp: TCPDTP serviceName: dtp-service portreplicas: 80801 template: targetPortmetadata: 8080 - namelabels: "data-collector" protocolapp: TCPDTP portspec: 8082 targetPortvolumes: 8082 - name: "httpsdtp-server"data protocol nfs: TCP portserver: 8443NFS_SERVER_HOST targetPort: 8443 path: /dtp/ # Uncomment section below if using DTP with Extension DesignerpersistentVolumeClaim: # - nameclaimName: "extensiondtp-designer"pvc # Uncomment section below if you are setting up protocol: TCP # port: 8314a custom keystore; you will also need to uncomment out the associated volumeMounts below # - targetPortname: 8314 keystore-cfgmap--volume apiVersion: v1 kind: Service metadata: # name: dtp-external namespace: parasoft-dtp-namespace spec configMap: # type: NodePort selector: appname: DTPkeystore-cfgmap ports: -securityContext: port: 8080 namerunAsNonRoot: HTTP_PORT_NAMEtrue nodePortcontainers: XXXXX - portname: 8082dtp namesecurityContext: DC_PORT_NAME nodePortallowPrivilegeEscalation: XXXXXfalse - port: 8443 capabilities: name: HTTPS_PORT_NAME nodePort: XXXXX # Uncomment section below if using DTP with Extension Designer # drop: ["ALL"] seccompProfile: - port: 8314 # nametype: EXTENSION_DESIGNER_PORT_NAME # RuntimeDefault nodePortimage: XXXXX DTP_DOCKER_IMAGE # SERVICE CONFIG NOTESimagePullPolicy: Always # 'name' can be whatever you wantenv: # 'nodePort' must be between 30000-32768 # 'spec.selector' must match 'metadata.labels' in pod config |
Example yaml using 'kind: StatefulSet'
Code Block | ||||
---|---|---|---|---|
| ||||
apiVersion: apps/v1 kind: StatefulSet metadata: name: dtp namespace: parasoft-dtp-namespace labels: app: DTP spec: selector: matchLabels- name: PARASOFT_POD_NAME #REQUIRED, DO NOT CHANGE valueFrom: fieldRef: app: DTP serviceName: dtp-service replicas: 1 template: metadata: fieldPath: metadata.name labels: - name: PARASOFT_POD_NAMESPACE #REQUIRED, DO app:NOT DTPCHANGE spec: volumesvalueFrom: - name: dtp-data fieldRef: nfs: serverfieldPath: 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-server securityContext: 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. # - allowPrivilegeEscalationname: falseDB_TYPE # capabilitiesvalue: "mysql" # - dropname: ["ALL"] DB_USER # seccompProfile: value: "dtp_user" # - typename: RuntimeDefaultDB_PASSWORD # image: DTP_DOCKER_IMAGE valueFrom: # imagePullPolicy: Always secretKeyRef: # env: - name: PARASOFT_POD_NAME #REQUIRED, DO NOT CHANGE YOUR_DB_USER_PASSWORD_SECRET # valueFrom: key: YOUR_DB_USER_PASSWORD_SECRET_KEY # - name: DB_URL # fieldRef: value: "jdbc:mysql://mysql-container:3306/DTP" # To configure DTP to automatically fieldPath: metadata.name - name: PARASOFT_POD_NAMESPACE #REQUIRED, DO NOT CHANGE valueFrom: fieldRef: 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. # - fieldPathname: metadata.namespaceJDBC_DRIVER_URL # 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: "http-server" containerPort: 8080 - name: "https-server" containerPort: 8443 volumeMounts: - mountPath: "/usr/local/parasoft/data" 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: dtp-dataJAVA_CONFIG_ARGS # 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. #value: "-Dcom.parasoft.sdm.storage.managers.admin.enable.delete.project.data=true" args: ["--run", "dtp"] ports: - name: keystore"dtp-cfgmaphttp-volumeport" # mountPathcontainerPort: "/usr/local/parasoft/dtp/tomcat/conf/.keystore" #8080 - subPathname: keystore #"dtp-https-port" - namecontainerPort: keystore-cfgmap-volume # 8443 volumeMounts: - mountPath: "/usr/local/parasoft/dtp/tomcat/conf/server.xml/parasoft/data" # subPathname: serverdtp-configdata # To prevent liveness probe failures on environments with low or overly taxed RAM/CPU, we recommend increasing the timeout seconds livenessProbe: exec: 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 # command: mountPath: "/usr/local/parasoft/dtp/tomcat/conf/.keystore" # - healthcheck.sh subPath: keystore # - name: keystore-cfgmap-verifyvolume # - dtp mountPath: "/usr/local/parasoft/dtp/tomcat/conf/server.xml" # initialDelaySecondssubPath: 120server-config # To prevent liveness probe failures on periodSeconds: 60 timeoutSeconds: 30environments with low or overly taxed RAM/CPU, we recommend increasing the timeout seconds livenessProbe: failureThreshold: 5 - nameexec: data-collector securityContext: command: allowPrivilegeEscalation: false - healthcheck.sh capabilities: - --verify drop: ["ALL"] - seccompProfile:dtp typeinitialDelaySeconds: RuntimeDefault120 imageperiodSeconds: DTP_DOCKER_IMAGE 60 imagePullPolicytimeoutSeconds: Always30 # To inject JVM arguments into the container, specify the "env" property as in the example below, which injects JAVA_DC_CONFIG_ARGS #failureThreshold: 5 - name: data-collector envsecurityContext: # - nameallowPrivilegeEscalation: JAVA_DC_CONFIG_ARGS #false valuecapabilities: "-Dcom.parasoft.sdm.dc.traffic.max.length=1000000" argsdrop: ["--run", "datacollector", "--no-copy-dataALL"] portsseccompProfile: - containerPort: 8082 type: RuntimeDefault volumeMounts: - mountPath: "/usr/local/parasoft/data"image: DTP_DOCKER_IMAGE nameimagePullPolicy: dtp-dataAlways # To preventinject livenessJVM probearguments failuresinto onthe environmentscontainer, withspecify lowthe or"env" overlyproperty taxed RAM/CPU, we recommend increasing the timeout seconds as in the example below, which injects JAVA_DC_CONFIG_ARGS # livenessProbeenv: # - exec: name: JAVA_DC_CONFIG_ARGS # command:value: "-Dcom.parasoft.sdm.dc.traffic.max.length=1000000" args: ["--run", "datacollector", - healthcheck.sh "--no-copy-data"] ports: - --verify - name: "dc-port" - datacollector containerPort: 8082 initialDelaySecondsvolumeMounts: 120 - periodSecondsmountPath: 60"/usr/local/parasoft/data" timeoutSecondsname: 30dtp-data # To prevent liveness probe failures on environments with low failureThreshold: 5 # Uncomment section below if using DTP with Extension Designer #or overly taxed RAM/CPU, we recommend increasing the timeout seconds - namelivenessProbe: extension-designer # securityContextexec: # allowPrivilegeEscalationcommand: false # - capabilities: #healthcheck.sh - --verify drop: ["ALL"] # - seccompProfile:datacollector # initialDelaySeconds: 120 type: RuntimeDefault # imageperiodSeconds: DTP_DOCKER_IMAGE #60 imagePullPolicytimeoutSeconds: Always30 # To inject JVM arguments into the container, specify the "env" property as in the example below, which injects JAVA_CONFIG_ARGSfailureThreshold: 5 # Uncomment section below if using DTP with Extension Designer # - argsname: ["--run", "dtpservices"]extension-designer # portssecurityContext: # - containerPortallowPrivilegeEscalation: 8314false # volumeMounts capabilities: # - mountPathdrop: "/usr/local/parasoft/data" #["ALL"] # seccompProfile: # nametype: dtp-dataRuntimeDefault # To prevent liveness probe failures on environments with low or overly taxed RAM/CPU, we recommend increasing the timeout seconds # livenessProbe: # exec: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: command:["--run", "dtpservices"] # - healthcheck.shports: # - name: - --verify"dep-port" # containerPort: 8314 - dtpservices # initialDelaySecondsvolumeMounts: 120 # - periodSecondsmountPath: 60"/usr/local/parasoft/data" # timeoutSecondsname: 30dtp-data # To prevent liveness probe failures on environments with low failureThreshold: 5 # Uncomment section below if using Extension Designer with an external MongoDBor overly taxed RAM/CPU, we recommend increasing the timeout seconds # envlivenessProbe: # - name: DEP_USE_REMOTE_DBexec: # valuecommand: "true" # - name: DEP_DB_HOSTNAMEhealthcheck.sh # value: "mongodb-hostname" --verify # Put your mongodb hostname here # - name: DEP_DB_PORTdtpservices # valueinitialDelaySeconds: "27017" 120 # restartPolicy periodSeconds: Always60 # serviceAccountName: parasoft-account automountServiceAccountTokentimeoutSeconds: true30 # imagePullSecrets: - namefailureThreshold: YOUR_SECRET --- apiVersion: v1 kind: Service metadata: name: dtp namespace: parasoft-dtp-namespace spec: selector: 5 # Uncomment section below if using Extension Designer with an external MongoDB # app: DTP portsenv: # - name: "http-server" DEP_USE_REMOTE_DB # protocolvalue: TCP "true" # - portname: 8080 DEP_DB_HOSTNAME # targetPort: 8080 - namevalue: "datamongodb-collector" protocol: TCP hostname" # Put your mongodb hostname here # - portname: 8082 DEP_DB_PORT # targetPort: 8082 - namevalue: "https-server27017" protocolrestartPolicy: TCPAlways portserviceAccountName: 8443parasoft-account automountServiceAccountToken: true targetPort: 8443 # Uncomment section below if using DTP with Extension Designer # - name: "extension-designer" # protocol: TCP # port: 8314 # targetPort: 8314 --- apiVersion: v1 kind: Service metadata: name: dtp-external namespace: parasoft-dtp-namespace spec: type: NodePort selector: app: DTP ports: - port: 8080 name: HTTP_PORT_NAME imagePullSecrets: - name: YOUR_SECRET |
Service Definition
Create the service that can be used to access the DTP server in Kubernetes. The example shown below exposes it using a node port, which provides a stable endpoint for applications to access it.
Code Block | ||||
---|---|---|---|---|
| ||||
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" nodePortprotocol: XXXXXTCP - port: 8082 namenodePort: DC_PORT_NAME30082 - nodePortname: XXXXX "dtp-https-port" - portprotocol: 8443TCP nameport: HTTPS_PORT_NAME8443 nodePort: XXXXX30443 # Uncomment section below if using DTP with Extension Designer Designer # - name: "dep-port" # - portprotocol: 8314TCP # nameport: EXTENSION_DESIGNER_PORT_NAME8314 # nodePort: XXXXX 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 |
...
Code Block | ||
---|---|---|
| ||
kubectl exec <POD_NAME> -c <CONTAINER_NAME> -- printenv | ||
Note |
Accessing DTP, Data Collector, and Extension Designer Externally
To allow external access to DTP, Data Collector, and/or Extension Designer in your cluster, use Ingress, an OpenShift route, or an equivalent resource set up to function as a reverse proxy as described in Reverse Proxy Support. If you are using DTP with Extension Designer, you will need to update the Reverse Proxy settings in Extension Designer to reflect the expected hostname and the exposed ports for accessing DTP and Extension Designer.
Configuring the Database JDBC URL
...
Using a custom truststore in Kubernetes environments is similar to using a custom keystore as described above. Adjust the directions for using a custom keystore as appropriate. Note that the truststore location is /usr/local/parasoft/dtp/jre/lib/security/cacerts
.
Troubleshooting
Accessing Additional Logging
DTP captures debugging logs automatically. You can access them in the tests.log file found in the <DTP_DATA_DIR>/logs/
directory.
machineId is LINUX2-0
This issue can occur when there is an underlying permission issue. To resolve it, try the following options:
...