Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions api/bases/watcher.openstack.org_watcherappliers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ spec:
description: The service specific Container Image URL (will be set
to environmental default if empty)
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
replicas:
default: 1
description: Replicas of Watcher service to run
Expand Down
7 changes: 0 additions & 7 deletions api/bases/watcher.openstack.org_watcherdecisionengines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ spec:
description: The service specific Container Image URL (will be set
to environmental default if empty)
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
replicas:
default: 1
description: Replicas of Watcher service to run
Expand Down
90 changes: 90 additions & 0 deletions api/bases/watcher.openstack.org_watchers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,83 @@ spec:
apiContainerImageURL:
description: APIContainerImageURL
type: string
apiServiceTemplate:
default:
replicas: 1
description: APIServiceTemplate - define the watcher-api service
properties:
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
replicas:
default: 1
description: Replicas of Watcher service to run
format: int32
maximum: 32
minimum: 0
type: integer
resources:
description: |-
Resources - Compute Resources required by this service (Limits/Requests).
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
properties:
claims:
description: |-
Claims lists the names of resources, defined in spec.resourceClaims,
that are used by this container.


This is an alpha field and requires enabling the
DynamicResourceAllocation feature gate.


This field is immutable. It can only be set for containers.
items:
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
properties:
name:
description: |-
Name must match the name of one entry in pod.spec.resourceClaims of
the Pod where this field is used. It makes that resource available
inside a container.
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: |-
Limits describes the maximum amount of compute resources allowed.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
requests:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: |-
Requests describes the minimum amount of compute resources required.
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
otherwise to an implementation-defined value. Requests cannot exceed Limits.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
type: object
type: object
applierContainerImageURL:
description: ApplierContainerImageURL
type: string
Expand All @@ -63,6 +140,13 @@ spec:
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
Expand Down Expand Up @@ -97,6 +181,7 @@ spec:
type: string
required:
- apiContainerImageURL
- apiServiceTemplate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to add a webhook validation for apiServiceTemplate? Or Can I include it in this this pr #33 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd bet by adding more validation later, once we have a final definition. I'd propose to keep a basic skeleton of the validation in #33 and complete it when we have the operator in a functional status.

- applierContainerImageURL
- databaseInstance
- decisionengineContainerImageURL
Expand All @@ -105,6 +190,11 @@ spec:
status:
description: WatcherStatus defines the observed state of Watcher
properties:
apiServiceReadyCount:
description: APIServiceReadyCount defines the number or replicas ready
from watcher-api
format: int32
type: integer
conditions:
description: Conditions
items:
Expand Down
36 changes: 31 additions & 5 deletions api/v1beta1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ type WatcherCommon struct {
// +kubebuilder:default=false
// PreserveJobs - do not delete jobs after they finished e.g. to check logs
PreserveJobs bool `json:"preserveJobs"`

// +kubebuilder:validation:Optional
// NodeSelector to target subset of worker nodes running this component. Setting here overrides
// any global NodeSelector settings within the Watcher CR.
NodeSelector *map[string]string `json:"nodeSelector,omitempty"`
}

// WatcherTemplate defines the fields used in the top level CR
Expand Down Expand Up @@ -78,6 +83,11 @@ type WatcherTemplate struct {
// +kubebuilder:default=watcher
// DatabaseAccount - MariaDBAccount CR name used for watcher DB, defaults to watcher
DatabaseAccount string `json:"databaseAccount"`

// +kubebuilder:validation:Required
// +kubebuilder:default={replicas:1}
// APIServiceTemplate - define the watcher-api service
APIServiceTemplate WatcherAPITemplate `json:"apiServiceTemplate"`
}

// PasswordSelector to identify the DB and AdminUser password from the Secret
Expand All @@ -94,11 +104,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
// NodeSelector to target subset of worker nodes running this component. Setting here overrides
// any global NodeSelector settings within the Watcher CR.
NodeSelector *map[string]string `json:"nodeSelector,omitempty"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=1
// +kubebuilder:validation:Maximum=32
Expand All @@ -117,6 +122,27 @@ type WatcherSubCrsCommon struct {
ServiceAccount string `json:"serviceAccount"`
}

// WatcherSubCrsTemplate define de common part of the input parameters specified by the user to
// create a 2nd CR via higher level CRDs.
type WatcherSubCrsTemplate struct {
// +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/
Resources corev1.ResourceRequirements `json:"resources,omitempty"`

// +kubebuilder:validation:Optional
// NodeSelector to target subset of worker nodes running this component. Setting here overrides
// any global NodeSelector settings within the Watcher CR.
NodeSelector *map[string]string `json:"nodeSelector,omitempty"`
}

type WatcherImages struct {
// +kubebuilder:validation:Required
// APIContainerImageURL
Expand Down
10 changes: 10 additions & 0 deletions api/v1beta1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
const (
// WatcherRabbitMQTransportURLReadyCondition -
WatcherRabbitMQTransportURLReadyCondition condition.Type = "WatcherRabbitMQTransportURLReady"
// WatcherAPIReadyCondition -
WatcherAPIReadyCondition condition.Type = "WatcherAPIReady"
)

const (
Expand All @@ -14,4 +16,12 @@ const (
WatcherRabbitMQTransportURLReadyMessage = "WatcherRabbitMQTransportURL successfully created"
// WatcherRabbitMQTransportURLReadyErrorMessage -
WatcherRabbitMQTransportURLReadyErrorMessage = "WatcherRabbitMQTransportURL error occured %s"
// WatcherAPIReadyInitMessage -
WatcherAPIReadyInitMessage = "WatcherAPI creation not started"
// WatcherAPIReadyRunningMessage -
WatcherAPIReadyRunningMessage = "WatcherAPI creation in progress"
// WatcherAPIReadyMessage -
WatcherAPIReadyMessage = "WatcherAPI successfully created"
// WatcherAPIReadyErrorMessage -
WatcherAPIReadyErrorMessage = "WatcherAPI error occured %s"
)
3 changes: 3 additions & 0 deletions api/v1beta1/watcher_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ type WatcherStatus struct {
// then the controller has not processed the latest changes injected by
// the opentack-operator in the top-level CR (e.g. the ContainerImage)
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

// APIServiceReadyCount defines the number or replicas ready from watcher-api
APIServiceReadyCount int32 `json:"apiServiceReadyCount,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
6 changes: 6 additions & 0 deletions api/v1beta1/watcherapi_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ type WatcherAPIStatus struct {
Hash map[string]string `json:"hash,omitempty"`
}

// WatcherAPITemplate defines the input parameters specified by the user to
// create a WatcherAPI via higher level CRDs.
type WatcherAPITemplate struct {
WatcherSubCrsTemplate `json:",inline"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

Expand Down
75 changes: 62 additions & 13 deletions api/v1beta1/zz_generated.deepcopy.go

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

Loading
Loading