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 13 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
2 changes: 1 addition & 1 deletion .github/workflows/build-and-push-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Build and Publish
on:
push:
branches: [main]
branches: [main, vsphere]
tosin2013 marked this conversation as resolved.
Show resolved Hide resolved
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
CI_FOLDER = images
PIPE_IMAGE ?= quay.io/ztpfw/pipeline
UI_IMAGE = quay.io/ztpfw/ui
#Default: PIPELINE_ACCOUNT = ztpfw
PIPELINE_ACCOUNT = takinosh
tosin2013 marked this conversation as resolved.
Show resolved Hide resolved
PIPE_IMAGE ?= quay.io/${PIPELINE_ACCOUNT}/pipeline
UI_IMAGE = quay.io/${PIPELINE_ACCOUNT}/ui
BRANCH ?= $(shell git branch --show-current | tr '[:upper:]' '[:lower:]' | tr '\/' '-')
HASH := $(shell git rev-parse HEAD)
RELEASE ?= latest
Expand Down
4 changes: 4 additions & 0 deletions contrib/deploy-aap/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/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/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.1-cluster-scoped
installPlanApproval: Automatic
name: ansible-automation-platform-operator
source: redhat-operators
sourceNamespace: openshift-marketplace
43 changes: 43 additions & 0 deletions contrib/deploy-aap/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
65 changes: 65 additions & 0 deletions contrib/deploy-aap/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env bash

set -o pipefail
set -o nounset
set -o errexit
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

if ./verify.sh; then

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

oc apply -f 01-namespace.yml
sleep 2

echo ">>>> Deploy manifests to install AAP"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
oc apply -f 02-operatorgroup.yml
sleep 10
oc apply -f 03-subscription.yml -o yaml --dry-run=client | oc apply -f -

OC_COMMAND=$(oc get csv -n ansible-automation-platform | grep "Ansible Automation Platform" | grep Succeeded | wc -l)
timeout=0
while [ "${timeout}" -lt "120" ]; do
if [[ ${OC_COMMAND} -eq 1 ]]; then
ready=true
break
fi
echo "Wait for Ansible Automation Platform"
sleep 5
timeout=$((timeout + 1))
OC_COMMAND=$(oc get csv -n ansible-automation-platform | grep "Ansible Automation Platform" | grep Succeeded | wc -l)
done
Copy link
Contributor

Choose a reason for hiding this comment

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

In the common.sh file there is a check_resources which do exactly this part. An example:

echo "Installing NFD operator for ${edgecluster}"
        oc --kubeconfig=${EDGE_KUBECONFIG} apply -f manifests/01-nfd-namespace.yaml
        sleep 2
        oc --kubeconfig=${EDGE_KUBECONFIG} apply -f manifests/02-nfd-operator-group.yaml
        sleep 2
        oc --kubeconfig=${EDGE_KUBECONFIG} apply -f manifests/03-nfd-subscription.yaml
        sleep 2

        check_resource "crd" "nodefeaturediscoveries.nfd.openshift.io" "Established" "openshift-nfd" "${EDGE_KUBECONFIG}"



echo ">>>> Deploy AAP instance"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>"
oc apply -f 04-instance.yml


echo ">>>> Wait until acm ready"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>"
timeout=0
ready=false
sleep 240
while [ "${timeout}" -lt "120" ]; do
if [[ $(oc get pod -n ansible-automation-platform | grep ac- | grep -i running | wc -l) -eq $(oc get pod -n ansible-automation-platform | grep ac- | wc -l) ]]; then
ready=true
break
fi
sleep 5
timeout=$((timeout + 1))
Copy link
Contributor

Choose a reason for hiding this comment

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

same than before

elif [[ $? -eq 50 ]]; then
echo ">>>> Verify failed...Some pods are failing..." #TODO change to remove and launch again
exit 50
else
echo ">>>> This step is not neccesary, everything looks ready"
fi
echo ">>>>EOF"
echo ">>>>>>>"
17 changes: 17 additions & 0 deletions contrib/deploy-aap/verify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/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

echo "development"
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to make it clear, the idea of the contrib framework is to have an interface with 2 functions:

  • Deploy.sh -> deploy resources for a specific resource/operator/item
  • Verify.sh -> verify if there's present to skip this task. The verification should be a functional test to know if the resources are ready and running.

So, said that, in this part an example of verify could be:

Verify.sh

echo ">>>>EOF"
echo ">>>>>>>"
4 changes: 4 additions & 0 deletions contrib/deploy-argocd/01-namespace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kind: Namespace
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need argocd? Maybe I'm wrong or missing something but I think we don't need argocd to deploy it

apiVersion: v1
metadata:
name: argocd
16 changes: 16 additions & 0 deletions contrib/deploy-argocd/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: '*'
123 changes: 123 additions & 0 deletions contrib/deploy-argocd/03-instance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
kind: ArgoCD
apiVersion: argoproj.io/v1alpha1
metadata:
creationTimestamp: null
name: openshift-gitops
namespace: argocd
spec:
controller:
processors: {}
resources:
limits:
cpu: 2000m
memory: 2048Mi
requests:
cpu: 250m
memory: 1024Mi
sharding: {}
dex:
openShiftOAuth: true
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 250m
memory: 128Mi
ha:
enabled: false
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 250m
memory: 128Mi
redis:
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 250m
memory: 128Mi
repo:
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 250m
memory: 256Mi
server:
autoscale:
enabled: false
grpc:
ingress:
enabled: false
ingress:
enabled: false
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 125m
memory: 128Mi
insecure: true
replicas: 1
route:
enabled: true
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
service:
type: ''
grafana:
enabled: false
size: 1
ingress:
enabled: false
route:
enabled: false
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
prometheus:
enabled: false
ingress:
enabled: false
route:
enabled: false
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
initialSSHKnownHosts: {}
applicationSet:
resources:
limits:
cpu: '2'
memory: 1Gi
requests:
cpu: 250m
memory: 512Mi
rbac:
defaultPolicy: 'role:admin'
policy: |
g, cluster-admins, role:admin
g, admins, role:admin
scopes: '[groups]'
resourceExclusions: |
- apiGroups:
- internal.open-cluster-management.io
kinds:
- ManagedClusterInfo
clusters:
- "*"
- apiGroups:
- tekton.dev
clusters:
- '*'
kinds:
- TaskRun
- PipelineRun
60 changes: 60 additions & 0 deletions contrib/deploy-argocd/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/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 pipefail
set -o nounset
set -o errexit
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

if ./verify.sh; then

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

oc apply -f 01-namespace.yml

echo ">>>> Deploy manifests to install OpenShift Gitops "
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
oc apply -f 02-subscription.yml -o yaml --dry-run=client | oc apply -f -

OC_COMMAND=$(oc get csv -n argocd | grep "Red Hat OpenShift GitOps" | grep Succeeded | wc -l)
timeout=0
while [ "${timeout}" -lt "120" ]; do
if [[ ${OC_COMMAND} -eq 1 ]]; then
ready=true
break
fi
echo "Wait for Red Hat OpenShift GitOps"
sleep 5
timeout=$((timeout + 1))
OC_COMMAND=$(oc get csv -n argocd | grep "Red Hat OpenShift GitOps" | grep Succeeded | wc -l)
done

echo ">>>> Deploy OpenShift Gitops instance"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>"
oc apply -f 03-instance.yml

echo ">>>> Wait until OpenShift Gitops ready"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>"
timeout=0
ready=false
sleep 240
while [ "${timeout}" -lt "120" ]; do
if [[ $(oc get pod -n argocd | grep -i running | wc -l) -eq $(oc get pod -n argocd | grep -v NAME | wc -l) ]]; then
ready=true
break
fi
sleep 5
timeout=$((timeout + 1))
elif [[ $? -eq 50 ]]; then
echo ">>>> Verify failed...Some pods are failing..." #TODO change to remove and launch again
exit 50
else
echo ">>>> This step is not neccesary, everything looks ready"
fi
echo ">>>>EOF"
echo ">>>>>>>"
Loading