Skip to content

Commit

Permalink
migrate controller yurtappset (#1368)
Browse files Browse the repository at this point in the history
Signed-off-by: huiwq1990 <[email protected]>
  • Loading branch information
huiwq1990 authored Apr 17, 2023
1 parent 1ebf32f commit 9d3eeba
Show file tree
Hide file tree
Showing 48 changed files with 9,037 additions and 285 deletions.
809 changes: 650 additions & 159 deletions charts/openyurt/templates/yurt-manager-auto-generated.yaml

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions cmd/yurt-manager/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@ import (

// YurtManagerOptions is the main context object for the yurt-manager.
type YurtManagerOptions struct {
Generic *GenericOptions
NodePoolController *NodePoolControllerOptions
GatewayController *GatewayControllerOptions
StaticPodController *StaticPodControllerOptions
Generic *GenericOptions
NodePoolController *NodePoolControllerOptions
GatewayController *GatewayControllerOptions
YurtAppSetController *YurtAppSetControllerOptions
StaticPodController *StaticPodControllerOptions
}

// NewYurtManagerOptions creates a new YurtManagerOptions with a default config.
func NewYurtManagerOptions() (*YurtManagerOptions, error) {

s := YurtManagerOptions{
Generic: NewGenericOptions(),
NodePoolController: NewNodePoolControllerOptions(),
GatewayController: NewGatewayControllerOptions(),
StaticPodController: NewStaticPodControllerOptions(),
Generic: NewGenericOptions(),
NodePoolController: NewNodePoolControllerOptions(),
GatewayController: NewGatewayControllerOptions(),
YurtAppSetController: NewYurtAppSetControllerOptions(),
StaticPodController: NewStaticPodControllerOptions(),
}

return &s, nil
Expand Down
60 changes: 60 additions & 0 deletions cmd/yurt-manager/app/options/yurtappsetcontroller.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
Copyright 2023 The OpenYurt Authors.
Licensed under the Apache License, Version 2.0 (the License);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an AS IS BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package options

import (
"github.com/spf13/pflag"

"github.com/openyurtio/openyurt/pkg/controller/yurtappset/config"
)

type YurtAppSetControllerOptions struct {
*config.YurtAppSetControllerConfiguration
}

func NewYurtAppSetControllerOptions() *YurtAppSetControllerOptions {
return &YurtAppSetControllerOptions{
&config.YurtAppSetControllerConfiguration{},
}
}

// AddFlags adds flags related to nodepool for yurt-manager to the specified FlagSet.
func (n *YurtAppSetControllerOptions) AddFlags(fs *pflag.FlagSet) {
if n == nil {
return
}

//fs.BoolVar(&n.CreateDefaultPool, "create-default-pool", n.CreateDefaultPool, "Create default cloud/edge pools if indicated.")
}

// ApplyTo fills up nodepool config with options.
func (o *YurtAppSetControllerOptions) ApplyTo(cfg *config.YurtAppSetControllerConfiguration) error {
if o == nil {
return nil
}

return nil
}

// Validate checks validation of YurtAppSetControllerOptions.
func (o *YurtAppSetControllerOptions) Validate() []error {
if o == nil {
return nil
}
errs := []error{}
return errs
}
42 changes: 37 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ require (
github.com/pmezard/go-difflib v1.0.0
github.com/projectcalico/api v0.0.0-20230222223746-44aa60c2201f
github.com/prometheus/client_golang v1.14.0
github.com/spf13/cobra v1.7.0
github.com/spf13/cobra v1.6.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.2
github.com/vishvananda/netlink v1.2.1-beta.2
go.etcd.io/etcd/api/v3 v3.5.0
go.etcd.io/etcd/client/pkg/v3 v3.5.0
go.etcd.io/etcd/client/v3 v3.5.0
golang.org/x/sys v0.7.0
golang.org/x/sys v0.6.0
google.golang.org/grpc v1.54.0
gopkg.in/cheggaaa/pb.v1 v1.0.28
gopkg.in/square/go-jose.v2 v2.6.0
Expand All @@ -40,9 +40,11 @@ require (
k8s.io/klog/v2 v2.9.0
k8s.io/kube-controller-manager v0.22.3
k8s.io/kubectl v0.22.3
k8s.io/kubernetes v1.22.3
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b
sigs.k8s.io/apiserver-network-proxy v0.0.15
sigs.k8s.io/controller-runtime v0.10.3
sigs.k8s.io/yaml v1.3.0
)

require (
Expand Down Expand Up @@ -78,6 +80,8 @@ require (
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/cyphar/filepath-securejoin v0.2.2 // indirect
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/emicklei/go-restful v2.16.0+incompatible // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/fatih/camelcase v1.0.0 // indirect
Expand All @@ -96,8 +100,8 @@ require (
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
Expand All @@ -110,6 +114,8 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/runc v1.0.2 // indirect
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
Expand Down Expand Up @@ -150,14 +156,40 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.22.2 // indirect
k8s.io/cloud-provider v0.22.3 // indirect
k8s.io/component-helpers v0.22.3 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace (
k8s.io/api => k8s.io/api v0.22.3
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.22.3
k8s.io/apimachinery => k8s.io/apimachinery v0.22.3
k8s.io/apiserver => k8s.io/apiserver v0.22.3
k8s.io/cli-runtime => k8s.io/cli-runtime v0.22.3
k8s.io/client-go => k8s.io/client-go v0.22.3
k8s.io/cloud-provider => k8s.io/cloud-provider v0.22.3
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.22.3
k8s.io/code-generator => k8s.io/code-generator v0.22.3
k8s.io/component-base => k8s.io/component-base v0.22.3
k8s.io/component-helpers => k8s.io/component-helpers v0.22.3
k8s.io/controller-manager => k8s.io/controller-manager v0.22.3
k8s.io/cri-api => k8s.io/cri-api v0.22.3
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.22.3
k8s.io/klog/v2 => k8s.io/klog/v2 v2.9.0
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.22.3
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.22.3
k8s.io/kube-proxy => k8s.io/kube-proxy v0.22.3
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.22.3
k8s.io/kubectl => k8s.io/kubectl v0.22.3
k8s.io/kubelet => k8s.io/kubelet v0.22.3
k8s.io/kubernetes => k8s.io/kubernetes v1.22.3
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.22.3
k8s.io/metrics => k8s.io/metrics v0.22.3
k8s.io/mount-utils => k8s.io/mount-utils v0.22.3
k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.22.3
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.22.3
sigs.k8s.io/apiserver-network-proxy => github.com/openyurtio/apiserver-network-proxy v1.18.8
sigs.k8s.io/apiserver-network-proxy/konnectivity-client => sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22
)
Expand Down
Loading

0 comments on commit 9d3eeba

Please sign in to comment.