Skip to content

Commit

Permalink
feat: add kepler-internal CRD
Browse files Browse the repository at this point in the history
This commit adds a `KeplerInternal` CRD which is a internal API of
Kepler Operator. Kepler CRD is now a facade for `KeplerInternal`
Creating a `Kepler` now creates a corresponding `keplerinternal` CR
with appropriate spec initialised. The KeplerInternal Controller
responds creation of `kepler-internal` by deploying kepler.

This separation allows for providing stable API - Kepler or other
higher level api (such as `powermon.openshift.io - PowerMonitoring`)
which provides a limited set of stable functionalities to users.

NOTE: KeplerInternal API can break at any point in time, so its usage is
highly discouraged other than for testing experimental features.

Signed-off-by: Sunil Thaha <[email protected]>
  • Loading branch information
sthaha committed Nov 17, 2023
1 parent 3fd788d commit 276e80f
Show file tree
Hide file tree
Showing 16 changed files with 1,535 additions and 477 deletions.
11 changes: 10 additions & 1 deletion bundle/manifests/kepler-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ metadata:
capabilities: Basic Install
categories: Monitoring
containerImage: quay.io/sustainable_computing_io/kepler-operator:0.9.2
createdAt: "2023-11-01T12:15:43Z"
createdAt: "2023-11-14T05:15:33Z"
description: 'Deploys and Manages Kepler on Kubernetes '
operators.operatorframework.io/builder: operator-sdk-v1.27.0
operators.operatorframework.io/internal-objects: |-
[
"keplerinternals.kepler.system.sustainable.computing.io",
]
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/sustainable-computing-io/kepler-operator
name: kepler-operator.v0.9.2
Expand All @@ -38,6 +42,11 @@ spec:
apiservicedefinitions: {}
customresourcedefinitions:
owned:
- description: KeplerInternal is the Schema for internal/unsupported API
displayName: KeplerInternal
kind: KeplerInternal
name: keplerinternals.kepler.system.sustainable.computing.io
version: v1alpha1
- description: Kepler is the Schema for the keplers API
displayName: Kepler
kind: Kepler
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.1
creationTimestamp: null
name: keplerinternals.kepler.system.sustainable.computing.io
spec:
group: kepler.system.sustainable.computing.io
names:
kind: KeplerInternal
listKind: KeplerInternalList
plural: keplerinternals
singular: keplerinternal
scope: Cluster
versions:
- additionalPrinterColumns:
- jsonPath: .spec.exporter.deployment.port
name: Port
type: integer
- jsonPath: .status.desiredNumberScheduled
name: Desired
type: integer
- jsonPath: .status.currentNumberScheduled
name: Current
type: integer
- jsonPath: .status.numberReady
name: Ready
type: integer
- jsonPath: .status.updatedNumberScheduled
name: Up-to-date
type: integer
- jsonPath: .status.numberAvailable
name: Available
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
- jsonPath: .spec.exporter.deployment.nodeSelector
name: Node-Selector
priority: 10
type: string
- jsonPath: .spec.exporter.deployment.tolerations
name: Tolerations
priority: 10
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: KeplerInternal is the Schema for the keplers internal API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: KeplerInternalSpec defines the desired state of Kepler
properties:
exporter:
properties:
deployment:
properties:
nodeSelector:
additionalProperties:
type: string
default:
kubernetes.io/os: linux
description: Defines which Nodes the Pod is scheduled on
type: object
port:
default: 9103
format: int32
maximum: 65535
minimum: 1
type: integer
tolerations:
default:
- effect: ""
key: ""
operator: Exists
value: ""
description: If specified, define Pod's tolerations
items:
description: The pod this Toleration is attached to tolerates
any taint that matches the triple <key,value,effect> using
the matching operator <operator>.
properties:
effect:
description: Effect indicates the taint effect to match.
Empty means match all taint effects. When specified,
allowed values are NoSchedule, PreferNoSchedule and
NoExecute.
type: string
key:
description: Key is the taint key that the toleration
applies to. Empty means match all taint keys. If the
key is empty, operator must be Exists; this combination
means to match all values and all keys.
type: string
operator:
description: Operator represents a key's relationship
to the value. Valid operators are Exists and Equal.
Defaults to Equal. Exists is equivalent to wildcard
for value, so that a pod can tolerate all taints of
a particular category.
type: string
tolerationSeconds:
description: TolerationSeconds represents the period
of time the toleration (which must be of effect NoExecute,
otherwise this field is ignored) tolerates the taint.
By default, it is not set, which means tolerate the
taint forever (do not evict). Zero and negative values
will be treated as 0 (evict immediately) by the system.
format: int64
type: integer
value:
description: Value is the taint value the toleration
matches to. If the operator is Exists, the value should
be empty, otherwise just a regular string.
type: string
type: object
type: array
type: object
type: object
type: object
status:
description: KeplerStatus defines the observed state of Kepler
properties:
conditions:
items:
properties:
lastTransitionTime:
description: lastTransitionTime is the 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: message is a human readable message indicating
details about the transition. This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition.
type: string
status:
description: status of the condition, one of True, False, Unknown.
type: string
type:
description: Type of Kepler Condition - Reconciled, Available
...
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
x-kubernetes-list-type: atomic
currentNumberScheduled:
description: The number of nodes that are running at least 1 kepler
pod and are supposed to run the kepler pod.
format: int32
type: integer
desiredNumberScheduled:
description: The total number of nodes that should be running the
kepler pod (including nodes correctly running the kepler pod).
format: int32
type: integer
numberAvailable:
description: The number of nodes that should be running the kepler
pod and have one or more of the kepler pod running and available
format: int32
type: integer
numberMisscheduled:
description: The number of nodes that are running the kepler pod,
but are not supposed to run the kepler pod.
format: int32
type: integer
numberReady:
description: numberReady is the number of nodes that should be running
the kepler pod and have one or more of the kepler pod running with
a Ready Condition.
format: int32
type: integer
numberUnavailable:
description: The number of nodes that should be running the kepler
pod and have none of the kepler pod running and available
format: int32
type: integer
updatedNumberScheduled:
description: The total number of nodes that are running updated kepler
pod
format: int32
type: integer
required:
- conditions
- currentNumberScheduled
- desiredNumberScheduled
- numberMisscheduled
- numberReady
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: null
storedVersions: null
10 changes: 9 additions & 1 deletion cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,15 @@ func main() {
Scheme: mgr.GetScheme(),
Cluster: cluster,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Kepler")
setupLog.Error(err, "unable to create controller", "controller", "kepler")
os.Exit(1)
}
if err = (&controllers.KeplerInternalReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Cluster: cluster,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "kepler-internal")
os.Exit(1)
}
//+kubebuilder:scaffold:builder
Expand Down
Loading

0 comments on commit 276e80f

Please sign in to comment.