Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bd5edf3
api: add GCP support for backend security policies and API schemas
sukumargaonkar May 22, 2025
90121fb
Merge remote-tracking branch 'upstream/main' into gcp-auth-api
sukumargaonkar May 22, 2025
6c7df97
api: add GCP auth support in filter configuration
sukumargaonkar May 22, 2025
355ad5a
add validations for fields in BackendSecurityPolicyGCPCredentials
sukumargaonkar May 22, 2025
ebc5147
remove unused dependencies from go.mod
sukumargaonkar May 23, 2025
f541e98
Merge remote-tracking branch 'upstream/main' into gcp-auth-api
sukumargaonkar May 23, 2025
40b1477
Reorganize fields under BackendSecurityPolicyGCPCredentials
sukumargaonkar May 24, 2025
f7e2634
Merge remote-tracking branch 'upstream/main' into gcp-auth-api
sukumargaonkar May 27, 2025
2414542
make precommit
sukumargaonkar May 27, 2025
f7d5192
Add Region and ProjectName to GCPAuth
sukumargaonkar Jun 9, 2025
c538a45
Merge remote-tracking branch 'upstream/main' into gcp-auth-api
sukumargaonkar Jun 9, 2025
e101a82
Rename GCPWorkloadIdentityProvider.OIDCConfig to OIDCProvider
sukumargaonkar Jun 10, 2025
e851bcc
Merge remote-tracking branch 'upstream/main' into gcp-auth-api
sukumargaonkar Jun 10, 2025
7263be3
Fix go.mod
sukumargaonkar Jun 10, 2025
622f5f5
Switch from GCP CredentialFile to AccessToken
sukumargaonkar Jun 11, 2025
3001321
Merge remote-tracking branch 'upstream/main' into gcp-auth-api
sukumargaonkar Jun 11, 2025
c4208b4
Merge remote-tracking branch 'upstream/main' into gcp-auth-api
sukumargaonkar Jun 11, 2025
831b6d2
Fix gitignore
sukumargaonkar Jun 11, 2025
04b7c08
Add crdcel test for gcp backendsecurity policy
sukumargaonkar Jun 11, 2025
2ae31ec
Remove unnecessary comments
sukumargaonkar Jun 12, 2025
fa5d02d
Merge remote-tracking branch 'upstream/main' into gcp-auth-api
sukumargaonkar Jun 13, 2025
2756c32
refactor: update GCP schema names to include Vertex AI platform
sukumargaonkar Jun 13, 2025
a4e725c
refactor: GeminiVertexAI schema to GCPVertexAI
sukumargaonkar Jun 16, 2025
700dc73
Merge remote-tracking branch 'upstream/main' into gcp-auth-api
sukumargaonkar Jun 16, 2025
687d29c
Fix CI
sukumargaonkar Jun 16, 2025
a48254b
Update docs and comments
sukumargaonkar Jun 17, 2025
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
44 changes: 42 additions & 2 deletions api/v1alpha1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ type AIServiceBackendSpec struct {
type VersionedAPISchema struct {
// Name is the name of the API schema of the AIGatewayRoute or AIServiceBackend.
//
// +kubebuilder:validation:Enum=OpenAI;AWSBedrock;AzureOpenAI
// +kubebuilder:validation:Enum=OpenAI;AWSBedrock;AzureOpenAI;GCPGemini;GCPAnthropic
Comment thread
sukumargaonkar marked this conversation as resolved.
Outdated
Name APISchema `json:"name"`

// Version is the version of the API schema.
Expand All @@ -427,6 +427,15 @@ const (
//
// https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#api-specs
APISchemaAzureOpenAI APISchema = "AzureOpenAI"
// APISchemaGCPGemini is the schema followed by Gemini models hosted on GCP.
Comment thread
yuzisun marked this conversation as resolved.
Outdated
//
// https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.endpoints/generateContent?hl=en
Comment thread
yuzisun marked this conversation as resolved.
APISchemaGCPGemini APISchema = "GCPGemini"
// APISchemaGCPAnthropic is the schema followed by Anthropic models hosted on GCP.
// This is majorly the Anthropic API with some GCP specific parameters as described in below URL.
//
// https://docs.anthropic.com/en/api/claude-on-vertex-ai
APISchemaGCPAnthropic APISchema = "GCPAnthropic"
)

const (
Expand All @@ -442,6 +451,7 @@ const (
BackendSecurityPolicyTypeAPIKey BackendSecurityPolicyType = "APIKey"
BackendSecurityPolicyTypeAWSCredentials BackendSecurityPolicyType = "AWSCredentials"
BackendSecurityPolicyTypeAzureCredentials BackendSecurityPolicyType = "AzureCredentials"
BackendSecurityPolicyTypeGCPCredentials BackendSecurityPolicyType = "GCPCredentials"
)

// BackendSecurityPolicy specifies configuration for authentication and authorization rules on the traffic
Expand All @@ -466,7 +476,7 @@ type BackendSecurityPolicy struct {
type BackendSecurityPolicySpec struct {
// Type specifies the auth mechanism used to access the provider. Currently, only "APIKey", "AWSCredentials", and "AzureCredentials" are supported.
Comment thread
yuzisun marked this conversation as resolved.
Outdated
//
// +kubebuilder:validation:Enum=APIKey;AWSCredentials;AzureCredentials
// +kubebuilder:validation:Enum=APIKey;AWSCredentials;AzureCredentials;GCPCredentials
Type BackendSecurityPolicyType `json:"type"`

// APIKey is a mechanism to access a backend(s). The API key will be injected into the Authorization header.
Expand All @@ -483,6 +493,10 @@ type BackendSecurityPolicySpec struct {
//
// +optional
AzureCredentials *BackendSecurityPolicyAzureCredentials `json:"azureCredentials,omitempty"`
// GCPCredentials is a mechanism to access a backend(s). GCP specific logic will be applied.
//
// +optional
GCPCredentials *BackendSecurityPolicyGCPCredentials `json:"gcpCredentials,omitempty"`
}

// BackendSecurityPolicyList contains a list of BackendSecurityPolicy
Expand Down Expand Up @@ -520,6 +534,32 @@ type BackendSecurityPolicyOIDC struct {
Aud string `json:"aud,omitempty"`
}

// BackendSecurityPolicyGCPCredentials contains the supported authentication mechanisms to access GCP.
type BackendSecurityPolicyGCPCredentials struct {
// ProjectID is the GCP project ID that the backend is hosted in.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
ProjectID string `json:"projectID"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is ProjectID specific to Federation Config? Would it make sense to bubble this field up if it's needed for all GCP auth

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not sure if other authentication methods would need project-id, so keeping it within federation config for now

// ServiceAccountEmail is the email address of the service account to be used to access GCP.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
ServiceAccountEmail string `json:"serviceAccountEmail"`
Comment thread
yuzisun marked this conversation as resolved.
Outdated
// WorkloadIdentityPoolName is the name of the workload identity pool defined in GCP.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
WorkloadIdentityPoolName string `json:"workloadIdentityPoolName"`
Comment thread
yuzisun marked this conversation as resolved.
Outdated
// GCPIdentityProviderName refers to the external identity provider whose credentials your workload is using to authenticate to Google Cloud.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
GCPIdentityProviderName string `json:"GCPIdentityProviderName"`
Comment thread
yuzisun marked this conversation as resolved.
Outdated
// BackendSecurityPolicyOIDC is the generic OIDC fields.
Comment thread
yuzisun marked this conversation as resolved.
Outdated
BackendSecurityPolicyOIDC `json:",inline"`
}

// BackendSecurityPolicyAzureCredentials contains the supported authentication mechanisms to access Azure.
type BackendSecurityPolicyAzureCredentials struct {
// ClientID is a unique identifier for an application in Azure.
Expand Down
21 changes: 21 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

11 changes: 11 additions & 0 deletions filterapi/filterconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ type BackendAuth struct {
AWSAuth *AWSAuth `json:"aws,omitempty"`
// AzureAuth specifies the location of Azure access token file.
AzureAuth *AzureAuth `json:"azure,omitempty"`
// GCPAuth specifies the location of GCP credential file.
GCPAuth *GCPAuth `json:"gcp,omitempty"`
}

// AWSAuth defines the credentials needed to access AWS.
Expand All @@ -229,6 +231,15 @@ type AzureAuth struct {
Filename string `json:"filename"`
}

// GCPAuth defines the file containing GCP credential that will be mounted to the external proc.
type GCPAuth struct {
// CredentialFileName is the name of the file containing the GCP credential.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
CredentialFileName string `json:"credentialFileName,omitempty"`
}

// UnmarshalConfigYaml reads the file at the given path and unmarshals it into a Config struct.
func UnmarshalConfigYaml(path string) (*Config, []byte, error) {
raw, err := os.ReadFile(path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@ spec:
- OpenAI
- AWSBedrock
- AzureOpenAI
- GCPGemini
Comment thread
yuzisun marked this conversation as resolved.
Outdated
- GCPAnthropic
type: string
version:
description: Version is the version of the API schema.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ spec:
- OpenAI
- AWSBedrock
- AzureOpenAI
- GCPGemini
Comment thread
yuzisun marked this conversation as resolved.
Outdated
- GCPAnthropic
type: string
version:
description: Version is the version of the API schema.
Expand Down
Loading