-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ansible scripts for infra automation, and workflow for applying and testing changes Signed-off-by: anandrkskd <anandrkskd@gmail.com> * fix Signed-off-by: anandrkskd <ansingh@redhat.com> * fix Signed-off-by: anandrkskd <ansingh@redhat.com> * rename requirements.yaml Signed-off-by: anandrkskd <ansingh@redhat.com> * change permissions Signed-off-by: anandrkskd <ansingh@redhat.com> * update cluster version Signed-off-by: anandrkskd <ansingh@redhat.com> --------- Signed-off-by: anandrkskd <anandrkskd@gmail.com> Signed-off-by: anandrkskd <ansingh@redhat.com>
- Loading branch information
1 parent
f491bcc
commit 7ff460b
Showing
42 changed files
with
2,001 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Infra update | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- scripts/ansible | ||
- '!scripts/ansible/Cluster/kubernetes-cluster/manual-changes/Readme.md' | ||
- '!scripts/ansible/Cluster/openshift-cluster/manual-changes/Readme.md' | ||
- '!scripts/ansible/Cluster/NFS-vm/manual-changes/Readme.md' | ||
- '!scripts/ansible/Cluster/windows-openshift-cluster/manual-changes/Readme.md' | ||
|
||
jobs: | ||
kubernetes-infra-stage-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: pre-config | ||
run: | | ||
echo "${{ secrets.NFSKEY }}" > ./ssh_key | ||
chmod 600 ./ssh_key | ||
- name: update name from Stageing to production | ||
run: | | ||
sed -i 's/odo-stage/odo-tests/g' scripts/ansible/Cluster/vars.yml | ||
- name: Create Stageing Cluster | ||
uses: dawidd6/action-ansible-playbook@v2 | ||
env: | ||
IC_API_KEY: ${{ secrets.IC_API_KEY }} | ||
IC_REGION: 'eu-de' | ||
SSHKEY: './ssh_key' | ||
with: | ||
playbook: scripts/ansible/create-infra.yaml | ||
requirements: scripts/ansible/requirements.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: odo-infra-stage-test | ||
on: | ||
push: | ||
paths: | ||
- scripts/ansible | ||
- '!scripts/ansible/Cluster/kubernetes-cluster/manual-changes/Readme.md' | ||
- '!scripts/ansible/Cluster/openshift-cluster/manual-changes/Readme.md' | ||
- '!scripts/ansible/Cluster/NFS-vm/manual-changes/Readme.md' | ||
- '!scripts/ansible/Cluster/windows-openshift-cluster/manual-changes/Readme.md' | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
kubernetes-infra-stage-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: pre-config | ||
run: | | ||
echo "${{ secrets.NFSKEY }}" > ./ssh_key | ||
chmod 600 ./ssh_key | ||
- name: Create Stageing Cluster | ||
uses: dawidd6/action-ansible-playbook@v2 | ||
env: | ||
IC_API_KEY: ${{ secrets.IC_API_KEY }} | ||
IC_REGION: 'eu-de' | ||
SSHKEY: './ssh_key' | ||
with: | ||
playbook: scripts/ansible/create-infra.yaml | ||
requirements: scripts/ansible/requirements.yaml | ||
|
||
- name: login to the three cluster | ||
env: | ||
IC_API_KEY: ${{ secrets.IC_API_KEY }} | ||
IC_REGION: 'eu-de' | ||
run: | | ||
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh | ||
ibmcloud login --apikey $IC_API_KEY -r $IC_REGION | ||
ibmcloud plugin install ks | ||
CLUSTER=`ibmcloud ks cluster get -c odo-test-kubernetes-cluster --output json ` | ||
ID=$(echo $CLUSTER | jq -r '.id') | ||
ibmcloud ks cluster config --cluster $ID --admin | ||
CLUSTER=`ibmcloud ks cluster get -c odo-test-kubernetes-cluster --output json ` | ||
ID=$(echo $CLUSTER | jq -r '.id') | ||
ibmcloud ks cluster config --cluster $ID --admin | ||
CLUSTER=`ibmcloud ks cluster get -c odo-test-kubernetes-cluster --output json ` | ||
ID=$(echo $CLUSTER | jq -r '.id') | ||
ibmcloud ks cluster config --cluster $ID --admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# ReadMe | ||
This directory contains yaml files to create NFS server | ||
|
||
### NFS provisioner (how to configure nfs for cluster) | ||
|
||
You can run the following commands upon a cluster to deploy the NFS provisioner to this cluster (either Kubernetes or OpenShift). You will need to uninstall the "Block Storage for VPC" add-on installed by default, to make the NFS provisioner work correctly. | ||
|
||
``` | ||
$ helm repo add nfs-subdir-external-provisioner \ | ||
https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/ | ||
$ helm install nfs-subdir-external-provisioner \ | ||
nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \ | ||
--set nfs.server=<IP_FOR_NFS> \ | ||
--set nfs.path=/mnt/nfs \ | ||
--set storageClass.defaultClass=true \ | ||
--set storageClass.onDelete=delete | ||
--version=4.0.15 | ||
``` | ||
|
||
> learn more about nfs-subdir-external-provisioner from https://artifacthub.io/packages/helm/nfs-subdir-external-provisioner/nfs-subdir-external-provisioner | ||
### check if nfs is working or not | ||
|
||
login using the floating IP | ||
|
||
### **NOTE** | ||
|
||
ibmcoud storage provided with cluster doesnt works with nfs storge(if nfs storage is set as default). So make sure to diable addon `vpc-block-csi-driver` from cluster for which you want to use **nfs-storage** | ||
|
||
#### *command to delete/remove storage addons from cluster* | ||
|
||
```shell | ||
ibmcloud ks cluster addon disable vpc-block-csi-driver | ||
``` | ||
|
||
### helpful commands | ||
|
||
1. Fetch IP for nfs configuration | ||
```shell | ||
IP_FOR_NFS=$(ibmcloud is instance <nfs-instance-name> --output json | jq -r ".primary_network_interface.primary_ip.address") | ||
``` | ||
|
||
2. Fetch Floating IP of NFS-Server | ||
```shell | ||
NFS_IP=$(ibmcloud is instance k8s-nfs-server --output json | jq -r ".primary_network_interface.floating_ips[0].address" ) | ||
``` | ||
|
||
3. Create/Delete just NFS server | ||
> NOTE: you will need to export path to ssh_key for login pourpose (`SSHKEY` is variable name) | ||
``` | ||
$ export SSHKEY=/path/to/ssh/key | ||
$ ansible-playbook create.yaml \ | ||
-e name_prefix=odo-tests \ | ||
-e cluster_zone="eu-de-2" | ||
$ ansible-playbook delete.yaml \ | ||
-e name_prefix=odo-tests | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.