-
Notifications
You must be signed in to change notification settings - Fork 108
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
[CECO-1763] Controller for generic custom resource #1534
base: main
Are you sure you want to change the base?
Conversation
// +k8s:openapi-gen=true | ||
type DatadogGenericCRSpec struct { | ||
// Type is the type of the API object | ||
// TODO: Add validation for the type (enum) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TODO: Add validation for the type (enum) | |
// +kubebuilder:validation:Enum=notebook;synthetics_api_test;synthetics_browser_test |
Will need to regenerate CRD. Worth adding a comment at the end of the constants about updating this line for new types.
// +kubebuilder:printcolumn:name="age",type="date",JSONPath=".metadata.creationTimestamp" | ||
// +k8s:openapi-gen=true | ||
// +genclient | ||
type DatadogGenericCR struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this naming. CR is kubernetes-specific concept while this represents a generic resource in Datadog. Maybe DatadogResource
, DatadogApiResource
, DatadogGenericResource
is a better fit?
type operation string | ||
|
||
const ( | ||
// mockSubresource is used to mock the subresource in tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any way to avoid this in the prod code?
//+kubebuilder:rbac:groups=datadoghq.com,resources=datadoggenericcrs/status,verbs=get;update;patch | ||
//+kubebuilder:rbac:groups=datadoghq.com,resources=datadoggenericcrs/finalizers,verbs=update | ||
|
||
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, redundant comment
Left some suggestions/nits. Overall looks good but handling of multiple resource APIs (in utils.go) can be refactored to more maintainable code. |
What does this PR do?
Introduces a generic controller relying on Datadog Go client to handle CRUD operations on multiple resources. Initial support includes notebooks and synthetics (api/browser tests).
Examples:
Additional Notes
Next steps:
Minimum Agent Versions
Are there minimum versions of the Datadog Agent and/or Cluster Agent required?
Describe your test plan
-datadogGenericCREnabled=true
inargs
for themanager
container to enable the controllerChecklist
bug
,enhancement
,refactoring
,documentation
,tooling
, and/ordependencies
qa/skip-qa
label