Add param WeaveScopeHost
Signed-off-by: Zhengyi Lai <zheng1@yunify.com>
This commit is contained in:
@@ -58,6 +58,7 @@ import (
|
|||||||
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/kapis/devops/v1alpha3"
|
devopsv1alpha3 "kubesphere.io/kubesphere/pkg/kapis/devops/v1alpha3"
|
||||||
iamapi "kubesphere.io/kubesphere/pkg/kapis/iam/v1alpha2"
|
iamapi "kubesphere.io/kubesphere/pkg/kapis/iam/v1alpha2"
|
||||||
monitoringv1alpha3 "kubesphere.io/kubesphere/pkg/kapis/monitoring/v1alpha3"
|
monitoringv1alpha3 "kubesphere.io/kubesphere/pkg/kapis/monitoring/v1alpha3"
|
||||||
|
networkv1alpha2 "kubesphere.io/kubesphere/pkg/kapis/network/v1alpha2"
|
||||||
notificationv1 "kubesphere.io/kubesphere/pkg/kapis/notification/v1"
|
notificationv1 "kubesphere.io/kubesphere/pkg/kapis/notification/v1"
|
||||||
"kubesphere.io/kubesphere/pkg/kapis/oauth"
|
"kubesphere.io/kubesphere/pkg/kapis/oauth"
|
||||||
openpitrixv1 "kubesphere.io/kubesphere/pkg/kapis/openpitrix/v1"
|
openpitrixv1 "kubesphere.io/kubesphere/pkg/kapis/openpitrix/v1"
|
||||||
@@ -199,6 +200,7 @@ func (s *APIServer) installKubeSphereAPIs() {
|
|||||||
im.NewLoginRecorder(s.KubernetesClient.KubeSphere()),
|
im.NewLoginRecorder(s.KubernetesClient.KubeSphere()),
|
||||||
s.Config.AuthenticationOptions))
|
s.Config.AuthenticationOptions))
|
||||||
urlruntime.Must(servicemeshv1alpha2.AddToContainer(s.container))
|
urlruntime.Must(servicemeshv1alpha2.AddToContainer(s.container))
|
||||||
|
urlruntime.Must(networkv1alpha2.AddToContainer(s.container, s.Config.NetworkOptions.WeaveScopeHost))
|
||||||
urlruntime.Must(devopsv1alpha2.AddToContainer(s.container,
|
urlruntime.Must(devopsv1alpha2.AddToContainer(s.container,
|
||||||
s.InformerFactory.KubeSphereSharedInformerFactory(),
|
s.InformerFactory.KubeSphereSharedInformerFactory(),
|
||||||
s.DevopsClient,
|
s.DevopsClient,
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ func newTestConfig() (*Config, error) {
|
|||||||
NSNPOptions: network.NSNPOptions{
|
NSNPOptions: network.NSNPOptions{
|
||||||
AllowedIngressNamespaces: []string{},
|
AllowedIngressNamespaces: []string{},
|
||||||
},
|
},
|
||||||
|
WeaveScopeHost: "weave-scope-app.weave",
|
||||||
},
|
},
|
||||||
MonitoringOptions: &prometheus.Options{
|
MonitoringOptions: &prometheus.Options{
|
||||||
Endpoint: "http://prometheus.kubesphere-monitoring-system.svc",
|
Endpoint: "http://prometheus.kubesphere-monitoring-system.svc",
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import (
|
|||||||
const ScopeQueryUrl = "http://%s/api/topology/services"
|
const ScopeQueryUrl = "http://%s/api/topology/services"
|
||||||
|
|
||||||
type handler struct {
|
type handler struct {
|
||||||
|
// if weave scope installed in the cluster, it is maybe `weave-scope-app.weave`
|
||||||
weaveScopeHost string
|
weaveScopeHost string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package network
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
|
||||||
"kubesphere.io/kubesphere/pkg/simple/client/network/ippool"
|
"kubesphere.io/kubesphere/pkg/simple/client/network/ippool"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -30,6 +31,7 @@ type Options struct {
|
|||||||
NSNPOptions NSNPOptions `json:"nsnpOptions,omitempty" yaml:"nsnpOptions,omitempty"`
|
NSNPOptions NSNPOptions `json:"nsnpOptions,omitempty" yaml:"nsnpOptions,omitempty"`
|
||||||
EnableIPPool bool `json:"enableIPPool,omitempty" yaml:"enableIPPool"`
|
EnableIPPool bool `json:"enableIPPool,omitempty" yaml:"enableIPPool"`
|
||||||
IPPoolOptions ippool.Options `json:"ippoolOptions,omitempty" yaml:"ippoolOptions,omitempty"`
|
IPPoolOptions ippool.Options `json:"ippoolOptions,omitempty" yaml:"ippoolOptions,omitempty"`
|
||||||
|
WeaveScopeHost string `json:"weaveScopeHost,omitempty" yaml:"weaveScopeHost,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewNetworkOptions returns a `zero` instance
|
// NewNetworkOptions returns a `zero` instance
|
||||||
@@ -43,6 +45,7 @@ func NewNetworkOptions() *Options {
|
|||||||
IPPoolOptions: ippool.Options{
|
IPPoolOptions: ippool.Options{
|
||||||
Calico: nil,
|
Calico: nil,
|
||||||
},
|
},
|
||||||
|
WeaveScopeHost: "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,6 +59,7 @@ func (s *Options) ApplyTo(options *Options) {
|
|||||||
options.EnableIPPool = s.EnableIPPool
|
options.EnableIPPool = s.EnableIPPool
|
||||||
options.NSNPOptions = s.NSNPOptions
|
options.NSNPOptions = s.NSNPOptions
|
||||||
options.IPPoolOptions = s.IPPoolOptions
|
options.IPPoolOptions = s.IPPoolOptions
|
||||||
|
options.WeaveScopeHost = s.WeaveScopeHost
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Options) AddFlags(fs *pflag.FlagSet, c *Options) {
|
func (s *Options) AddFlags(fs *pflag.FlagSet, c *Options) {
|
||||||
@@ -63,4 +67,6 @@ func (s *Options) AddFlags(fs *pflag.FlagSet, c *Options) {
|
|||||||
"This field instructs KubeSphere to enable network policy or not.")
|
"This field instructs KubeSphere to enable network policy or not.")
|
||||||
fs.BoolVar(&s.EnableIPPool, "enable-ippool", c.EnableIPPool,
|
fs.BoolVar(&s.EnableIPPool, "enable-ippool", c.EnableIPPool,
|
||||||
"This field instructs KubeSphere to enable ippool or not.")
|
"This field instructs KubeSphere to enable ippool or not.")
|
||||||
|
fs.StringVar(&s.WeaveScopeHost, "weave-scope-host", c.WeaveScopeHost,
|
||||||
|
"Weave Scope service endpoint which build a topology API of the applications and the containers running on the hosts")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user