-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: introduce the v1 version of component definition
- Loading branch information
Showing
10 changed files
with
31,930 additions
and
2 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
Large diffs are not rendered by default.
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,39 @@ | ||
/* | ||
Copyright (C) 2022-2024 ApeCloud Co., Ltd | ||
This file is part of KubeBlocks project | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
// Package v1 contains API Schema definitions for the apps v1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=apps.kubeblocks.io | ||
package v1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects | ||
GroupVersion = schema.GroupVersion{Group: "apps.kubeblocks.io", Version: "v1"} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToScheme adds the types in this group-version to the given scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) |
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,111 @@ | ||
/* | ||
Copyright (C) 2022-2024 ApeCloud Co., Ltd | ||
This file is part of KubeBlocks project | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package v1 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
) | ||
|
||
// Phase represents the status of a CR. | ||
// | ||
// +enum | ||
// +kubebuilder:validation:Enum={Available,Unavailable} | ||
type Phase string | ||
|
||
const ( | ||
// AvailablePhase indicates that a CR is in an available state. | ||
AvailablePhase Phase = "Available" | ||
|
||
// UnavailablePhase indicates that a CR is in an unavailable state. | ||
UnavailablePhase Phase = "Unavailable" | ||
) | ||
|
||
// LetterCase defines the available cases to be used in password. | ||
// | ||
// +enum | ||
// +kubebuilder:validation:Enum={LowerCases,UpperCases,MixedCases} | ||
type LetterCase string | ||
|
||
const ( | ||
// LowerCases represents the use of lower case letters only. | ||
LowerCases LetterCase = "LowerCases" | ||
|
||
// UpperCases represents the use of upper case letters only. | ||
UpperCases LetterCase = "UpperCases" | ||
|
||
// MixedCases represents the use of a mix of both lower and upper case letters. | ||
MixedCases LetterCase = "MixedCases" | ||
) | ||
|
||
type Service struct { | ||
// Name defines the name of the service. | ||
// otherwise, it indicates the name of the service. | ||
// Others can refer to this service by its name. (e.g., connection credential) | ||
// Cannot be updated. | ||
// | ||
// +kubebuilder:validation:Required | ||
// +kubebuilder:validation:MaxLength=25 | ||
Name string `json:"name"` | ||
|
||
// ServiceName defines the name of the underlying service object. | ||
// If not specified, the default service name with different patterns will be used: | ||
// | ||
// - CLUSTER_NAME: for cluster-level services | ||
// - CLUSTER_NAME-COMPONENT_NAME: for component-level services | ||
// | ||
// Only one default service name is allowed. | ||
// Cannot be updated. | ||
// | ||
// +kubebuilder:validation:MaxLength=25 | ||
// +kubebuilder:validation:Pattern:=`^[a-z]([a-z0-9\-]*[a-z0-9])?$` | ||
// | ||
// +optional | ||
ServiceName string `json:"serviceName,omitempty"` | ||
|
||
// If ServiceType is LoadBalancer, cloud provider related parameters can be put here | ||
// More info: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer. | ||
// | ||
// +optional | ||
Annotations map[string]string `json:"annotations,omitempty"` | ||
|
||
// Spec defines the behavior of a service. | ||
// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status | ||
// | ||
// +optional | ||
Spec corev1.ServiceSpec `json:"spec,omitempty"` | ||
|
||
// Extends the above `serviceSpec.selector` by allowing you to specify defined role as selector for the service. | ||
// When `roleSelector` is set, it adds a label selector "kubeblocks.io/role: {roleSelector}" | ||
// to the `serviceSpec.selector`. | ||
// Example usage: | ||
// | ||
// roleSelector: "leader" | ||
// | ||
// In this example, setting `roleSelector` to "leader" will add a label selector | ||
// "kubeblocks.io/role: leader" to the `serviceSpec.selector`. | ||
// This means that the service will select and route traffic to Pods with the label | ||
// "kubeblocks.io/role" set to "leader". | ||
// | ||
// Note that if `podService` sets to true, RoleSelector will be ignored. | ||
// The `podService` flag takes precedence over `roleSelector` and generates a service for each Pod. | ||
// | ||
// +optional | ||
RoleSelector string `json:"roleSelector,omitempty"` | ||
} |
Oops, something went wrong.