Skip to content

Commit

Permalink
template traefik
Browse files Browse the repository at this point in the history
  • Loading branch information
strantalis committed Aug 13, 2024
1 parent e9fa30f commit 55463dc
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 25 deletions.
39 changes: 39 additions & 0 deletions tests/chart_platform_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package test
import (
"encoding/json"
"fmt"
"html/template"
"os"
"os/exec"
"path/filepath"
"strings"
Expand All @@ -17,6 +19,36 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var traefikIngress = `
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: platform
spec:
entryPoints:
- websecure
routes:
- match: Host('keycloak.opentdf.local')
kind: Rule
services:
- name: platform-keycloak
namespace: {{ .Namespace }}
port: 80
scheme: http
passHostHeader: true
- match: Host('platform.opentdf.local')
kind: Rule
services:
- name: opentdf-platform
namespace: {{ .Namespace }}
port: 9000
scheme: h2c
passHostHeader: true
tls:
secretName: platform-tls
`

type PlatformChartIntegrationSuite struct {
suite.Suite
chartPath string
Expand Down Expand Up @@ -126,6 +158,13 @@ func (suite *PlatformChartIntegrationSuite) TestBasicDeployment() {
ingresses := k8s.ListIngresses(suite.T(), kubectlOptions, metav1.ListOptions{})
suite.Require().Len(ingresses, 0)

ingFile, err := os.Create("traefik.yaml")
suite.Require().NoError(err)
ingTmpl, err := template.New("traefik").Parse(traefikIngress)
suite.Require().NoError(err)
err = ingTmpl.Execute(ingFile, map[string]string{"Namespace": namespaceName})
suite.Require().NoError(err)

traefikIngressCfg, err := filepath.Abs("traefik.yaml")
suite.Require().NoError(err)

Expand Down
25 changes: 0 additions & 25 deletions tests/traefik.yaml

This file was deleted.

0 comments on commit 55463dc

Please sign in to comment.