Skip to content

Commit

Permalink
support to config node placement (stolostron#532)
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Liu <[email protected]>

Signed-off-by: Wei Liu <[email protected]>
  • Loading branch information
skeeey authored Oct 31, 2022
1 parent f90d32d commit adcae35
Show file tree
Hide file tree
Showing 482 changed files with 23,369 additions and 9,942 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ registration-operator
e2e.test
.DS_Store

multicloud-operators-foundation/

# editor and IDE paraphernalia
.vscode
17 changes: 15 additions & 2 deletions cmd/controller/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import (
"open-cluster-management.io/addon-framework/pkg/addonfactory"
"open-cluster-management.io/addon-framework/pkg/addonmanager"
addonagent "open-cluster-management.io/addon-framework/pkg/agent"
addonv1alpha1client "open-cluster-management.io/api/client/addon/clientset/versioned"
clusterv1client "open-cluster-management.io/api/client/cluster/clientset/versioned"
clusterv1informers "open-cluster-management.io/api/client/cluster/informers/externalversions"
clusterv1 "open-cluster-management.io/api/cluster/v1"
Expand Down Expand Up @@ -102,6 +103,11 @@ func Run(o *options.ControllerRunOptions, ctx context.Context) error {
return err
}

addonClient, err := addonv1alpha1client.NewForConfig(kubeConfig)
if err != nil {
return err
}

clusterInformers := clusterv1informers.NewSharedInformerFactory(clusterClient, 10*time.Minute)
kubeInfomers := kubeinformers.NewSharedInformerFactory(kubeClient, 10*time.Minute)

Expand Down Expand Up @@ -170,10 +176,17 @@ func Run(o *options.ControllerRunOptions, ctx context.Context) error {
}
if o.EnableAddonDeploy {
registrationOption := addon.NewRegistrationOption(kubeClient, addon.WorkManagerAddonName)
getValuesFunc := addon.NewGetValuesFunc(o.AddonImage)
agentAddon, err := addonfactory.NewAgentAddonFactory(addon.WorkManagerAddonName, addon.ChartFS, addon.ChartDir).
WithScheme(scheme).
WithGetValuesFuncs(getValuesFunc, addonfactory.GetValuesFromAddonAnnotation).
WithConfigGVRs(addonfactory.AddOnDeploymentConfigGVR).
WithGetValuesFuncs(
addon.NewGetValuesFunc(o.AddonImage),
addonfactory.GetValuesFromAddonAnnotation,
addonfactory.GetAddOnDeloymentConfigValues(
addonfactory.NewAddOnDeloymentConfigGetter(addonClient),
addonfactory.ToAddOnNodePlacementValues,
),
).
WithAgentRegistrationOption(registrationOption).
WithInstallStrategy(addonagent.InstallAllStrategy(o.AddonInstallNamespace)).
WithAgentHostedModeEnabledOption().
Expand Down
9 changes: 6 additions & 3 deletions deploy/foundation/hub/resources/clustermanagementaddon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ kind: ClusterManagementAddOn
metadata:
name: work-manager
spec:
addOnMeta:
displayName: work-manager
description: "work-manager provides action, view and rbac settings"
addOnMeta:
displayName: work-manager
description: "work-manager provides action, view and rbac settings"
supportedConfigs:
- group: addon.open-cluster-management.io
resource: addondeploymentconfigs
4 changes: 3 additions & 1 deletion deploy/foundation/hub/resources/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ rules:
- apiGroups: ["addon.open-cluster-management.io"]
resources: ["managedclusteraddons/status"]
verbs: ["update", "patch"]

- apiGroups: ["addon.open-cluster-management.io"]
resources: ["addondeploymentconfigs"]
verbs: ["get", "list", "watch"]

---
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
74 changes: 37 additions & 37 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ replace (
k8s.io/code-generator => k8s.io/code-generator v0.24.1
k8s.io/component-base => k8s.io/component-base v0.24.1
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.24.1
k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42
sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.11.1
)

Expand All @@ -69,40 +70,41 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stolostron/cluster-lifecycle-api v0.0.0-20220930080346-456dd8fcbea8
github.com/stretchr/testify v1.7.2
golang.org/x/net v0.0.0-20220325170049-de3da57026de
k8s.io/api v0.24.1
k8s.io/apimachinery v0.24.1
k8s.io/apiserver v0.24.1
k8s.io/cli-runtime v0.24.1
golang.org/x/net v0.0.0-20220722155237-a158d28d115b
k8s.io/api v0.25.0
k8s.io/apimachinery v0.25.0
k8s.io/apiserver v0.25.0
k8s.io/cli-runtime v0.24.2
k8s.io/client-go v12.0.0+incompatible
k8s.io/code-generator v0.24.1
k8s.io/component-base v0.24.1
k8s.io/code-generator v0.25.0
k8s.io/component-base v0.25.0
k8s.io/klog v1.0.0
k8s.io/klog/v2 v2.60.1
k8s.io/klog/v2 v2.70.1
k8s.io/kube-aggregator v0.24.1
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42
open-cluster-management.io/addon-framework v0.4.1-0.20220805023606-4de6c788fddf
open-cluster-management.io/api v0.7.1-0.20220609092005-e8cc7a4e4c10
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1
open-cluster-management.io/addon-framework v0.5.0
open-cluster-management.io/api v0.9.0
sigs.k8s.io/controller-runtime v0.12.1
sigs.k8s.io/yaml v1.3.0
)

require (
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/gobuffalo/flect v0.2.5 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
)

// golang
require (
cloud.google.com/go v0.81.0 // indirect
cloud.google.com/go v0.99.0 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.18 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.13 // indirect
github.com/Azure/go-autorest/autorest v0.11.24 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.18 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/BurntSushi/toml v0.4.1 // indirect
github.com/BurntSushi/toml v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
Expand All @@ -113,12 +115,11 @@ require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/cyphar/filepath-securejoin v0.2.2 // indirect
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-errors/errors v1.0.1 // indirect
github.com/go-logr/zapr v1.2.0 // indirect
Expand All @@ -144,8 +145,8 @@ require (
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/metal3-io/baremetal-operator/pkg/hardwareutils v0.0.0 // indirect
github.com/mitchellh/copystructure v1.1.1 // indirect
github.com/mitchellh/reflectwalk v1.0.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
Expand All @@ -158,15 +159,15 @@ require (
github.com/prometheus/procfs v0.7.3 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/smartystreets/assertions v1.2.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/cobra v1.4.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect
go.etcd.io/etcd/api/v3 v3.5.1 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.1 // indirect
go.etcd.io/etcd/client/v3 v3.5.1 // indirect
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/v3 v3.5.4 // indirect
go.opentelemetry.io/contrib v0.20.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0 // indirect
Expand All @@ -182,33 +183,32 @@ require (
go.uber.org/atomic v1.8.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.19.1 // indirect
golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064 // indirect
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/tools v0.1.10-0.20220218145154-897bd77cd717 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
golang.org/x/tools v0.1.12 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 // indirect
google.golang.org/grpc v1.46.0 // indirect
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 // indirect
google.golang.org/grpc v1.47.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
helm.sh/helm/v3 v3.7.2 // indirect
k8s.io/apiextensions-apiserver v0.24.1 // indirect
helm.sh/helm/v3 v3.9.4 // indirect
k8s.io/apiextensions-apiserver v0.25.0 // indirect
k8s.io/gengo v0.0.0-20211129171323-c02415ce4185 // indirect
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.30 // indirect
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.32 // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/kustomize/api v0.11.4 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.6 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)
Loading

0 comments on commit adcae35

Please sign in to comment.