Skip to content

Commit

Permalink
added k8s-gateway-api support (#165)
Browse files Browse the repository at this point in the history
* added gateway api support

* removed gateway config

* added webdocs for gatewayapi

---------

Signed-off-by: David Viejo <[email protected]>
Co-authored-by: David Viejo <[email protected]>
  • Loading branch information
rohitrj22 and dviejokfs authored May 29, 2023
1 parent be62fa4 commit a08644a
Show file tree
Hide file tree
Showing 34 changed files with 8,760 additions and 11,918 deletions.
27 changes: 23 additions & 4 deletions api/hlf.kungfusoftware.es/v1alpha1/hlf_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ type FabricPeerSpec struct {
// +optional
// +kubebuilder:validation:Optional
// +nullable
GatewayApi *FabricGatewayApi `json:"gatewayApi"`
Istio *FabricIstio `json:"istio"`
Gossip FabricPeerSpecGossip `json:"gossip"`
ExternalEndpoint string `json:"externalEndpoint"`
Expand Down Expand Up @@ -290,6 +291,21 @@ type FabricIstio struct {
IngressGateway string `json:"ingressGateway"`
}

type FabricGatewayApi struct {
// +optional
// +nullable
Port int `json:"port"`
// +nullable
// +kubebuilder:validation:Optional
// +optional
// +kubebuilder:validation:Default={}
Hosts []string `json:"hosts,omitempty"`
// +kubebuilder:validation:Default=hlf-gateway
GatewayName string `json:"gatewayName"`
// +kubebuilder:validation:Default=default
GatewayNamespace string `json:"gatewayNamespace"`
}

type FabricPeerSpecGossip struct {
ExternalEndpoint string `json:"externalEndpoint"`
Bootstrap string `json:"bootstrap"`
Expand Down Expand Up @@ -510,11 +526,13 @@ type FabricOrdererNodeSpec struct {
// +optional
// +kubebuilder:validation:Optional
// +nullable
Istio *FabricIstio `json:"istio"`
GatewayApi *FabricGatewayApi `json:"gatewayApi"`
Istio *FabricIstio `json:"istio"`
// +optional
// +kubebuilder:validation:Optional
// +nullable
AdminIstio *FabricIstio `json:"adminIstio"`
AdminGatewayApi *FabricGatewayApi `json:"adminGatewayApi"`
AdminIstio *FabricIstio `json:"adminIstio"`

// +nullable
// +kubebuilder:validation:Optional
Expand Down Expand Up @@ -626,8 +644,9 @@ type FabricCASpec struct {
// +optional
// +kubebuilder:validation:Optional
// +nullable
Istio *FabricIstio `json:"istio"`
Database FabricCADatabase `json:"db"`
GatewayApi *FabricGatewayApi `json:"gatewayApi"`
Istio *FabricIstio `json:"istio"`
Database FabricCADatabase `json:"db"`
// +kubebuilder:validation:MinItems=1
// Hosts for the Fabric CA
Hosts []string `json:"hosts"`
Expand Down
132 changes: 26 additions & 106 deletions api/hlf.kungfusoftware.es/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions charts/hlf-ca/templates/tls-route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if and (not .Values.istio.hosts) (and (.Values.gatewayApi.hosts) (.Values.gatewayApi.gatewayName)) -}}
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TLSRoute
metadata:
name: {{ include "hlf-ca.fullname" . }}-tlsroute
spec:
parentRefs:
- name: {{.Values.gatewayApi.gatewayName}}
sectionName: tcp
namespace: {{.Values.gatewayApi.gatewayNamespace}}
hostnames:
{{- range .Values.gatewayApi.hosts }}
- {{ . }}
{{- end }}
rules:
- backendRefs:
- name: {{ include "hlf-ca.fullname" . }}
port: 7054
{{- end -}}
8 changes: 7 additions & 1 deletion charts/hlf-ca/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,10 @@ istio:
hosts: []
ingressGateway: ingressgateway

envVars: []
gatewayApi:
port: 443
hosts: []
gatewayName: ""
gatewayNamespace: ""

envVars: []
19 changes: 19 additions & 0 deletions charts/hlf-ordnode/templates/tlsroute-admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if and .Values.channelParticipationEnabled (and (not .Values.adminIstio.hosts) (and (.Values.adminGatewayApi.hosts) (.Values.adminGatewayApi.gatewayName))) -}}
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TLSRoute
metadata:
name: {{ include "hlf-ordnode.fullname" . }}-tlsroute-admin
spec:
parentRefs:
- name: {{.Values.adminGatewayApi.gatewayName}}
sectionName: tcp
namespace: {{.Values.gatewayApi.gatewayNamespace}}
hostnames:
{{- range .Values.adminGatewayApi.hosts }}
- {{ . }}
{{- end }}
rules:
- backendRefs:
- name: {{ include "hlf-ordnode.fullname" . }}
port: 7053
{{- end -}}
19 changes: 19 additions & 0 deletions charts/hlf-ordnode/templates/tlsroute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if and (not .Values.istio.hosts) (and (.Values.gatewayApi.hosts) (.Values.gatewayApi.gatewayName)) -}}
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TLSRoute
metadata:
name: {{ include "hlf-ordnode.fullname" . }}-tlsroute
spec:
parentRefs:
- name: {{.Values.gatewayApi.gatewayName}}
sectionName: tcp
namespace: {{.Values.gatewayApi.gatewayNamespace}}
hostnames:
{{- range .Values.gatewayApi.hosts }}
- {{ . }}
{{- end }}
rules:
- backendRefs:
- name: {{ include "hlf-ordnode.fullname" . }}
port: 7050
{{- end -}}
12 changes: 12 additions & 0 deletions charts/hlf-ordnode/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ adminIstio:
hosts: []
ingressGateway: ingressgateway

gatewayApi:
port: 443
hosts: []
gatewayName: "hlf-gateway"
gatewayNamespace: ""

adminGatewayApi:
port: 443
hosts: []
gatewayName: "hlf-gateway"
gatewayNamespace: ""


serviceMonitor:
## If true, a ServiceMonitor CRD is created for a prometheus operator
Expand Down
19 changes: 19 additions & 0 deletions charts/hlf-peer/templates/tls-route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if and (not .Values.istio.hosts) (and (.Values.gatewayApi.hosts) (.Values.gatewayApi.gatewayName)) -}}
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TLSRoute
metadata:
name: {{ include "hlf-peer.fullname" . }}-tlsroute
spec:
parentRefs:
- name: {{.Values.gatewayApi.gatewayName}}
sectionName: tcp
namespace: {{.Values.gatewayApi.gatewayNamespace}}
hostnames:
{{- range .Values.gatewayApi.hosts }}
- {{ . }}
{{- end }}
rules:
- backendRefs:
- name: {{ include "hlf-peer.fullname" . }}
port: 7051
{{- end -}}
5 changes: 5 additions & 0 deletions charts/hlf-peer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,9 @@ couchdbPassword: "couchdb"
opsTLS:
key: ""
cert: ""
gatewayApi:
port: 443
hosts: []
gatewayName: "hlf-gateway"
gatewayNamespace: ""

Loading

0 comments on commit a08644a

Please sign in to comment.