Skip to content

Conversation

@byjg
Copy link
Owner

@byjg byjg commented Dec 16, 2025

Summary

This release adds support for the modern Kubernetes IngressClass API and automatic ingress status updates, improving compliance with Kubernetes standards and user experience.

Features Implemented

1. IngressClass Resource Support

Added proper IngressClass resource definition and support for the modern spec.ingressClassName field.

What changed:

  • Created IngressClass resource named easyhaproxy (replaces verbose easyhaproxy-ingress)
  • Supports modern spec.ingressClassName: easyhaproxy field (Kubernetes 1.18+)
  • Maintains backward compatibility with deprecated kubernetes.io/ingress.class: easyhaproxy-ingress annotation
  • Updated RBAC permissions to include ingressclasses resource

Benefits:

  • ✅ Follows Kubernetes best practices and standards
  • ✅ Matches naming conventions of nginx, traefik, and other ingress controllers
  • ✅ Backward compatible - existing deployments continue to work
  • ✅ Future-proof as the annotation is officially deprecated

Usage:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
spec:
  ingressClassName: easyhaproxy  # Modern approach (recommended)
  rules:
  - host: example.com
    http:
      paths:
      - backend:
          service:
            name: example-service
            port:
              number: 8080
        pathType: ImplementationSpecific

2. Automatic Ingress Status Updates

EasyHAProxy now automatically updates ingress status with load balancer addresses, populating the ADDRESS column in kubectl get ingress output.

What changed:

  • Auto-detects deployment mode (DaemonSet, NodePort, or ClusterIP)
  • Reports appropriate IP addresses/hostnames based on deployment mode:
    • DaemonSet: Node IPs where pods are scheduled
    • NodePort: All node IPs (traffic can reach any node)
    • ClusterIP: LoadBalancer IP, external hostname, or ClusterIP
  • Caches deployment mode and addresses for performance
  • Added RBAC permissions for ingresses/status updates
  • Enabled by default (can be disabled via configuration)

Benefits:

  • Better UX: Users immediately see where to access their ingresses
  • Standard behavior: Matches nginx-ingress, traefik, etc.
  • Easier debugging: Quick verification that ingress is configured
  • Tool integration: Works with Kubernetes dashboards and monitoring tools

Example output:

# Before:
$ kubectl get ingress
NAME    CLASS        HOSTS         ADDRESS   PORTS
myapp   easyhaproxy  example.com             80

# After:
$ kubectl get ingress
NAME    CLASS        HOSTS         ADDRESS        PORTS
myapp   easyhaproxy  example.com   192.168.1.100  80

Configuration

Disable Status Updates

# values.yaml
ingressStatus:
  enabled: false

Override Deployment Mode Detection

# values.yaml
ingressStatus:
  deploymentMode: nodeport  # auto, daemonset, nodeport, or clusterip

Set External Hostname (ClusterIP mode)

# values.yaml
ingressStatus:
  externalHostname: "haproxy.example.com"

Adjust Cache TTL

# values.yaml
ingressStatus:
  updateInterval: 60  # seconds

Backward Compatibility

No breaking changes. All existing deployments continue to work:

  • Old annotation kubernetes.io/ingress.class: easyhaproxy-ingress still supported
  • Ingress status updates are additive (don't affect existing functionality)
  • Status updates can be disabled if needed

Technical Details

Files Modified

Helm templates:

  • helm/easyhaproxy/templates/ingressclass.yaml (new)
  • helm/easyhaproxy/templates/clusterrole.yaml (updated RBAC)
  • helm/easyhaproxy/templates/deployment.yaml (added env vars)
  • helm/easyhaproxy/values.yaml (added configuration)

Python code:

  • src/processor/__init__.py (added detection and status update logic)
  • src/functions/__init__.py (added configuration support)

Static manifests (regenerated):

  • deploy/kubernetes/easyhaproxy-daemonset.yml
  • deploy/kubernetes/easyhaproxy-nodeport.yml
  • deploy/kubernetes/easyhaproxy-clusterip.yml

Documentation:

  • docs/kubernetes.md (updated examples and explanations)
  • deploy/kubernetes/README.md (enhanced with detailed instructions)

RBAC Permissions Added

- apiGroups: ["networking.k8s.io"]
  resources: ["ingresses/status", "ingressclasses"]
  verbs: ["get", "list", "watch"]
  
- apiGroups: ["networking.k8s.io"]
  resources: ["ingresses/status"]
  verbs: ["patch"]
  
- apiGroups: [""]
  resources: ["nodes"]
  verbs: ["get", "list"]

Migration Guide

For New Deployments

Use the modern approach:

spec:
  ingressClassName: easyhaproxy

For Existing Deployments

Option 1: Keep current annotation (still works)

metadata:
  annotations:
    kubernetes.io/ingress.class: easyhaproxy-ingress

Option 2: Migrate to new field (recommended)

spec:
  ingressClassName: easyhaproxy

Performance Impact

  • Minimal: Deployment mode detected once and cached
  • Node IPs cached with 30s TTL (configurable)
  • Status updates: 1 API call per ingress per refresh cycle
  • Graceful degradation: Errors are logged but don't affect HAProxy config

Future Enhancements

Potential improvements for consideration:

  • Support for setting custom status messages
  • Webhook for immediate status updates on deployment changes
  • Metrics for status update success/failure rates
  • Support for multiple external IPs/hostnames

Related Documentation

byjg added 3 commits December 15, 2025 19:58
…c.ingressClassName` in Kubernetes examples and processor logic for compatibility with Kubernetes v1.22+. Updated documentation and examples to reflect the change while maintaining backward compatibility.
…Name` across templates, examples, and documentation for consistency and backward compatibility

- Introduced new IngressClass resource in Helm templates to define `easyhaproxy` as the default ingress class.
- Updated Kubernetes examples to replace `easyhaproxy-ingress` with `easyhaproxy` as the ingress class name.
- Enhanced processor logic to support both the new `spec.ingressClassName` field and the deprecated `kubernetes.io/ingress.class` annotation.
- Revised documentation to reflect the changes and ensure alignment with Kubernetes recommendations.
… modes

- Introduced `ingressStatus` configuration in Helm values to enable status updates and customize deployment modes (auto, daemonset, nodeport, clusterip).
- Implemented logic in the processor to detect deployment mode, retrieve ingress addresses, and update ingress status dynamically.
- Updated Kubernetes manifests to grant required permissions for `ingresses/status` operations and pass necessary environment variables for configuration.
- Adjusted Helm templates and associated Kubernetes examples to reflect the new ingress status update capability.
- Added support for new configuration fields: `update_ingress_status`, `deployment_mode`, `external_hostname`, and `ingress_status_update_interval`.
- Updated assertions in test cases to validate the presence of these fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants