Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space FUNCTDEV and version SVC2022.2

...

Parasoft SOAtest and Virtualize as well as Data Repositorycan Repository can be deployed to Docker.  Parasoft Parasoft has published official Docker images to Docker Hub for your convenience. Full installation instructions are included in the readme with each image. Follow the links below for the image that best suites suits your needs:

...

Code Block
languageyml
titlesoavirt.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: soavirt
  labels:
    tag: soavirt
spec:
  replicas: 1
  selector:
    matchLabels:
      tag: soavirt
  serviceName: soavirt
  template:
    metadata:
      labels:
        tag: soavirt
    spec:
      volumes:
      - name: soavirt-pv
        persistentVolumeClaim:
          claimName: soavirt-pvc
      - name: soavirt-config
        configMap:
          name: soavirt-config
      containers:
      - name: soavirt
        image: parasoft/soavirt-server
        imagePullPolicy: IfNotPresent
        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: events
          containerPort: 9617
        - name: statistics
          containerPort: 9618
        startupProbe:
          httpGet:
            path: /soavirt/api/v6/status?fields=machineIdopenapi.yaml
            port: 9080
          initialDelaySeconds: 30
          periodSeconds: 30
          timeoutSeconds: 30
          failureThreshold: 3
        livenessProbe:
          httpGet:
            path: /soavirt/api/v6/status?fields=machineIdopenapi.yaml
            port: 9080
          initialDelaySeconds: 30
          periodSeconds: 30
          timeoutSeconds: 30
           readinessProbe env:
        -  httpGet:name: CATALINA_OPTS
            path: /soavirt/api/v6/virtualAssets?fields=idvalue: "-Dparasoft.auto.deploy.new=false
            port: 9080
          initialDelaySeconds: 30
  -Dparasoft.event.monitoring.broker.port=9617
        periodSeconds: 30
          timeoutSeconds: 30
        env:
        - name: CATALINA_OPTS
          value: "-Dparasoft.auto.deploy.new=false
                   -Dparasoft.event.monitoring.broker.port=9617
                   -Dparasoft.server.statistics.broker.port=9618"

Use the yaml file to create the soavirt server:

Code Block
languagetext
kubectl create -f soavirt.yaml

Deploying CTP in Kubernetes

Using the Embedded HyperSQL Database

To deploy CTP in Kubernetes using the embedded HyperSQL database, follow the process outlined below.

Note

Deploying multiple CTP servers in Kubernetes is not supported with this version. Support is limited to a single instance of CTP running in a Kubernetes cluster.

Prerequisites

First, a Persistent Volume and a Persistent Volume claim for exports storage are needed. It should be provisioned with around 10GB of space (this can be increased or decreased according to your needs) and ReadWriteOnce access mode is recommended. This space will be used for the workspace of the CTP server.

-Dparasoft.server.statistics.broker.port=9618"

Use the yaml file to create the soavirt server:

Code Block
languagetext
kubectl create -f soavirt.yaml

Deploying CTP in Kubernetes

To deploy CTP in Kubernetes, follow the process outlined below.

Note

Deploying multiple CTP servers in Kubernetes is not supported with this version. Support is limited to a single instance of CTP running in a Kubernetes cluster.

Prerequisites

First, Persistent Volumes and Persistent Volume claims for database configuration and exports storage are needed. They should be provisioned with around 1GB (for the database configuration) to 10GB (for exports storage) of space (this can be increased or decreased according to your needs) and ReadWriteOnce access mode is recommended. This space will be used for the workspace of the CTP server.

You must have a well-formatted db_config.xml present in the volume you are mounting. See the db_config.xml below for an example of one that is well-formatted. You can copy the example below into the volume you are mounting if you prefer; whatever configuration you need to do will be done within the application itself.

Code Block
languagexml
titledb_config.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <db_config>
        <connection>
            <url>jdbc:mysql://localhost:3306/em?useUnicode=true&characterEncoding=UTF-8&sessionVariables=sql_mode=NO_BACKSLASH_ESCAPES&useSSL=false&allowPublicKeyRetrieval=true</url>
            <username>em</username>
            <password>em</password>
        </connection>
    </db_config>
</configuration>

The default Persistent Volume Claim names are 'ctp-config-storage' and 'ctp-exports-storage' and these names The default Persistent Volume Claim name is 'ctp-exports-storage' and can be customized by updating the yaml definition of the CTP server. The example shown below is a configuration to set up an NFS Persistent Volume Volumes and Persistent Volume ClaimClaims. While the example uses NFS, this is not required; use whatever persistent volume type fits your needs.

...

Code Block
languageyml
titlectp-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
 # ==== Persistent Volume to Mount db_config.xml ====
apiVersion: v1
kind: PersistentVolume
metadata:
  name: ctp-exportsconfig-storage
spec:
  capacity:
    storage: 10Gi1Gi
  volumeMode: Filesystem
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: nfs
  nfs:
    path: <path>
    server: <ip address>
---
# ==== PersistentVolumeClaim for CTP exports folderdb_config.xml ====
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ctp-exportsconfig-pvc
spec:
  accessModes:
  - ReadWriteOnce
  storageClassName: nfs
  resources:
    requests:
      storage: 10Gi

Use the yaml file to create a Persistent Volume and a Persistent Volume claim:

Code Block
languagetext
kubectl create -f ctp-pv.yaml

Second, a Persistent Volume and a Persistent Volume claim for a SQL database are needed. It should be provisioned with around 50GB of space (this can be increased or decreased according to your needs) and ReadWriteOnce access mode is recommended.

The default Persistent Volume claim name is 'ctp-hsqldb-storage' and can be customized by updating the yaml definition of the CTP server. While the example uses NFS, this is not required; use whatever persistent volume type fits your needs.

Warning: For NFS, the exported directory must have the same UID and GID as the Parasoft user that runs the container. For example, execute the command chown 1000:1000 <shared_path>.

Code Block
languageyml
titlectp-hsqldb.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: ctp-hsqldb-storage
spec:
  capacity:
    storage: 50Gi1Gi
  volumeName: "ctp-config-storage"
---
# ==== Persistent Volume for Export Storage ====
apiVersion: v1
kind: PersistentVolume
metadata:
  name: ctp-exports-storage
spec:
  capacity:
    storage: 10Gi
  volumeMode: Filesystem
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: nfs
  nfs:
    path: <path>
    server: <ip address>
---
# ==== PersistentVolumeClaim for CTP exports HyperSQL DBfolder ====
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ctp-hsqldbexports-pvc
spec:
  accessModes:
  - ReadWriteOnce
  storageClassName: nfs
  resources:
    requests:
      storage: 10Gi
  volumeName: 50Gi"ctp-exports-storage"

Use the yaml file to create a Persistent Volume Volumes and a Persistent Volume claimclaims:

Code Block
languagetext
kubectl create -f ctp-hsqldbpv.yaml

CTP Deployment

Once the prerequisites have been met, you can deploy CTP in Kubernetes. If custom Persistent Volume Claim names were used in previous steps, make sure to update the appropriate 'volumeMounts:name' and 'claimName' fields to match the custom name.

The server EULA must be accepted by setting the ACCEPT_EULA value to "true" in the -env specifier. Additionally, to opt-in to sending anonymous usage data to Parasoft to help improve the product, change the USAGE_DATA value to "true" in the -env specifier.

Second, a Persistent Volume and a Persistent Volume claim for the database are needed. It should be provisioned with around 50GB of space (this can be increased or decreased according to your needs) and ReadWriteOnce access mode is recommended.

The default Persistent Volume claim names in the examples below can be customized by updating the yaml definition of the CTP server. While the examples use NFS, this is not required; use whatever persistent volume type fits your needs. Be aware that for the external databases the Persistent Volume and Persistent Volume claim mounts are for the database JDBC adapters, not the databases themselves.

Different yaml examples are included for the embedded HyperSQL database and each of the supported external databases. Use the one that's right for your environment.

Warning: For NFS, the exported directory must have the same UID and GID as the Parasoft user that runs the container. For example, execute the command chown 1000:1000 <shared_path>.

HyperSQL (Embedded)

Code Block
languageyml
titlectp-db.yaml
apiVersion: v1
kind: PersistentVolume
Code Block
languageyml
titlectp-pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: ctp-pod-hsqldb-storage
spec:
  labelscapacity:
    appstorage: ctp
spec:50Gi
  containersvolumeMode: Filesystem
  - nameaccessModes:
 ctp
 - ReadWriteOnce
  imagepersistentVolumeReclaimPolicy: parasoft/ctp:latestRetain
  storageClassName: nfs
  portsnfs:
    - containerPortpath: 8080<path>
    volumeMountsserver:
 <ip   - name: ctp-exports-storage
      mountPath: /usr/local/parasoft/exports
    -address>
---
# PersistentVolumeClaim for CTP HyperSQL DB
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ctp-hsqldb-storage
      mountPath: /usr/local/parasoft/ctp/hsqldb
     env:
    # === USE BELOW TO CONFIGURE ENVIRONMENT VARIABLES ===
    # Configures CTP to connect to license server at the specified base URL
    - name: LICENSE_SERVER_URL 
      value: https://licenseserver:8443
    # Configures CTP to use basic authentication when connecting to license server
    - name: LICENSE_SERVER_AUTH_ENABLED
      value: "false"
    # Configures CTP to connect to license server as the specified user
    # - name: LICENSE_SERVER_USERNAME
    #   value: admin
    # Configures CTP to connect to license server with the specified password
    # - name: LICENSE_SERVER_PASSWORD
    #   value: admin
    # Set to true or false to opt-in or opt-out of sending anonymous usage data to Parasoft
    - name: USAGE_DATA
      value: "false"
    # Accepts the End User License Agreement if set to true
    - name: ACCEPT_EULA
      value: "false"
    # === PROBES ===
    startupProbe:
      httpGet:
        path: /em/resources/favicon.ico
        port: 8080
      initialDelaySeconds: 30
      periodSeconds: 30
      timeoutSeconds: 30
      failureThreshold: 3
    livenessProbe:
      httpGet:
        path: /em/resources/favicon.ico
        port: 8080
      initialDelaySeconds: 30
      periodSeconds: 30
      timeoutSeconds: 30
    readinessProbe:
      httpGet:
        path: /em/healthcheck
        port: 8080
      initialDelaySeconds: 30
      periodSeconds: 30
      timeoutSeconds: 30 
  volumes:
  - name: ctp-exports-storage
    persistentVolumeClaim:
      claimName: ctp-exports-pvc
  - name: ctp-hsqldb-storage
    persistentVolumeClaim:
      claimName: ctp-hsqldb-pvc
---
apiVersion: v1
kind: Service
metadata:
  name: ctp-service
spec:
  selector:
    app: ctp
  type: NodePort
  ports:
  - protocol: TCP
    port: 8080
    targetPort: 8080
    nodePort: 30000

Use the yaml file to create service that can be used to access CTP in Kubernetes:

Code Block
languagetext
kubectl create -f ctp-pod.yaml

Using an External Database

To deploy CTP in Kubernetes using one of the supported external databases, follow the process outlined below.

Note

Deploying multiple CTP servers in Kubernetes is not supported with this version. Support is limited to a single instance of CTP running in a Kubernetes cluster.

Prerequisites

First, Persistent Volumes and Persistent Volume claims for database configuration and exports storage are needed. They should be provisioned with around 1GB (for the database configuration) to 10GB (for exports storage) of space (this can be increased or decreased according to your needs) and ReadWriteOnce access mode is recommended. This space will be used for the workspace of the CTP server.

You must have a well-formatted db_config.xml present in the volume you are mounting. See the db_config.xml below for an example of one that is well-formatted. You can copy the example below into the volume you are mounting if you prefer; whatever configuration you need to do will be done within the application itself.

Code Block
languagexml
titledb_config.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <db_config>
        <connection>
            <url>jdbc:mysql://localhost:3306/em?useUnicode=true&characterEncoding=UTF-8&sessionVariables=sql_mode=NO_BACKSLASH_ESCAPES&useSSL=false&allowPublicKeyRetrieval=true</url>
            <username>em</username>
            <password>em</password>
        </connection>
    </db_config>
</configuration>

The default Persistent Volume Claim names are 'ctp-config-storage' and 'ctp-exports-storage' and these names can be customized by updating the yaml definition of the CTP server. The example shown below is a configuration to set up NFS Persistent Volumes and Persistent Volume Claims. While the example uses NFS, this is not required; use whatever persistent volume type fits your needs.

Warning: For NFS, the exported directory must have the same UID and GID as the Parasoft user that runs the container. For example, execute the command chown 1000:1000 <shared_path>.

Code Block
languageyml
titlectp-pv.yaml
# ==== Persistent Volume to Mount db_config.xml ====
apiVersion: v1
kind: PersistentVolume
metadata:
  name: ctp-config-storage
spec:
  capacity:
    storage: 1Gi
  volumeMode: Filesystem
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: nfs
  nfs:
    path: <path>
    server: <ip address>
---
# ==== PersistentVolumeClaim for db_config.xml ====
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ctp-config-pvc
spec:
  accessModes:
  - ReadWriteOnce
  storageClassName: nfs
  resources:
    requests:
      storage: 1Gi
  volumeName: "ctp-config-storage"
---
# ==== Persistent Volume for Export Storage ====
apiVersion: v1
kind: PersistentVolume
metadata:
  name: ctp-exports-storage
spec:
  capacity:
    storage: 10Gi
  volumeMode: Filesystem
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: nfs
  nfs:
    path: <path>
    server: <ip address>
---
# ==== PersistentVolumeClaim for CTP exports folder ====
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ctp-exports-pvc
spec:
  accessModes:
  - ReadWriteOnce
  storageClassName: nfs
  resources:
    requests:
      storage: 10Gi
  volumeName: "ctp-exports-storage"

Use the yaml file to create Persistent Volumes and a Persistent Volume claims:

Code Block
languagetext
kubectl create -f ctp-pv.yaml

Second, a Persistent Volume and a Persistent Volume claim for the external database are needed. It should be provisioned with around 50GB of space (this can be increased or decreased according to your needs) and ReadWriteOnce access mode is recommended.

The default Persistent Volume claim names in the example below can be customized by updating the yaml definition of the CTP server. Uncomment the sections for database you are using. While the example uses NFS, this is not required; use whatever persistent volume type fits your needs. Be aware that the Persistent Volume and Persistent Volume claim mounts are for the database JDBC adapters, not the databases themselves.

Different yaml examples are included for each of the supported external databases. Use the one that's right for your environment.

...

pvc
spec:
  accessModes:
  - ReadWriteOnce
  storageClassName: nfs
  resources:
    requests:
      storage: 50Gi

MariaDB

Code Block
languageyml
titlectp-db.yaml
# ==== Persistent Volume for MariaDB JDBC Adapter
apiVersion: v1
kind: PersistentVolume
metadata:
  name: ctp-mariadbadapter-storage
spec:
  capacity:
    storage: 1Gi
  volumeMode: Filesystem
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: nfs
  nfs:
    path: <path>
    server: <ip address>
---
# ==== PersistentVolumeClaim for MariaDB JDBC Adapter ====
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ctp-mariadbadapter-pvc
spec:
  accessModes:
  - ReadWriteOnce
  storageClassName: nfs
  resources:
    requests:
      storage: 1Gi
  volumeName: "ctp-mariadbadapter-storage"

...

Code Block
languagetext
kubectl create -f ctp-db.yaml

CTP Deployment

Once the prerequisites have been met, you can deploy CTP in Kubernetes. If custom Persistent Volume Claim names were used in previous steps, make sure to update the appropriate 'volumeMounts:name' and 'claimName' fields to match the custom name. Uncomment the sections for the database you are using.

...