Versions Compared

Key

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

...

Warning

Once CTP has been licensed, deleting the namespace will invalidate machine-locked licenses, even if you recreate the same namespace.

A Persistent Volume and Persistent Volume claim for exports storage are needed. They 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 CTP server.

The default Persistent Volume Claim name 'ctp-exports-storage' 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 and Persistent Volume Claim. 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>You must have a well-formatted db_config.xml present in the volume you are mounting. See the ctp-db-config-secret.yaml 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. Note that if the URL JDBC string is for MariaDB, MySQL, Oracle, or PostgreSQL, then your CTP deployment/pod should be configured with the correct JDBC adapter; if the URL JDBC string is for HyperSQL, it should start up regardless of your CTP deployment/pod configuration.

Code Block
languageyml
titlectp-db-config-secretpv.yaml
# ==== Persistent Volume for Export Storage ====
apiVersion: v1
kind: SecretPersistentVolume
metadata:
  name: ctp-dbexports-config-secretstorage
  namespace namespace: parasoft-ctp-namespace
typespec: Opaque
stringData:
  db_config_xml: |capacity:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <db_config>
          <connection>storage: 10Gi
  volumeMode: Filesystem
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: nfs
  nfs:
    path: <path>
    server: <ip_address>
---
# ==== PersistentVolumeClaim for CTP exports  <mode>JDBC_URL</mode>
            <url>jdbc:mysql://mysql-service:3306/em</url>
            <username>em</username>
            <password>Kxj6+gSI/FcC8QJcg6UDyg==</password>folder ====
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ctp-exports-pvc
  namespace: parasoft-ctp-namespace
spec:
  accessModes:
  - ReadWriteOnce
  storageClassName: nfs
  resources:
    requests:
            <type>MySQL</type>storage: 10Gi
  volumeName: "ctp-exports-storage"

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

Code Block
languagetext
kubectl create      </connection>
      </db_config>
    </configuration>

Next, a Persistent Volume and Persistent Volume claim for exports storage are needed. They 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 CTP server.

The default Persistent Volume Claim name 'ctp-exports-storage' 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 and Persistent Volume Claim. 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 for Export Storage ====
apiVersion: v1
kind: PersistentVolume
metadata:
  name: ctp-exports-storage
  namespace: parasoft-ctp-namespace
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
  namespace: parasoft-ctp-namespace
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:

-f ctp-pv.yaml

Next, you need to configure your CTP database. If you do not specify otherwise, CTP will create a default HyperSQL database in the /usr/local/parasoft/ctp/hsqldb directory. Alternatively, use the secret below by modifying the db_config_xml string to configure CTP to connect to a different database. Note that if the URL JDBC string is for MariaDB, MySQL, Oracle, or PostgreSQL, then your CTP deployment/pod should be configured with the correct JDBC adapter; if the URL JDBC string is for HyperSQL, it should start up regardless of your CTP deployment/pod configuration.

Code Block
languageyml
titlectp-db-config-secret.yaml
apiVersion: v1
kind: Secret
metadata:
  name: ctp-db-config-secret
  namespace: parasoft-ctp-namespace
type: Opaque
stringData:
  db_config_xml: |
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <db_config>
          <connection>
            <mode>JDBC_URL</mode>
            <url>jdbc:mysql://mysql-service:3306/em</url>
            <username>em</username>
            <password>Kxj6+gSI/FcC8QJcg6UDyg==</password>
            <type>MySQL</type>
          </connection>
      </db_config>
    </configuration>
Code Block
languagetext
kubectl create -f ctp-pv.yaml

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.

...

Code Block
languageyml
titlectp-pod.yamlctp-pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: ctp-pod
  namespace: parasoft-ctp-namespace
  labels:apiVersion: v1
kind: Pod
metadata:
  name: ctp-pod
  namespace: parasoft-ctp-namespace
  labels:
    app: ctp
spec:
  securityContext:
    runAsNonRoot: true
  serviceAccountName: parasoft-account
  automountServiceAccountToken: true
  containers:
  - name: ctp
    securityContext:
      allowPrivilegeEscalation: false
      capabilitiesapp: ctp
spec:
  securityContext:
      droprunAsNonRoot: ["ALL"]true
  serviceAccountName: parasoft-account
  automountServiceAccountToken: true
  seccompProfilecontainers:
  - name: ctp
    typesecurityContext:
 RuntimeDefault     allowPrivilegeEscalation: false
    image: parasoft/ctp:latest
    ports capabilities:
    - name: http
      containerPortdrop: 8080["ALL"]
     - nameseccompProfile: https
      containerPort: 8443
 type: RuntimeDefault  # Delete database.properties file
 to prevent overwriting of db_config.xml on pod startupimage: parasoft/ctp:latest
    commandports:
 [ "/bin/bash", "-c" ]   - name: http
    args  containerPort: 8080
     -
 name: https
      cd ctp/webapps/em/WEB-INF/classes/META-INF/spring/ &&containerPort: 8443
    #    rmDelete database.properties &&
file to prevent overwriting of db_config.xml on  cd /usr/local/parasoft &&pod startup
    command: [ "/bin/bash",  ./entrypoint.sh"-c" ]
    volumeMountsargs:
     -
 name: ctp-exports-storage
      mountPath:cd /usr/local/parasoft/exports
    # === db_config.xml Secret Volume Mount ===ctp/webapps/em/WEB-INF/classes/META-INF/spring/ &&
      
  rm  - name: "ctp-db-config-secret-volume"
database.properties &&
        mountPath:cd /usr/local/parasoft/ctp/webapps/em/config/db_config.xml &&
      subPath: db_config.xml  ./entrypoint.sh
      readOnly: true volumeMounts:
    # - name: ctp-hsqldbexports-storage
    #   mountPath: /usr/local/parasoft/ctp/hsqldbexports
      # === DB JDBC Adapter db_config.xml Secret Volume Mount ===    
    # - name: "ctp-db-config-jdbcadaptersecret-storagevolume"
    #   mountPath: /usr/local/parasoft/ctp/webapps/em/WEB-INF/lib/mariadb-java-client-3.0.8.jarconfig/db_config.xml
      subPath: db_config.xml
      readOnly: true 
    # -  subPathname: mariadbctp-java-client-3.0.8.jarhsqldb-storage
    #   mountPath: /usr/local/parasoft/ctp/webapps/em/WEB-INF/lib/mysql-connector-java-8.0.30.jarhsqldb
    # === DB JDBC Adapter Volume Mount ===
    # -  subPathname: mysqlctp-connector-java-8.0.30.jarjdbcadapter-storage
    #   mountPath: /usr/local/parasoft/ctp/webapps/em/WEB-INF/lib/ojdbc8.jar<JAR_FILE>
    #   subPath: ojdbc8.jar
    #   mountPath: 
    #   subPath: <JAR_FILE>
    # === OIDC Secret Volume Mount ===
    # - name: ctp-oidc-secret-volume  
    #   mountPath: /usr/local/parasoft/ctp/webapps/em/config/oidc.json
    #   subPath: oidc.json
    #   readOnly: true 
    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"
    - name: CATALINA_OPTS
      value: "-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
    # === 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
  # === db_config.xml Secret Volume ===
  - name: "ctp-db-config-secret-volume"
    secret:
      secretName: "ctp-db-config-secret"
      optional: true
      items:
      - key: db_config_xml
        path: db_config.xml
  # - name: ctp-hsqldb-storage
  #   persistentVolumeClaim:
  #     claimName: ctp-hsqldb-pvc
  # === SQL JDBC Adapter Volume ===
  # - name: ctp-jdbcadapter-storage
  #   persistentVolumeClaim:
  #     claimName: ctp-jdbcadapter-pvc
  # === OIDC Secret Volume ===
  #  - name: ctp-oidc-secret-volume
  #    secret:
  #      secretName: ctp-oidc-secret
  #      optional: true
  #      items:
  #      - key: oidc_json
  #        path: oidc.json

...