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

Adding Vsphere Functionality to deployment #489

Open
wants to merge 103 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
74a7c22
adding aap argocd and gitea for vsphere
tosin2013 Jul 20, 2022
1166b3a
Merge branch 'main' into vsphere
tosin2013 Jul 27, 2022
c7287b7
updating code
tosin2013 Jul 27, 2022
810e8a4
adding deploy-ztp-vsphere pipeline
tosin2013 Jul 27, 2022
4c124b8
updating validation check
tosin2013 Jul 27, 2022
1fd045c
testing build
tosin2013 Jul 28, 2022
43b69e3
building container to test with
tosin2013 Jul 28, 2022
d010656
correcting line 5
tosin2013 Jul 28, 2022
abafd2d
correcting line 5
tosin2013 Jul 28, 2022
581a949
adding quotes to make file
tosin2013 Jul 28, 2022
eaa7c6c
changing quay user
tosin2013 Jul 28, 2022
4af1708
testing preflight script
tosin2013 Jul 28, 2022
c31bb37
adding to-do
tosin2013 Jul 28, 2022
fee4bed
updating code
tosin2013 Jul 29, 2022
3c58dbc
updating code
tosin2013 Jul 29, 2022
67b528e
Merge branch 'main' into vsphere
tosin2013 Jul 29, 2022
ff681bf
updating contrib folder
tosin2013 Jul 29, 2022
e649df3
correcting ansible check
tosin2013 Jul 29, 2022
2d2ce40
adding deploy-openshift-ztp-vshpere.yaml template
tosin2013 Jul 29, 2022
b85a4fb
Merge branch 'rh-ecosystem-edge:main' into main
tosin2013 Jul 29, 2022
b99252a
removing deploy-ztp-vsphere.yaml
tosin2013 Jul 29, 2022
2f6d356
Merge branch 'main' of github.com:tosin2011/ztp-pipeline-relocatable
tosin2013 Jul 29, 2022
b51278b
deploy-openshift-ztp-vshpere.yaml to contrib
tosin2013 Jul 29, 2022
5d46bcb
udpate task
tosin2013 Jul 29, 2022
48cb055
correcting task
tosin2013 Jul 29, 2022
53b2743
change kustomize
tosin2013 Jul 29, 2022
51fcc57
correcting task name
tosin2013 Jul 29, 2022
8a1a9ba
correcting syntax
tosin2013 Jul 29, 2022
b2d231e
updating code
tosin2013 Jul 29, 2022
6d57872
adding mock variable
tosin2013 Jul 29, 2022
1aada8a
updating deploy.sh script
tosin2013 Jul 29, 2022
27cc55b
testing deploy.sh
tosin2013 Aug 1, 2022
ece7a5d
updating path
tosin2013 Aug 1, 2022
774a16b
updating deploy app
tosin2013 Aug 1, 2022
17f2fbf
updating task scripts
tosin2013 Aug 1, 2022
e032198
Merge pull request #1 from rh-ecosystem-edge/main
tosin2013 Aug 1, 2022
d9fced4
Merge branch 'main' into vsphere
tosin2013 Aug 1, 2022
7373aa3
updating code
tosin2013 Aug 1, 2022
cf7ce29
udpating code
tosin2013 Aug 3, 2022
5b692ad
Merge branch 'rh-ecosystem-edge:main' into main
tosin2013 Aug 3, 2022
aab553f
change name and create pipeline for openshift-ztp
tosin2013 Aug 3, 2022
9918bfa
updating code
tosin2013 Aug 3, 2022
93c2978
correcting task name
tosin2013 Aug 3, 2022
d025d69
correcting run after
tosin2013 Aug 3, 2022
989b12c
correcting run after command
tosin2013 Aug 3, 2022
e54bf42
correcting pipeline call
tosin2013 Aug 4, 2022
301f177
correcting app script
tosin2013 Aug 5, 2022
dae5a8c
Finially a good run
tosin2013 Aug 5, 2022
f7c3b79
adding new piepline giles
tosin2013 Aug 5, 2022
b80e3fd
updating kustomize
tosin2013 Aug 5, 2022
1203f33
fixing
tosin2013 Aug 5, 2022
aba9678
udpating kubectl env variables
tosin2013 Aug 5, 2022
6f95e1b
correcting gitea script
tosin2013 Aug 5, 2022
1e0cde6
Merge branch 'rh-ecosystem-edge:main' into main
tosin2013 Aug 5, 2022
9db552a
Merge branch 'main' into vsphere
tosin2013 Aug 6, 2022
51e462b
adding reflector
tosin2013 Aug 7, 2022
b71e01e
adding relector
tosin2013 Aug 7, 2022
e286aad
reflector
tosin2013 Aug 7, 2022
106f6e9
testing
tosin2013 Aug 7, 2022
b4551f5
testing
tosin2013 Aug 7, 2022
60ffe44
adding pipeline run name
tosin2013 Aug 7, 2022
18e6042
testing deploy.sh
tosin2013 Aug 7, 2022
5a8daa4
adding pipeline-name to tekton tasks
tosin2013 Aug 8, 2022
836321b
updating pipeline-name in contrib
tosin2013 Aug 8, 2022
5a92835
updating code
tosin2013 Aug 8, 2022
dc609c6
adding configure openshift cluster
tosin2013 Aug 8, 2022
9d734f2
adding configure openshift for vsphere
tosin2013 Aug 8, 2022
7846cf3
correcting folder name
tosin2013 Aug 8, 2022
7430736
udpating reflector install
tosin2013 Aug 8, 2022
6e4572f
updating code for reflector
tosin2013 Aug 8, 2022
a5c6b48
adding rolebinding for reflector
tosin2013 Aug 8, 2022
5e784fe
updating codebase
tosin2013 Aug 8, 2022
101e7d9
just testing
tosin2013 Aug 8, 2022
80a43e9
updating ansible steps
tosin2013 Aug 8, 2022
8e9d65c
updating code
tosin2013 Aug 8, 2022
8b60433
udpating code again
tosin2013 Aug 8, 2022
e7d801d
testing ansible
tosin2013 Aug 8, 2022
2c6e595
testing pull secret
tosin2013 Aug 8, 2022
ce9fcce
adding more stuff to install
tosin2013 Aug 8, 2022
3b086e8
ansible_python_interpreter=/usr/bin/python3
tosin2013 Aug 8, 2022
ef14135
adding -vv
tosin2013 Aug 8, 2022
abba130
adding multiclusterhub dependency
tosin2013 Aug 8, 2022
5425f28
update code
tosin2013 Aug 8, 2022
1e89864
Merge branch 'rh-ecosystem-edge:main' into main
tosin2013 Aug 11, 2022
ec418ed
updating
tosin2013 Aug 11, 2022
4f31697
Merge branch 'main' into vsphere
tosin2013 Aug 11, 2022
3276326
adding s3 download for tower manifest
tosin2013 Aug 11, 2022
1d87f66
updating code
tosin2013 Aug 11, 2022
377f11a
updating code
tosin2013 Aug 11, 2022
686b025
updating code
tosin2013 Aug 11, 2022
04b7d2c
Merge branch 'vsphere' of github.com:tosin2013/ztp-pipeline-relocatab…
tosin2013 Aug 11, 2022
f5f7b7d
updating code
tosin2013 Aug 11, 2022
33dafd4
updating code
tosin2013 Aug 11, 2022
a0655cd
adding vsphere creds
tosin2013 Aug 11, 2022
1262656
adding comment
tosin2013 Aug 11, 2022
3de8eea
Merge branch 'rh-ecosystem-edge:main' into main
tosin2013 Aug 22, 2022
f847c43
Merge branch 'rh-ecosystem-edge:main' into main
tosin2013 Aug 24, 2022
49c90dd
updating dir
tosin2013 Aug 25, 2022
938b442
Merge branch 'main' into vsphere
tosin2013 Aug 25, 2022
43c39a5
updating
tosin2013 Aug 25, 2022
5ca3528
updating
tosin2013 Aug 25, 2022
ec174a5
Merge branch 'rh-ecosystem-edge:main' into vsphere
tosin2013 Sep 29, 2022
f807806
updating ansbile pipeline
tosin2013 Sep 30, 2022
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
62 changes: 62 additions & 0 deletions contrib/configure-openshift-ztp/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env bash

set -o errexit
set -o pipefail
set -o nounset
set -m



if ./verify.sh; then
# Load common vars
source ${WORKDIR}/shared-utils/common.sh
echo ">>>> Deploy manifests to create template namespace on HUB Cluster"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"

##############################################################################
# Here can be added other manifests to create the required resources
##############################################################################
### TEMPORARY INSTALLING the packages for ansible:
yum install epel-next-release -y
yum install ansible git python3-pip unzip -y

##############################################################################
# Assuming you have an OCP 4.9+ cluster deployed with OpenShift Assisted Installer Service (OAS), you can simply run the following to bootstrap it into a Hub Cluster:
# https://github.com/Red-Hat-SE-RTO/openshift-ztp
##############################################################################
git clone ${OPENSHIFT_ZTP_VSPHERE_REPO}
cd openshift-ztp
## Install needed pip modules
pip3 install -r ./requirements.txt
pip3 install kubernetes openshift

## Install needed Ansible Collections
ansible-galaxy collection install -r ./collections/requirements.yml

## Collecting Manifest.zip for AA
## Configure the Hub cluster Operators and Workloads, namely RHACM, AAP2, and RH GitOps (ArgoCD)
ls -lath /opt/ztp
sleep 5s

TOWER_MAINFEST_ZIP=$(ls /opt/ztp| grep manifest_tower)
if [ -z "${TOWER_MAINFEST_ZIP}" ]; then
echo "ERROR: Tower manifest zip file not found in $/opt/ztp"
exit 1
fi
ansible-playbook ansible/2_configure.yaml \
-e configure_rhacm=true \
-e configure_aap2_controller=true \
-e configure_rh_gitops=true \
-e use_services_not_routes=false \
-e pull_secret_path="${PULL_SECRET}" -e 'ansible_python_interpreter=/usr/bin/python3' \
-e subscription_manifest_path="/opt/ztp/${TOWER_MAINFEST_ZIP}" -vv


##############################################################################
# End of customization
##############################################################################

fi

echo ">>>>EOF"
echo ">>>>>>>"
33 changes: 33 additions & 0 deletions contrib/configure-openshift-ztp/verify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

set -o pipefail
set -o nounset
set -m

# variables
# #########
# uncomment it, change it or get it from gh-env vars (default behaviour: get from gh-env)
# export KUBECONFIG=/root/admin.kubeconfig

# Load common vars
source ${WORKDIR}/shared-utils/common.sh

if [[ $(oc get ns | grep dummy-namespace | wc -l) -eq 0 || $(oc get AutomationController -n dummy-namespace --no-headers | wc -l) -eq 0 ]]; then
#dummy-namespace namespace does not exist. Launching the step to create it...
exit 0
elif [[ $(oc get pod -n dummy-namespace | grep -i running | wc -l) -eq $(oc get pod -n dummy-namespace | grep -v NAME | wc -l) ]]; then
#All pods for DUMMY running...Skipping the step to create it
exit 1
elif [[ $(oc get multiclusterhub multiclusterhub -n open-cluster-management | grep Running | wc -l) -eq 0 ]]; then
#All pods for DUMMY running...Skipping the step to create it
echo "A multiclusterhub is not running"
exit 1
else
#Some pods are failing...Stop pipe to solve it #TODO this scenario we should remove the subscription and destroy everything and relaunch again
exit 50
fi

oc get multiclusterhub multiclusterhub -n open-cluster-management | grep Running | wc -l

echo ">>>>EOF"
echo ">>>>>>>"
51 changes: 51 additions & 0 deletions contrib/credentials-openshift-ztp/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash

set -o errexit
set -o pipefail
set -o nounset
set -m



if ./verify.sh; then
# Load common vars
source ${WORKDIR}/shared-utils/common.sh
echo ">>>> Deploy manifests to create template namespace on HUB Cluster"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"

##############################################################################
# Here can be added other manifests to create the required resources
##############################################################################
### TEMPORARY INSTALLING the packages for ansible:
yum install epel-next-release -y
yum install ansible git python3-pip -y

##############################################################################
# Assuming you have an OCP 4.9+ cluster deployed with OpenShift Assisted Installer Service (OAS), you can simply run the following to bootstrap it into a Hub Cluster:
# https://github.com/Red-Hat-SE-RTO/openshift-ztp
##############################################################################
git clone ${OPENSHIFT_ZTP_VSPHERE_REPO}
cd openshift-ztp
## Install needed pip modules
pip3 install -r ./requirements.txt
pip3 install kubernetes openshift

## Install needed Ansible Collections
ansible-galaxy collection install -r ./collections/requirements.yml

## Create credentials for vSphere Infrastructure, Pull Secret, Git credentials, etc
ansible-playbook \
-e vcenter_username="[email protected]" \
-e vcenter_password='somePass!' \
-e vcenter_fqdn="vcenter.example.com" \
ansible/3_create_credentials.yaml -e 'ansible_python_interpreter=/usr/bin/python3' -vv


##############################################################################
# End of customization
##############################################################################

fi

echo ">>>>EOF"
echo ">>>>>>>"
31 changes: 31 additions & 0 deletions contrib/credentials-openshift-ztp/verify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

set -o pipefail
set -o nounset
set -m

# variables
# #########
# uncomment it, change it or get it from gh-env vars (default behaviour: get from gh-env)
# export KUBECONFIG=/root/admin.kubeconfig

# Load common vars
source ${WORKDIR}/shared-utils/common.sh

if [[ $(oc get ns | grep dummy-namespace | wc -l) -eq 0 || $(oc get AutomationController -n dummy-namespace --no-headers | wc -l) -eq 0 ]]; then
#dummy-namespace namespace does not exist. Launching the step to create it...
exit 0
elif [[ $(oc get pod -n dummy-namespace | grep -i running | wc -l) -eq $(oc get pod -n dummy-namespace | grep -v NAME | wc -l) ]]; then
#All pods for DUMMY running...Skipping the step to create it
exit 1
elif [[ $(oc get multiclusterhub multiclusterhub -n open-cluster-management | grep Running | wc -l) -eq 0 ]]; then
#All pods for DUMMY running...Skipping the step to create it
echo "A multiclusterhub is not running"
exit 1
else
#Some pods are failing...Stop pipe to solve it #TODO this scenario we should remove the subscription and destroy everything and relaunch again
exit 50
fi

echo ">>>>EOF"
echo ">>>>>>>"
36 changes: 36 additions & 0 deletions contrib/deploy-aap/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

set -o errexit
set -o pipefail
set -o nounset
set -m



if ./verify.sh; then
# Load common vars
source ${WORKDIR}/shared-utils/common.sh
echo ">>>> Deploy manifests to create template namespace on HUB Cluster"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"

##############################################################################
# Here can be added other manifests to create the required resources
##############################################################################

oc --kubeconfig=${KUBECONFIG_HUB} apply -f manifests/01-namespace.yml
sleep 2
oc --kubeconfig=${KUBECONFIG_HUB} apply -f manifests/02-operatorgroup.yml
sleep 2
oc --kubeconfig=${KUBECONFIG_HUB} apply -f manifests/03-subscription.yml
sleep 2
check_resource "crd" "automationhubs.automationhub.ansible.com" "Established" "ansible-automation-platform" "${KUBECONFIG_HUB}"
oc --kubeconfig=${KUBECONFIG_HUB} apply -f manifests/04-instance.yml

##############################################################################
# End of customization
##############################################################################

fi

echo ">>>>EOF"
echo ">>>>>>>"
4 changes: 4 additions & 0 deletions contrib/deploy-aap/manifests/01-namespace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kind: Namespace
apiVersion: v1
metadata:
name: ansible-automation-platform
7 changes: 7 additions & 0 deletions contrib/deploy-aap/manifests/02-operatorgroup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: ansible-automation-platform
namespace: ansible-automation-platform
spec: {}
13 changes: 13 additions & 0 deletions contrib/deploy-aap/manifests/03-subscription.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
labels:
operators.coreos.com/ansible-automation-platform-operator.ansible-automation-platfor: ''
name: ansible-automation-platform-operator
namespace: ansible-automation-platform
spec:
channel: stable-2.2-cluster-scoped
installPlanApproval: Automatic
name: ansible-automation-platform-operator
source: redhat-operators
sourceNamespace: openshift-marketplace
43 changes: 43 additions & 0 deletions contrib/deploy-aap/manifests/04-instance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: automationcontroller.ansible.com/v1beta1
kind: AutomationController
metadata:
labels:
app.kubernetes.io/component: automationcontroller
app.kubernetes.io/managed-by: automationcontroller-operator
app.kubernetes.io/name: ac-tower
app.kubernetes.io/operator-version: ''
app.kubernetes.io/part-of: ac-tower
name: ac-tower
namespace: ansible-automation-platform
spec:
ee_resource_requirements:
limits:
cpu: 2000m
requests:
cpu: 500m
create_preload_data: true
route_tls_termination_mechanism: Edge
garbage_collect_secrets: false
loadbalancer_port: 80
projects_use_existing_claim: _No_
task_resource_requirements:
limits:
cpu: 2000m
requests:
cpu: 500m
image_pull_policy: IfNotPresent
projects_storage_size: 8Gi
admin_email: [email protected]
task_privileged: false
projects_storage_class: ocs-storagecluster-ceph-rbd
projects_storage_access_mode: ReadWriteOnce
web_resource_requirements:
limits:
cpu: 2000m
requests:
cpu: 500m
projects_persistence: true
replicas: 1
admin_user: admin
loadbalancer_protocol: http
nodeport_port: 30080
31 changes: 31 additions & 0 deletions contrib/deploy-aap/verify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

set -o pipefail
set -o nounset
set -m

# variables
# #########
# uncomment it, change it or get it from gh-env vars (default behaviour: get from gh-env)
# export KUBECONFIG=/root/admin.kubeconfig

# Load common vars
source ${WORKDIR}/shared-utils/common.sh

if [[ $(oc get ns | grep ansible-automation-platform | wc -l) -eq 0 || $(oc get AutomationController -n ansible-automation-platform --no-headers | wc -l) -eq 0 ]]; then
#ansible-automation-platform namespace does not exist. Launching the step to create it...
exit 0
elif [[ $(oc get pod -n ansible-automation-platform | grep -i running | wc -l) -eq $(oc get pod -n ansible-automation-platform | grep -v NAME | wc -l) ]]; then
#All pods for AAP running...Skipping the step to create it
exit 1
elif [[ $(oc get multiclusterhub multiclusterhub -n open-cluster-management | grep Running | wc -l) -eq 0 ]]; then
#All pods for DUMMY running...Skipping the step to create it
echo "A multiclusterhub is not running"
exit 1
else
#Some pods are failing...Stop pipe to solve it #TODO this scenario we should remove the subscription and destroy everything and relaunch again
exit 50
fi

echo ">>>>EOF"
echo ">>>>>>>"
35 changes: 35 additions & 0 deletions contrib/deploy-argocd/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment regarding the question about why need argocd ;)


set -o errexit
set -o pipefail
set -o nounset
set -m

if ./verify.sh; then
# Load common vars
source ${WORKDIR}/shared-utils/common.sh

echo ">>>> Deploy manifests to create template namespace in: HUB Cluster"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo "Extract Kubeconfig for HUB Cluster}"

##############################################################################
# Here can be added other manifests to create the required resources
##############################################################################

oc --kubeconfig=${KUBECONFIG_HUB} apply -f manifests/01-namespace.yml
sleep 2
oc --kubeconfig=${KUBECONFIG_HUB} apply -f manifests/02-subscription.yml
sleep 2
check_resource "crd" "gitopsservices.pipelines.openshift.io" "Established" "argocd" "${KUBECONFIG_HUB}"
oc --kubeconfig=${KUBECONFIG_HUB} apply -f manifests/03-instance.yml
sleep 2

##############################################################################
# End of customization
##############################################################################

fi

echo ">>>>EOF"
echo ">>>>>>>"
4 changes: 4 additions & 0 deletions contrib/deploy-argocd/manifests/01-namespace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kind: Namespace
apiVersion: v1
metadata:
name: argocd
16 changes: 16 additions & 0 deletions contrib/deploy-argocd/manifests/02-subscription.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
creationTimestamp: null
name: openshift-gitops-operator
namespace: openshift-operators
spec:
channel: stable
installPlanApproval: Automatic
name: openshift-gitops-operator
source: redhat-operators
sourceNamespace: openshift-marketplace
config:
env:
- name: ARGOCD_CLUSTER_CONFIG_NAMESPACES
value: '*'
Loading