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
1 change: 1 addition & 0 deletions .cruft.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@
},
"directory": null
}

12 changes: 3 additions & 9 deletions class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@ parameters:
multi_tenant: true
namespace: syn-kgateway

gateway_api:
enabled: true
channel: experimental
version: v1.4.0
source: https://github.com/kubernetes-sigs/gateway-api/releases/download/${kgateway:gateway_api:version}/${kgateway:gateway_api:channel}-install.yaml

charts:
kgateway-crds:
source: oci://cr.kgateway.dev/kgateway-dev/charts/kgateway-crds
version: 2.3.6
version: 2.4.2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change, the PR clearly doesn't check the box "PR contains a single logical change (to build a better changelog)." anymore.

kgateway:
source: oci://cr.kgateway.dev/kgateway-dev/charts/kgateway
version: 2.3.6
version: 2.4.2

namespace_labels: {}
namespace_annotations: {}
Expand All @@ -34,7 +28,7 @@ parameters:
traffic_policies: {}

rbac:
# Whether to aggregate read permissions for Gateway API + kgateway CRDs to the `cluster-reader` cluster role
# Whether to aggregate read permissions for the kgateway CRDs to the `cluster-reader` cluster role
aggregated_cluster_reader: true

helm_values_crds: {}
Expand Down
4 changes: 0 additions & 4 deletions class/kgateway.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
parameters:
kapitan:
dependencies:
- type: https
source: ${kgateway:gateway_api:source}
output_path: ${_base_directory}/manifests/gateway-api/install.yaml
- type: helm
source: ${kgateway:charts:kgateway-crds:source}
version: ${kgateway:charts:kgateway-crds:version}
Expand All @@ -21,7 +18,6 @@ parameters:
output_path: .
- input_paths:
- ${_base_directory}/component/main.jsonnet
- ${_base_directory}/component/gateway-api-crds.jsonnet
input_type: jsonnet
output_path: kgateway/
# kgateway CRDs Helm chart
Expand Down
42 changes: 0 additions & 42 deletions component/gateway-api-crds.jsonnet

This file was deleted.

8 changes: 4 additions & 4 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// main template for kgateway
local com = import 'lib/commodore.libjsonnet';
local kap = import 'lib/kapitan.libjsonnet';
local kube = import 'lib/kube.libjsonnet';
local lib = import 'lib/kgateway.libsonnet';
local kube = import 'lib/kube.libjsonnet';
local inv = kap.inventory();
// The hiera parameters for the component
local params = inv.parameters.kgateway;
Expand All @@ -18,9 +18,9 @@ local aggregatedClusterRole = {
},
rules: [
{
apiGroups: [lib.kgatewayApiGroup],
resources: ['*'],
verbs: ['get', 'list', 'watch'],
apiGroups: [ lib.kgatewayApiGroup ],
resources: [ '*' ],
verbs: [ 'get', 'list', 'watch' ],
},
],
};
Expand Down
9 changes: 9 additions & 0 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@

kgateway is a Commodore component to manage kgateway.

[NOTE]
====
This component requires https://github.com/projectsyn/component-gateway-api[component-gateway-api] to be present in the cluster's `applications`.
That component installs the upstream Gateway API CRDs and provides the component library which this component uses to generate Gateway API resources such as `Gateway`, `HTTPRoute` and `ReferenceGrant`.

Ensure that the deployed kgateway version and its enabled features are compatible with the Gateway API channel and version configured for component-gateway-api on the cluster.
For example, experimental Gateway API features (`KGW_ENABLE_GATEWAY_API_EXPERIMENTAL_FEATURES`) require the `experimental` channel.
====

See the xref:references/parameters.adoc[parameters] reference for further details.
33 changes: 3 additions & 30 deletions docs/modules/ROOT/pages/references/parameters.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,6 @@ default:: `{}`
Additional annotations to add to the component's namespace.


== `gateway_api.enabled`

[horizontal]
type:: bool
default:: `true`

Whether to install Gateway API CRDs.
Disable this if Gateway API CRDs are managed by another component or installed separately.


== `gateway_api.channel`

[horizontal]
type:: string
default:: `experimental`

The Gateway API release channel to install.
See https://gateway-api.sigs.k8s.io/guides/#install-standard-channel[Gateway API installation guide] for available channels.


== `gateway_api.version`

[horizontal]
type:: string
default:: `v1.4.0`

The Gateway API CRD version to install.


== `charts`

[horizontal]
Expand Down Expand Up @@ -370,7 +341,9 @@ A common use case is deploying an HTTP-to-HTTPS redirect route alongside a Gatew
type:: bool
default:: `true`

Whether to create ClusterRoles aggregated to `cluster-reader` that grant read access to kgateway CRDs (and Gateway API CRDs when `gateway_api.enabled` is `true`).
Whether to create a ClusterRole aggregated to `cluster-reader` that grants read access to the kgateway CRDs.

NOTE: The aggregated ClusterRole for the upstream Gateway API CRDs is managed by https://github.com/projectsyn/component-gateway-api[component-gateway-api].


== `helm_values_crds`
Expand Down
42 changes: 14 additions & 28 deletions lib/kgateway.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,16 @@
* Library with public helper methods provided by component kgateway.
*/

local gatewayApiGroup = 'gateway.networking.k8s.io';
local kgatewayApiGroup = 'gateway.kgateway.dev';
local kap = import 'lib/kapitan.libjsonnet';
local inv = kap.inventory();

local Gateway(name='') = {
apiVersion: '%s/v1' % gatewayApiGroup,
kind: 'Gateway',
metadata: {
name: name,
},
};
local gw =
if std.member(inv.applications, 'gateway-api') then
import 'lib/gateway-api.libsonnet'
else
error 'Application "gateway-api" is required for the Gateway API helpers provided by lib/kgateway.libsonnet';

local ReferenceGrant(name='') = {
apiVersion: '%s/v1beta1' % gatewayApiGroup,
kind: 'ReferenceGrant',
metadata: {
name: name,
},
};
local kgatewayApiGroup = 'gateway.kgateway.dev';

local GatewayParameters(name='') = {
apiVersion: '%s/v1alpha1' % kgatewayApiGroup,
Expand Down Expand Up @@ -61,24 +53,18 @@ local TrafficPolicy(name='') = {
},
};

local HTTPRoute(name='') = {
apiVersion: '%s/v1' % gatewayApiGroup,
kind: 'HTTPRoute',
metadata: {
name: name,
},
};

{
Gateway: Gateway,
ReferenceGrant: ReferenceGrant,
Gateway: gw.Gateway,
HTTPRoute: gw.HTTPRoute,
ReferenceGrant: gw.ReferenceGrant,

GatewayParameters: GatewayParameters,
ListenerPolicy: ListenerPolicy,
BackendConfigPolicy: BackendConfigPolicy,
GatewayExtension: GatewayExtension,
TrafficPolicy: TrafficPolicy,
HTTPRoute: HTTPRoute,

gatewayApiGroup: gatewayApiGroup,
gatewayApiGroup: gw.gatewayApiGroup,
gatewayApiExperimentalGroup: gw.gatewayApiExperimentalGroup,
kgatewayApiGroup: kgatewayApiGroup,
}
12 changes: 10 additions & 2 deletions tests/defaults.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
# Overwrite parameters here
# parameters: {...}
applications:
- gateway-api

parameters:
# Dependency for testing with upstream lib
kapitan:
dependencies:
- type: https
source: https://raw.githubusercontent.com/projectsyn/component-gateway-api/master/lib/gateway-api.libsonnet
output_path: vendor/lib/gateway-api.libsonnet
Loading
Loading