Skip to content

Commit

Permalink
add CI workflow and k8s deployment for otel
Browse files Browse the repository at this point in the history
  • Loading branch information
pnickolov committed Feb 8, 2024
1 parent d4c0a18 commit e763186
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build and Publish Container image

on:
push:
branches: [ otel ]
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
name: Build Container image
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
push: false

push_to_registry:
runs-on: ubuntu-latest
name: Push container image to GitHub Packages
needs: build
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ghcr.io/${{ github.repository_owner }}/image-name:${{ github.event.release.tag_name }}
labels: |
org.opencontainers.image.title=co-http
org.opencontainers.image.description=Simple workload for testing performance and optimization
org.opencontainers.image.url=github://github.com/${{ github.repository }}/releases/tag/${{ github.event.release.tag_name }}
55 changes: 55 additions & 0 deletions k8s-otel/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
apiVersion: apps/v1
kind: Deployment

metadata:
name: co-http
labels:
comp: co-http

spec:
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
comp: co-http
template:
metadata:
labels:
comp: co-http
spec:
containers:
- name: main
image: ghcr.io/opsani/co-http:0.7.0-otel
args: [ 'busy=400' ]
resources:
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 8080
env:
- name: OTEL_SERVICE_NAME
value: "co-http"
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: "appdynamics-otel-collector-service.appdynamics.svc.cluster.local:4318"
- name: OTEL_EXPORTER_OTLP_INSECURE
value: "true"
- name: OTEL_TRACES_EXPORTER
value: "otlp,logging"

---

apiVersion: v1
kind: Service

metadata:
name: co-http

spec:
selector:
comp: co-http
ports:
- protocol: TCP
port: 8080
targetPort: 8080

0 comments on commit e763186

Please sign in to comment.