Documentation ¶
Index ¶
- Variables
- func ContainsInList(list []string, s string) bool
- func ContainsInMap(m map[string]string, vals ...string) bool
- func ConvertToArrayString(intf interface{}) ([]string, error)
- func ConvertToInt(intf interface{}) (int32, error)
- func ConvertToString(intf interface{}) (string, error)
- func CopyMap(originalMap map[string]string) map[string]string
- func ExecuteAndGetResult(pod *corev1.Pod, managementOperation string) (interface{}, error)
- func ExecuteMgmtOp(pod *corev1.Pod, mgmtOpString string) (map[string]interface{}, error)
- func ExecuteOpAndWaitForServerBeingReady(reqLogger logr.Logger, mgmtOp string, pod *corev1.Pod) error
- func GetEnvAsDuration(key string, fallbackDurationAmount int64, durationType time.Duration) time.Duration
- func GetEnvAsInt(key string, fallbackInteger int64) int64
- func GetTransactionRecoveryPort(pod *corev1.Pod) (int32, error)
- func IsAppServerRunningViaJBossCli(pod *corev1.Pod) (bool, error)
- func IsMgmtOutcomeSuccesful(jsonBody map[string]interface{}) bool
- func ListSubsystems(pod *corev1.Pod) ([]string, error)
- func MapMerge(firstMap map[string]string, secondOverwritingMap map[string]string) map[string]string
- func ReadJSONDataByIndex(json interface{}, indexes ...string) interface{}
- func RemoveFromList(list []string, s string) []string
- func SanitizeVolumeName(name string) string
- func SortPodListByName(podList *corev1.PodList) *corev1.PodList
- type RemoteOperationsInterface
- type RemoteOperationsStruct
- func (RemoteOperationsStruct) Execute(pod *corev1.Pod, command string) (string, error)
- func (RemoteOperationsStruct) ObtainLogLatestTimestamp(pod *corev1.Pod) (*time.Time, error)
- func (RemoteOperationsStruct) SocketConnect(hostname string, port int32, command string) (string, error)
- func (RemoteOperationsStruct) VerifyLogContainsRegexp(pod *corev1.Pod, logFromTime *time.Time, regexpLineCheck *regexp.Regexp) (string, error)
Constants ¶
This section is empty.
Variables ¶
var ( // MgmtOpServerStateRead is a JBoss CLI command for reading WFLY server MgmtOpServerStateRead = ":read-attribute(name=server-state)" // MgmtOpListSubsystems is a JBoss CLI command to read names of available subsystems MgmtOpListSubsystems = ":read-children-names(child-type=subsystem)" // MgmtOpReload is a JBoss CLI command for reloading WFLY server MgmtOpReload = ":reload()" // MgmtOpRestart is a JBoss CLI command for restarting WFLY server MgmtOpRestart = ":shutdown(restart=true)" // MgmtOpTxnCheckJdbcStore is a JBoss CLI command to verify if txn log is saved in a database MgmtOpTxnCheckJdbcStore = "/subsystem=transactions:read-attribute(name=use-jdbc-store)" // MgmtOpTxnCheckRecoveryListener is a JBoss CLI command to verify if recovery listener is active MgmtOpTxnCheckRecoveryListener = "/subsystem=transactions:read-attribute(name=recovery-listener)" // MgmtOpTxnProbe is a JBoss CLI command for probing transaction log store MgmtOpTxnProbe = "/subsystem=transactions/log-store=log-store:probe()" // MgmtOpTxnRead is a JBoss CLI command for reading transaction log store MgmtOpTxnRead = "" /* 128-byte string literal not displayed */ // MgmtOpTxnReadHeuristic is a JBoss CLI command for scanning the log store in search of transactions in HEURISTIC status MgmtOpTxnReadHeuristicPattern = "/subsystem=transactions/log-store=log-store/transactions=*/participants=*:query(where={\"status\"=\"%s\"}" // MgmtOpTxnRecoverySocketBindingRead is a JBoss CLI command for reading name of recovery socket binding MgmtOpTxnRecoverySocketBindingRead = "/subsystem=transactions:read-attribute(name=socket-binding)" // MgmtOpSocketBindingRead is a JBoss CLI command for reading all data on the socket binding group MgmtOpSocketBindingRead = "/socket-binding-group=standard-sockets:read-resource(recursive=true,resolve-expressions=true,include-runtime=true)" // MgmtOpSystemPropertyRecoveryBackoffPeriod is a JBoss CLI command to set system property of recovery backoff period MgmtOpSystemPropertyRecoveryBackoffPeriod = "/system-property=com.arjuna.ats.arjuna.common.RecoveryEnvironmentBean.recoveryBackoffPeriod:add(value=%s)" // MgmtOpSystemPropertyPeriodicRecoveryPeriod is a JBoss CLI command to set system property of periodic recovery period MgmtOpSystemPropertyPeriodicRecoveryPeriod = "/system-property=com.arjuna.ats.arjuna.common.RecoveryEnvironmentBean.periodicRecoveryPeriod:add(value=%s)" // MgmtOpSystemPropertyOrphanSafetyInterval is a JBoss CLI command to set system property of orphan safety interval MgmtOpSystemPropertyOrphanSafetyInterval = "/system-property=com.arjuna.ats.jta.common.JTAEnvironmentBean.orphanSafetyInterval:add(value=%s)" // MgmtOpSystemPropertyTransactionManagerDisabled is a JBoss CLI command to set system property to disable/enable transaction manager MgmtOpSystemPropertyTransactionManagerDisabled = "/system-property=com.arjuna.ats.arjuna.common.CoordinatorEnvironmentBean.startDisabled:add(value=%s)" )
Functions ¶
func ContainsInList ¶
ContainsInList returns true if the string s is included in the list,
otherwise false is returned
func ContainsInMap ¶
ContainsInMap returns true if the map m contains at least one of the string
presented as argument `vals`, otherwise false is returned
func ConvertToArrayString ¶
ConvertToArrayString takes interface type and tries to convert it to array of strings
func ConvertToInt ¶
ConvertToInt takes interface type and tries to convert it to int32
func ConvertToString ¶
ConvertToString takes interface type and tries to convert it to string
func CopyMap ¶
CopyMap duplicates map as it creates new map and puts there all the
key value pairs that were included in the first map
func ExecuteAndGetResult ¶
ExecuteAndGetResult executes the JBoss CLI operation provided as the string in parameter 'managementOperation'
It will be executed by call of 'jboss-cli.sh' at the particular pod. When succesful it returns the result part of the returned json, otherwise it returns nil with error describing failure details.
func ExecuteMgmtOp ¶
ExecuteMgmtOp executes WildFly managemnt operation represented as a string
the execution runs as shh remote command with jboss-cli.sh executed on the pod returns the JSON as the return value from the operation
func ExecuteOpAndWaitForServerBeingReady ¶
func ExecuteOpAndWaitForServerBeingReady(reqLogger logr.Logger, mgmtOp string, pod *corev1.Pod) error
ExecuteOpAndWaitForServerBeingReady executes WildFly management operation on the pod
this operation is checked to succeed and then waits for the container is ready this method is assumed to be used for reload/restart operations returns error if execution was not processed successfully
func GetEnvAsDuration ¶
func GetEnvAsDuration(key string, fallbackDurationAmount int64, durationType time.Duration) time.Duration
GetEnvAsDuration returns defined environment variable as duration
while it expects the environment variable contains the number defined in duration type defined as a third parameter. The result will be returned as duration. If env variable is not found then the default value as duration is returned (defined by the duration type) e.g. call 'GetEnvAsDuration("TIMEOUT", 10, time.Second)' means search for the TIMEOUT env variable and the value is expected being defined in seconds, if the env var is not found then returns duration of 10 seconds
func GetEnvAsInt ¶
GetEnvAsInt returns defined environment variable as an integer
or default value is returned if the env var is not configured
func GetTransactionRecoveryPort ¶
GetTransactionRecoveryPort reads management to find out the recovery port
func IsAppServerRunningViaJBossCli ¶
IsAppServerRunningViaJBossCli runs JBoss CLI call to app server to find out if is in state 'running'
if 'running' then returns true, otherwise false when false is returned then error contains a message with app server's state
func IsMgmtOutcomeSuccesful ¶
IsMgmtOutcomeSuccesful verifies if the management operation was succcesfull
func ListSubsystems ¶
ListSubsystems list the available subsystems in the application server at the po
func MapMerge ¶
MapMerge merges the two maps together and returns the result. If one of them is nil then is ommitted from the merged result If both maps are null then an empty initialized map is returned The second map rewrites data of the first map in the result if there are such
func ReadJSONDataByIndex ¶
func ReadJSONDataByIndex(json interface{}, indexes ...string) interface{}
ReadJSONDataByIndex iterates over the JSON object to return
data saved at the provided index. It returns json data as interface{}.
func RemoveFromList ¶
RemoveFromList iterates over the list and removes all occurences
of the string s. The list without the s strings is returned.
func SanitizeVolumeName ¶
SanitizeVolumeName ensures that the given volume name is a valid DNS-1123 label accepted by Kubernetes.
Types ¶
type RemoteOperationsInterface ¶
type RemoteOperationsInterface interface { Execute(pod *corev1.Pod, command string) (string, error) SocketConnect(hostname string, port int32, command string) (string, error) VerifyLogContainsRegexp(pod *corev1.Pod, logFromTime *time.Time, regexpLineCheck *regexp.Regexp) (string, error) ObtainLogLatestTimestamp(pod *corev1.Pod) (*time.Time, error) }
var (
RemoteOps RemoteOperationsInterface
)
type RemoteOperationsStruct ¶
type RemoteOperationsStruct struct{}
func (RemoteOperationsStruct) ObtainLogLatestTimestamp ¶
ObtainLogLatestTimestamp reads log from pod and find out
what is the latest log record at the time and returns time stamp of the record
func (RemoteOperationsStruct) SocketConnect ¶
func (RemoteOperationsStruct) SocketConnect(hostname string, port int32, command string) (string, error)
SocketConnect send a command (a string) to the defined hostname and port
where it connects to with 'net.Dial' tcp connection
func (RemoteOperationsStruct) VerifyLogContainsRegexp ¶
func (RemoteOperationsStruct) VerifyLogContainsRegexp(pod *corev1.Pod, logFromTime *time.Time, regexpLineCheck *regexp.Regexp) (string, error)
VerifyLogContainsRegexp checks if a line in the log from the pod matches the provided regexp
the log could be limited to be taken from particular time further, when no time defined the log is not limited by time