This repository was archived by the owner on Mar 10, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Replace MongoDB storage for scheduling strategies/intents with K8s CRDs #18
Merged
ianchen0119
merged 5 commits into
main
from
copilot/migrate-scheduling-strategies-to-etcd
Mar 10, 2026
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
002ce35
Initial plan
Copilot 9928647
Replace MongoDB strategy/intent storage with K8s CRDs
Copilot b401cc1
Add unit tests for CR strategy repository
Copilot 6d83ada
Remove unused MongoDB collection constants for strategies/intents
Copilot b7b6546
feat(manager): harden CRD strategy/intent repository and align k8s co…
ianchen0119 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| apiVersion: apiextensions.k8s.io/v1 | ||
| kind: CustomResourceDefinition | ||
| metadata: | ||
| name: schedulingintents.gthulhu.io | ||
| spec: | ||
| group: gthulhu.io | ||
| versions: | ||
| - name: v1alpha1 | ||
| served: true | ||
| storage: true | ||
| schema: | ||
| openAPIV3Schema: | ||
| type: object | ||
| properties: | ||
| spec: | ||
| type: object | ||
| properties: | ||
| strategyID: | ||
| type: string | ||
| podID: | ||
| type: string | ||
| podName: | ||
| type: string | ||
| nodeID: | ||
| type: string | ||
| k8sNamespace: | ||
| type: string | ||
| commandRegex: | ||
| type: string | ||
| priority: | ||
| type: integer | ||
| executionTime: | ||
| type: integer | ||
| format: int64 | ||
| podLabels: | ||
| type: object | ||
| additionalProperties: | ||
| type: string | ||
| state: | ||
| type: integer | ||
| creatorID: | ||
| type: string | ||
| updaterID: | ||
| type: string | ||
| createdTime: | ||
| type: integer | ||
| format: int64 | ||
| updatedTime: | ||
| type: integer | ||
| format: int64 | ||
| additionalPrinterColumns: | ||
| - name: Strategy | ||
| type: string | ||
| jsonPath: .spec.strategyID | ||
| - name: Pod | ||
| type: string | ||
| jsonPath: .spec.podName | ||
| - name: Node | ||
| type: string | ||
| jsonPath: .spec.nodeID | ||
| - name: State | ||
| type: integer | ||
| jsonPath: .spec.state | ||
| - name: Age | ||
| type: date | ||
| jsonPath: .metadata.creationTimestamp | ||
| scope: Namespaced | ||
| names: | ||
| plural: schedulingintents | ||
| singular: schedulingintent | ||
| kind: SchedulingIntent | ||
| shortNames: | ||
| - si |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| apiVersion: apiextensions.k8s.io/v1 | ||
| kind: CustomResourceDefinition | ||
| metadata: | ||
| name: schedulingstrategies.gthulhu.io | ||
| spec: | ||
| group: gthulhu.io | ||
| versions: | ||
| - name: v1alpha1 | ||
| served: true | ||
| storage: true | ||
| schema: | ||
| openAPIV3Schema: | ||
| type: object | ||
| properties: | ||
| spec: | ||
| type: object | ||
| properties: | ||
| strategyNamespace: | ||
| type: string | ||
| labelSelectors: | ||
| type: array | ||
| items: | ||
| type: object | ||
| properties: | ||
| key: | ||
| type: string | ||
| value: | ||
| type: string | ||
| k8sNamespaces: | ||
| type: array | ||
| items: | ||
| type: string | ||
| commandRegex: | ||
| type: string | ||
| priority: | ||
| type: integer | ||
| executionTime: | ||
| type: integer | ||
| format: int64 | ||
| creatorID: | ||
| type: string | ||
| updaterID: | ||
| type: string | ||
| createdTime: | ||
| type: integer | ||
| format: int64 | ||
| updatedTime: | ||
| type: integer | ||
| format: int64 | ||
| additionalPrinterColumns: | ||
| - name: Priority | ||
| type: integer | ||
| jsonPath: .spec.priority | ||
| - name: Creator | ||
| type: string | ||
| jsonPath: .spec.creatorID | ||
| - name: Age | ||
| type: date | ||
| jsonPath: .metadata.creationTimestamp | ||
| scope: Namespaced | ||
| names: | ||
| plural: schedulingstrategies | ||
| singular: schedulingstrategy | ||
| kind: SchedulingStrategy | ||
| shortNames: | ||
| - ss |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # ClusterRole granting the API Server (manager mode) full access to | ||
| # SchedulingStrategy and SchedulingIntent custom resources. | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: gthulhu-manager-crd | ||
| rules: | ||
| - apiGroups: ["gthulhu.io"] | ||
| resources: ["schedulingstrategies", "schedulingintents"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
| --- | ||
| # Bind the ClusterRole to the manager ServiceAccount so that only the | ||
| # manager pods can manipulate scheduling CRs. | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: gthulhu-manager-crd-binding | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: gthulhu-manager | ||
| namespace: gthulhu-system | ||
| roleRef: | ||
| kind: ClusterRole | ||
| name: gthulhu-manager-crd | ||
| apiGroup: rbac.authorization.k8s.io | ||
| --- | ||
| # Read-only ClusterRole for monitoring / dashboards. | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: gthulhu-crd-viewer | ||
| rules: | ||
| - apiGroups: ["gthulhu.io"] | ||
| resources: ["schedulingstrategies", "schedulingintents"] | ||
| verbs: ["get", "list", "watch"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The ClusterRoleBinding targets ServiceAccount
gthulhu-managerin namespacegthulhu-system, but the existing manager deployment manifest uses ServiceAccountmanagerin namespacegthulhu-api-local(deployment/kind/manager/deployment.yaml). As-is, applying this RBAC in the kind environment won't grant the manager pod access to the CRDs. Consider aligning the subject to the actual ServiceAccount/namespace used by your deployment manifests (or providing environment-specific overlays/templates).