Skip to content

Minimal web server to print the content that you pass to it with the `--text` flag.

Notifications You must be signed in to change notification settings

carlosgrillet/http-echo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

http-echo

http-echo is a minimal http server with the purpose of just serving plain text. This can be useful when testing or learning tools like Kubernetes.

Inspiration

This project was highly ispired by hashicorp/http-echo

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Deploy on kubernetes

Make a fast Deployment

kubectl apply -f https://github.com/carlosgrillet/http-echo/releases/download/v0.1.0/http-echo.yaml

Or create a file and change it as you wish.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: http-echo
  labels:
    app: http-echo
spec:
  replicas: 3
  selector:
    matchLabels:
      app: http-echo
  template:
    metadata:
      labels:
        app: http-echo
    spec:
      containers:
      - name: http-echo
        image: carlosgrillet/http-echo:latest
        args:
        - "http-echo"
        - "--text"
        - "Pod: $(POD_NAME)\nNamespace: $(POD_NAMESPACE)\nIP: $(POD_IP)\nNode: $(NODE_NAME)\nCPU-R: $(CPU_REQUEST)\nMEM-R: $(MEMORY_REQUEST)\nCPU-L: $(CPU_LIMIT)\nMEM-L: $(MEMORY_LIMIT)"
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        - name: CPU_REQUEST
          valueFrom:
            resourceFieldRef:
              resource: requests.cpu
        - name: MEMORY_REQUEST
          valueFrom:
            resourceFieldRef:
              resource: requests.memory
        - name: CPU_LIMIT
          valueFrom:
            resourceFieldRef:
              resource: limits.cpu
        - name: MEMORY_LIMIT
          valueFrom:
            resourceFieldRef:
              resource: limits.memory
        ports:
        - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: http-echo
spec:
  selector:
    app: http-echo
  ports:
  - protocol: TCP
    port: 80
    targetPort: 8080
  type: ClusterIP
  # type: LoadBalancer # for external access

MakeFile

Run build make command with tests

make all

Build the application

make build

Run the application

make run

Live reload the application:

make watch

Run the test suite:

make test

Clean up binary from the last build:

make clean

About

Minimal web server to print the content that you pass to it with the `--text` flag.

Resources

Stars

Watchers

Forks

Packages

No packages published