16.1.1 Patching a Container Image
The instructions in this section relate to patching or upgrading an existing 14.1.2.1.0 Oracle Identity Governance (OIG) deployment with a new OIG container image.
Note:
Administrators should be aware of the following:- If you are not using Oracle Container Registry or your own container registry, then you must first load the new container image on all nodes in your Kubernetes cluster.
- If you have Kubernetes Horizontal Pod Autoscaler (HPA) enabled, you must disable HPA before performing the steps below. See, Deleting HPA.
Note:
The instructions in this section relate to patching an OIG container image to the July 25 container image or later. If you are patching to a version earlier than July 25, you only need to follow Patching the Container Image and Verifying the OIG Deployment is Using the New Image .Patching the container image involves the following:
Stopping the Domain
Before patching you must shutdown the OIG Domain. For details on how to do this, see Stopping and Starting the Domain.
Patching the Database Schemas
Once the image has been updated you must patch the schemas in the database.
- Check to see if the helper pod exists by running:
For example:kubectl get pods -n <domain_namespace> | grep helper
The output should look similar to the following:kubectl get pods -n oigns | grep helper
If the helper pod exists delete the pod with following command:helper 1/1 Running 0 26h
For example:kubectl delete pod helper -n <namespace>
kubectl delete pod helper -n oigns
- Create a new helper pod using the new image.
If using Oracle Container Registry or your own container registry for the Oracle Identity Governance (OIG) container image:For example:
kubectl run --image=<image_name-from-registry>:<tag> \ --image-pull-policy="IfNotPresent" \ --overrides='{"apiVersion": "v1", "spec":{"imagePullSecrets": [{"name": "orclcred"}]}}' \ helper -n <domain_namespace> \ -- sleep infinity
kubectl run --image=container-registry.oracle.com/middleware/oig_cpu:14.1.2.1.0-jdk17-ol8-<YYMMDD> \ --image-pull-policy="IfNotPresent" \ --overrides='{"apiVersion": "v1","spec":{"imagePullSecrets": [{"name": "orclcred"}]}}' \ helper -n oigns \ -- sleep infinity
If you are not using a container registry and have loaded the image on each of the worker nodes, run the following command:
For example:kubectl run helper --image <image>:<tag> -n oigns -- sleep infinity
The output will look similar to the following:kubectl run helper --image oracle/oig_cpu:14.1.2.1.0-jdk17-ol8-<YYMMDD> -n oigns --sleep infinity
pod/helper created
- Run the following command to start a bash shell in the helper pod:
For example:kubectl exec -it helper -n <domain_namespace> -- /bin/bash
This will take you into a bash shell in the running helper pod:kubectl exec -it helper -n oigns -- /bin/bash
[oracle@helper ~]$
- In the helper bash shell run the following commands to set the environment:
export DB_HOST=<db_host.domain>
export DB_PORT=<db_port>
export DB_SERVICE=<service_name>
export RCUPREFIX=<rcu_schema_prefix>
export RCU_SCHEMA_PWD=<rcu_schema_pwd>
echo -e <db_pwd>"\n"<rcu_schema_pwd> > /tmp/pwd.txt
Where:cat /tmp/pwd.txt
<db_host.domain>
is the database server hostname.<db_port>
is the database listener port.<service_name>
is the database service name.<rcu_schema_prefix>
is the RCU schema prefix you want to set.<rcu_schema_pwd>
is the password you want to set for the<rcu_schema_prefix>
.<db_pwd>
is the SYS password for the database.
export DB_HOST=mydatabasehost.example.com
export DB_PORT=1521
export DB_SERVICE=orcl.example.com
export RCUPREFIX=OIGK8S
export RCU_SCHEMA_PWD=<password>
echo -e <db_pwd>"\n"<rcu_schema_pwd> > /tmp/pwd.txt
Ensure thecat /tmp/pwd.txt
cat /tmp/pwd.txt
command shows the correct passwords. - In the helper bash shell run the following command to patch the schemas:
The output will look similar to the following:/u01/oracle/oracle_common/modules/thirdparty/org.apache.ant/apache-ant/bin/ant \ -f /u01/oracle/idm/server/setup/deploy-files/automation.xml \ run-patched-sql-files \ -logger org.apache.tools.ant.NoBannerLogger \ -logfile /u01/oracle/idm/server/bin/patch_oim_wls.log \ -DoperationsDB.host="$DB_HOST" \ -DoperationsDB.port="$DB_PORT" \ -DoperationsDB.serviceName="$DB_SERVICE" \ -DoperationsDB.user="$RCUPREFIX"_OIM \ -DOIM.DBPassword="$RCU_SCHEMA_PWD" \ -Dojdbc=/u01/oracle/oracle_common/modules/oracle.jdbc/ojdbc11.jar
Buildfile: /u01/oracle/idm/server/setup/deploy-files/automation.xml
- Inside the helper pod, verify the database was patched successfully by viewing the
patch_oim_wls.log
:
The output should look similar to below:cat /u01/oracle/idm/server/bin/patch_oim_wls.log
... run-patched-sql-files: [sql] Executing resource: /u01/oracle/idm/server/db/oim/oracle/StoredProcedures/Recon/OIM_SP_ReconBlkAccountChglog.sql [sql] Executing resource: /u01/oracle/idm/server/db/oim/oracle/Upgrade/oim14cBP/list/oim14c_dml_pty_insert_self_assignment_allowed.sql [sql] Executing resource: /u01/oracle/idm/server/db/oim/oracle/StoredProcedures/API/oim_role_mgmt_pkg_body.sql [sql] Executing resource: /u01/oracle/idm/server/db/oim/oracle/StoredProcedures/API/oim_usr_mgmt_pkg_body.sql [sql] Executing resource: /u01/oracle/idm/server/db/oim/oracle/StoredProcedures/DBDiagnostics/oim_db_diagnostics_pkg_body.sql [sql] 5 of 5 SQL statements executed successfully BUILD SUCCESSFUL Total time: 1 second
Patching the Container Image
To update the domain:
- Run the following command to set the
image
parameter to the location of the new image:
For example:kubectl patch domain <domainUID> -n <domain_namespace> --type merge -p '{"spec":{"image":"<repository>:<new_tag>"}}'
- If using Oracle Container Registry or your own container registry for your OIG container image:
kubectl patch domain governancedomain -n oigns --type merge -p '{"spec":{"image":"container-registry.oracle.com/middleware/oig_cpu:<new_tag>"}}'
- If you are not using a container registry and have loaded the image on each of the worker nodes:
The output will look similar to the following:kubectl patch domain governancedomain -n oigns --type merge -p '{"spec":{"image":"oracle/oig:<new_tag>"}}'
domain.weblogic.oracle/governancedomain patched
- If using Oracle Container Registry or your own container registry for your OIG container image:
Starting the OIG Domain
To start the OIG domain, seeStopping and Starting the Domain.
Verifying the OIG Deployment is Using the New Image
Once the upgrade is successful, you can run the following command to show the image is used by the pods:
kubectl describe pod <pod> -n <domain_namespace>
For example:kubectl describe pod governancedomain-oim-server1 -n oigns
The new image should be displayed in the following section:...
Containers:
weblogic-server:
Container ID: cri-o://220fa83d079e079ac183c00f884b10ea30a794527dbb65e6964a035d450384f8
Image: container-registry.oracle.com/middleware/oig_cpu:<new>
Image ID: container-registry.oracle.com/middleware/oig_cpu@sha256:cdf51b6aa47cd05573bc53244681b193fb4e2f6db56e50d2251b9416bc68ebc0
Port: 14100/TCP
Host Port: 0/TCP
Command:
...