Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[patch] Update FVT needs to be started after install #1416

Merged
merged 4 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions image/cli/app-root/src/update-configmap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
MAX_RETRIES=${MAX_RETRIES:-50} # Just over 4 hours hours
DELAY=${DELAY:-300} # 5 minute interval
IGNORE_FAILURE=${IGNORE_FAILURE:-False} # Return success RC even if pipelinerun failed
CONFIGMAP_KEY=STATUS

while [[ $# -gt 0 ]]
do
key="$1"
Expand All @@ -24,10 +26,6 @@ do
CONFIGMAP_NAME=$1
shift
;;
--key)
CONFIGMAP_KEY=$1
shift
;;
--value)
CONFIGMAP_VALUE=$1
shift
Expand Down
11 changes: 3 additions & 8 deletions image/cli/app-root/src/wait-for-configmap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
MAX_RETRIES=${MAX_RETRIES:-50} # Just over 4 hours hours
DELAY=${DELAY:-300} # 5 minute interval
IGNORE_FAILURE=${IGNORE_FAILURE:-False} # Return success RC even if pipelinerun failed
CONFIGMAP_KEY=STATUS
ESCAPE_CONFIGMAP_KEY=STATUS

while [[ $# -gt 0 ]]
do
key="$1"
Expand All @@ -26,10 +29,6 @@ do
CONFIGMAP_NAME=$1
shift
;;
--key)
CONFIGMAP_KEY=$1
shift
;;
--initial-value)
CONFIGMAP_INITIAL_VALUE=$1
shift
Expand All @@ -44,10 +43,6 @@ do
ESCAPE_CONFIGMAP_NAME=$1
shift
;;
--escape-key)
ESCAPE_CONFIGMAP_KEY=$1
shift
;;

--max-retries)
MAX_RETRIES=$1
Expand Down
9 changes: 4 additions & 5 deletions python/src/mas/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def lookupTargetArchitecture(self, architecture: str = None) -> None:
self.fatalError(f"Unsupported worker node architecture: {self.architecture}")

@logMethodCall
def initializeApprovalConfigMap(self, namespace: str, id: str, key: str = None, maxRetries: int = 100, delay: int = 300, ignoreFailure: bool = True) -> None:
def initializeApprovalConfigMap(self, namespace: str, id: str, enabled: bool, maxRetries: int = 100, delay: int = 300, ignoreFailure: bool = True) -> None:
"""
Set key = None if you don't want approval workflow enabled
"""
Expand All @@ -388,8 +388,7 @@ def initializeApprovalConfigMap(self, namespace: str, id: str, key: str = None,
"MAX_RETRIES": str(maxRetries),
"DELAY": str(delay),
"IGNORE_FAILURE": str(ignoreFailure),
"CONFIGMAP_KEY": key,
key: ""
"STATUS": ""
}
}

Expand All @@ -400,6 +399,6 @@ def initializeApprovalConfigMap(self, namespace: str, id: str, key: str = None,
except NotFoundError:
pass

if key is not None:
logger.debug(f"Enabling approval workflow for {id} using {key} with {maxRetries} max retries on a {delay}s delay ({'ignoring failures' if ignoreFailure else 'abort on failure'})")
if enabled:
logger.debug(f"Enabling approval workflow for {id} with {maxRetries} max retries on a {delay}s delay ({'ignoring failures' if ignoreFailure else 'abort on failure'})")
cmAPI.create(body=configMap, namespace=namespace)
21 changes: 10 additions & 11 deletions python/src/mas/cli/install/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,16 +904,15 @@ def nonInteractiveMode(self) -> None:

if value != "":
valueParts = value.split(":")
if len(valueParts) != 4:
self.fatalError(f"Unsupported format for {key} ({value}). Expected APPROVAL_KEY:MAX_RETRIES:RETRY_DELAY:IGNORE_FAILURE")
if len(valueParts) != 3:
self.fatalError(f"Unsupported format for {key} ({value}). Expected MAX_RETRIES:RETRY_DELAY:IGNORE_FAILURE")
else:
try:
self.approvals[key]["approvalKey"] = valueParts[0]
self.approvals[key]["maxRetries"] = int(valueParts[1])
self.approvals[key]["retryDelay"] = int(valueParts[2])
self.approvals[key]["ignoreFailure"] = bool(valueParts[3])
self.approvals[key]["maxRetries"] = int(valueParts[0])
self.approvals[key]["retryDelay"] = int(valueParts[1])
self.approvals[key]["ignoreFailure"] = bool(valueParts[2])
except ValueError:
self.fatalError(f"Unsupported format for {key} ({value}). Expected string:int:int:boolean")
self.fatalError(f"Unsupported format for {key} ({value}). Expected int:int:boolean")

# Arguments that we don't need to do anything with
elif key in ["accept_license", "dev_mode", "skip_pre_check", "skip_grafana_install", "no_confirm", "no_wait_for_pvc", "help", "advanced", "simplified"]:
Expand Down Expand Up @@ -1094,11 +1093,11 @@ def setupApprovals(self, namespace: str) -> None:
- present with the chosen state field initialized to ""
"""
for approval in self.approvals.values():
if "approvalKey" in approval:
if "maxRetries" in approval:
# Enable this approval workload
logger.debug(f"Approval workflow for {approval['id']} will be enabled during install ({approval['maxRetries']} / {approval['retryDelay']}s / {approval['approvalKey']} / {approval['ignoreFailure']})")
self.initializeApprovalConfigMap(namespace, approval['id'], approval['approvalKey'], approval['maxRetries'], approval['retryDelay'], approval['ignoreFailure'])
logger.debug(f"Approval workflow for {approval['id']} will be enabled during install ({approval['maxRetries']} / {approval['retryDelay']}s / {approval['ignoreFailure']})")
self.initializeApprovalConfigMap(namespace, approval['id'], True, approval['maxRetries'], approval['retryDelay'], approval['ignoreFailure'])
else:
# Disable this approval workload
logger.debug(f"Approval workflow for {approval['id']} will be disabled during install")
self.initializeApprovalConfigMap(namespace, approval['id'])
self.initializeApprovalConfigMap(namespace, approval['id'], False)
2 changes: 1 addition & 1 deletion python/src/mas/cli/install/argParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ def isValidFile(parser, arg) -> str:

# Approvals
# -----------------------------------------------------------------------------
approvalsGroup = installArgParser.add_argument_group("Integrated Approval Workflow (APPROVAL_KEY:MAX_RETRIES:RETRY_DELAY:IGNORE_FAILURE)")
approvalsGroup = installArgParser.add_argument_group("Integrated Approval Workflow (MAX_RETRIES:RETRY_DELAY:IGNORE_FAILURE)")
approvalsGroup.add_argument(
"--approval-core",
default="",
Expand Down
2 changes: 0 additions & 2 deletions tekton/generate-tekton-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
- fvt-optimizer
- fvt-predict
- fvt-sls
- fvt-upgrade-post
- fvt-upgrade-pre
- fvt-visualinspection
- fvt-launcher
- fvt-dynamicscan
Expand Down
4 changes: 3 additions & 1 deletion tekton/generate-tekton-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@
- fvt-monitor
- fvt-run-suite
- fvt-sls
- fvt-uninstall
- fvt-start-update
- fvt-start-upgrade
- fvt-start-uninstall

- name: Generate Tasks (FVT Launchers)
ansible.builtin.template:
Expand Down
Loading
Loading