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

Dev #4

Open
wants to merge 62 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
c4219ec
test integration
KNarendra99599 May 30, 2024
684653b
Create main.yml
KNarendra99599 May 30, 2024
a41e19c
test
KNarendra99599 May 30, 2024
36d1b8d
sonar-scanner
KNarendra99599 May 30, 2024
1976fb8
sonar-scanner-01
KNarendra99599 May 30, 2024
3897800
sonar-scanner-02
KNarendra99599 May 30, 2024
99058d2
sonar-scanner-03
KNarendra99599 May 30, 2024
febe394
sonar-scanner-04
KNarendra99599 May 30, 2024
f45feae
sonar-scanner-05
KNarendra99599 May 30, 2024
8099286
sonar-scanner-06
KNarendra99599 May 30, 2024
d41f960
sonar-scanner-07
KNarendra99599 May 30, 2024
51bbb4d
sonan-scanner
KNarendra99599 May 30, 2024
068562e
sonar-scanner-08
KNarendra99599 May 30, 2024
92b4f32
BUILD_AND_PUBLISH
KNarendra99599 May 30, 2024
e27cd9a
BUILD AND PUSH JOB
KNarendra99599 May 31, 2024
86bb64d
BUILD AND PUSH - 01
KNarendra99599 May 31, 2024
e06138e
BUILD AND PUSH - 02
KNarendra99599 May 31, 2024
5a1df2d
BUILD AND PUSH - 03
KNarendra99599 May 31, 2024
087034c
Deploy into eks cluster
KNarendra99599 May 31, 2024
9dd7d4f
Build and push to ecr
KNarendra99599 May 31, 2024
1283633
build, push and deployment
KNarendra99599 May 31, 2024
8340ce7
deployment
KNarendra99599 May 31, 2024
9e21286
deployment
KNarendra99599 May 31, 2024
558437b
deployment - 01
KNarendra99599 May 31, 2024
b7d1720
deployment - 02
KNarendra99599 May 31, 2024
a1bf6dd
eks and bash.sh
KNarendra99599 May 31, 2024
5f1c287
bash and eks
KNarendra99599 May 31, 2024
f2949c3
deployment
KNarendra99599 May 31, 2024
235cc93
bash update
KNarendra99599 May 31, 2024
66a052d
bash update -01
KNarendra99599 May 31, 2024
6d7ce0a
update
KNarendra99599 May 31, 2024
72fe50e
update - 01
KNarendra99599 May 31, 2024
c598c66
update - 02
KNarendra99599 May 31, 2024
dc5a778
Image tag update in yaml file
KNarendra99599 May 31, 2024
a423cc7
Image update
KNarendra99599 May 31, 2024
2f0198a
Update image to 35
KNarendra99599 May 31, 2024
94dca85
secrets update
KNarendra99599 May 31, 2024
7b1867d
Merge branch 'main' of github.com:KNarendra99599/hprofile
KNarendra99599 May 31, 2024
bcdf81c
Update image to 36
KNarendra99599 May 31, 2024
1038bb7
Pipe line script
KNarendra99599 May 31, 2024
351bfd9
Merge branch 'main' of github.com:KNarendra99599/hprofile
KNarendra99599 May 31, 2024
21d2bbb
bash
KNarendra99599 Jun 12, 2024
9d6b05c
cicd pipeline
KNarendra99599 Jun 12, 2024
b2a6013
Jenkinsfile deleted
KNarendra99599 Jun 12, 2024
8444ac2
action deleted
KNarendra99599 Jun 12, 2024
d450d0b
dev
KNarendra99599 Jun 12, 2024
b0e4a5f
commit
KNarendra99599 Jun 12, 2024
4d725e7
readme
KNarendra99599 Jun 12, 2024
64a4ab4
readme
KNarendra99599 Jun 12, 2024
a52fc88
Update README.md
KNarendra99599 Jun 20, 2024
91980f5
Update README.md
KNarendra99599 Jun 20, 2024
a5169cc
Update README.md
KNarendra99599 Jun 20, 2024
daed548
Update README.md
KNarendra99599 Jun 20, 2024
23b186a
Update README.md
KNarendra99599 Jun 20, 2024
f96d3ea
Update README.md
KNarendra99599 Jun 20, 2024
81b4a62
Update README.md
KNarendra99599 Jun 20, 2024
b3c52d5
Update README.md
KNarendra99599 Jun 20, 2024
211f24c
Update README.md
KNarendra99599 Jun 20, 2024
92ae8e8
Update README.md
KNarendra99599 Jun 20, 2024
551d694
Update README.md
KNarendra99599 Jun 20, 2024
4922182
Update README.md
KNarendra99599 Jun 20, 2024
1ee1987
Update README.md
KNarendra99599 Jun 20, 2024
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
94 changes: 94 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Hprofile Actions
#on: workflow_dispatch # [push, workflow_dispatch]
on:
push:
branches:
- master
workflow_dispatch:
env:
AWS_REGION: us-east-1
jobs:
Testing:
runs-on: ubuntu-latest
steps:
- name: code checkout
uses: actions/checkout@v4

- name: Maven test
run: mvn test

- name: Checkstyle
run: mvn checkstyle:checkstyle

- name: Set Java 11
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'

- name: Setup SonarQube
uses: warchant/setup-sonar-scanner@v7

# Run sonar-scanner
- name: SonarQube Scan
run: sonar-scanner
-Dsonar.host.url=${{ secrets.SONAR_URL }}
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
-Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }}
-Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }}
-Dsonar.sources=src/
-Dsonar.junit.reportsPath=target/surefire-report/
-Dsonar.jacoco.reportsPath=target/jacoco.exec
-Dsonar.java.checkstyle.reportsPath=target/checkstyle-result.xml
-Dsonar.java.binaries=target/test-classes/com/visualpathit/account

# Check the Quality Gate status.
- name: SonarQube Quality Gate check
id: sonarqube-quality-gate-check
uses: sonarsource/sonarqube-quality-gate-action@master
# Force to fail step after specific time.
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_URL }} #OPTIONAL

BUILD_AND_PUBLISH:
needs: Testing
runs-on: ubuntu-latest
steps:
- name: code checkout
uses: actions/checkout@v4

# - name: Update application.properties file
# run: |
# sed -i "s/^jdbc.username.*$/jdbc.username\=${{ secrets.RDS_USER }}/" src/main/resources/application.properties
# sed -i "s/^jdbc.password.*$/jdbc.password\=${{ secrets.RDS_PASS }}/" src/main/resources/application.properties
# sed -i "s/db01/${{ secrets.RDS_ENDPOINT }}/" src/main/resources/application.properties

- name: upload image to ECR
uses: appleboy/docker-ecr-action@master
with:
access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
registry: ${{ secrets.REGISTRY }}
repo: docker
region: ${{ env.AWS_REGION }}
tags: ${{ github.run_number }} #latest,${{ github.run_number }}
daemon_off: false
dockerfile: ./Dockerfile
context: ./

- name: Update Image tag
run: |
sed -i "s|image:.*|image: 637423293208.dkr.ecr.us-east-1.amazonaws.com/docker:${{ github.run_number }} |" ./java.yaml

- name: Commit changes
run: |
git config --global user.name ${{ secrets.USER_NAME }}
git config --global user.email ${{ secrets.USER_MAIL }}
git add java.yaml
git commit -m "Update image to ${{ github.run_number }}"
git push



40 changes: 40 additions & 0 deletions EKS/01-Nginx-App1-Deployment-and-NodePortService.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: app1-nginx-deployment
labels:
app: app1-nginx
spec:
replicas: 1
selector:
matchLabels:
app: app1-nginx
template:
metadata:
labels:
app: app1-nginx
spec:
containers:
- name: app1-nginx
image: stacksimplify/kube-nginxapp1:1.0.0
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: app1-nginx-nodeport-service
labels:
app: app1-nginx
annotations:
#Important Note: Need to add health check path annotations in service level if we are planning to use multiple targets in a load balancer
# alb.ingress.kubernetes.io/healthcheck-path: /app1/index.html
spec:
type: NodePort
selector:
app: app1-nginx
ports:
- port: 80
targetPort: 80


13 changes: 13 additions & 0 deletions EKS/01-ingressclass-resource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: my-aws-ingress-class
annotations:
ingressclass.kubernetes.io/is-default-class: "true"
spec:
controller: ingress.k8s.aws/alb

## Additional Note
# 1. You can mark a particular IngressClass as the default for your cluster.
# 2. Setting the ingressclass.kubernetes.io/is-default-class annotation to true on an IngressClass resource will ensure that new Ingresses without an spec.ingressClassName field specified will be assigned this default IngressClass.
# 3. Reference: https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.3/guide/ingress/ingress_class/
38 changes: 38 additions & 0 deletions EKS/02-ALB-Ingress-Basic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Annotations Reference: https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/guide/ingress/annotations/
# Annotations Reference: https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/guide/ingress/annotations/
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-nginxapp1
labels:
app: app1-nginx
annotations:
# Load Balancer Name
alb.ingress.kubernetes.io/load-balancer-name: app1ingressrules
#kubernetes.io/ingress.class: "alb" (OLD INGRESS CLASS NOTATION - STILL WORKS BUT RECOMMENDED TO USE IngressClass Resource)
# Ingress Core Settings
alb.ingress.kubernetes.io/scheme: internet-facing
# Health Check Settings
alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
alb.ingress.kubernetes.io/healthcheck-port: traffic-port
alb.ingress.kubernetes.io/healthcheck-path: /app1/index.html
alb.ingress.kubernetes.io/healthcheck-interval-seconds: '15'
alb.ingress.kubernetes.io/healthcheck-timeout-seconds: '5'
alb.ingress.kubernetes.io/success-codes: '200'
alb.ingress.kubernetes.io/healthy-threshold-count: '2'
alb.ingress.kubernetes.io/unhealthy-threshold-count: '2'
spec:
ingressClassName: my-aws-ingress-class # Ingress Class
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: app1-nginx-nodeport-service
port:
number: 80

# 1. If "spec.ingressClassName: my-aws-ingress-class" not specified, will reference default ingress class on this kubernetes cluster
# 2. Default Ingress class is nothing but for which ingress class we have the annotation `ingressclass.kubernetes.io/is-default-class: "true"`
122 changes: 0 additions & 122 deletions Jenkinsfile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Prerequisites
#####
###########
- JDK 11
- Maven 3
- MySQL 8
Expand Down
37 changes: 37 additions & 0 deletions bash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

sudo eksctl create iamserviceaccount \
--cluster=demo-cluster \
--namespace=kube-system \
--name=aws-load-balancer-controller \
--region=us-east-1 \
--attach-role-arn arn:aws:iam::637423293208:role/aws-service-controller-eks-role \
--approve

# eksctl get iamserviceaccount --cluster demo-cluster

helm repo add eks https://aws.github.io/eks-charts

helm repo update eks

#helm repo remove eks

helm install aws-load-balancer-controller eks/aws-load-balancer-controller \
-n kube-system \
--set clusterName=demo-cluster \
--set serviceAccount.create=false \
--set serviceAccount.name=aws-load-balancer-controller \
--set image.repository=602401143452.dkr.ecr.us-east-1.amazonaws.com/amazon/aws-load-balancer-controller \
--set image.tag=v2.7.1 \
--set region=us-east-1 \
--set vpcId=vpc-07d3c084b26a40ddd

#helm unstall aws-load-balancer-controller

# Deploy EBS CSI Driver
kubectl apply -k "github.com/kubernetes-sigs/aws-ebs-csi-driver/deploy/kubernetes/overlays/stable/?ref=master"

#kubectl delete -k "github.com/kubernetes-sigs/aws-ebs-csi-driver/deploy/kubernetes/overlays/stable/?ref=master"

# Verify ebs-csi pods running
kubectl get pods -n kube-system
32 changes: 32 additions & 0 deletions java.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: java-deployment
spec:
selector:
matchLabels:
app.kubernetes.io/name: java-app
replicas: 1 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app.kubernetes.io/name: java-app
spec:
containers:
- name: java
image: 637423293208.dkr.ecr.us-east-1.amazonaws.com/docker:36
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: java-service
spec:
ports:
- port: 8080
targetPort: 80
type: ClusterIP
selector:
app.kubernetes.io/name: java-app
Loading