-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jesse Haka <haka.jesse@gmail.com>
- Loading branch information
Showing
7 changed files
with
395 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright Envoy Gateway Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// The full text of the Apache license is available in the LICENSE file at | ||
// the root of the repo. | ||
|
||
package v1alpha1 | ||
|
||
// +kubebuilder:validation:XValidation:rule="(has(self.allow) || has(self.deny))",message="one of allow or deny must be specified" | ||
// | ||
// Authorization defines the authorization configuration. | ||
type Authorization struct { | ||
// Rules contains all the authorization rules. | ||
// +kubebuilder:validation:MinItems=1 | ||
Rules []Rule `json:"rules,omitempty"` | ||
} | ||
|
||
// Rule defines the single authorization rule. | ||
type Rule struct { | ||
// ClientSelector contains the client selector configuration. | ||
ClientSelector ClientSelector `json:"clientSelector,omitempty"` | ||
|
||
// Permission contains the permissions for the selector. | ||
Permission Permission `json:"permissions,omitempty"` | ||
|
||
// Action defines the action to be taken if the rule matches. | ||
Action RuleActionType `json:"action,omitempty"` | ||
} | ||
|
||
// ClientSelector contains the client selector configuration. | ||
type ClientSelector struct { | ||
// ClientCIDRs is a list of CIDRs. | ||
// Valid examples are "192.168.1.0/24" or "2001:db8::/64" | ||
// | ||
// +optional | ||
ClientCIDRs []string `json:"clientCIDR,omitempty"` | ||
} | ||
|
||
// Permission contains the permissions for the selector. | ||
type Permission struct { | ||
// Any indicates that the rule matches any permission. | ||
// | ||
// +optional | ||
Any bool `json:"any,omitempty"` | ||
} | ||
|
||
// RuleActionType specifies the types of authorization rule action. | ||
// +kubebuilder:validation:Enum=AllowRuleType;DenyRuleType;LogRuleType | ||
type RuleActionType string | ||
|
||
const ( | ||
// AllowRuleType is the action to allow the request. | ||
AllowRuleType RuleActionType = "ALLOW" | ||
// DenyRuleType is the action to deny the request. | ||
DenyRuleType RuleActionType = "DENY" | ||
// LogRuleType is the action to log the request. | ||
LogRuleType RuleActionType = "LOG" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.