Skip to content
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
28 changes: 22 additions & 6 deletions cli/cmd/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@
}
}

// Necessary for WebSocket support with Contour
if ingressClassName == "contour" {
annotationsMap["projectcontour.io/websocket-routes"] = "/"
}

if useExisting {
output.InfoMessage("Configuring Drasi to use existing ingress controller")
output.InfoMessage(fmt.Sprintf("IngressClass: %s", ingressClassName))
Expand Down Expand Up @@ -143,12 +148,23 @@

// Get configuration from the installer
installerConfig := ingressInstaller.GetIngressConfig()
config := &sdk.IngressConfig{
IngressClassName: installerConfig.ClassName,
IngressService: installerConfig.ServiceName,
IngressNamespace: installerConfig.Namespace,
GatewayIPAddress: "",
IngressAnnotations: annotationsMap, // Include annotations for Contour too
var config *sdk.IngressConfig
if localCluster {
config = &sdk.IngressConfig{
IngressClassName: installerConfig.ClassName,
IngressService: installerConfig.ServiceName,
IngressNamespace: installerConfig.Namespace,
GatewayIPAddress: "127.0.0.1",

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production
IngressAnnotations: annotationsMap, // Include annotations for Contour too
}
} else {
config = &sdk.IngressConfig{
IngressClassName: installerConfig.ClassName,
IngressService: installerConfig.ServiceName,
IngressNamespace: installerConfig.Namespace,
GatewayIPAddress: "",
IngressAnnotations: annotationsMap, // Include annotations for Contour too
}
}
if err := k8sPlatformClient.UpdateIngressConfig(config, output); err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,10 @@
if ip_suffix != "UNAVAILABLE" {
rule.host = Some(host.replace("PLACEHOLDER", &ip_suffix));
} else {
log::warn!("Could not determine external IP, using None");
rule.host = None;
log::warn!(
"Could not determine external IP, using 127.0.0.1"

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production
);
rule.host = Some(host.replace("PLACEHOLDER", "127.0.0.1"));

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production
}
}
}
Expand Down
18 changes: 8 additions & 10 deletions e2e-tests/fixtures/signalr-fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
this.localPort = parseInt(process.env.INGRESS_PORT) || 8001;

// Generate the hostname that the ingress expects
// Format: {reaction-name}.drasi.{ip}.nip.io
// For local testing with kind, we can use localhost
this.hostname = `${this.reactionManifest.name}.drasi.localhost`;
// Format: {reaction-name}.drasi.127.0.0.1.nip.io

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production
// This matches the format used by drasi ingress init --local-cluster
this.hostname = `${this.reactionManifest.name}.drasi.127.0.0.1.nip.io`;

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production

console.log(`SignalRFixture: Using localhost access on port ${this.localPort}`);
console.log(`SignalRFixture: Using ingress access on port ${this.localPort}`);
console.log(`SignalRFixture: Using hostname: ${this.hostname}`);

// Initialize SignalR connection through ingress
Expand All @@ -62,14 +62,12 @@
}

async connectSignalR() {
// Create SignalR connection through ingress via localhost
const hubUrl = `http://localhost:${this.localPort}/hub`;

// Create SignalR connection through ingress using nip.io hostname
// nip.io automatically resolves *.127.0.0.1.nip.io to 127.0.0.1

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production
const hubUrl = `http://${this.hostname}:${this.localPort}/hub`;

Check warning

Code scanning / devskim

An HTTP-based URL without TLS was detected. Warning

Insecure URL

this.signalr = new signalR.HubConnectionBuilder()
.withUrl(hubUrl, {
headers: {
'Host': this.hostname // Set Host header for ingress routing
},
transport: signalR.HttpTransportType.LongPolling, // Force long polling instead of WebSockets
})
.withAutomaticReconnect()
Expand Down
3 changes: 1 addition & 2 deletions e2e-tests/kind-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
extraPortMappings:
- containerPort: 30080 # Maps to contour-envoy NodePort 30080
hostPort: 8001
listenAddress: "0.0.0.0"
- containerPort: 30443 # Maps to contour-envoy NodePort 30443
- containerPort: 30443 # Maps to contour-envoy NodePort 30443
hostPort: 443
listenAddress: "0.0.0.0"
Loading