Skip to content

Commit

Permalink
WIP Add basic reconcile methods for WatcherDecisionEngine
Browse files Browse the repository at this point in the history
  • Loading branch information
marios committed Jan 17, 2025
1 parent a22488f commit 0c079bf
Show file tree
Hide file tree
Showing 6 changed files with 460 additions and 7 deletions.
89 changes: 89 additions & 0 deletions api/bases/watcher.openstack.org_watcherdecisionengines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,35 @@ spec:
description: The service specific Container Image URL (will be set
to environmental default if empty)
type: string
memcachedInstance:
default: memcached
description: MemcachedInstance is the name of the Memcached CR that
all watcher service will use.
type: string
nodeSelector:
additionalProperties:
type: string
description: |-
NodeSelector to target subset of worker nodes running this component. Setting here overrides
any global NodeSelector settings within the Watcher CR.
type: object
passwordSelectors:
default:
service: WatcherPassword
description: PasswordSelectors - Selectors to identify the ServiceUser
password from the Secret
properties:
service:
default: WatcherPassword
description: Service - Selector to get the watcher service user
password from the Secret
type: string
type: object
preserveJobs:
default: false
description: PreserveJobs - do not delete jobs after they finished
e.g. to check logs
type: boolean
replicas:
default: 1
description: Replicas of Watcher service to run
Expand Down Expand Up @@ -115,17 +137,84 @@ spec:
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
type: object
secret:
description: Secret containing all passwords / keys needed
type: string
serviceAccount:
description: |-
ServiceAccount - service account name used internally to provide
Watcher services the default SA name
type: string
serviceUser:
default: watcher
description: ServiceUser - optional username used for this service
to register in keystone
type: string
required:
- secret
- serviceAccount
type: object
status:
description: WatcherDecisionEngineStatus defines the observed state of
WatcherDecisionEngine
properties:
conditions:
description: |-
INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
Important: Run "make" to regenerate code after modifying this file
items:
description: Condition defines an observation of a API resource
operational state.
properties:
lastTransitionTime:
description: |-
Last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when
the API field changed is acceptable.
format: date-time
type: string
message:
description: A human readable message indicating details about
the transition.
type: string
reason:
description: The reason for the condition's last transition
in CamelCase.
type: string
severity:
description: |-
Severity provides a classification of Reason code, so the current situation is immediately
understandable and could act accordingly.
It is meant for situations where Status=False and it should be indicated if it is just
informational, warning (next reconciliation might fix it) or an error (e.g. DB create issue
and no actions to automatically resolve the issue can/should be done).
For conditions where Status=Unknown or Status=True the Severity should be SeverityNone.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: Type of condition in CamelCase.
type: string
required:
- lastTransitionTime
- status
- type
type: object
type: array
hash:
additionalProperties:
type: string
description: Map of hashes to track e.g. job status
type: object
observedGeneration:
description: |-
ObservedGeneration - the most recent generation observed for this
service. If the observed generation is less than the spec generation,
then the controller has not processed the latest changes injected by
the openstack-operator in the top-level CR (e.g. the ContainerImage)
format: int64
type: integer
type: object
type: object
served: true
Expand Down
15 changes: 15 additions & 0 deletions api/v1beta1/watcherdecisionengine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1beta1

import (
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -27,6 +28,11 @@ import (
type WatcherDecisionEngineSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
WatcherCommon `json:",inline"`

// +kubebuilder:validation:Required
// Secret containing all passwords / keys needed
Secret string `json:"secret"`

WatcherSubCrsCommon `json:",inline"`
}
Expand All @@ -35,6 +41,15 @@ type WatcherDecisionEngineSpec struct {
type WatcherDecisionEngineStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"`

// ObservedGeneration - the most recent generation observed for this
// service. If the observed generation is less than the spec generation,
// then the controller has not processed the latest changes injected by
// the openstack-operator in the top-level CR (e.g. the ContainerImage)
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// Map of hashes to track e.g. job status
Hash map[string]string `json:"hash,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
19 changes: 17 additions & 2 deletions api/v1beta1/zz_generated.deepcopy.go

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

89 changes: 89 additions & 0 deletions config/crd/bases/watcher.openstack.org_watcherdecisionengines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,35 @@ spec:
description: The service specific Container Image URL (will be set
to environmental default if empty)
type: string
memcachedInstance:
default: memcached
description: MemcachedInstance is the name of the Memcached CR that
all watcher service will use.
type: string
nodeSelector:
additionalProperties:
type: string
description: |-
NodeSelector to target subset of worker nodes running this component. Setting here overrides
any global NodeSelector settings within the Watcher CR.
type: object
passwordSelectors:
default:
service: WatcherPassword
description: PasswordSelectors - Selectors to identify the ServiceUser
password from the Secret
properties:
service:
default: WatcherPassword
description: Service - Selector to get the watcher service user
password from the Secret
type: string
type: object
preserveJobs:
default: false
description: PreserveJobs - do not delete jobs after they finished
e.g. to check logs
type: boolean
replicas:
default: 1
description: Replicas of Watcher service to run
Expand Down Expand Up @@ -115,17 +137,84 @@ spec:
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
type: object
secret:
description: Secret containing all passwords / keys needed
type: string
serviceAccount:
description: |-
ServiceAccount - service account name used internally to provide
Watcher services the default SA name
type: string
serviceUser:
default: watcher
description: ServiceUser - optional username used for this service
to register in keystone
type: string
required:
- secret
- serviceAccount
type: object
status:
description: WatcherDecisionEngineStatus defines the observed state of
WatcherDecisionEngine
properties:
conditions:
description: |-
INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
Important: Run "make" to regenerate code after modifying this file
items:
description: Condition defines an observation of a API resource
operational state.
properties:
lastTransitionTime:
description: |-
Last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when
the API field changed is acceptable.
format: date-time
type: string
message:
description: A human readable message indicating details about
the transition.
type: string
reason:
description: The reason for the condition's last transition
in CamelCase.
type: string
severity:
description: |-
Severity provides a classification of Reason code, so the current situation is immediately
understandable and could act accordingly.
It is meant for situations where Status=False and it should be indicated if it is just
informational, warning (next reconciliation might fix it) or an error (e.g. DB create issue
and no actions to automatically resolve the issue can/should be done).
For conditions where Status=Unknown or Status=True the Severity should be SeverityNone.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: Type of condition in CamelCase.
type: string
required:
- lastTransitionTime
- status
- type
type: object
type: array
hash:
additionalProperties:
type: string
description: Map of hashes to track e.g. job status
type: object
observedGeneration:
description: |-
ObservedGeneration - the most recent generation observed for this
service. If the observed generation is less than the spec generation,
then the controller has not processed the latest changes injected by
the openstack-operator in the top-level CR (e.g. the ContainerImage)
format: int64
type: integer
type: object
type: object
served: true
Expand Down
Loading

0 comments on commit 0c079bf

Please sign in to comment.