Skip to content

Commit

Permalink
Add watcher-applier deployment to WatcherApplier controller
Browse files Browse the repository at this point in the history
Adds a statefulset deployment of watcher-applier into WatcherApplier
controller.
Includes templates for watcher-applier configuration.
  • Loading branch information
viroel authored and openshift-merge-bot[bot] committed Feb 4, 2025
1 parent 40933a2 commit 65536a3
Show file tree
Hide file tree
Showing 22 changed files with 544 additions and 53 deletions.
6 changes: 5 additions & 1 deletion api/bases/watcher.openstack.org_watcherappliers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ spec:
default: 1
description: Replicas of Watcher service to run
format: int32
maximum: 32
maximum: 1
minimum: 0
type: integer
resources:
Expand Down Expand Up @@ -251,6 +251,10 @@ spec:
the openstack-operator in the top-level CR (e.g. the ContainerImage)
format: int64
type: integer
readyCount:
description: ReadyCount of watcher Applier instances
format: int32
type: integer
type: object
type: object
served: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ spec:
default: 1
description: Replicas of Watcher service to run
format: int32
maximum: 32
maximum: 1
minimum: 0
type: integer
resources:
Expand Down
7 changes: 0 additions & 7 deletions api/v1beta1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,6 @@ type WatcherSubCrsCommon struct {
// The service specific Container Image URL (will be set to environmental default if empty)
ContainerImage string `json:"containerImage"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=1
// +kubebuilder:validation:Maximum=32
// +kubebuilder:validation:Minimum=0
// Replicas of Watcher service to run
Replicas *int32 `json:"replicas"`

// +kubebuilder:validation:Optional
// Resources - Compute Resources required by this service (Limits/Requests).
// https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand Down
7 changes: 7 additions & 0 deletions api/v1beta1/watcherapi_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ type WatcherAPISpec struct {

WatcherSubCrsCommon `json:",inline"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=1
// +kubebuilder:validation:Maximum=32
// +kubebuilder:validation:Minimum=0
// Replicas of Watcher service to run
Replicas *int32 `json:"replicas"`

// +kubebuilder:validation:Optional
// Override, provides the ability to override the generated manifest of
// several child resources.
Expand Down
10 changes: 8 additions & 2 deletions api/v1beta1/watcherapplier_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ type WatcherApplierSpec struct {
Secret string `json:"secret"`

WatcherSubCrsCommon `json:",inline"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=1
// +kubebuilder:validation:Maximum=1
// +kubebuilder:validation:Minimum=0
// Replicas of Watcher service to run
Replicas *int32 `json:"replicas"`
}

// WatcherApplierStatus defines the observed state of WatcherApplier
Expand All @@ -52,9 +59,8 @@ type WatcherApplierStatus struct {
// the openstack-operator in the top-level CR (e.g. the ContainerImage)
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

// TODO(dviroel): Add ReadyCount once Deployment is implemented
// ReadyCount of watcher Applier instances
// ReadyCount int32 `json:"readyCount,omitempty"`
ReadyCount int32 `json:"readyCount,omitempty"`

// Map of hashes to track e.g. job status
Hash map[string]string `json:"hash,omitempty"`
Expand Down
7 changes: 7 additions & 0 deletions api/v1beta1/watcherdecisionengine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ type WatcherDecisionEngineSpec struct {
Secret string `json:"secret"`

WatcherSubCrsCommon `json:",inline"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=1
// +kubebuilder:validation:Maximum=1
// +kubebuilder:validation:Minimum=0
// Replicas of Watcher service to run
Replicas *int32 `json:"replicas"`
}

// WatcherDecisionEngineStatus defines the observed state of WatcherDecisionEngine
Expand Down
20 changes: 15 additions & 5 deletions api/v1beta1/zz_generated.deepcopy.go

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

6 changes: 5 additions & 1 deletion config/crd/bases/watcher.openstack.org_watcherappliers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ spec:
default: 1
description: Replicas of Watcher service to run
format: int32
maximum: 32
maximum: 1
minimum: 0
type: integer
resources:
Expand Down Expand Up @@ -251,6 +251,10 @@ spec:
the openstack-operator in the top-level CR (e.g. the ContainerImage)
format: int64
type: integer
readyCount:
description: ReadyCount of watcher Applier instances
format: int32
type: integer
type: object
type: object
served: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ spec:
default: 1
description: Replicas of Watcher service to run
format: int32
maximum: 32
maximum: 1
minimum: 0
type: integer
resources:
Expand Down
12 changes: 12 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ rules:
- patch
- update
- watch
- apiGroups:
- apps
resources:
- statefulsets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- batch
resources:
Expand Down
2 changes: 1 addition & 1 deletion controllers/watcher_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,10 +817,10 @@ func (r *WatcherReconciler) ensureAPI(
},
WatcherSubCrsCommon: watcherv1beta1.WatcherSubCrsCommon{
ContainerImage: instance.Spec.APIContainerImageURL,
Replicas: instance.Spec.APIServiceTemplate.Replicas,
Resources: instance.Spec.APIServiceTemplate.Resources,
ServiceAccount: "watcher-" + instance.Name,
},
Replicas: instance.Spec.APIServiceTemplate.Replicas,
Override: instance.Spec.APIServiceTemplate.Override,
}

Expand Down
Loading

0 comments on commit 65536a3

Please sign in to comment.