By javier mugueta

Me and my circumstance

“Kool” Kubernetes Client Tools


When working with k8s, you typically have several clusters and a bunch of namespaces per cluster, the following tools can help you manage the stuff with easy.

kubectx + kubens

kubectx allows you to change the context between different k8s clusters

kubens allows you to change between different namespaces in the current cluster context

brew install kubectx

More info here

Kube-ps1

Allows you to see the current context and namespace in the promt

brew install kube-ps1

More info here

Examples

kubectx, kubens and kube-ps1 at a glance

kubeaudit

Great tool for auditing the security settings on your k8s clusters

brew install kubeaudit
kubeaudit allowpe

krew

Krew is a package manager for kubectl (kubectl has an extensibility framework and this tool helps manage extensions)

Hope it helps! 🙂

Set Up an Ingress Controller in OKE Cluster


Step 1: setting up the nginx ingress controller

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml

Step 2: exposing the ingress as a service of type LoadBalancer (as a public IP)

kubectl apply -f https://raw.githubusercontent.com/javiermugueta/rawcontent/master/cloud-generic.yaml

Step 3: Execute this command several times until the external-ip appears as non <pending>, grab the IP for later testing

kubectl get svc -n ingress-nginx

Step 4: a certificate for ssl termination

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout tls.key -out tls.crt -subj "/CN=nginxsvc/O=nginxsvc"


kubectl create secret tls tls-secret --key tls.key --cert tls.crtopenssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout tls.key -out tls.crt -subj "/CN=nginxsvc/O=nginxsvc"

Step 5

kubectl create -f https://raw.githubusercontent.com/javiermugueta/rawcontent/master/hello-world-ingress.yaml

Step 6: A typical hello world deployment with a pod in it and 3 replicas

kubectl create -f https://raw.githubusercontent.com/javiermugueta/rawcontent/master/ingress.yaml

Step 7: Test the url and see what happens…

That’s all folks! Hope it helps 🙂

Oracle SaaS Stories: Creating a Custom App Extension with Visual Builder | Part Three: Filtering Data


Next step after what we posted here is how to implement a mechanism to filter results. Taking a look to the REST APIs we can notice that the query parameter q is the one that can help us to implement what we are pretending:

So the q parameter works as a field1<operator1>value1;fieldn<operatorn>valuen expression that can be passed as a parameter to the REST service. Let’s hands on.

Create a global variable for the search criteria:

Drag and drop an InputText onto the Page Structure pane:

Create a new Event for storing in a variable the value of the InputText when it changes:

Drag and drop a Button same way:

Create new Event and implement action chain:

In the success branch of the Rest call put a Call Component Method and select the refresh method of the table object:

In the failure branch put a Fire Notification Error and configure it as follows:

Hope it helps! 🙂

Oracle SaaS Stories: Creating a Custom App Extension with Visual Builder | Part Two: Results Pagination


In this episode we are explaining how to list data results in a table located on a page. This is the typical use case in which we want to show business data to the user according to certain criteria. For now what we want to demonstrate is how to show results in paginated mode. The good thing here is that we are not writing any line of code at all.

SaaS REST API Structure and Taxonomy

Most of the new REST APIs of Fusion SaaS have the same structure, for example in the HCM package we found:

For now we are focusing in the offset and limit parameters.

An example querying Transfer Orders

Let’s create a page that retrieves all transfer orders. First, we need to locate the service in the catalog. See here for more details.

This API retrieves all transfer orders

Create a new project in VB and then drag and drop a table in the page and click Add Data assistant:

Create a couple of global variables at application level adn set the default value for rowspertable as 10:

Select the TransferOrders endpoint and click [Next]:

Select columns to show and the table primary key:

Map the global variables to the endpoint parameters and click [Finish]:

For now we have the results in the table:

Drag and drop an InputNumber on to the Page Structure pane, above the table and set the min value to 0:

Add Assign Variables action to the Action Chain:

Add Navigate action as well:

Click on Assign Variables action and then on Assing link:

Map the value variable in the action chain to the application variable offset and click on [Save]:

Click the Navigate action and then de [Select Target] button:

Select Peer Page:

Select the page where the table is located:

We are almost done, click on the Play button:

Click on the InputNumber up and down and see how the table shows data in pages as the inputnumber changes:

So that’s all for now, in the next episode we’ll see how to filter results in the table.

Hope it helps! 🙂

Oracle SaaS Stories: Creating a Custom App Extension with Visual Builder | Part One: Connect Visual Builder to Fusion SaaS API Service Catalog


Visual Builder Cloud Service (aka VBCS), one of the 3 legs of Oracle Integration Cloud (aka OIC), is a low code development environment that is one of the main mechanisms for extending Oracle Fusion SaaS Apps.

In this episode we are connecting VBCS to a SaaS instance, so we can get the different endpoints provided and then use it in the application.

What you need is:

  • a user with access to OIC instance
  • same user with access to SaaS instance

Step 1: Create a new VBCS app

OIC -> Visual Builder
Click [New] on the top right
Select SaaS Template
Provide values and click [Finish]

Step 2: Configure

Go to hamburger menu on top right and select [Settings]
Click on [Services] tab and provide the info

The url to provide has the following format: https://instancefqdm/helpPortalApi/otherResources/latest/interfaceCatalogs

where instancefqdm is your SaaS instance such as https://<id>-<env&gt;.fa.<datacenter>.oraclecloud.com

Click on [Test] button

Step 3: Import the catalog

Click on [Service Connections] icon on the left
Click on [+ Service Connection]
Click on [Select from Catalog]
Click on [FA Services]
Click on one depending on the functional area you want to work with
Wait for the endpoints to appear, expand and select endpoints desired
When you are done click on [Create] on right down corner
Click on [Endpoints] tab and find your endpoints in there

Step 4: Use an endpoint for listing Contacts in a table

Click on [Web Applications] icon on the left, expand flows, expand main, select main-start, locate Table in the Components panel and drag and drop onto the view or onto the Page Structure panel. Click on [Add Data] on the right
Select Contacts and click [Next]
Select or drag&drop fields in the Columns panel. Select the Primary Key and click [Next]
Leave things as it is for now and click [Finish]
Click the “play” button up right
And here it is, you have your contacts page created

And that’s all folks for now, hope it helps! 🙂

Deploying a Coherence Cluster in Kubernetes


Coherence-Operator is a Kubernetes opeartor for deploying Oracle Coherence in k8s. Let’s see how to do it.

1 Clean previous setup intents:

helm del --purge sample-coherence
helm del --purge sample-coherence-operator
kubectl delete namespace sample-coherence-ns

2 Execute the following:

kubectl config set-context $(kubectl config current-context) --namespace=sample-coherence-ns

helm repo add coherence https://oracle.github.io/coherence-operator/charts

helm repo update

helm --debug install coherence/coherence-operator --name sample-coherence-operator --set "targetNamespaces={}" --set imagePullSecrets=sample-coherence-secret

helm ls

helm status sample-coherence-operator

3 Create a secret with your credentials to Oracle Container Registry:

kubectl create secret docker-registry oracle-container-registry-secret --docker-server=container-registry.oracle.com --docker-username='youruser' --docker-password='yourpasswd' --docker-email='youremail'

4 Install:

helm --debug install coherence/coherence --name sample-coherence --set imagePullSecrets=oracle-container-registry-secret

5 Proxy to a pod:

export POD_NAME=$(kubectl get pods --namespace sample-coherence-ns -l "app=coherence,release=sample-coherence,component=coherencePod" -o jsonpath="{.items[0].metadata.name}")

kubectl --namespace sample-coherence-ns port-forward $POD_NAME 20000:20000

6 Download and install Coherence Stand Alone

7 Download this and this

8 Build the client:

export COHERENCE_HOME=~/Oracle/Middleware/Oracle_Home/coherence
javac -cp .:${COHERENCE_HOME}/lib/coherence.jar HelloCoherence.javaexport COHERENCE_HOME=~/Oracle/Middleware/Oracle_Home/coherence

9 Test it:

java -cp .:${COHERENCE_HOME}/lib/coherence.jar -Dcoherence.cacheconfig=$PWD/example-client-config.xml HelloCoherence

2019-07-11 01:21:33.575/0.538 Oracle Coh...

…

Oracle Coherence Version 12.2.1.3.0 Build 68243

2019-07-11 01:21:34.430/1.392 Oracle 

The value of the key is 7

That’s all, hope it helps 🙂

Oracle SaaS Stories: Invoking a Service when an Entity is Created/Updated


In this episode we are explaining one of the many mechanisms for executing actions when changes happen in the Cloud App Environment.

In this particular case, as an example, we are calling an external REST service hosted in a kubernetes cluster, that implements a counter. Every time we create or modify a Contact, the external service is called.

Hands on!

Enter in the environment with a user with al least ORA_ASM_APPLICATION_IMPLEMENTATION_CONSULTANT_JOB

Go to “Manage Sandboxes”:

Create a new sandbox and set active:

Go to Application Composer:

Click on “Common Setup-Web Services”:

Create a new Web Service:

Select REST/SOAP appropriately:

Put the information of your service endpoint:

Search for the “Contact” business object, click on “Server Scripts”, then “triggers”, then click on “create”:

Crate a trigger of type “After Create”:

Go to the Web Services tab on the right pane, locate the service you want to invoke and click on “insert”:

The code invoked when a new contact is created is put in the editor. Save it.

NOTE: You can create another trigger for other events, such as “AfterTransactionPosted”, etc.

Let’s test it!

Check the status of the external web service:

Go to the Contacts Menu:

Create a new contact, for example Abelardo Pirindiki:

Check the status of the external service and see it has been called:

And that’s all folks, hope it helps! 🙂