-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from didil/4-config-crd
Replace config annotations with config CRD
- Loading branch information
Showing
20 changed files
with
696 additions
and
68 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
Copyright 2023. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
|
||
// LoadBalancerConfigSpec defines the desired state of LoadBalancerConfig | ||
type LoadBalancerConfigSpec struct { | ||
// Default defines if this config is the default config | ||
// +kubebuilder:validation:Required | ||
Default bool `json:"default,omitempty"` | ||
// HTTPUpdaterURL is the http updater url | ||
// +kubebuilder:validation:Required | ||
HTTPUpdaterURL string `json:"httpUpdaterURL,omitempty"` | ||
// Host is the load balancer host | ||
// +kubebuilder:validation:Required | ||
Host string `json:"host,omitempty"` | ||
// PortRange is the load balancer port range | ||
// +kubebuilder:validation:Required | ||
PortRange PortRange `json:"portRange,omitempty"` | ||
} | ||
|
||
// PortRange defines the load balancer port range | ||
type PortRange struct { | ||
// Low is the lower limit of the port range | ||
// +kubebuilder:validation:Required | ||
// +kubebuilder:validation:Minimum=1 | ||
Low int `json:"low,omitempty"` | ||
// High is the higher limit of the port range | ||
// +kubebuilder:validation:Required | ||
// +kubebuilder:validation:Maximum=65535 | ||
High int `json:"high,omitempty"` | ||
} | ||
|
||
// LoadBalancerConfigStatus defines the observed state of LoadBalancerConfig | ||
type LoadBalancerConfigStatus struct { | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
//+kubebuilder:subresource:status | ||
|
||
// LoadBalancerConfig is the Schema for the loadbalancerconfigs API | ||
type LoadBalancerConfig struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec LoadBalancerConfigSpec `json:"spec,omitempty"` | ||
Status LoadBalancerConfigStatus `json:"status,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// LoadBalancerConfigList contains a list of LoadBalancerConfig | ||
type LoadBalancerConfigList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []LoadBalancerConfig `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&LoadBalancerConfig{}, &LoadBalancerConfigList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,68 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.11.1 | ||
creationTimestamp: null | ||
name: loadbalancerconfigs.lb.paperlb.com | ||
spec: | ||
group: lb.paperlb.com | ||
names: | ||
kind: LoadBalancerConfig | ||
listKind: LoadBalancerConfigList | ||
plural: loadbalancerconfigs | ||
singular: loadbalancerconfig | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: LoadBalancerConfig is the Schema for the loadbalancerconfigs | ||
API | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: LoadBalancerConfigSpec defines the desired state of LoadBalancerConfig | ||
properties: | ||
default: | ||
description: Default defines if this config is the default config | ||
type: boolean | ||
host: | ||
description: Host is the load balancer host | ||
type: string | ||
httpUpdaterURL: | ||
description: HTTPUpdaterURL is the http updater url | ||
type: string | ||
portRange: | ||
description: PortRange is the load balancer port range | ||
properties: | ||
high: | ||
description: High is the higher limit of the port range | ||
maximum: 65535 | ||
type: integer | ||
low: | ||
description: Low is the lower limit of the port range | ||
minimum: 1 | ||
type: integer | ||
type: object | ||
type: object | ||
status: | ||
description: LoadBalancerConfigStatus defines the observed state of LoadBalancerConfig | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
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
Oops, something went wrong.