IBM Sterling: Configurando o Container Toolkit no OpenShift

From Wiki

O Toolkit é um projeto "temporário" para colocar alguns arquivos necessários para o Sterling B2Bi.

Os arquivos são:

  • JDBC drivers
  • Local Policy
Nesta versão vou utilizar alocada do openshift-image-registry

Procedimento

Criando o Projeto

1) Crie um novo projeto no OpenShift para o Toolkit e defina contas de serviço e permissões.

oc new-project sterling-b2bi-toolkit

2) Defina as permissão.

oc adm policy add-scc-to-user anyuid -z default -n sterling-b2bi-toolkit

Configurando o Armazenamento

1) Localize as informações necessárias no default storage volume (volume de armazenamento padrão)

oc get pv -n openshift-image-registry

NAME       CAPACITY ACCESS MOD  RECLAIM POLICY  STATUS  CLAIM                                              STORAGECLASS    
pvc-42...  20Gi     RWO           Delete          Bound   sterling-b2bi-mq/data-mqsterling-ibm-mq-0                                 
pvc-99...  100Gi    RWX           Delete          Bound   openshift-image-registry/image-registry-storage  ibmc-file-gold      
pvc-ac3... 20Gi     RWO           Delete          Bound   sterling-b2bi-db2/db2vol-db2-0                                          

2) Pegue os detalhes do pv

oc describe pv pvc-99...

:Ref 5
...
failure-domain.beta.kubernetes.io/region=us-south
failure-domain.beta.kubernetes.io/zone=dal10
...
Type:   NFS (an NFS mount that lasts the lifetime of a pod)
Server: fsf-xxxxxxx-xx.adn.networklayer.com
Path:   /IBMxxSEVxxxxxxx_xx/data01
...

3) Crie o arquivo my-toolkit-pv-pvc.yaml e faça os ajustes

apiVersion: v1
kind: PersistentVolume
metadata:
 name: sterling-b2bi-toolkit-pv
 labels:
   failure-domain.beta.kubernetes.io/region: <your region>
   failure-domain.beta.kubernetes.io/zone: <your zone>
spec:
 capacity:
   storage: 20Gi
 accessModes:
   - ReadWriteMany
 nfs:
  server: fsf-xxxxxxx-xx.adn.networklayer.com
  path: /IBMxxSEVxxxxxxx_xx/data01
   
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
 name: sterling-b2bi-toolkit-pvc
spec:
 accessModes:
   - ReadWriteMany
 resources:
   requests:
     storage: 20Gi
 storageClassName: ""

4) Realize a criação do PV/PVC

oc create -f my-toolkit-pv-pvc.yaml

Deploy do Toolkit

1) Crie o arquivo toolkit-deploy.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: sterling-b2bi-toolkit
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sterling-b2bi-toolkit
  template:
    metadata:
      labels:
        app: sterling-b2bi-toolkit
    spec:
      containers:
      - name: sterling-b2bi-toolkit
        image: ubuntu:18.4
        command: ["/bin/bash", "-ce", "tail -f /dev/null"]
        volumeMounts:
        - mountPath: /var/nfs-data
          name: sterling-b2bi-toolkit-storage
      volumes:
      - name: sterling-b2bi-toolkit-storage
        persistentVolumeClaim:
          claimName: sterling-b2bi-toolkit-pvc

2) Realize a criação do

oc create -f toolkit-deploy.yaml

Copiar os arquivos do DB2

1) Pegando as informações do Pod

oc project sterling-b2bi-toolkit

oc get pods

NAME                                     READY   STATUS    RESTARTS   AGE
sterling-b2bi-toolkit-59..   1/1     Running   0          73m

exportando a variável

export  MY_TOOLKIT_POD=sterling-b2bi-toolkit-59..

2) Conectando ao pod

oc rsh pod/$MY_TOOLKIT_POD

3) Configurando os diretórios e permissões

cd /var/nfs-data/

mkdir resources logs documents

useradd -u 1010 b2biuser
chown b2biuser:b2biuser logs 
chown b2biuser:b2biuser resources 
chown b2biuser:b2biuser documents

exit

4) Copia os arquivos do DB2 para o pod

oc cp db2jcc4.jar $MY_TOOLKIT_POD:/var/nfs-data/resources/
oc cp db2jcc_license_cu.jar $MY_TOOLKIT_POD:/var/nfs-data/resources/
oc cp local_policy.jar $MY_TOOLKIT_POD:/var/nfs-data/resources/

5) Verificando o resultado

oc rsh $MY_TOOLKIT_POD ls -l /var/nfs-data/resources/

total 6452
-rw-r--r--. 1 1010 1010 6568908 May 23 18:36 db2jcc4.jar
-rw-r--r--. 1 1010 1010    1535 May 23 18:37 db2jcc_license_cu.jar
-rw-r--r--. 1 1010 1010    128  May 23 18:38 local_policy.jar

See Also