1
+ run-name : Kubernetes deployment test - Branch ${{ inputs.BRANCH_VERSION }} - Launched by @${{ github.actor }}
2
+ name : Test Wazuh deployment on Kubernetes
3
+
4
+ on :
5
+ workflow_dispatch :
6
+ inputs :
7
+ BRANCH_VERSION :
8
+ description : ' Branch version to deploy'
9
+ required : true
10
+ default : ' 5.0.0'
11
+
12
+ permissions :
13
+ id-token : write # This is required for requesting the JWT
14
+ contents : read # This is required for actions/checkout
15
+
16
+ jobs :
17
+ EKS_deployment_test :
18
+ runs-on : ubuntu-20.04
19
+ steps :
20
+ - name : Checkout code
21
+ uses : actions/checkout@v4
22
+ with :
23
+ ref : ${{ inputs.BRANCH_VERSION }}
24
+
25
+ - name : Configure aws credentials
26
+ uses : aws-actions/configure-aws-credentials@v4
27
+ with :
28
+ role-to-assume : ${{ secrets.AWS_IAM_KUBERNETES_ROLE }}
29
+ aws-region : " ${{ secrets.AWS_REGION }}"
30
+
31
+ - name : Install eksctl
32
+ run : |
33
+ ARCH=amd64
34
+ PLATFORM=$(uname -s)_$ARCH
35
+ curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_$PLATFORM.tar.gz"
36
+ curl -sL "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_checksums.txt" | grep $PLATFORM | sha256sum --check
37
+ tar -xzf eksctl_$PLATFORM.tar.gz -C /tmp && rm eksctl_$PLATFORM.tar.gz
38
+ sudo mv /tmp/eksctl /usr/local/bin
39
+
40
+ - name : Deploy eks cluster
41
+ run : |
42
+ eksctl create cluster && \
43
+ --name test-eks-deploy-${{ github.event.number }} && \
44
+ --with-oidc && \
45
+ --region us-east-1 && \
46
+ --nodes-min 6 && \
47
+ --nodes-max 6 && \
48
+ --managed && \
49
+ --spot && \
50
+ -t t3a.medium && \
51
+ --tags "issue=https://github.com/wazuh/wazuh-kubernetes/pull/${{ github.event.number }},team=devops,termination_date=2030-01-01 21:00:00"
52
+
53
+ - name : Create sa for ebs-csi-controller
54
+ run : |
55
+ eksctl create iamserviceaccount && \
56
+ --name ebs-csi-controller-sa && \
57
+ --region us-east-1 && \
58
+ --namespace kube-system && \
59
+ --cluster test-eks-deploy-${{ github.event.number }} && \
60
+ --role-name AmazonEKS_EBS_CSI_DriverRole_test-eks-deploy-${{ github.event.number }} && \
61
+ --role-only && \
62
+ --attach-policy-arn arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy && \
63
+ --approve
64
+
65
+ - name : Install addon aws-ebs-csi-driver into a eks cluster deployed
66
+ run : |
67
+ eksctl create addon && \
68
+ --name aws-ebs-csi-driver && \
69
+ --cluster test-eks-deploy-${{ github.event.number }} && \
70
+ --region ${{ secrets.AWS_REGION }} && \
71
+ --service-account-role-arn arn:aws:iam::567970947422:role/AmazonEKS_EBS_CSI_DriverRole_test-eks-deploy-${{ github.event.number }} && \
72
+ --force
73
+
74
+ - name : Create Wazuh indexer certificates
75
+ run : wazuh/certs/indexer_cluster/generate_certs.sh
76
+
77
+ - name : Create Wazuh dashboard certificates
78
+ run : wazuh/certs/dashboard_http/generate_certs.sh
79
+
80
+ - name : Deploy Wazuh stack
81
+ run : kubectl apply -k envs/eks/
82
+
83
+ Local_deployment_test :
84
+ runs-on : ubuntu-20.04
85
+ steps :
86
+ - name : Checkout code
87
+ uses : actions/checkout@v4
88
+ with :
89
+ ref : ${{ inputs.BRANCH_VERSION }}
90
+
91
+ - name : free disk space
92
+ run : |
93
+ sudo swapoff -a
94
+ sudo rm -f /swapfile
95
+ sudo apt clean
96
+ docker rmi $(docker image ls -aq)
97
+ df -h
98
+
99
+ - name : Install Minikube cluster
100
+ run : |
101
+ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
102
+ sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64
103
+
104
+ - name : Start Minikube cluster
105
+ run : minikube start
106
+
107
+ - name : Create Wazuh indexer certificates
108
+ run : wazuh/certs/indexer_cluster/generate_certs.sh
109
+
110
+ - name : Create Wazuh dashboard certificates
111
+ run : wazuh/certs/dashboard_http/generate_certs.sh
112
+
113
+ - name : Deploy Wazuh stack
114
+ run : minikube kubectl apply -k envs/local/
0 commit comments