Skip to content

Commit

Permalink
Add ClusterManagementAddon for app and policy
Browse files Browse the repository at this point in the history
A new check blocked enabling addons if this is missing.

Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
  • Loading branch information
dhaiducek committed Nov 4, 2023
1 parent def0676 commit df3c43a
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
3 changes: 3 additions & 0 deletions pkg/cmd/install/hubaddon/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func (o *Options) runWithClient() error {
// Install the Application Management Addon
case appMgrAddonName:
files := []string{
"addon/appmgr/clustermanagementaddon_appmgr.yaml",
"addon/appmgr/clusterrole_agent.yaml",
"addon/appmgr/clusterrole_binding.yaml",
"addon/appmgr/clusterrole.yaml",
Expand Down Expand Up @@ -140,6 +141,8 @@ func (o *Options) runWithClient() error {
"addon/policy/propagator_role.yaml",
"addon/policy/propagator_rolebinding.yaml",
"addon/policy/propagator_serviceaccount.yaml",
"addon/policy/clustermanagementaddon_configpolicy.yaml",
"addon/policy/clustermanagementaddon_policyframework.yaml",
"addon/appmgr/crd_placementrule.yaml",
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright Contributors to the Open Cluster Management project
apiVersion: addon.open-cluster-management.io/v1alpha1
kind: ClusterManagementAddOn
metadata:
name: application-manager
spec:
addOnMeta:
description: Synchronizes application on the managed clusters from the hub
displayName: Application Manager
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright Contributors to the Open Cluster Management project
apiVersion: addon.open-cluster-management.io/v1alpha1
kind: ClusterManagementAddOn
metadata:
name: config-policy-controller
spec:
addOnMeta:
description: Audits k8s resources and remediates violation based on configuration policies.
displayName: Config Policy Addon
supportedConfigs:
- group: addon.open-cluster-management.io
resource: addondeploymentconfigs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright Contributors to the Open Cluster Management project
apiVersion: addon.open-cluster-management.io/v1alpha1
kind: ClusterManagementAddOn
metadata:
name: governance-policy-framework
spec:
addOnMeta:
description: Distributes policies and collects policy evaluation results.
displayName: Governance Policy Framework Addon
supportedConfigs:
- group: addon.open-cluster-management.io
resource: addondeploymentconfigs
10 changes: 8 additions & 2 deletions pkg/cmd/install/hubaddon/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
package hubaddon

import (
"path/filepath"
"testing"

"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/client-go/discovery"
"k8s.io/client-go/discovery/cached/memory"
"k8s.io/client-go/restmapper"
"k8s.io/client-go/tools/clientcmd"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
"testing"

"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
Expand Down Expand Up @@ -41,7 +43,11 @@ var _ = ginkgo.BeforeSuite(func() {
ginkgo.By("bootstrapping test environment")

// start a kube-apiserver
testEnv = &envtest.Environment{}
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{
filepath.Join("..", "..", "..", "..", "vendor", "open-cluster-management.io", "api", "addon", "v1alpha1"),
},
}

cfg, err := testEnv.Start()
gomega.Expect(err).ToNot(gomega.HaveOccurred())
Expand Down

0 comments on commit df3c43a

Please sign in to comment.