Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
e32039c
make a BackendConfig alongside the CA security policy [skip ci]
stephencompall-DA Oct 21, 2025
70fa29f
pass the BackendConfig to configureIstio [skip ci]
stephencompall-DA Oct 21, 2025
863ca1c
annotate the istio gateway service with the BackendConfig [skip ci]
stephencompall-DA Oct 21, 2025
8ef95eb
Merge remote-tracking branch 'origin/main' into s11/2723-attach-Secur…
stephencompall-DA Oct 30, 2025
6ff4018
also replace on changes values.service.annotations [skip ci]
stephencompall-DA Nov 3, 2025
4eebe9a
Merge commit 'd676aeb96d77233c19230422ec0f960f803452c8' into s11/2723…
stephencompall-DA Nov 3, 2025
18aeb82
Merge remote-tracking branch 'origin/main' into s11/2723-attach-Secur…
stephencompall-DA Nov 10, 2025
218246d
Merge remote-tracking branch 'origin/main' into s11/2723-attach-Secur…
stephencompall-DA Dec 8, 2025
36b0026
create a GCPBackendPolicy, not a BackendConfig [skip ci]
stephencompall-DA Dec 8, 2025
6a4e716
dumbly pulumify the k8s ALB experiment [skip ci]
stephencompall-DA Dec 8, 2025
5075dd6
link CA policy properly with backend policy [skip ci]
stephencompall-DA Dec 8, 2025
09b9ac1
regional ALB is closer to what we already use [skip ci]
stephencompall-DA Dec 9, 2025
b136984
backend config is now part of the ALB setup [skip ci]
stephencompall-DA Dec 9, 2025
04e89a6
Merge remote-tracking branch 'origin/main' into s11/2723-attach-Secur…
stephencompall-DA Dec 9, 2025
fc0c182
Merge remote-tracking branch 'origin/main' into s11/2723-attach-Secur…
stephencompall-DA Jan 5, 2026
5be3b70
pull gateway service ref from istio gateway helm chart installation […
stephencompall-DA Jan 5, 2026
e1ffe0a
don't expect helm; add TLS config to GKE gateway [skip ci]
stephencompall-DA Jan 5, 2026
0485178
set up routes for https redirect [skip ci]
stephencompall-DA Jan 6, 2026
833c2e3
call configureGKEL7Gateway properly when Cloud Armor enabled [skip ci]
stephencompall-DA Jan 6, 2026
edc7b7b
disable istio https redirect if using GKE L7 instead [skip ci]
stephencompall-DA Jan 6, 2026
dd1c423
Merge remote-tracking branch 'origin/main' into s11/2723-attach-Secur…
stephencompall-DA Jan 14, 2026
5c8ad4f
separate magic strings; pass service name from right place [skip ci]
stephencompall-DA Jan 14, 2026
547c8d1
fix service name [skip ci]
stephencompall-DA Jan 14, 2026
0f7b102
option to configure istio gateway chart as ClusterIP instead [skip ci]
stephencompall-DA Jan 14, 2026
ef762cd
change HTTP 308 to 301 [skip ci]
stephencompall-DA Jan 14, 2026
1bc75fe
pass ingress IP to new gateway instead of istio, if configured [skip ci]
stephencompall-DA Jan 14, 2026
736ffd9
use istio status for health check [skip ci]
stephencompall-DA Jan 14, 2026
7d40c70
redirect port is unsupported; don't need it anyway [skip ci]
stephencompall-DA Jan 15, 2026
2a1517c
avoid unnecessary replacement of cometbft gateway [skip ci]
stephencompall-DA Jan 15, 2026
db28e7b
correct security policy attachment ID [skip ci]
stephencompall-DA Jan 15, 2026
6dd6880
Merge commit '955bf68cb8e94d0b28e8f6370e01bddada038d38' into s11/2723…
stephencompall-DA Jan 16, 2026
07e2516
fix invalid NEG annotation [skip ci]
stephencompall-DA Jan 16, 2026
5d0025c
try with global [skip ci]
stephencompall-DA Jan 16, 2026
8716846
might need parsing for security policy link [skip ci]
stephencompall-DA Jan 16, 2026
ccfeb8c
note about enabling gateway API [skip ci]
stephencompall-DA Jan 16, 2026
cd67be8
go back to regional, qualify the address name [skip ci]
stephencompall-DA Jan 20, 2026
cf5c195
use plain securityPolicy name with assertion; works [skip ci]
stephencompall-DA Jan 20, 2026
37a1b66
go back to unqualified IP address name [skip ci]
stephencompall-DA Jan 20, 2026
8e6005e
new security policy problem [skip ci]
stephencompall-DA Jan 20, 2026
8f63809
make SecurityPolicy region vs global more easily changeable [skip ci]
stephencompall-DA Jan 21, 2026
87ce778
match SecurityPolicy type to gateway type; fixes reference [skip ci]
stephencompall-DA Jan 21, 2026
da43295
note global vs regional; notes on special subnet [skip ci]
stephencompall-DA Jan 21, 2026
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: 19 additions & 9 deletions cluster/pulumi/infra/src/cloudArmor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as gcp from '@pulumi/gcp';
import * as pulumi from '@pulumi/pulumi';
import * as _ from 'lodash';
import { CLUSTER_BASENAME } from '@lfdecentralizedtrust/splice-pulumi-common';
import { CLUSTER_BASENAME, ExactNamespace } from '@lfdecentralizedtrust/splice-pulumi-common';

import * as config from './config';

Expand Down Expand Up @@ -34,23 +34,31 @@ export interface PredefinedWafRule {
sensitivityLevel?: 'off' | 'low' | 'medium' | 'high';
}

// Regional and Global policies and rules use different types/constructors; most
// of our pulumi code doesn't care about the difference so can use this alias
export type Policy = gcp.compute.RegionSecurityPolicy;
const Policy = gcp.compute.RegionSecurityPolicy;
const PolicyRule = gcp.compute.RegionSecurityPolicyRule;

/**
* Creates a Cloud Armor security policy
* @param cac loaded configuration
* @param bothGatewaysNs namespace where both the L7 ALB and the Istio gateways are installed
* @param opts Pulumi resource options
* @returns The created security policy resource, if enabled
*/
export function configureCloudArmorPolicy(
cac: CloudArmorConfig,
bothGatewaysNs: ExactNamespace,
opts?: pulumi.ComponentResourceOptions
): gcp.compute.SecurityPolicy | undefined {
): Policy | undefined {
if (!cac.enabled) {
return undefined;
}

// Step 1: Create the security policy
const name = `waf-whitelist-throttle-ban-${CLUSTER_BASENAME}`;
const securityPolicy = new gcp.compute.SecurityPolicy(
const securityPolicy = new Policy(
name,
{
name,
Expand Down Expand Up @@ -89,7 +97,7 @@ export function configureCloudArmorPolicy(
*/
function addPredefinedWafRules(): void {
/*
securityPolicy: gcp.compute.SecurityPolicy,
securityPolicy: Policy,
rules: PredefinedWafRule[],
preview: boolean,
opts: pulumi.ResourceOptions
Expand All @@ -102,7 +110,7 @@ function addPredefinedWafRules(): void {
*/
function addIpWhitelistRules(): void {
/*
securityPolicy: gcp.compute.SecurityPolicy,
securityPolicy: Policy,
preview: boolean,
opts: pulumi.ResourceOptions
*/
Expand All @@ -113,7 +121,7 @@ function addIpWhitelistRules(): void {
* Adds throttle and ban rules for API endpoints to a security policy
*/
function addThrottleAndBanRules(
securityPolicy: gcp.compute.SecurityPolicy,
securityPolicy: Policy,
throttles: ThrottleConfig,
preview: boolean,
opts: pulumi.ResourceOptions
Expand All @@ -137,10 +145,11 @@ function addThrottleAndBanRules(
const hostExpr = `request.headers['host'].matches(R"^${_.escapeRegExp(hostname)}(?::[0-9]+)?$")`;
const matchExpr = `${pathExpr} && ${hostExpr}`;

new gcp.compute.SecurityPolicyRule(
new PolicyRule(
ruleName,
{
securityPolicy: securityPolicy.name,
region: securityPolicy.region,
description: `Throttle rule for all ${confEntryHead} API endpoints`,
priority,
preview: preview || singleServiceThrottle.rulePreviewOnly,
Expand Down Expand Up @@ -173,7 +182,7 @@ function addThrottleAndBanRules(
* Adds a default deny rule to a security policy
*/
function addDefaultDenyRule(
securityPolicy: gcp.compute.SecurityPolicy,
securityPolicy: Policy,
preview: boolean,
opts: pulumi.ResourceOptions
): void {
Expand All @@ -183,10 +192,11 @@ function addDefaultDenyRule(
if (preview) {
return;
}
new gcp.compute.SecurityPolicyRule(
new PolicyRule(
'default-deny',
{
securityPolicy: securityPolicy.name,
region: securityPolicy.region,
description: 'Default rule to deny all other traffic',
priority: DEFAULT_DENY_RULE_NUMBER,
// default rule cannot be in preview mode; google API gives 400 if you try
Expand Down
Loading