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

Create Custom Resource Definitions (CRDs) to represent the spec #87

Open
kenfinnigan opened this issue Dec 7, 2021 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@kenfinnigan
Copy link
Collaborator

Problem to solve

At the moment there is YAML within the README defining the desired structure, and it appears the specification is embedded into https://github.com/OpenSLO/oslo

Making it difficult to grab the specification and utilize it.

Proposal

To align with the Kubernetes ecosystem, it would be great if there were CRDs that defined the various parts of the specification.

Links / references

https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

@kenfinnigan kenfinnigan added the enhancement New feature or request label Dec 7, 2021
@embano1
Copy link

embano1 commented Jan 23, 2022

Related #20

@kenfinnigan
Copy link
Collaborator Author

I'm going to start looking at this and was curious as to the preferred approach, as we have a few available possibilities.

From my perspective I see the following goals:

  • OpenSLO specification CRD for use with Kubernetes
  • Schema for OpenSLO specification that can be used for basic validation processing. i.e. used by Oslo
  • Go Structs for OpenSLO specification components aligned with the Schema (I know there are structs in Oslo at present, but it would be good to have the Struct and Spec in the same repository for alignment)

In terms of how we get there, here are the options I'm aware of:

  1. Define a schema with Cue as per WIP: Define schema with cue #32. It appears possible to generate a Kubernetes CRD from Cue, but I couldn't see a way to generate Go structs from it. Looks like there is a way to generate validation methods for Go, but it didn't really explain if it was backed by a Struct or not. If anyone has details, please share.
  2. Define a Go Struct for the OpenSLO specification components (maybe using the existing Oslo ones as a starting point) and use the Kubernetes code generator to generate a CRD from the Go Structs. The generation could be tied into the build/release process to prevent PRs needing to run the CRD generation process for each change.

I don't have a preference as to the process, but I'd appreciate feedback from the community as to the preferred approach.

Should I be proposing a PR based on option 2, or looking to help with #32 for option 1?

kenfinnigan pushed a commit to kenfinnigan/OpenSLO that referenced this issue Apr 4, 2022
Can be an alternative to OpenSLO#20 and OpenSLO#87, or as a precursor to them.

Changes:
 - Moved `v1alpha` structs from oslo to here
 - Created `v1beta1` structs to represent the current state of the spec
 - Removed `Service` from `v1beta` as it is not used, as far as I could
   tell
 - Renamed `kind` to `type` for `AlertCondition` to prevent confusion
   with `Kind` which has a different meaning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants