Creating a new Search application service

Learn how to create additional search services to use with the HCL Compass helm chart.

Before you begin

Before you can create a new Search application service, you must first:
  • Untar the HCL Compass solution chart .tgz file.
     $ tar xzvf <hcl-cpmpass-solution-tgz-file>
  • Move the /charts/hcl-compass/ directory.
     $ cd <hcl-cpmpass-solution-tgz-folder>/charts/hcl-compass
     $ ls
     Chart.yaml  licenses  templates  values.yaml

About this task

If you require more than two search services, you must update the HCL Compass helm chart to add the new search application services. In this guide, you will create a new search application service named hcl-compass-search-app3.service and you will add it to the HCL Compass Helm chart.

Procedure

  1. Create the hcl-compass-search-app3.service by creating a file named search-app3-service.yaml in the /hcl-compass/template directory and paste in the following:
    {{- if .Values.service.enabled.search -}}
    {{- if .Values.searchapp3.service -}}
    apiVersion: v1
    kind: Service
    metadata:
      name: {{ include "hcl-compass.fullname" . }}-search-app3
      labels:
        app.kubernetes.io/name: {{ include "hcl-compass.name" . }}-search-app3
        app.kubernetes.io/instance: {{ .Release.Name }}
        app.kubernetes.io/managed-by: {{ .Release.Service }}
    spec:
      type: ClusterIP
      ports:
      - name: search-app3
        port: {{ .Values.searchapp3.port }}
        protocol: TCP
      selector:
        app.kubernetes.io/name: {{ include "hcl-compass.name" . }}-search-app3
        app.kubernetes.io/instance: {{ .Release.Name }}
    {{- end -}}
    {{- end -}}
  2. Create the hcl-compass-search-app3 deployment by creating a file named search-app3-deployment.yaml in the /hcl-compass/template directory and paste in the following:
    {{- if .Values.service.enabled.search -}}
    {{- if .Values.searchapp3.service -}}
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: {{ include "hcl-compass.fullname" . }}-search-app3
      labels:
        {{- include "hcl-compass.labels" . | nindent 4 }}
    spec:
      replicas: {{ .Values.searchapp3.replicaCount }}
      selector:
        matchLabels:
          app.kubernetes.io/name: {{ include "hcl-compass.name" . }}-search-app3
          app.kubernetes.io/instance: {{ .Release.Name }}
      template:
        metadata:
          labels:
            app.kubernetes.io/name: {{ include "hcl-compass.name" . }}-search-app3
            app.kubernetes.io/instance: {{ .Release.Name }}
        spec:
          {{- if .Values.global.hclImagePullSecret }}
          imagePullSecrets:
          - name: {{ .Values.global.hclImagePullSecret }}
          {{- end }}
          volumes:
          {{ if .Values.search.entityFile.enabled }}
            - name: search-conf
              configMap:
                name: "{{ .Values.search.entityFile.configMapName }}"
          {{- end }}
          hostname:  "{{ .Values.searchapp3.hostname }}"
          initContainers:
          {{- if .Values.service.enabled.oracle }}
            - name: init-myoraclservice
              image: busybox:1.28
              env:
              - name: oraclservice
                value: {{ include "hcl-compass.fullname" . }}-oracle
              command: ['sh', '-c', "until nc -vz $(oraclservice) 1521; do echo waiting for $(oraclservice); sleep 2; done"]
          {{- end }}
          containers:
          - name: {{ .Chart.Name }}-search-app3
            image: "{{ .Values.global.hclImageRegistry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
            imagePullPolicy: {{ .Values.image.pullPolicy }}
            ports:
            - name: search-app3
              containerPort: {{ .Values.searchapp3.port }}
              protocol: TCP
            env:
            - name: compass-search-app3
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: HCL_CCM_LICENSE_SERVER_URL
              value: "{{ tpl .Values.hclFlexnetURL . }}"
            - name: HCL_CCM_LICENSE_SERVER_ID
              value: "{{ tpl .Values.hclFlexnetID . }}"
            - name: DB_SERVER_IP
              {{ if .Values.service.enabled.oracle }}
              {{ if contains "hcl-compass" .Release.Name }}
              value: "{{ .Values.searchapp3.db.serverIP }}"
              {{ else }}
              value: "{{ .Release.Name }}-{{ .Values.searchapp3.db.serverIP }}"
              {{ end }}
              {{ else }}
              value: "{{ .Values.searchapp3.db.serverIP }}"
              {{ end }}
            - name: DB_CONNECTION_SET
              valueFrom:
                secretKeyRef:
                  name: {{ include "hcl-compass.fullname" . }}-db-secret
                  key: db-app3-connection-set
          {{ if .Values.searchapp3.properties.update }}
            - name: SEARCH_PROPERTIES_VALUE_SET
              value: "{{ .Values.searchapp3.properties.valueSet }}"
          {{- end }}
          {{ if .Values.searchapp3.importRecords }}
            - name: IMPORT_RECORDS
              value: "TRUE"
          {{- end }}
            - name: SEARCH_ENABLED
              value: "TRUE"
            - name: SEARCH_CONFIG_SET
              valueFrom:
                secretKeyRef:
                  name: {{ include "hcl-compass.fullname" . }}-db-secret
                  key: search-app3-config-set
            - name: SEARCH_PORT
              value: "{{ .Values.searchapp3.port }}"
            volumeMounts:
          {{ if .Values.search.entityFile.enabled }}
              - name: search-conf
                mountPath: /opt/hcl/compass/compass-rest-server-distribution/config/search
          {{- end }}
    
            resources:
              {{- toYaml .Values.resources | nindent 12 }}
          {{- with .Values.nodeSelector }}
          nodeSelector:
            {{- toYaml . | nindent 8 }}
          {{- end }}
          {{- with .Values.affinity }}
          affinity:
            {{- toYaml . | nindent 8 }}
          {{- end }}
          {{- with .Values.tolerations }}
          tolerations:
            {{- toYaml . | nindent 8 }}
          {{- end }}
    {{- end -}}
    {{- end -}}
      ```
  3. Update the search-confimap.yaml file to include the following searchapp3 information:
       data:
        searchHostnames: |-
          ("{{ .Values.searchapp3.hostname }} {{ .Values.searchapp3.port }})
  4. Update the compass-deployment.yaml file by adding the hcl-compass-search-app3 to the initContainers:* key:
            {{- if .Values.searchapp3.service }}
              - name: init-mysearchapp3service
                image: busybox:1.28
                env:
                - name: searchapp3service
                  value: {{ include "hcl-compass.fullname" . }}-search-app3
                command: ['sh', '-c', "until nslookup $(searchapp3service).$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for $(searchapp3service); sleep 2; done"]
            {{- end }}
  5. Update the compass-secrets.yaml file to include the following at the end of the file:
    search-app3-config-set: {{ default "" .Values.searchapp3.configSet | b64enc | quote }}
    db-app3-connection-set: {{ default "" .Values.searchapp3.db.connectionSet | b64enc | quote }}
  6. Update the values.yaml file and paste the following:
    searchapp3:
      service: true
      replicaCount: 1                     # The replicaCount that can be 1 to n
      hostname: search-app3               # Host name of the docker container runs the Search feature
      configSet: (“-username <Username> -password <User password> -dbset <dbset_name> -userdb <User database> -searchPort <Search_port_number>”)
      port: 8985                          # Search port number
      db:                                 # Database connection setting
        connectionSet: ("-v <db_vendor> -d <db_name> -s <db_server> -u <user> -p <password> -dbset <dbset_name>")