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 support for more resource types #7

Merged
merged 2 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*.dll
*.so
*.dylib
bin/*
/bin/*
Dockerfile.cross

# Test binary, built with `go test -c`
Expand All @@ -26,5 +26,3 @@ go.work
*.swp
*.swo
*~

e2e-test-received-data/
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"arrowParens": "avoid",
"quoteProps": "as-needed",
"printWidth": 120,
"semi": true,
"singleQuote": true,
"trailingComma": "all"
}
12 changes: 0 additions & 12 deletions api/v1alpha1/dash0_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ type Dash0List struct {
Items []Dash0 `json:"items"`
}

type ConditionType string
type Reason string

const (
ConditionTypeAvailable ConditionType = "Available"
ConditionTypeDegraded ConditionType = "Degraded"

ReasonSuccessfulInstrumentation Reason = "SuccessfulInstrumentation"
ReasonAlreadyInstrumented Reason = "AlreadyInstrumented"
ReasonFailedInstrumentation Reason = "FailedInstrumentation"
)

func init() {
SchemeBuilder.Register(&Dash0{}, &Dash0List{})
}
17 changes: 8 additions & 9 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

operatorv1alpha1 "github.com/dash0hq/dash0-operator/api/v1alpha1"
"github.com/dash0hq/dash0-operator/internal/controller"
"github.com/dash0hq/dash0-operator/internal/k8sresources"
"github.com/dash0hq/dash0-operator/internal/util"
dash0webhook "github.com/dash0hq/dash0-operator/internal/webhook"
//+kubebuilder:scaffold:imports
)
Expand Down Expand Up @@ -155,15 +155,17 @@ func startOperatorManager(
initContainerImageVersion,
)

versions := util.Versions{
OperatorVersion: operatorVersion,
InitContainerImageVersion: initContainerImageVersion,
}

if err = (&controller.Dash0Reconciler{
Client: mgr.GetClient(),
ClientSet: clientSet,
Scheme: mgr.GetScheme(),
Recorder: mgr.GetEventRecorderFor("dash0-controller"),
Versions: k8sresources.Versions{
OperatorVersion: operatorVersion,
InitContainerImageVersion: initContainerImageVersion,
},
Versions: versions,
}).SetupWithManager(mgr); err != nil {
return fmt.Errorf("unable to set up the Dash0 reconciler: %w", err)
}
Expand All @@ -172,10 +174,7 @@ func startOperatorManager(
if os.Getenv("ENABLE_WEBHOOKS") != "false" {
if err = (&dash0webhook.Handler{
Recorder: mgr.GetEventRecorderFor("dash0-webhook"),
Versions: k8sresources.Versions{
OperatorVersion: operatorVersion,
InitContainerImageVersion: initContainerImageVersion,
},
Versions: versions,
}).SetupWebhookWithManager(mgr); err != nil {
return fmt.Errorf("unable to create the Dash0 webhook: %w", err)
}
Expand Down
17 changes: 14 additions & 3 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,22 @@ rules:
- apiGroups:
- apps
resources:
- daemonsets
- deployments
- replicasets
- statefulsets
verbs:
- get
- list
- patch
- update
- watch
- apiGroups:
- batch
resources:
- cronjobs
- jobs
verbs:
- create
- delete
- get
- list
- patch
Expand All @@ -22,7 +34,6 @@ rules:
- events
verbs:
- create
- patch
- apiGroups:
- ""
resources:
Expand Down
Loading