-
Notifications
You must be signed in to change notification settings - Fork 118
Dynamic control plane configuration support #943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,2 @@ | ||
// Package apis stores the API definitions for NGINX Kubernetes Gateway configuration. | ||
package apis |
This file contains hidden or 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,6 @@ | ||
// Package v1alpha1 contains API Schema definitions for the | ||
// gateway.nginx.org API group. | ||
// | ||
// +kubebuilder:object:generate=true | ||
// +groupName=gateway.nginx.org | ||
package v1alpha1 |
This file contains hidden or 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,90 @@ | ||
package v1alpha1 | ||
|
||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:storageversion | ||
// +kubebuilder:subresource:status | ||
|
||
// NginxGateway represents the dynamic configuration for an NGINX Kubernetes Gateway control plane. | ||
type NginxGateway struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// NginxGatewaySpec defines the desired state of the NginxGateway. | ||
Spec NginxGatewaySpec `json:"spec"` | ||
|
||
// NginxGatewayStatus defines the state of the NginxGateway. | ||
Status NginxGatewayStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// NginxGatewayList contains a list of NginxGateways. | ||
type NginxGatewayList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []NginxGateway `json:"items"` | ||
} | ||
|
||
// NginxGatewaySpec defines the desired state of the NginxGateway. | ||
type NginxGatewaySpec struct { | ||
// Logging defines logging related settings for the control plane. | ||
// | ||
// +optional | ||
Logging *Logging `json:"logging,omitempty"` | ||
} | ||
|
||
// Logging defines logging related settings for the control plane. | ||
type Logging struct { | ||
// Level defines the logging level. | ||
// | ||
// +optional | ||
// +kubebuilder:default=info | ||
Level *ControllerLogLevel `json:"level,omitempty"` | ||
} | ||
|
||
// ControllerLogLevel type defines the logging level for the control plane. | ||
// | ||
// +kubebuilder:validation:Enum=info;debug;error | ||
type ControllerLogLevel string | ||
|
||
const ( | ||
// ControllerLogLevelInfo is the info level for control plane logging. | ||
ControllerLogLevelInfo ControllerLogLevel = "info" | ||
|
||
// ControllerLogLevelDebug is the debug level for control plane logging. | ||
ControllerLogLevelDebug ControllerLogLevel = "debug" | ||
|
||
// ControllerLogLevelError is the error level for control plane logging. | ||
ControllerLogLevelError ControllerLogLevel = "error" | ||
) | ||
|
||
// NginxGatewayStatus defines the state of the NginxGateway. | ||
type NginxGatewayStatus struct { | ||
// +optional | ||
sjberman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// +listType=map | ||
// +listMapKey=type | ||
// +kubebuilder:validation:MaxItems=8 | ||
Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
} | ||
|
||
// NginxGatewayConditionType is a type of condition associated with an | ||
// NginxGateway. This type should be used with the NginxGatewayStatus.Conditions field. | ||
type NginxGatewayConditionType string | ||
|
||
// NginxGatewayConditionReason defines the set of reasons that explain why a | ||
// particular NginxGateway condition type has been raised. | ||
type NginxGatewayConditionReason string | ||
|
||
const ( | ||
// NginxGatewayConditionValid is a condition that is true when the NginxGateway | ||
// configuration is syntactically and semantically valid. | ||
NginxGatewayConditionValid NginxGatewayConditionType = "Valid" | ||
|
||
// NginxGatewayReasonValid is a reason that is used with the "Valid" condition when the condition is True. | ||
NginxGatewayReasonValid NginxGatewayConditionReason = "Valid" | ||
|
||
// NginxGatewayReasonInvalid is a reason that is used with the "Valid" condition when the condition is False. | ||
NginxGatewayReasonInvalid NginxGatewayConditionReason = "Invalid" | ||
) |
This file contains hidden or 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,41 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
) | ||
|
||
// GroupName specifies the group name used to register the objects. | ||
const GroupName = "gateway.nginx.org" | ||
|
||
// SchemeGroupVersion is group version used to register these objects | ||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} | ||
|
||
// Resource takes an unqualified resource and returns a Group qualified GroupResource | ||
func Resource(resource string) schema.GroupResource { | ||
return SchemeGroupVersion.WithResource(resource).GroupResource() | ||
} | ||
|
||
var ( | ||
// SchemeBuilder collects functions that add things to a scheme. It's to allow | ||
// code to compile without explicitly referencing generated types. You should | ||
// declare one in each package that will have generated deep copy or conversion | ||
// functions. | ||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) | ||
|
||
// AddToScheme applies all the stored functions to the scheme. A non-nil error | ||
// indicates that one function failed and the attempt was abandoned. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) | ||
|
||
// Adds the list of known types to Scheme. | ||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&NginxGateway{}, | ||
&NginxGatewayList{}, | ||
) | ||
// AddToGroupVersion allows the serialization of client types like ListOptions. | ||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion) | ||
return nil | ||
kate-osborn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
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.
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.
Uh oh!
There was an error while loading. Please reload this page.