Skip to content
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

feat: add kepler-internal CRD #306

Conversation

sthaha
Copy link
Collaborator

@sthaha sthaha commented Nov 13, 2023

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.

In this PR, I have added the provision to set export.deployment.Image in the keplerinternal API.

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

@sthaha sthaha force-pushed the feat-kepler-internal-api branch 3 times, most recently from 05a0493 to 1addde7 Compare November 14, 2023 02:40
Kepler container is container[0] and not 1 which was a change introduced
in ae09380

Signed-off-by: Sunil Thaha <[email protected]>
@sthaha sthaha force-pushed the feat-kepler-internal-api branch 3 times, most recently from 97c807f to 276e80f Compare November 17, 2023 02:12
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]>
@sthaha sthaha force-pushed the feat-kepler-internal-api branch 3 times, most recently from 7fa8d1e to b72ca9e Compare November 17, 2023 03:03
@sthaha sthaha force-pushed the feat-kepler-internal-api branch from b72ca9e to cee1bb3 Compare November 17, 2023 03:45
@sthaha sthaha requested a review from vimalk78 November 17, 2023 04:35
@sthaha
Copy link
Collaborator Author

sthaha commented Nov 17, 2023

@vprashar2929 could you please give this a go on openshift as well?

@sthaha
Copy link
Collaborator Author

sthaha commented Nov 17, 2023

Lets wait for @vprashar2929 to run the tests before merging this 👼

@vprashar2929
Copy link
Collaborator

When kepler deployed using Kepler API the instance also visible in KeplerInternal as well

~ ❯ oc get kepler -o wide ; oc get keplerinternals -o wide                                                                                         ⎈ 
NAME     PORT   DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   AGE     NODE-SELECTOR                  TOLERATIONS
kepler   9103   6         6         6       6            6           2m29s   {"kubernetes.io/os":"linux"}   [{"operator":"Exists"}]
NAME     PORT   DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   AGE     IMAGE                                                   NODE-SELECTOR                  TOLERATIONS
kepler   9103   6         6         6       6            6           2m33s   quay.io/sustainable_computing_io/kepler:release-0.6.1   {"kubernetes.io/os":"linux"}   [{"operator":"Exists"}]

@sthaha
Copy link
Collaborator Author

sthaha commented Nov 20, 2023

When kepler deployed using Kepler API the instance also visible in KeplerInternal as well

Like the PR mentions, Kepler is now a facade over KeplerInternal, so when user creates Kepler, kepler-controller creates KeplerInternal and then kepler-internal controller creates the daemonset, etc ..

metadata:
type: object
spec:
description: KeplerInternalSpec defines the desired state of Kepler
Copy link
Collaborator

Choose a reason for hiding this comment

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

desired state of KeplerInternal

properties:
deployment:
properties:
image:
Copy link
Collaborator

Choose a reason for hiding this comment

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

add description? since users can set the image in KeplerInternal which is not allowed in Kepler

Comment on lines +23 to +27
- description: KeplerInternal is the Schema for internal/unsupported API
displayName: KeplerInternal
kind: KeplerInternal
name: keplerinternals.kepler.system.sustainable.computing.io
version: v1alpha1
Copy link
Collaborator

Choose a reason for hiding this comment

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

add statusDescriptors for KeplerInternal same as that of Kepler ?

type: object
type: object
type: object
status:
Copy link
Collaborator

Choose a reason for hiding this comment

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

question: the status field today is KeplerStatus, for deployment of exporter pods via daemonset.
In the future when model-server is added, a new type ExporterStatus is to be added and all exporter status fields moved there? somewhere need to differentiate exporter status from future added status.

type: object
type: object
status:
description: KeplerStatus defines the observed state of Kepler
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: the type for status is getting reused here, but description says observed state of Kepler

Comment on lines +110 to +114
if kepler == nil {
// no kepler found , so stop here
logger.V(6).Info("Kepler Nil")
return ctrl.Result{}, nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: rename variable to ki . should the log say KeplerInternal Nil

return ctrl.Result{}, nil
}

logger.V(6).Info("Running sub reconcilers", "kepler", kepler.Spec)
Copy link
Collaborator

Choose a reason for hiding this comment

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

running kepler internal ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment for other logs in this file, should it say kepler or keplerinternal ?

@@ -0,0 +1,61 @@
package controllers
Copy link
Collaborator

Choose a reason for hiding this comment

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

add license comment header

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

+1

@@ -0,0 +1,403 @@
package controllers
Copy link
Collaborator

Choose a reason for hiding this comment

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

add license comment header

@sthaha
Copy link
Collaborator Author

sthaha commented Nov 29, 2023

@vimalk78 @sunya-ch , I am closing this PR in favour of #309

@sthaha sthaha closed this Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants