Skip to content

Commit b56bce4

Browse files
committed
feat: configurable ingress hosts template
1 parent 9010413 commit b56bce4

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ jobs:
231231
podman save ${{ env.IMG }} -o operator-oci.tar
232232
kind load image-archive operator-oci.tar
233233
234+
- name: Add service hosts to /etc/hosts
235+
run: |
236+
sudo echo "127.0.0.1 keycloak-internal.keycloak-system.svc" | sudo tee -a /etc/hosts
237+
234238
- name: Replace images
235239
run: make dev-images && cat config/default/images.env
236240

@@ -243,9 +247,6 @@ jobs:
243247
run: |
244248
kubectl wait --for=condition=available deployment/rhtas-operator-controller-manager --timeout=120s -n openshift-rhtas-operator
245249
246-
- name: Add service hosts to /etc/hosts
247-
run: |
248-
sudo echo "127.0.0.1 fulcio-server.local tuf.local rekor-server.local keycloak-internal.keycloak-system.svc rekor-search-ui.local cli-server.local tsa-server.local" | sudo tee -a /etc/hosts
249250
- name: Install cosign
250251
run: go install github.com/sigstore/cosign/v2/cmd/[email protected]
251252

@@ -487,10 +488,6 @@ jobs:
487488
podman save ${{ env.IMG }} -o operator-oci.tar
488489
kind load image-archive operator-oci.tar
489490
490-
- name: Add service hosts to /etc/hosts
491-
run: |
492-
sudo echo "127.0.0.1 fulcio-server.local tuf.local rekor-server.local rekor-search-ui.local cli-server.local" | sudo tee -a /etc/hosts
493-
494491
- name: Replace images
495492
run: make dev-images generate && cat config/default/images.env
496493

@@ -574,7 +571,7 @@ jobs:
574571
575572
- name: Add service hosts to /etc/hosts
576573
run: |
577-
sudo echo "127.0.0.1 fulcio-server.local tuf.local rekor-server.local rekor-search-ui.local tsa-server.local cli-server.local ${{ steps.kind.outputs.oidc_host }}" | sudo tee -a /etc/hosts
574+
sudo echo "127.0.0.1 ${{ steps.kind.outputs.oidc_host }}" | sudo tee -a /etc/hosts
578575
579576
- name: Replace images
580577
run: make dev-images generate && cat config/default/images.env
@@ -607,7 +604,7 @@ jobs:
607604
export TSA_URL=$(kubectl get timestampauthorities -o jsonpath='{.items[0].status.url}' -n ${{ env.TEST_NAMESPACE }})/api/v1/timestamp
608605
609606
export CLI_STRATEGY=cli_server
610-
export CLI_SERVER_URL="http://cli-server.local"
607+
export CLI_SERVER_URL="http://cli-server.trusted-artifact-signer.traefik.me"
611608
612609
cd e2e
613610
source ./tas-env-variables.sh

cmd/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ func main() {
101101
flag.BoolVar(&enableHTTP2, "enable-http2", false,
102102
"If set, HTTP/2 will be enabled for the metrics and webhook servers")
103103
flag.Int64Var(&appconfig.CreateTreeDeadline, "create-tree-deadline", appconfig.CreateTreeDeadline, "The time allowance (in seconds) for the create tree job to run before failing.")
104+
flag.StringVar(&appconfig.IngressHostTemplate, "ingress-host-template", appconfig.IngressHostTemplate, "Sprintf-style format string for generating Ingress hostnames when not specified. Where %[1]s is the service name and %[2]s is the namespace.")
104105
utils.BoolFlagOrEnv(&appconfig.Openshift, "openshift", "OPENSHIFT", false, "Enable to ensures the operator applies OpenShift specific configurations.")
106+
105107
utils.RelatedImageFlag("trillian-log-signer-image", images.TrillianLogSigner, "The image used for trillian log signer.")
106108
utils.RelatedImageFlag("trillian-log-server-image", images.TrillianServer, "The image used for trillian log server.")
107109
utils.RelatedImageFlag("trillian-db-image", images.TrillianDb, "The image used for trillian's database.")

internal/config/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ package config
33
var (
44
CreateTreeDeadline int64 = 1200
55
Openshift bool
6+
7+
IngressHostTemplate = "%[1]s.%[2]s.traefik.me"
68
)

internal/utils/kubernetes/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func CalculateHostname(ctx context.Context, client client.Client, svcName, ns st
8686
}
8787
return fmt.Sprintf("%s-%s.%s", svcName, ns, ingress.Spec.Domain), nil
8888
}
89-
return svcName + ".local", nil
89+
return fmt.Sprintf(config.IngressHostTemplate, svcName, ns), nil
9090
}
9191

9292
func FindByLabelSelector(ctx context.Context, c client.Client, list client.ObjectList, namespace, labelSelector string) error {

0 commit comments

Comments
 (0)