-
Notifications
You must be signed in to change notification settings - Fork 2
/
ambiente-inicial-Jenkinsfile
43 lines (43 loc) · 1.97 KB
/
ambiente-inicial-Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
pipeline {
agent any
stages {
stage('Git Clone Source Repositoty') {
steps {
git branch: 'main',
url: 'https://github.com/breinerHenrique/terraform-aws-eks-lab.git'
}
}
stage('Enable Metrics Server on EKS') {
steps {
sh 'kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml'
}
}
stage('Creating Monitoring Environment on AWS EKS') {
steps {
sh 'kubectl create namespace monitoring'
sh 'helm repo add prometheus-community https://prometheus-community.github.io/helm-charts'
sh 'helm repo add kube-state-metrics https://kubernetes.github.io/kube-state-metrics'
sh 'helm repo add grafana https://grafana.github.io/helm-charts'
sh 'helm repo update'
sh 'helm upgrade --install prometheus prometheus-community/prometheus --values k8s/monitoring/values-prometheus.yaml --namespace monitoring'
sh 'helm upgrade --install grafana grafana/grafana --values k8s/monitoring/values-grafana.yaml --namespace monitoring'
}
}
stage ("Creating API namespace") {
steps {
sh 'kubectl create namespace api-services'
}
}
stage ("Waiting EKS LoadBalancer configuring Grafana Extenal IP") {
steps {
sleep 45 // seconds
}
}
stage('Sending Enviroment Access Details | Grafana') {
steps {
sh 'kubectl get services -n monitoring'
sh 'kubectl get secret -n monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo'
}
}
}
}