Skip to content

Commit 1c07515

Browse files
fixes generation of manifests via kubebuilder (#2924)
* fixes generation of manifests via kubebuilder currently when you run a task operator-manifests, it will change the clusterrole when it shouldn't. the reason for this is because a var block was added directly below the kubebuilder comment markers that generate the permissions for the clusterrole. kubebuilder therefore ignored the markers because they thought the comments were related to the var block itself. this commit moves the var block to be away from the kubebuilder markers to remove interference Signed-off-by: Chris Burns <[email protected]> * removes duplicate var block Signed-off-by: Chris Burns <[email protected]> --------- Signed-off-by: Chris Burns <[email protected]> Co-authored-by: Chris Burns <[email protected]>
1 parent 7670219 commit 1c07515

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cmd/thv-operator/controllers/virtualmcpserver_controller.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ type VirtualMCPServerReconciler struct {
6666
PlatformDetector *ctrlutil.SharedPlatformDetector
6767
}
6868

69+
var (
70+
envVarSanitizeRegex = regexp.MustCompile(`[^A-Z0-9_]`)
71+
)
72+
6973
// +kubebuilder:rbac:groups=toolhive.stacklok.dev,resources=virtualmcpservers,verbs=get;list;watch;create;update;patch;delete
7074
// +kubebuilder:rbac:groups=toolhive.stacklok.dev,resources=virtualmcpservers/status,verbs=get;update;patch
7175
// +kubebuilder:rbac:groups=toolhive.stacklok.dev,resources=mcpgroups,verbs=get;list;watch
@@ -81,9 +85,6 @@ type VirtualMCPServerReconciler struct {
8185
// +kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch
8286
// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=create;delete;get;list;patch;update;watch
8387
// +kubebuilder:rbac:groups="",resources=serviceaccounts,verbs=create;delete;get;list;patch;update;watch
84-
var (
85-
envVarSanitizeRegex = regexp.MustCompile(`[^A-Z0-9_]`)
86-
)
8788

8889
// Reconcile is part of the main kubernetes reconciliation loop which aims to
8990
// move the current state of the cluster closer to the desired state.

0 commit comments

Comments
 (0)