我有以下字符串:
new k8s.KubeRoleBinding(this, "argocd-application-controller", {
kind: "RoleBinding",
metadata: {
labels: {
"app.kubernetes.io/component": "application-controller",
"app.kubernetes.io/name": "argocd-application-controller",
"app.kubernetes.io/part-of": "argocd",
},
name: "argocd-application-controller",
},
roleRef: {
apiGroup: "rbac.authorization.k8s.io",
kind: "Role",
name: "argocd-application-controller",
},
subjects: [{
kind: "ServiceAccount",
name: "argocd-application-controller",
}],
});
kind:
到目前为止,我尝试了以下操作,但它删除了所有事件。
re := regexp.MustCompile("(?m)[\r\n]+^.*kind.*$")
res := re.ReplaceAllString(str, "$1")
操场链接,代码:https://play.golang.org/p/SMiyTJvKNVF
通缉串:
new k8s.KubeRoleBinding(this, "argocd-application-controller", {
metadata: {
labels: {
"app.kubernetes.io/component": "application-controller",
"app.kubernetes.io/name": "argocd-application-controller",
"app.kubernetes.io/part-of": "argocd",
},
name: "argocd-application-controller",
},
roleRef: {
apiGroup: "rbac.authorization.k8s.io",
kind: "Role",
name: "argocd-application-controller",
},
subjects: [{
kind: "ServiceAccount",
name: "argocd-application-controller",
}],
});