Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Make geth ws ingress optional. (#35)
Browse files Browse the repository at this point in the history
Websock ingress are not fully supported out of the box by various K8s
services, and users may not want to add ws geth ingresses. When enabling
K8s ingresses do not geth ws by default, but allow ws be enabled in the
config.

service:
  Ingress:
    ws: true
  • Loading branch information
libby authored Jun 8, 2020
1 parent 3b56aa0 commit 28461f4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
3 changes: 2 additions & 1 deletion examples/config/qubernetes-ingress-ws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ service:
Ingress:
# OneToMany | OneToOne
Strategy: OneToMany
Host: "quorum.testnet.com"
Host: "quorum.ws.testnet.com"
ws: true
quorum:
# supported: (raft | istanbul)
consensus: istanbul
Expand Down
27 changes: 19 additions & 8 deletions templates/k8s/quorum-ingress.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ def set_node_template_vars(values)
return
end


@Geth_WS = false
if @config["service"]["Ingress"] then
@Ingress = true
# OneForAll
@IngressStrategy = @config["service"]["Ingress"]["Strategy"]
if @config["service"]["Ingress"]["Host"] then
@Ingress_Host = @config["service"]["Ingress"]["Host"]
end
if @config["service"]["Ingress"]["ws"] then
@Geth_WS = true
end
end
-%>

Expand All @@ -36,10 +41,12 @@ spec:
backend:
serviceName: <%= @Node_UserIdent %>
servicePort: <%= @Node_RPCPort %>
<%- if @Geth_WS -%>
- path: /quorum-ws
backend:
serviceName: <%= @Node_UserIdent %>
servicePort: <%= @Node_WSPort %>
<%- end -%>
tls:
- hosts:
- "<%= @Node_UserIdent %>.<%= @Ingress_Host %>"
Expand All @@ -50,11 +57,13 @@ spec:
backend:
serviceName: <%= @Node_UserIdent %>
servicePort: <%= @Node_RPCPort %>
<%- if @Geth_WS -%>
- path: /quorum-ws
backend:
serviceName: <%= @Node_UserIdent %>
servicePort: <%= @Node_WSPort %>
<%- end -%> <%# End Host conditional %>
<%- end -%>
<%- end -%> <%# End Host conditional %>
<% end -%> <%# end this node iteration %>
<%- end -%> <%# End Ingress OneForEach (this node's ingress) %>

Expand All @@ -75,23 +84,25 @@ spec:
http:
<%- else -%>
- http:
<%- end -%> <%# end Host conditional%>
<%- end -%> <%# end Host conditional%>
paths:
<%- # create paths for each node -%>
<%- @nodes.each do |node| -%>
<%- # create paths for each node -%>
<%- @nodes.each do |node| -%>
<%- set_node_template_vars(node.values.first) -%>
- path: /<%= @Node_UserIdent %>/quorum-rpc
backend:
serviceName: <%= @Node_UserIdent %>
servicePort: <%= @Node_RPCPort %>
<%- if @Geth_WS -%>
- path: /<%= @Node_UserIdent %>/quorum-ws
backend:
serviceName: <%= @Node_UserIdent %>
servicePort: <%= @Node_WSPort %>
<%- end -%> <%# end setting path for each node %>
<%- if @Ingress_Host -%>
<%- end -%>
<%- end -%> <%# end setting path for each node %>
<%- if @Ingress_Host -%>
tls:
- hosts:
- "<%= @Ingress_Host %>"
<%- end -%>
<%- end %> <%# end Ingress conditional%>
<%- end -%>
<%- end %> <%# end Ingress conditional%>

0 comments on commit 28461f4

Please sign in to comment.