Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable admission and feature gate #102

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions controlplane/cmd/server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"k8s.io/component-base/version/verflag"
"k8s.io/klog/v2"

ocmfeature "open-cluster-management.io/api/feature"
"open-cluster-management.io/ocm-controlplane/pkg/apiserver"
"open-cluster-management.io/ocm-controlplane/pkg/apiserver/options"
)
Expand All @@ -37,10 +36,7 @@ func NewAPIServerCommand() *cobra.Command {
verflag.PrintAndExitIfRequested()
fs := cmd.Flags()

// TODO(ycyaoxdu): add DefaultHubRegistrationFeatureGates
// add OCM feature gates
featureGate := utilfeature.DefaultFeatureGate.DeepCopy()
featureGate.Add(ocmfeature.DefaultHubRegistrationFeatureGates)

// Activate logging as soon as possible, after that
// show flags with the final logging configuration.
Expand Down
2 changes: 1 addition & 1 deletion controlplane/hack/start-ocm-controlplane.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ PRESERVE_ETCD="${PRESERVE_ETCD:-false}"
AUTHORIZATION_MODE=${AUTHORIZATION_MODE:-"RBAC"}
# Default list of admission Controllers to invoke prior to persisting objects in cluster
# The order defined here does not matter.
ENABLE_ADMISSION_PLUGINS=${ENABLE_ADMISSION_PLUGINS:-"NamespaceLifecycle,ServiceAccount,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"}
ENABLE_ADMISSION_PLUGINS=${ENABLE_ADMISSION_PLUGINS:-"NamespaceLifecycle,ServiceAccount,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,ManagedClusterMutating,ManagedClusterValidating,ManagedClusterSetBindingValidating"}
DISABLE_ADMISSION_PLUGINS=${DISABLE_ADMISSION_PLUGINS:-""}

# Stop right away if the build fails
Expand Down
6 changes: 3 additions & 3 deletions controlplane/pkg/apiserver/options/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ var AllOrderedPlugins = []string{
certsubjectrestriction.PluginName, // CertificateSubjectRestriction

// self-defined plugins
managedclustermutating.PluginName,
managedclustervalidating.PluginName,
managedclustersetbindingvalidating.PluginName,
managedclustermutating.PluginName, // ManagedClusterMutating
managedclustervalidating.PluginName, // ManagedClusterValidating
managedclustersetbindingvalidating.PluginName, // ManagedClusterSetBindingValidating
// new admission plugins should generally be inserted above here
// webhook, resourcequota, and deny plugins must go at the end

Expand Down
3 changes: 3 additions & 0 deletions controlplane/pkg/apiserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,15 @@ import (
"k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes"
rbacrest "k8s.io/kubernetes/pkg/registry/rbac/rest"
"k8s.io/kubernetes/pkg/serviceaccount"
ocmfeature "open-cluster-management.io/api/feature"
"open-cluster-management.io/ocm-controlplane/pkg/apiserver/options"
"open-cluster-management.io/ocm-controlplane/pkg/etcd"
)

func init() {
utilruntime.Must(logs.AddFeatureGates(utilfeature.DefaultMutableFeatureGate))
utilruntime.Must(utilfeature.DefaultMutableFeatureGate.Add(ocmfeature.DefaultHubWorkFeatureGates))
utilruntime.Must(utilfeature.DefaultMutableFeatureGate.Add(ocmfeature.DefaultHubRegistrationFeatureGates))
}

// CreateServerChain creates the apiservers connected via delegation.
Expand Down