Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤖 Generated by Copilot at 86f2bbe
Summary
🧪🇨🇳🔑
This pull request adds a new feature to the
IngressValidator
webhook that validates the ICP licenses of ingress rule hosts in China regions. It defines a new typeIcpValidator
and its methods to query and cache the ICP license information using a third-party API. It also adds new environment variables and error codes to configure and handle the ICP validation. It modifies theIngressValidator
type and its methods to integrate theIcpValidator
and updates the unit tests, the docker image, and the deployment manifests accordingly.Walkthrough
IcpValidator
and its methods to query and cache the ICP license information of a domain name using a third-party API endpoint and a key (link)IcpValidator
to theIngressValidator
type and initialize it with the environment variablesICP_ENABLED
,ICP_ENDPOINT
, andICP_KEY
in theSetupWithManager
method (link, link)validate
method of theIngressValidator
type to use a slice of check functions that includes thecheckIcp
method (link)checkIcp
to theIngressValidator
type that checks if the ingress rule host has a valid ICP license by calling theQuery
method of theIcpValidator
field and returns an error if the validation fails or the query encounters an error (link)IngressFailedIcpCheck
andIngressWebhookInternalError
to thecommon.go
file to indicate the ICP validation failure or the ICP query error (link)ICP_ENABLED
,ICP_ENDPOINT
, andICP_KEY
to themanager.yaml
,Kubefile
, anddeploy.yaml.tmpl
files to configure theIcpValidator
field of theIngressValidator
instance (link, link, link)TestIcpValidator_Query
to theicp_test.go
file that tests theQuery
method of theIcpValidator
with a sample domain name (link)