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

Cluster provisioning part 1 #12

Merged

Conversation

nsricardor
Copy link
Contributor

@nsricardor nsricardor commented Nov 27, 2024

This pull request implements the provisioning of compute clusters, integrating the latest version of the region service with a shift from physical networks to a more flexible generic network model. While the core provisioning functionality is in place, there are a few features still pending implementation, such as the image selector logic, OpenAPI cluster status support, and the logic to provide custom configuration options post-provisioning.

Copy link
Member

@spjmurray spjmurray left a comment

Choose a reason for hiding this comment

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

Looks relatively small, you're next on my list!

@nsricardor nsricardor marked this pull request as ready for review November 29, 2024 07:53
Copy link
Member

@spjmurray spjmurray left a comment

Choose a reason for hiding this comment

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

I think other than my pedantry, it's good to test on Monday. Looking forward to it!

}

// find rules to delete
for id := range provisionedSet {
Copy link
Member

Choose a reason for hiding this comment

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

Okay so you can now do...

import (
  "github.com/spjmurray/go-util/pkg/set"
)

func foo() {
  // Nice data types!
  actual := set.New[string]()
  required := set.New[string]()

  for _, rule := range rules {
    actual.Add(rule.ID)
  }

  ... etc
  
  // Even nicer Cantor style set theory jazz!
  return required.Difference(actual), actual.Difference(required)
}

Docs here

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'll get it updated before your Monday starts ;)

Copy link
Member

@spjmurray spjmurray Nov 29, 2024

Choose a reason for hiding this comment

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

You could even go as far as something like...

type RuleList []Rule

func (l RuleList) IDs() iter.Seq[string] {
  return func(yield func(s string) bool) {
    for _, r := range l {
      if !yield(r.ID) {
        return
      }
    }
  }
}

then...

actual := set.New(slices.Collect(rules.IDs())...)

some of the new stuff in Go is bloody lovely 😻

@spjmurray
Copy link
Member

Wing it, I can "create" a cluster in the UI and it says provisioned, I'll add in issues as I encounter them!

@spjmurray spjmurray merged commit 6984759 into unikorn-cloud:main Dec 3, 2024
4 checks passed
@nsricardor nsricardor deleted the feature/cluster-provisioning-part1 branch December 4, 2024 02:16
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.

2 participants