-
Just wonder how to use "custom rules with multi-cluster support (Plugin API)" feature, does it mean that we can create custom rules, what are the rules refer here? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
1. Annotation linkerCurrently, you can link make objects declare their own parent without ownerReferences by writing the annotation 2. Custom linker pluginAlternatively, you may use out-of-tree plugins by building your own binary with package main
import (
"context"
"github.com/kubewharf/kelemetry/cmd/kelemetry"
"github.com/kubewharf/kelemetry/pkg/aggregator/linker"
"github.com/kubewharf/kelemetry/pkg/manager"
_ "github.com/kubewharf/kelemetry/pkg"
"github.com/kubewharf/kelemetry/pkg/util"
)
type myLinker struct {
manager.BaseComponent
}
func (*myLinker) Lookup(ctx context.Context, object util.ObjectRef) *util.ObjectRef {
// compute new parent object reference from `object`
}
func init() {
manager.Global.ProvideListImpl("my-linker", manager.Ptr(&myLinker{}), &manager.List[linker.Linker]{})
}
func main() {
kelemetry.Main()
} Then compile this binary in place of the official Kelemetry image. 3. LinkRuleThere is a WIP feature in #109 (currently on hold to merge #157 first), which will allow dynamically defining link rules with a CRD. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
metadata:
annotations:
kelemetry.kubewharf.io/parent-link: |
{"cluster": "the-cluster-name", "group": "apps", "version": "v1", "resource": "deployments", "namespace": "default", "name": "example"}
apiVersion: kelemetry.kubewharf.io/v1alpha1
kind: LinkRule
metadata:
name:
filter:
selector:
matchLabels:
app.kubernetes.io/managed-by: Helm
parent:
group: ""
version: v1
resource: secrets
scope: Namespaced
nameTemplate: '{{.metadata.annotations["meta.helm.sh/release-name"]}}' However the feature has not been completed yet and is subject to change. |
Beta Was this translation helpful? Give feedback.
-
By the way, with the changes in #157, it might become feasible to extract linkers to a separate process in the future using a distributed message queue (currently linkers are synchronous, and #157 makes them asynchronous, but still only supports a local message queue), then the custom linkers may be deployed like add-on controllers instead of replacing the kelemetry image directly. |
Beta Was this translation helpful? Give feedback.
By the way, with the changes in #157, it might become feasible to extract linkers to a separate process in the future using a distributed message queue (currently linkers are synchronous, and #157 makes them asynchronous, but still only supports a local message queue), then the custom linkers may be deployed like add-on controllers instead of replacing the kelemetry image directly.