Skip to content

Commit

Permalink
move utils and add setup ruleset
Browse files Browse the repository at this point in the history
  • Loading branch information
Eikykun committed Aug 17, 2023
1 parent 64e5456 commit 04b3672
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 25 deletions.
25 changes: 25 additions & 0 deletions pkg/controllers/add_ruleset.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
Copyright 2023 The KusionStack Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package controllers

import (
"kusionstack.io/kafed/pkg/controllers/ruleset"
)

func init() {
AddToManagerFuncs = append(AddToManagerFuncs, ruleset.RuleSetManager().SetupRuleSetController)
}
8 changes: 8 additions & 0 deletions pkg/utils/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package utils

import (
"encoding/json"

"sigs.k8s.io/controller-runtime/pkg/client"

"kusionstack.io/kafed/apis/apps/v1alpha1"
Expand All @@ -29,3 +31,9 @@ func ControlledByKafed(obj client.Object) bool {
v, ok := obj.GetLabels()[v1alpha1.KafedSystemLabel]
return ok && v == "true"
}

// DumpJSON returns the JSON encoding
func DumpJSON(o interface{}) string {
j, _ := json.Marshal(o)
return string(j)
}
25 changes: 0 additions & 25 deletions pkg/webhook/utils/json.go

This file was deleted.

0 comments on commit 04b3672

Please sign in to comment.