IBM Sterling: Configurando as imagens no Registry: Difference between revisions

From Wiki
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 15: Line 15:


== Configurando o OpenShift Registry==
== Configurando o OpenShift Registry==
oc project openshift-image-registry
Now using project "openshift-image-registry" on server "https://c107-e.us-south.containers.cloud.ibm.com:31619".


$ oc get svc
O procedimento a seguir é uma configuração única para ativar a rota de registro OpenShift interna.
NAME                      TYPE        CLUSTER-IP    EXTERNAL-IP  PORT(S)    AGE
image-registry            ClusterIP  172.21.191.9  <none>        5000/TCP    4h8m
image-registry-operator  ClusterIP  None          <none>        60000/TCP  4h39m


$ oc create route reencrypt --service=image-registry
1) Alterando para o projeto
route.route.openshift.io/image-registry created


$ oc get route image-registry
oc project openshift-image-registry
NAME            HOST/PORT                                                                                                                                  PATH  SERVICES        PORT      TERMINATION  WILDCARD
image-registry  image-registry-openshift-image-registry.ebasso-roks-demo-sb2bi-...us-south.containers.appdomain.cloud          image-registry  5000-tcp  reencrypt    None


$ oc edit route image-registry
2) Listando o serviço


$ oc get svc
<small>NAME                      TYPE        CLUSTER-IP  EXTERNAL-IP  PORT(S)    AGE
image-registry            ClusterIP  172.xx.1.9  <none>        5000/TCP    4h8m
image-registry-operator  ClusterIP  None        <none>        60000/TCP  4h39m</small>


apiVersion: route.openshift.io/v1
3) Reencriptando
kind: Route
 
metadata:
$ oc create route reencrypt --service=image-registry
annotations:
 
4) Listando a rota
 
$ oc get route image-registry
<small>NAME            HOST/PORT      ...                                                                                                                     
image-registry  image-registry-openshift-image-registry.ebasso-roks-demo-sb2bi-...us-south.containers.appdomain.cloud      ... </small>
 
5) Agora que temos a url do nosso registry, vamos exportar uma variável
 
export MY_IMG_REGISTRY=<small>image-registry-openshift-image-registry.ebasso-roks-demo-sb2bi-...us-south.containers.appdomain.cloud</small>
 
Edite a rota
 
6) Alterando a route do image-registry
 
$ oc edit route image-registry
 
e adicione "haproxy.router.openshift.io/balance: source"
 
apiVersion: route.openshift.io/v1
kind: Route
metadata:
annotations:
     openshift.io/host.generated: "true"
     openshift.io/host.generated: "true"
     haproxy.router.openshift.io/balance: source
     '''haproxy.router.openshift.io/balance: source'''
 
Salve e feche o arquivo (sintaxe do vim -- > ''':wq!'''). O resultado é os seguinte:
 
<small>route.route.openshift.io/image-registry edited</small>
 
 
==Carregando as imagens==
 
1) Alterando o Projeto e configurando uma variável de ambiente


route.route.openshift.io/image-registry edited
oc project sterling-b2bi-app
export MY_SB2BI_PROJECT=sterling-b2bi-app


oc new-project sterling-b2bi-app
2) Fazendo o Login no Docker


docker login -u $(oc whoami) -p $(oc whoami -t) image-registry-openshift-image-registry.ebasso-roks-demo-sb2bi-....us-south.containers.appdomain.cloud
docker login -u $(oc whoami) -p $(oc whoami -t) $MY_IMG_REGISTRY
   <small>WARNING! Using --password via the CLI is insecure. Use --password-stdin.
   <small>WARNING! Using --password via the CLI is insecure. Use --password-stdin.
   Login Succeeded</small>
   Login Succeeded</small>


Carregando as imagens
3) Carregando as imagens


  docker load -i b2bi-6.1.0.0.tar
  docker load -i b2bi-6.1.0.0.tar
Line 54: Line 85:
  docker load -i purge-6.1.0.0.tar
  docker load -i purge-6.1.0.0.tar


Rotulando as imagens
4) Rotulando as imagens


  docker tag b2bi:6.1.0.0 image-registry-openshift-image-registry.ebasso-roks-demo-sb2bi-....us-south.containers.appdomain.cloud/sterling-b2bi-app/b2bi:6.1.0.0
  docker tag b2bi:6.1.0.0 $MY_IMG_REGISTRY/$MY_SB2BI_PROJECT/b2bi:6.1.0.0
  docker tag ps:6.1.0.0 image-registry-openshift-image-registry.ebasso-roks-demo-sb2bi-8c1e167e9d701a9f52a0a22606bde374-0000.us-south.containers.appdomain.cloud/sterling-b2bi-app/ps:6.1.0.0
  docker tag ps:6.1.0.0 $MY_IMG_REGISTRY/$MY_SB2BI_PROJECT/ps:6.1.0.0
  docker tag purge:6.1.0.0 image-registry-openshift-image-registry.ebasso-roks-demo-sb2bi-8c1e167e9d701a9f52a0a22606bde374-0000.us-south.containers.appdomain.cloud/sterling-b2bi-app/purge:6.1.0.0
  docker tag purge:6.1.0.0 $MY_IMG_REGISTRY/$MY_SB2BI_PROJECT/purge:6.1.0.0


docker push image-registry-openshift-image-registry.ebasso-roks-demo-....us-south.containers.appdomain.cloud/sterling-b2bi-app/b2bi:6.1.0.0
5) Push das imagens
docker push image-registry-openshift-image-registry.ebasso-roks-demo-....us-south.containers.appdomain.cloud/sterling-b2bi-app/ps:6.1.0.0
docker push image-registry-openshift-image-registry.ebasso-roks-demo-....us-south.containers.appdomain.cloud/sterling-b2bi-app/purge:6.1.0.0


docker push $MY_IMG_REGISTRY/$MY_SB2BI_PROJECT/b2bi:6.1.0.0
docker push $MY_IMG_REGISTRY/$MY_SB2BI_PROJECT/ps:6.1.0.0
docker push $MY_IMG_REGISTRY/$MY_SB2BI_PROJECT/purge:6.1.0.0


==Validando o resultado==


oc get imagestream
<small>NAME    IMAGE REPOSITORY                                                          TAGS      UPDATED
b2bi    image-registry.openshift-image-registry.svc:5000/sterling-b2bi-app/b2bi    6.1.0.0  4 minutes ago
ps      image-registry.openshift-image-registry.svc:5000/sterling-b2bi-app/ps      6.1.0.0  About a minute ago
purge  image-registry.openshift-image-registry.svc:5000/sterling-b2bi-app/purge  6.1.0.0  45 seconds ago</small>


= See Also =
= See Also =

Latest revision as of 14:41, 23 May 2021

Procedimento

Extrair os arquivos

tar -xvf STER_B2B_INT_CERT_CONT_V6.1_ML.tar

Serão extraídos os seguintes arquivos:

x b2bi-6.1.0.0.tar
x purge-6.1.0.0.tar
x ps-6.1.0.0.tar
x ibm-b2bi-prod-2.0.0.tgz


Configurando o OpenShift Registry

O procedimento a seguir é uma configuração única para ativar a rota de registro OpenShift interna.

1) Alterando para o projeto

oc project openshift-image-registry

2) Listando o serviço

$ oc get svc

NAME                      TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)     AGE
image-registry            ClusterIP   172.xx.1.9   <none>        5000/TCP    4h8m
image-registry-operator   ClusterIP   None         <none>        60000/TCP   4h39m

3) Reencriptando

$ oc create route reencrypt --service=image-registry

4) Listando a rota

$ oc get route image-registry

NAME             HOST/PORT      ...                                                                                                                      
image-registry   image-registry-openshift-image-registry.ebasso-roks-demo-sb2bi-...us-south.containers.appdomain.cloud      ... 

5) Agora que temos a url do nosso registry, vamos exportar uma variável

export MY_IMG_REGISTRY=image-registry-openshift-image-registry.ebasso-roks-demo-sb2bi-...us-south.containers.appdomain.cloud

Edite a rota

6) Alterando a route do image-registry

$ oc edit route image-registry

e adicione "haproxy.router.openshift.io/balance: source"

apiVersion: route.openshift.io/v1
kind: Route
metadata:
annotations:
   openshift.io/host.generated: "true"
   haproxy.router.openshift.io/balance: source

Salve e feche o arquivo (sintaxe do vim -- > :wq!). O resultado é os seguinte:

route.route.openshift.io/image-registry edited


Carregando as imagens

1) Alterando o Projeto e configurando uma variável de ambiente

oc project sterling-b2bi-app
export MY_SB2BI_PROJECT=sterling-b2bi-app

2) Fazendo o Login no Docker

docker login -u $(oc whoami) -p $(oc whoami -t) $MY_IMG_REGISTRY

 WARNING! Using --password via the CLI is insecure. Use --password-stdin.
 Login Succeeded

3) Carregando as imagens

docker load -i b2bi-6.1.0.0.tar
docker load -i ps-6.1.0.0.tar
docker load -i purge-6.1.0.0.tar

4) Rotulando as imagens

docker tag b2bi:6.1.0.0 $MY_IMG_REGISTRY/$MY_SB2BI_PROJECT/b2bi:6.1.0.0
docker tag ps:6.1.0.0 $MY_IMG_REGISTRY/$MY_SB2BI_PROJECT/ps:6.1.0.0
docker tag purge:6.1.0.0 $MY_IMG_REGISTRY/$MY_SB2BI_PROJECT/purge:6.1.0.0

5) Push das imagens

docker push $MY_IMG_REGISTRY/$MY_SB2BI_PROJECT/b2bi:6.1.0.0
docker push $MY_IMG_REGISTRY/$MY_SB2BI_PROJECT/ps:6.1.0.0
docker push $MY_IMG_REGISTRY/$MY_SB2BI_PROJECT/purge:6.1.0.0

Validando o resultado

oc get imagestream

NAME    IMAGE REPOSITORY                                                           TAGS      UPDATED
b2bi    image-registry.openshift-image-registry.svc:5000/sterling-b2bi-app/b2bi    6.1.0.0   4 minutes ago
ps      image-registry.openshift-image-registry.svc:5000/sterling-b2bi-app/ps      6.1.0.0   About a minute ago
purge   image-registry.openshift-image-registry.svc:5000/sterling-b2bi-app/purge   6.1.0.0   45 seconds ago

See Also