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

CASMAUTO 32 : adding IUF BATS #629

Open
wants to merge 36 commits into
base: release/1.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
4ad86f7
CASMAUTO 32 : Adding IUF BATS
Pankhuri-Rajesh Nov 13, 2024
9619dd5
updates
Pankhuri-Rajesh Nov 29, 2024
369ec18
updated apis
Pankhuri-Rajesh Dec 2, 2024
4f59d37
updates dependency
Pankhuri-Rajesh Dec 4, 2024
b271cc6
updating dependencies
Pankhuri-Rajesh Dec 4, 2024
a9106d3
updating requirements
Pankhuri-Rajesh Dec 4, 2024
d671fe3
updating requirements
Pankhuri-Rajesh Dec 4, 2024
d1d2a4e
updating constraints
Pankhuri-Rajesh Dec 4, 2024
648cf41
updating constraints
Pankhuri-Rajesh Dec 4, 2024
b104abe
Merge branch 'release/1.6' into CASMAUTO-32
Pankhuri-Rajesh Dec 4, 2024
3848181
updating constraints added keycloak
Pankhuri-Rajesh Dec 4, 2024
d792730
updating apis main
Pankhuri-Rajesh Dec 4, 2024
892636a
final testing
Pankhuri-Rajesh Dec 5, 2024
5bde776
Merge branch 'release/1.6' into CASMAUTO-32
mharding-hpe Dec 5, 2024
f6654dc
final test
Pankhuri-Rajesh Dec 6, 2024
a3f7ee8
Merge branch 'release/1.6' into CASMAUTO-32
mharding-hpe Dec 7, 2024
e642e49
Merge branch 'release/1.6' into CASMAUTO-32
mharding-hpe Dec 9, 2024
a64b1dd
Merge branch 'release/1.6' into CASMAUTO-32
mharding-hpe Dec 10, 2024
3901cd4
Merge branch 'release/1.6' into CASMAUTO-32
mharding-hpe Dec 10, 2024
1a3c379
Merge branch 'release/1.6' into CASMAUTO-32
mharding-hpe Dec 11, 2024
ab0c305
pylint
Pankhuri-Rajesh Dec 11, 2024
53de69b
pylint changes
Pankhuri-Rajesh Dec 11, 2024
9321abb
pylint
Pankhuri-Rajesh Dec 11, 2024
a5277f0
pylint
Pankhuri-Rajesh Dec 11, 2024
4c51e43
final test
Pankhuri-Rajesh Dec 12, 2024
bfc6ac5
final test
Pankhuri-Rajesh Dec 12, 2024
ce3d6c1
Update constraints.txt
mharding-hpe Dec 12, 2024
13012f5
Apply suggestions from code review
mharding-hpe Dec 12, 2024
117e9ed
Linting
mharding-hpe Dec 12, 2024
4143c76
Modify comparision of exit code with non-zero instead of exit-code 1 …
Pankhuri-Rajesh Dec 13, 2024
2d139f0
Apply suggestions from code review
mharding-hpe Dec 13, 2024
979e9c8
Apply suggestions from code review
mharding-hpe Dec 13, 2024
e53730d
Apply suggestions from code review
Pankhuri-Rajesh Dec 16, 2024
a21c569
addresses PR comments for SAT
Pankhuri-Rajesh Dec 17, 2024
716591f
apis changes final
Pankhuri-Rajesh Dec 20, 2024
47c9d90
minor changes to bootprep and manifest scripts
Pankhuri-Rajesh Jan 2, 2025
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
2 changes: 2 additions & 0 deletions constraints.txt
Pankhuri-Rajesh marked this conversation as resolved.
Show resolved Hide resolved
mharding-hpe marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ jsonschema==3.2.0
# CSM 1.6 uses Kubernetes v1.24
kubernetes==24.2.0
oauthlib==3.2.2
packaging==21.3.0
pyasn1==0.5.1
pyasn1-modules==0.3.0
pyrsistent==0.18.0
python-dateutil==2.9.0
python-keycloak==0.27.1
PyYAML==6.0.1
requests==2.27.1
requests-oauthlib==2.0.0
Expand Down
28 changes: 28 additions & 0 deletions goss-testing/scripts/check_iuf_abort.sh
Srinivas-Anand-HPE marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
#
# MIT License
#
# (C) Copyright 2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#

/opt/cray/tests/install/ncn/scripts/python/iuf_run /opt/cray/tests/install/ncn/scripts/iuf_run_setup test-activity && \
sleep 10 && \
iuf -a test-activity abort -f
Binary file not shown.
54 changes: 54 additions & 0 deletions goss-testing/scripts/iuf_run_setup/management-bootprep.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# (C) Copyright 2024 Hewlett Packard Enterprise Development LP
---
schema_version: 1.0.2
configurations:
- name: "config-minimal-management-dummy-1.0.0"
layers:
- name: csm-ncn-nodes-{{csm.version}}
playbook: ncn_nodes.yml
product:
name: csm
version: "{{csm.version}}"
- name: csm-ncn-initrd-{{csm.version}}
playbook: ncn-initrd.yml
product:
name: csm
version: "{{csm.version}}"

images:
- name: "worker-image-dummy-product"
base:
product:
name: csm
version: "{{csm.version}}"
type: image
filter:
prefix: secure-kubernetes
configuration: "config-minimal-management-dummy-1.0.0"
configuration_group_names:
- Management_Worker

- name: "master-image-dummy-product"
base:
product:
name: csm
version: "{{csm.version}}"
type: image
filter:
prefix: secure-kubernetes
configuration: "config-minimal-management-dummy-1.0.0"
configuration_group_names:
- Management_Master

- name: "storage-image-dummy-product"
base:
product:
name: csm
version: "{{csm.version}}"
type: image
filter:
prefix: secure-storage-ceph
configuration: "config-minimal-management-dummy-1.0.0"
configuration_group_names:
- Management_Storage

34 changes: 34 additions & 0 deletions goss-testing/scripts/iuf_run_setup/product_vars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2024 Hewlett Packard Enterprise Development LP
---

# variables available for substitution
# --------------------------------------------------------
# {{name}} - product name from the product manifest
# {{version_x_y}} - x.y portion of the product version
# {{version_x_y_z}} - x.y.z portion of the product version
# {{working_branch}} - default working branch

# CAUTION
# version substitution in working_branches must be at the very end for automatic updates to
# work properly in the IUF `update-vcs-config` stage.
# ex: integration-{{version_x_y}} (will work correctly)
# ex: integration-{{version_x_y}}-test (will NOT work correctly)

# set site specific default working_branch with an entry in a default section in site_vars.yaml

# set default network_type to "mellanox" or "cassini" in the default section in site_vars.yaml

# set note and/or suffix to a value such as "test" in the default section in site_vars.yaml
# in order to namespace all CFS configurations, images and BOS session templates with that value.

# CAUTION: note and suffix are used to construct key values and thus spaces must be avoided

default:
working_branch: "integration-{{version_x_y_z}}"
network_type: "mellanox"
note: ""
suffix: ""
wlm: "future use"

dummy:
version: 1.0.0
41 changes: 41 additions & 0 deletions goss-testing/scripts/workflows/iuf_base_workflow.yaml
Pankhuri-Rajesh marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#
# MIT License
#
# (C) Copyright 2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: iuf-base-auto-workflow-
namespace: argo
spec:
arguments:
parameters:
- name: scriptContent
value: |
echo "This is a test script."
- name: dryRun
value: "true" # Set to "false" to execute the script
- name: script_output_file
value: "/tmp/my_output"
workflowTemplateRef:
name: iuf-base-template-auto
32 changes: 32 additions & 0 deletions goss-testing/scripts/workflows/update_cpc_workflow.yaml
Pankhuri-Rajesh marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# MIT License
#
# (C) Copyright 2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: update-product-catalog-auto-workflow-
namespace: argo
spec:
workflowTemplateRef:
name: update-product-catalog-template-auto
180 changes: 180 additions & 0 deletions goss-testing/scripts/workflowtemplates/iuf_base_template.yaml
Pankhuri-Rajesh marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
#
# MIT License
#
# (C) Copyright 2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: iuf-base-template-auto
namespace: argo
labels:
version: 4.0.3
spec:
volumes:
- name: ca-bundle
hostPath:
path: /var/lib/ca-certificates
type: Directory
- name: iuf
hostPath:
path: /etc/cray/upgrade/csm
type: Directory
entrypoint: shell-script
templates:
- name: shell-script
inputs:
parameters:
- name: scriptContent
description: |
The content of the script that will be run
- name: dryRun
description: >
A flag indicating whether to run the script or not. True means do
not run the script merely output it to a file.
- name: script_output_file
value: /tmp/script_output
description: >
The file containing any output the script chooses to write.
Writing to this file is optional. This file's name is stored in
the environment variable SCRIPT_OUTPUT_FILE, which is accessible
to the script.
outputs:
parameters:
- name: output
description: |
Output from the script
valueFrom:
path: '{{inputs.parameters.script_output_file}}'
metadata:
annotations:
sidecar.istio.io/inject: 'false'
retryStrategy:
limit: '1'
retryPolicy: Always
backoff:
duration: 10s
factor: '1'
maxDuration: 1m
script:
image: 'artifactory.algol60.net/csm-docker/stable/iuf:v0.1.12'
command:
- sh
source: >
#!/usr/bin/bash

ts=$(echo $RANDOM | md5sum | head -c 20; echo)

cat << 'EOF2' > "/tmp/${ts}.sh"

set -e

secret=`kubectl -n argo get serviceaccount/default -o
jsonpath='{.secrets[0].name}'`

if [[ -z "$secret" ]]; then
token=`kubectl -n argo create token default`
else
token=`kubectl -n argo get secret $secret -o jsonpath='{.data.token}'| base64 -d`
fi

mkdir -p mykubeconfig

cat << EOF > mykubeconfig/admin.conf

apiVersion: v1

kind: Config

current-context: default

contexts:
- context:
cluster: kubernetes
user: default
namespace: default
name: default
clusters:
- cluster:
server: https://kubeapi-vip.local:6442
insecure-skip-tls-verify: true
name: kubernetes
users:

- name: default
user:
token: ${token}
EOF

export KUBECONFIG=mykubeconfig/admin.conf

chmod 600 mykubeconfig/admin.conf

export TOKEN=$(curl -k -s -S -d grant_type=client_credentials \
-d client_id=admin-client \
-d client_secret=`kubectl get secrets admin-client-auth -o jsonpath='{.data.client-secret}' | base64 -d` \
https://api-gw-service-nmn.local/keycloak/realms/shasta/protocol/openid-connect/token | jq -r '.access_token')
API_GW="https://api-gw-service-nmn.local"

ADMIN_SECRET=$(kubectl get secrets admin-client-auth -o
jsonpath='{.data.client-secret}' | base64 -d)

curl -k -s -d grant_type=client_credentials \
-d client_id=admin-client \
-d client_secret=$ADMIN_SECRET https://api-gw-service-nmn.local/keycloak/realms/shasta/protocol/openid-connect/token > /tmp/setup-token.json
export CRAY_CREDENTIALS=/tmp/setup-token.json

cray init --hostname $API_GW --no-auth --overwrite > /dev/null

mkdir -p "$(dirname "{{inputs.parameters.script_output_file}}")"

touch {{inputs.parameters.script_output_file}}

{{inputs.parameters.scriptContent}}

EOF2

chmod +x /tmp/${ts}.sh

DRY_RUN={{inputs.parameters.dryRun}}

if [[ "$DRY_RUN" == "true" ]];then
echo "====================="
echo "=======DRY RUN======="
echo "====================="
cat /tmp/${ts}.sh
touch {{inputs.parameters.script_output_file}}
else
bash -e /tmp/${ts}.sh
fi

if [ ! -s {{inputs.parameters.script_output_file}} ]; then
echo "{}" | tee {{inputs.parameters.script_output_file}}
fi
env:
- name: SCRIPT_OUTPUT_FILE
value: '{{inputs.parameters.script_output_file}}'
volumeMounts:
- name: ca-bundle
mountPath: /var/lib/ca-certificates
- name: iuf
mountPath: /etc/cray/upgrade/csm
Loading
Loading