Skip to content

MTCTL - Middle tier Controller

Middle tier controller (MTCTL) is a command line interface (CLI) tool for easy administration of common tasks in IFS cloud middle tier instance. It can help you do the following tasks.

  • list status of the deployments
  • start deployments
  • stop deployments
  • wait for deployments to fully start or stop
  • switch namespace maintenance mode
  • dump descriptions and logs to disk - use this for all support issues on Middle tier
  • Create/delete the service which is used by init containers to wait on db deployments.

Prerequisites

Your computer should have the following third party software installed and the path to the executable set in the PATH environment variable.

  • OpenJDK runtime
  • KUBECTL client

Usage

mtctl CLI is called with sub command and options to the sub command. Sub command and options are case sensitive. The script mtctl.cmd/sh is located in the ifsinstaller folder. The Java application is in ifsinstaller/lib/mtctl.jar.

mtctl sub-command [options]

example:

mtctl start --namespace custA_prod

Sub commands

Sub command Syntax Description
status mtctl status [--namespace NAMESPACE] Lists status of all the deployments.
start mtctl start [--namespace NAMESPACE] [--deployment DEPLOYMENT] [--timeout TIMEOUT] Starts all the deployments to their original scale setting. Scale is set when IFS Cloud Applications is installed. Also individual deployments can be started.
"mtctl start --deployment ifsapp-proxy --namespace testns"
stop mtctl stop [--namespace NAMESPACE] [--deployment DEPLOYMENT] [--timeout TIMEOUT] [--graceful] Stops all the deployments by scaling them down to zero (0). Original scale setting is preserved. A force stop is carried out where the pods are scaled to 0 immediately. If --graceful flag is given the stop will be carried out gracefully. Also individual deployments can be stopped.
"mtctl start --deployment ifsapp-proxy --namespace testns"
wait mtctl wait [--namespace NAMESPACE] --timeout TIMEOUT Wait until all deployments are fully started (scaled up to required number of pods),
fully stopped (scaled down to zero) or timeout.
TIMEOUT is a mandatory argument (in seconds).
maintenance mtctl maintenance --mode MODE [--namespace NAMESPACE] Switch the namespace maintenance mode on or off.
When the maintenance mode is on (set) all the requests to the namespace are
responded with a "maintenance mode" splash.
However the maintenance mode will be reset (off) if the ingress controller in the namespace was redeployed.
MODE is a mandatory argument (valid values: on|set|off|reset).
dump mtctl dump [--namespace NAMESPACE] [--dumpPath <path>] Writes the description for deployments, description and log for pods to disk in a folder named _dump with a subfolder named yyyyMMdd_HHmmss/IFS_Cloud. If autoscale is enabled ifs_autoscaler folder will contain information about autoscale related objects. The folder ifs-ingress will contain information about ifs-ingress objects. Default location for the dumpPath is where you start the mtctl tool.
initwait mtctl initwait [--namespace NAMESPACE ] Creates the service "initwaitservice" in the namespace provided. If the namespace does not exist it will be create. If no namespace is provided the default namespace of the cluster will be used. This is the service which init containers ( with database connectivity) ping at a regular interval keep waiting prior to starting up the application containers. This to be able to start pods and reserve space but not connect to the database while a db deployment is ongoing. Mainly for environments with high requirements on uptime, where K8s cluster has auto scale nodes.
initnowait mtclt initnowait --namespace NAMESPACE Delete the service "initwaitservice" in the namespace provided. The pods with database connection will start at this stage.
clean mtctl clean [--namespace NAMESPACE] Will delete all pods in status "Evicted" in the namespace
usage mtctl usage Will display this list of Sub Commands

NOTES:

  • NAMESPACE: Optional namespace in Kubernetes cluster to connect to. If not provided the default namespace set in the kube config is used.
  • DEPLOYMENT: any of the deployments in the namespace listed by "kubectl get deployment -n "
  • MODE: Mode is required and valid options are on, set, off and reset
  • TIMEOUT: Wait time in seconds before all deployments are started or stopped. If not provided the mtctl will start/stop all deployments and exit before the operation is completed.
    When timeout option is passed with start or stop commands start or stop will automatically execute a wait command with the given timeout value.
  • Status output format: Each deployment status is listed in two lines. First line is the status of the deployment and the second line is the status of the pods associated with the deployment. Each pod had status of the containers.
  • Status, start, stop and wait sub commands print the status of the namespace when the operation completed.

Status example

IFS Cloud Applications - Middletier Controller
List deployment status
Thu Sep 16 09:35:20 IST 2021 L5 - 6 deployments not started
Deployments/Pods status
Namespace: ifs-test
Deployments/Pods status
Namespace: ifs-test

DEPLOYMENT STATUS
  POD NAME                                     READY  AGE     CONTAINER STATUS
ifs-file-storage DISABLED

ifs-forecast DISABLED

ifsapp-busmod DISABLED

ifsapp-amm NOT READY
  ifsapp-amm-866fb6c788-btxw5                  1/2    12d23h  ifsapp-amm NOT STARTED (580 restarts)                  linkerd-proxy READY

ifsapp-client READY
  ifsapp-client-5dc6f7ff7c-v2ldd               2/2    12d23h  ifsapp-client READY                                    linkerd-proxy READY
  • DEPLOYMENT STATE: Status of the deployment
    • DISABLED - scale is 0
    • NOT READY - one or more pods not started
    • READY - fully started
  • READY: Count of running containers in a pod against the count of all containers
  • AGE: Age of the pod (time since the last start).
  • CONTAINER STATE: Status of the container
    • NOT STARTED - container is not running
    • READY - container is running
  • Exit Codes mtctl will always return 0 when the operation was successful. The following lists possible exit codes.
Exit Code Note
0 Operation was successful
1 Failed - unknown reason
2 No arguments passed
3 java exception
11 Operation timeout
12 Operation partially failed
  • Other options to KUBECTL: Addition to the listed options, any option valid to KUBECTL client is also accepted.

example:

passing non default config file and context

mtctl start --kubeconfig c:\ifs\kubeconfig.conf --context ifs-cluster --namespace ifs-test

Debug

To enable debugging add the option --v= where n is 1-9 where 1 is deep debug and 9 is less. example:

mtctl stop --v=1 --namespace ifs-test