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: Write pod cost to CRD #1134

Merged
merged 22 commits into from
Apr 26, 2023
Merged

feat: Write pod cost to CRD #1134

merged 22 commits into from
Apr 26, 2023

Conversation

patriknw
Copy link
Member

@patriknw patriknw commented Apr 19, 2023

  • alternative to adding the Kubernetes annotation directly to the pod resource in case allowing PATCH verb is a security concern
  • a separate Kubernetes operator with more privilages would watch the CR and update the pod resource with the annotation

TODO:

  • add test similar to PodDeletionCostAnnotatorSpec
  • add integration test to integration-test/rollingupdate-kubernetes
  • docs
  • FIXMEs
  • maybe some more config for the CRD to be able to change the names

Copy link
Member

@johanandren johanandren left a comment

Choose a reason for hiding this comment

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

Looks good so far


log.debug("kubernetes access namespace: {}. Secure: {}", namespace, settings.secure)

override def updatePodDeletionCostAnnotation(podName: String, cost: Int): Future[Done] = {
Copy link
Member Author

Choose a reason for hiding this comment

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

This was "moved" from previous ApiRequests and PodDeletionCostAnnotator actor


201 Created if it works
*/
override def readOrCreatePodCostResource(crName: String): Future[PodCostResource] = {
Copy link
Member Author

Choose a reason for hiding this comment

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

These methods for reading and updating the CR are based on the corresponding in the lease module.

@patriknw patriknw force-pushed the wip-pod-delete-crd-patriknw branch 2 times, most recently from 2cb3d9b to 5984b10 Compare April 21, 2023 12:43
@patriknw patriknw marked this pull request as ready for review April 24, 2023 06:21
Copy link
Member

@johanandren johanandren left a comment

Choose a reason for hiding this comment

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

LGTM (but CI unhappy about some formatting and rolling upgrade integration test is failing)

if (normalized.length > 63)
throw new IllegalArgumentException(s"Too long resource name [$normalized]. At most 63 characters is accepted. " +
"A custom resource name can be defined in configuration `akka.rollingupdate.kubernetes.custom-resource.cr-name`.")
trim(normalized, List('-'))
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@efgpinto efgpinto left a comment

Choose a reason for hiding this comment

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

LGTM

* alternative to adding the Kubernetes annotation directly to the pod resource
  in case allowing PATCH verb is a security concern
* a separate Kubernetes operator with more privilages would watch the CR and
  update the pod resource with the annotation
@patriknw patriknw force-pushed the wip-pod-delete-crd-patriknw branch from 8656cb7 to 7800157 Compare April 26, 2023 13:34
@patriknw patriknw merged commit bd6c4c1 into main Apr 26, 2023
11 checks passed
@patriknw patriknw deleted the wip-pod-delete-crd-patriknw branch April 26, 2023 13:53
@patriknw patriknw added this to the 1.3.1 milestone Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants