Skip to content

Commit

Permalink
Define labels and annotations for NodeSet inline (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
kobzonega authored Mar 20, 2024
1 parent b01d9bc commit 25e00cd
Show file tree
Hide file tree
Showing 16 changed files with 400 additions and 39 deletions.
1 change: 1 addition & 0 deletions api/v1alpha1/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const (
AnnotationSkipInitialization = "ydb.tech/skip-initialization"
AnnotationDisableLivenessProbe = "ydb.tech/disable-liveness-probe"
AnnotationDataCenter = "ydb.tech/data-center"
AnnotationGRPCPublicHost = "ydb.tech/grpc-public-host"
AnnotationNodeHost = "ydb.tech/node-host"
AnnotationNodeDomain = "ydb.tech/node-domain"

Expand Down
17 changes: 13 additions & 4 deletions api/v1alpha1/databasenodeset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ type DatabaseNodeSetSpecInline struct {
// +required
Name string `json:"name,omitempty"`

// (Optional) Object should be reference to remote object
// Labels for DatabaseNodeSet object
// +optional
Labels map[string]string `json:"labels,omitempty"`

// Annotations for DatabaseNodeSet object
// +optional
Annotations map[string]string `json:"annotations,omitempty"`

// (Optional) Object should be reference to RemoteDatabaseNodeSet object
// +optional
Remote *RemoteSpec `json:"remote,omitempty"`

Expand Down Expand Up @@ -69,9 +77,10 @@ func init() {
func RecastDatabaseNodeSet(databaseNodeSet *DatabaseNodeSet) *Database {
return &Database{
ObjectMeta: metav1.ObjectMeta{
Name: databaseNodeSet.Spec.DatabaseRef.Name,
Namespace: databaseNodeSet.Spec.DatabaseRef.Namespace,
Labels: databaseNodeSet.Labels,
Name: databaseNodeSet.Spec.DatabaseRef.Name,
Namespace: databaseNodeSet.Spec.DatabaseRef.Namespace,
Labels: databaseNodeSet.Labels,
Annotations: databaseNodeSet.Annotations,
},
Spec: DatabaseSpec{
DatabaseClusterSpec: databaseNodeSet.Spec.DatabaseClusterSpec,
Expand Down
19 changes: 14 additions & 5 deletions api/v1alpha1/storagenodeset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,19 @@ type StorageNodeSetStatus struct {

// StorageNodeSetSpecInline describes an group nodes object inside parent object
type StorageNodeSetSpecInline struct {
// Name of child *NodeSet object
// Name of StorageNodeSet object
// +required
Name string `json:"name"`

// (Optional) Object should be reference to remote object
// Labels for StorageNodeSet object
// +optional
Labels map[string]string `json:"labels,omitempty"`

// Annotations for StorageNodeSet object
// +optional
Annotations map[string]string `json:"annotations,omitempty"`

// (Optional) Object should be reference to RemoteStorageNodeSet object
// +optional
Remote *RemoteSpec `json:"remote,omitempty"`

Expand Down Expand Up @@ -69,9 +77,10 @@ func init() {
func RecastStorageNodeSet(storageNodeSet *StorageNodeSet) *Storage {
return &Storage{
ObjectMeta: metav1.ObjectMeta{
Name: storageNodeSet.Spec.StorageRef.Name,
Namespace: storageNodeSet.Spec.StorageRef.Namespace,
Labels: storageNodeSet.Labels,
Name: storageNodeSet.Spec.StorageRef.Name,
Namespace: storageNodeSet.Spec.StorageRef.Namespace,
Labels: storageNodeSet.Labels,
Annotations: storageNodeSet.Annotations,
},
Spec: StorageSpec{
StorageClusterSpec: storageNodeSet.Spec.StorageClusterSpec,
Expand Down
28 changes: 28 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions deploy/ydb-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.5.1
version: 0.5.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.5.1"
appVersion: "0.5.2"
12 changes: 11 additions & 1 deletion deploy/ydb-operator/crds/database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3154,6 +3154,16 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
description: Annotations for DatabaseNodeSet object
type: object
labels:
additionalProperties:
type: string
description: Labels for DatabaseNodeSet object
type: object
name:
description: Name of DatabaseNodeSet object
type: string
Expand All @@ -3173,7 +3183,7 @@ spec:
description: (Optional) If specified, the pod's priorityClassName.
type: string
remote:
description: (Optional) Object should be reference to remote
description: (Optional) Object should be reference to RemoteDatabaseNodeSet
object
properties:
cluster:
Expand Down
14 changes: 12 additions & 2 deletions deploy/ydb-operator/crds/storage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4289,6 +4289,11 @@ spec:
type: array
type: object
type: object
annotations:
additionalProperties:
type: string
description: Annotations for StorageNodeSet object
type: object
dataStore:
description: (Optional) Where cluster data should be kept
items:
Expand Down Expand Up @@ -4507,8 +4512,13 @@ spec:
description: '(Optional) Whether host network should be enabled.
Default: false'
type: boolean
labels:
additionalProperties:
type: string
description: Labels for StorageNodeSet object
type: object
name:
description: Name of child *NodeSet object
description: Name of StorageNodeSet object
type: string
nodeSelector:
additionalProperties:
Expand All @@ -4526,7 +4536,7 @@ spec:
description: (Optional) If specified, the pod's priorityClassName.
type: string
remote:
description: (Optional) Object should be reference to remote
description: (Optional) Object should be reference to RemoteStorageNodeSet
object
properties:
cluster:
Expand Down
Loading

0 comments on commit 25e00cd

Please sign in to comment.