Skip to content

Commit

Permalink
Update: reorg so that we use a similar structure to stateful set inst…
Browse files Browse the repository at this point in the history
…ead of *imaginary* name
  • Loading branch information
vimystic committed Nov 19, 2024
1 parent 9dfdca0 commit 62db355
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 16 deletions.
12 changes: 9 additions & 3 deletions api/v1/cosmosfullnode_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,20 @@ const CosmosFullNodeController = "CosmosFullNode"
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// Ordinal specifies the configuration for pod ordinal numbers
type Ordinal struct {
// Start specifies the initial ordinal number for pod naming
// +kubebuilder:validation:Minimum:=0
Start *int32 `json:"start,omitempty"`
}

// FullNodeSpec defines the desired state of CosmosFullNode
type FullNodeSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// StartingOrdinal specifies the initial ordinal number for pod naming
// +kubebuilder:validation:Minimum:=0
StartingOrdinal *int32 `json:"startingOrdinal,omitempty"`
// Ordinal specifies the configuration for pod ordinal numbers
Ordinal Ordinal `json:"ordinal,omitempty"`

// Number of replicas to create.
// Individual replicas have a consistent identity.
Expand Down
26 changes: 21 additions & 5 deletions api/v1/zz_generated.deepcopy.go

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

16 changes: 10 additions & 6 deletions config/crd/bases/cosmos.strange.love_cosmosfullnodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,16 @@ spec:
Example: cosmos-1
Used for debugging.
type: object
ordinal:
description: Ordinal specifies the configuration for pod ordinal numbers
properties:
start:
description: Start specifies the initial ordinal number for pod
naming
format: int32
minimum: 0
type: integer
type: object
podTemplate:
description: |-
Template applied to all pods.
Expand Down Expand Up @@ -5783,12 +5793,6 @@ spec:
type: string
type: object
type: object
startingOrdinal:
description: StartingOrdinal specifies the initial ordinal number
for pod naming
format: int32
minimum: 0
type: integer
strategy:
description: How to scale pods when performing an update.
properties:
Expand Down
4 changes: 2 additions & 2 deletions controllers/cosmosfullnode_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ func (r *CosmosFullNodeReconciler) Reconcile(ctx context.Context, req ctrl.Reque
}

startingOrdinal := int32(0)
if crd.Spec.StartingOrdinal != nil {
startingOrdinal = *crd.Spec.StartingOrdinal
if crd.Spec.Ordinal.Start != nil {
startingOrdinal = *crd.Spec.Ordinal.Start
}

reporter := kube.NewEventReporter(logger, r.recorder, crd)
Expand Down

0 comments on commit 62db355

Please sign in to comment.