Skip to content
Open
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
17 changes: 16 additions & 1 deletion api/v1alpha1/l7api_types.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2025 Broadcom Inc. and its subsidiaries. All Rights Reserved.
// Copyright (c) 2026 Broadcom Inc. and its subsidiaries. All Rights Reserved.
// AI assistance has been used to generate some or all contents of this file. That includes, but is not limited to, new code, modifying existing code, stylistic edits.

package v1alpha1

Expand Down Expand Up @@ -74,13 +75,27 @@ type PortalMeta struct {
CreateTs int `json:"createTs,omitempty"`
ModifyTs int `json:"modifyTs,omitempty"`
SsgServiceType string `json:"ssgServiceType,omitempty"`
HttpMethods []HttpMethod `json:"httpMethods,omitempty"`

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.

[Suggestion] ❌ No +kubebuilder:validation:Enum marker on HttpMethods []HttpMethod, even though HttpMethod is defined as a closed enum type below with 8 named consts. As generated, the CRD schema only enforces type: array of type: string (see httpMethods: in config/crd/bases/security.brcmlabs.com_l7apis.yaml) — any string value passes admission and flows straight into the Graphman bundle's <l7:Verb> elements via the qtpl template.

✅ Consider adding // +kubebuilder:validation:Enum=GET;POST;PUT;PATCH;DELETE;HEAD;OPTIONS;OTHER above the field so the API server rejects typos/invalid verbs at admission time rather than letting them reach the Gateway.

(Noting the rest of this file doesn't use Enum markers elsewhere, so this is a suggestion rather than a blocking pattern violation.)

@ksaladi ksaladi Jul 21, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Intentional — mirrors StateStoreType/RedisType in l7statestore_types.go, which also has no enum marker.

PolicyTemplates []PolicyTemplate `json:"policyEntities,omitempty"`
CustomFields []CustomField `json:"customFieldValues,omitempty"`
SecurePasswords []SecurePassword `json:"securePasswords,omitempty"`
SecurePasswordIdsForUndeployment []string `json:"securePasswordIdsForUndeployment,omitempty"`
Checksum string `json:"checksum,omitempty"`
}

type HttpMethod string

const (
HttpMethodGet HttpMethod = "GET"
HttpMethodPost HttpMethod = "POST"
HttpMethodPut HttpMethod = "PUT"
HttpMethodPatch HttpMethod = "PATCH"
HttpMethodDelete HttpMethod = "DELETE"
HttpMethodHead HttpMethod = "HEAD"
HttpMethodOptions HttpMethod = "OPTIONS"
HttpMethodOther HttpMethod = "OTHER"

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.

[Question]HttpMethodOther = "OTHER" isn't a real HTTP verb. If a caller sets httpMethods: ["OTHER"], the template will render <l7:Verb>OTHER</l7:Verb> into the Graphman bundle for the l7:HttpMapping. What's the intended use case for this constant? If it's meant as a catch-all for arbitrary/custom verbs, is <l7:Verb>OTHER</l7:Verb> actually meaningful to the Gateway/Graphman schema, or should it be dropped until there's a concrete use for it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

OTHER is a Gateway-native value (see the HttpMethod enum's doc comment in generated-modified.go), not invented here — Portal is just mirroring what the Gateway already exposes.

)

type PolicyTemplate struct {
Uuid string `json:"policyEntityUuid"`
ApiPolicyTemplateArguments []PolicyTemplateArg `json:"policyTemplateArguments"`
Expand Down
5 changes: 5 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.

4 changes: 4 additions & 0 deletions bundle/manifests/security.brcmlabs.com_l7apis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ spec:
type: array
enabled:
type: boolean
httpMethods:
items:
type: string
type: array
locationUrl:
type: string
modifyTs:
Expand Down
4 changes: 4 additions & 0 deletions charts/layer7-operator/crds/l7api-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ spec:
type: array
enabled:
type: boolean
httpMethods:
items:
type: string
type: array
locationUrl:
type: string
modifyTs:
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/security.brcmlabs.com_l7apis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ spec:
type: array
enabled:
type: boolean
httpMethods:
items:
type: string
type: array
locationUrl:
type: string
modifyTs:
Expand Down
4 changes: 4 additions & 0 deletions deploy/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6713,6 +6713,10 @@ spec:
type: array
enabled:
type: boolean
httpMethods:
items:
type: string
type: array
locationUrl:
type: string
modifyTs:
Expand Down
9 changes: 8 additions & 1 deletion internal/templategen/portal-api-restman-template.qtpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
----------------------------------------------
Copyright (c) 2026 Broadcom Inc. and its subsidiaries. All Rights Reserved.
AI assistance has been used to generate some or all contents of this file. That includes, but is not limited to, new code, modifying existing code, stylistic edits.


Variables Used:
Expand All @@ -10,6 +12,7 @@ Variables Used:
- portalApi.ApiEnabled
- portalApi.ModifyTs
- portalApi.CustomFields
- portalApi.HttpMethods
- apiServiceXml
- apiFragmentXml
- isSoapAPI
Expand Down Expand Up @@ -59,7 +62,11 @@ Variables Used:
<l7:HttpMapping>
<l7:UrlPattern>/{%s portalApi.SsgUrl %}</l7:UrlPattern>
<l7:Verbs>
{% if isSoapApi == "true" %}
{% if len(portalApi.HttpMethods) > 0 %}
{% for _, verb := range portalApi.HttpMethods %}
<l7:Verb>{%s verb %}</l7:Verb>
{% endfor %}
{% elseif isSoapApi == "true" %}
<l7:Verb>GET</l7:Verb>
<l7:Verb>POST</l7:Verb>
{% else %}
Expand Down
Loading
Loading