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

Add EasyHAProxy (new vendor) #521

Merged
merged 5 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
63 changes: 63 additions & 0 deletions stacks/easyhaproxy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# EasyHAProxy

[EasyHAProxy](https://easyhaproxy.com/) is an Ingress and Auto Discover service based on HAProxy.

HAProxy is an open-source, high-performance load balancer and reverse proxy designed for TCP and HTTP-based applications. Renowned for its stability, reliability, and performance, it is widely adopted in production environments.

EasyHAProxy combines HAProxy's robustness with seamless service discovery and exposure within Kubernetes clusters. It offers a straightforward method to configure Ingress rules for services.
Key Features

- Handles and routes HTTP, HTTPS, and TCP traffic (e.g., MySQL server).
- Supports custom error messages.
- Integrates Let's Encrypt SSL certificate functionality.
- Automatically discovers services within the Kubernetes cluster.
- Facilitates the configuration of Ingress rules for services.
- Provides load balancing capabilities.

## Install

- Enable the EasyHAProxy in the Digital Ocean marketplace
- Create a Digital Ocean Load Balance pointing to your Kubernetes Cluster.

## How to set up your application for EasyHAProxy

You need to add to your application ingress annotations to expose your service to the internet.

```yaml
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: easyhaproxy-ingress
.
.
.
```

## Additional Resources

For further details about EasyHAProxy, please refer to the [documentation](https://easyhaproxy.com/).

## Troubleshooting

### Check if the EasyHAProxy is running properly

You can install the "Static Http Server" and define the domain you want to validate as the example below:

```shell
helm repo add byjg https://opensource.byjg.com/helm
helm repo update
helm upgrade --install mysite byjg/static-httpserver \
--namespace default \
--set "ingress.hosts={www.example.org,example.org}" \
--set parameters.title=Welcome
```


### EasyHAProxy Container not Starting

Due to limitations in the HAProxy community edition, EasyHAProxy functions solely as a standalone service, regardless of the number of nodes present.

If the node hosting EasyHAProxy experiences downtime, the service will remain unavailable until the node is operational again.

To restore connectivity, you have the option to deploy or upgrade the EasyHAProxy service.

48 changes: 48 additions & 0 deletions stacks/easyhaproxy/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh

set -e

################################################################################
# repo
################################################################################
helm repo add byjg https://opensource.byjg.com/helm
helm repo update > /dev/null

################################################################################
# Pre-requisites
################################################################################

# Check if there is any node with the label "easyhaproxy/node=master"
master_node_exists=$(kubectl get nodes --selector=easyhaproxy/node=master -o jsonpath='{.items[*].metadata.name}')

# If there is no node with the label, then label the first node
if [ -z "$master_node_exists" ]; then
masternode=$(kubectl get nodes -o jsonpath='{.items[0].metadata.name}')
kubectl label nodes "$masternode" "easyhaproxy/node=master" --overwrite
fi

################################################################################
# chart
################################################################################
STACK="easyhaproxy"
CHART="byjg/easyhaproxy"
CHART_VERSION="0.1.7"
NAMESPACE="easyhaproxy"

if [ -z "${MP_KUBERNETES}" ]; then
# use local version of values.yml
ROOT_DIR=$(git rev-parse --show-toplevel)
values="$ROOT_DIR/stacks/easyhaproxy/values.yml"
else
# use github hosted master version of values.yml
values="https://raw.githubusercontent.com/digitalocean/marketplace-kubernetes/master/stacks/easyhaproxy/values.yml"
fi

helm upgrade "$STACK" "$CHART" \
--atomic \
--create-namespace \
--install \
--timeout 8m0s \
--namespace "$NAMESPACE" \
--values "$values" \
--version "$CHART_VERSION"
20 changes: 20 additions & 0 deletions stacks/easyhaproxy/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

set -e

################################################################################
# chart
################################################################################
STACK="easyhaproxy"
NAMESPACE="easyhaproxy"

# Check if there is any node with the label "easyhaproxy/node=master"
master_node_exists=$(kubectl get nodes --selector=easyhaproxy/node=master -o jsonpath='{.items[*].metadata.name}')

# If there is a node with the label, then remove the label
if [ -n "$master_node_exists" ]; then
kubectl label nodes "$master_node_exists" "easyhaproxy/node-"
fi

helm uninstall "$STACK" \
--namespace "$NAMESPACE"
42 changes: 42 additions & 0 deletions stacks/easyhaproxy/upgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh

set -e

################################################################################
# repo
################################################################################
helm repo add byjg https://opensource.byjg.com/helm
helm repo update > /dev/null

################################################################################
# Pre-requisites
################################################################################

# Check if there is any node with the label "easyhaproxy/node=master"
master_node_exists=$(kubectl get nodes --selector=easyhaproxy/node=master -o jsonpath='{.items[*].metadata.name}')

# If there is no node with the label, then label the first node
if [ -z "$master_node_exists" ]; then
masternode=$(kubectl get nodes -o jsonpath='{.items[0].metadata.name}')
kubectl label nodes "$masternode" "easyhaproxy/node=master" --overwrite
fi

################################################################################
# chart
################################################################################
STACK="easyhaproxy"
CHART="byjg/easyhaproxy"
NAMESPACE="easyhaproxy"

if [ -z "${MP_KUBERNETES}" ]; then
# use local version of values.yml
ROOT_DIR=$(git rev-parse --show-toplevel)
values="$ROOT_DIR/stacks/easyhaproxy/values.yml"
else
# use github hosted master version of values.yml
values="https://raw.githubusercontent.com/digitalocean/marketplace-kubernetes/master/stacks/easyhaproxy/values.yml"
fi

helm upgrade "$STACK" "$CHART" \
--namespace "$NAMESPACE" \
--values "$values" \
5 changes: 5 additions & 0 deletions stacks/easyhaproxy/values.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# byjg/easyhaproxy
resources:
requests:
cpu: "100m"
memory: "128Mi"
Loading