-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Operator 0.5.3 #215
Operator 0.5.3 #215
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: wildfly.org/v1alpha1 | ||
kind: WildFlyServer | ||
metadata: | ||
name: quickstart | ||
spec: | ||
applicationImage: "quay.io/wildfly-quickstarts/wildfly-operator-quickstart:18.0" | ||
replicas: 2 | ||
resources: | ||
limits: | ||
cpu: "1" | ||
memory: "512Mi" | ||
requests: | ||
cpu: "500m" | ||
memory: "256Mi" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,6 +210,33 @@ spec: | |
format: int32 | ||
minimum: 0 | ||
type: integer | ||
resources: | ||
description: 'ResourcesSpec defines the resources used by the WildFlyServer, | ||
ie CPU and memory, use limits and requests. More info: https://pkg.go.dev/k8s.io/[email protected]/core/v1#ResourceRequirements' | ||
properties: | ||
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-compute-resources-container/' | ||
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. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/' | ||
type: object | ||
type: object | ||
secrets: | ||
description: Secrets is a list of Secrets in the same namespace as | ||
the WildFlyServer object, which shall be mounted into the WildFlyServer | ||
|
@@ -534,15 +561,20 @@ spec: | |
\n Read-only." | ||
format: int32 | ||
type: integer | ||
selector: | ||
description: selector for pods, used by HorizontalPodAutoscaler | ||
type: string | ||
required: | ||
- replicas | ||
- scalingdownPods | ||
- selector | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
scale: | ||
labelSelectorPath: .status.selector | ||
specReplicasPath: .spec.replicas | ||
statusReplicasPath: .status.replicas | ||
status: {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,29 @@ spec: | |
replicas:2 | ||
---- | ||
|
||
[[resources]] | ||
## Specify the Resource requirements for the container | ||
|
||
The `resources` spec is defined in the link:../apis.adoc#Resources[Resources API Documentation]. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am getting 404 as this is resolving to Should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
[source,yaml] | ||
.Example of resources configuration | ||
``` | ||
spec: | ||
resources: | ||
limits: | ||
cpu: 500m | ||
memory: 2Gi | ||
requests: | ||
cpu: 100m | ||
memory: 1Gi | ||
``` | ||
|
||
For more examples visit: | ||
|
||
* https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/ | ||
* https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/ | ||
|
||
[[storage]] | ||
## Specify the Storage Requirements for the Server Data Directory | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,9 @@ type WildFlyServerSpec struct { | |
// +kubebuilder:validation:MinItems=1 | ||
// +listType=set | ||
ConfigMaps []string `json:"configMaps,omitempty"` | ||
// ResourcesSpec defines the resources used by the WildFlyServer, ie CPU and memory, use limits and requests. | ||
// More info: https://pkg.go.dev/k8s.io/[email protected]/core/v1#ResourceRequirements | ||
Resources *corev1.ResourceRequirements `json:"resources,omitempty"` | ||
} | ||
|
||
// StandaloneConfigMapSpec defines the desired configMap configuration to obtain the standalone configuration for WildFlyServer | ||
|
@@ -83,6 +86,8 @@ type WildFlyServerStatus struct { | |
// | ||
// Read-only. | ||
ScalingdownPods int32 `json:"scalingdownPods"` | ||
// selector for pods, used by HorizontalPodAutoscaler | ||
Selector string `json:"selector"` | ||
} | ||
|
||
const ( | ||
|
@@ -119,7 +124,7 @@ type PodStatus struct { | |
// +k8s:openapi-gen=true | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas | ||
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector | ||
// +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".spec.replicas" | ||
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" | ||
// +kubebuilder:resource:shortName=wfly | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I ask? From how this is documented here user can think there should be
resources.resurces
field. But in example there is just one fieldresources
.Shouldn't be here
resources
directly of typehttps://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#resourcerequirements-v1-core[corev1.ResourceRequirements
? Analogous as env orenvFrom
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yersan @jmesnil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mchoma,
I understand your concern, the key point here is that the value at the Scheme column is a pointer to another structure (notice it starts with
*
, and not a structure itself. So,resources
is like*resources
, which is indeed ahttps://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#resourcerequirements-v1-core[corev1.ResourceRequirements
This specific case falls into these others:
standaloneConfigMap
-> *StandaloneConfigMapSpecstorage
-> *StorageSpecIt could be subtle for the user's thought, but after you run/check an example, you can realize it. Maybe having more quick examples could help with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mchoma sorry, my explanation isn't really a good one; we indeed have resources -> *resources but then you see a field named as
resources
, and that can be confusing and make you think you have to useresources.resources
to define it.We could have resources -> *resources and then two fields like limits and requests or completely replace resources -> *resources by resources -> corev1.ResourceRequirements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that was my understanding what could be done to be consistent with rest.
TBH that sounds to me it will be less consistent with rest.