Thursday, November 14, 2019

creating a domain with WLST


in WLS 12.1 + the config.sh script no longer supports a silent installation

./config.sh -silent -response response_file

see Document "Can config.sh be Run in Silent or Non-GUI Mode in Weblogic 12c ? (Doc ID 2370636.1) "

"The configuration tool only works in GUI mode with 12.1.x and above. In order to create a domain without using a GUI the WLST tool will need to be used. "


this is really stupid, 99% of Linux machines are headless

and using UI defeats automation



here how to create a domain with WLST:

https://docs.oracle.com/middleware/1221/wls/WLSTG/domains.htm#WLSTG429

but when you do:

selectTemplate('Base WebLogic Server Domain')

you get a

Caused by: com.oracle.cie.domain.script.ScriptException: 60708: Template not found.

60708: Found no templates with Base WebLogic Server Domain name and null version

60708: Select a different template.

        at com.oracle.cie.domain.script.ScriptExecutor.selectTemplate(ScriptExecutor.java:556)

        at com.oracle.cie.domain.script.jython.WLScriptContext.selectTemplate(WLScriptContext.java:580)


do a showAvailableTemplates()


'20849: Available templates.\n20849: Currently available templates for loading: WebLogic Advanced Web Services for JAX-RPC Extension:12.2.1.3.0\nWebLogic Advanced Web Services for JAX-WS Extension:12.2.1.3.0\nWebLogic JAX-WS SOAP/JMS Extension:12.2.1.3.0\nBasic WebLogic Server Domain:12.2.1.3.0\nWebLogic Coherence Cluster Extension:12.2.1.3.0\n\n20849: No action required.\n'



so the solution is


selectTemplate('Basic WebLogic Server Domain', '12.2.1.3.0')


To find out more info on the domain template (like wls.jar) open its template-info.xml




Saturday, November 9, 2019

kubernetes quotas

kubectl create namespace pippo
kubectl create quota myhq --hard=cpu=1,memory=1G,pods=2 --namespace=pippo
kubectl run --restart=Never busybox --image=busybox --namespace=pippo




Error from server (Forbidden): pods "busybox" is forbidden: failed quota: myhq: must specify cpu,memory


You can create your pod with requests and limits:


kubectl run --restart=Never busybox --image=busybox --namespace=pippo --limits=cpu=100m,memory=512Mi --requests=cpu=50m,memory=256Mi --dry-run -o yaml > mypod.yaml


spec:
  containers:
  - image: busybox
    imagePullPolicy: IfNotPresent
    name: busybox
    resources:
      limits:
        cpu: 100m
        memory: 512Mi
      requests:
        cpu: 50m
        memory: 256Mi


obviously all values in "requests" must be <= values in limits



busybox docker image

https://hub.docker.com/_/busybox/

docker pull busybox
docker inspect busybox

if I see in the Config section (don't look at ContainerConfig ) the Cmd is simply "sh"

which means that if I do

kubectl run --restart=Never busybox -it --image=busybox

I simply get a shell.

If I create a pod who executes simply "env"

kubectl run --restart=Never busybox --image=busybox -- env


and then "inspect" it

kubectl get pod busybox -o yaml

I see that the container got the entry:

args:
  - env


and since the "args" are simply appended to the default command defined in the container ("If you define args, but do not define a command, the default command is used with your new arguments.")... it's equivalent to specifying:


command: ["sh", "-c"]
args: ["env"]

don't forget the "-c", otherwise you get "sh: can't open 'env': No such file or directory"


NB: if with "kubectl run" you specify --command

kubectl run busybox --image=busybox --restart=Never --command -- env

then "command" instead of "args" will be generated:

spec:
  containers:
  - command:
    - env
    image: busybox
    name: busybox


This aspect of containers/pods (how to run a command with arguments) is rather confusing and poorly engineered.