forked from istio/istio
-
Notifications
You must be signed in to change notification settings - Fork 1
/
args.go
131 lines (107 loc) · 4.37 KB
/
args.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// Copyright 2018 Istio 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 server
import (
"bytes"
"fmt"
"time"
"istio.io/istio/pkg/ctrlz"
"istio.io/istio/pkg/log"
"istio.io/istio/pkg/mcp/creds"
)
const (
defaultConfigMapFolder = "/etc/istio/config/"
defaultMeshConfigFolder = "/etc/istio/mesh-config/"
defaultAccessListFile = defaultConfigMapFolder + "accesslist.yaml"
defaultMeshConfigFile = defaultMeshConfigFolder + "mesh"
defaultDomainSuffix = "cluster.local"
)
// Args contains the startup arguments to instantiate Galley.
type Args struct {
// The path to kube configuration file.
KubeConfig string
// resync period to be passed to the K8s machinery.
ResyncPeriod time.Duration
// Address to use for Galley's gRPC API.
APIAddress string
// Enables gRPC-level tracing
EnableGRPCTracing bool
// Maximum size of individual received gRPC messages
MaxReceivedMessageSize uint
// Maximum number of outstanding RPCs per connection
MaxConcurrentStreams uint
// Insecure gRPC service is used for the MCP server. CertificateFile and KeyFile is ignored.
Insecure bool
// The credential options to use for MCP.
CredentialOptions *creds.Options
// The logging options to use
LoggingOptions *log.Options
// The introspection options to use
IntrospectionOptions *ctrlz.Options
// Enable galley server mode
EnableServer bool
// AccessListFile is the YAML file that specifies ids of the allowed mTLS peers.
AccessListFile string
// ConfigPath is the path for Galley specific config files
ConfigPath string
// MeshConfigFile is the path for mesh config
MeshConfigFile string
// DNS Domain suffix to use while constructing Ingress based resources.
DomainSuffix string
// DisableResourceReadyCheck disables the CRD readiness check. This
// allows Galley to start when not all supported CRD are
// registered with the kube-apiserver.
DisableResourceReadyCheck bool
}
// DefaultArgs allocates an Args struct initialized with Mixer's default configuration.
func DefaultArgs() *Args {
return &Args{
APIAddress: "tcp://0.0.0.0:9901",
MaxReceivedMessageSize: 1024 * 1024,
MaxConcurrentStreams: 1024,
LoggingOptions: log.DefaultOptions(),
IntrospectionOptions: ctrlz.DefaultOptions(),
Insecure: false,
AccessListFile: defaultAccessListFile,
MeshConfigFile: defaultMeshConfigFile,
EnableServer: true,
CredentialOptions: creds.DefaultOptions(),
ConfigPath: "",
DomainSuffix: defaultDomainSuffix,
DisableResourceReadyCheck: false,
}
}
// String produces a stringified version of the arguments for debugging.
func (a *Args) String() string {
buf := &bytes.Buffer{}
fmt.Fprintf(buf, "KubeConfig: %s\n", a.KubeConfig)
fmt.Fprintf(buf, "ResyncPeriod: %v\n", a.ResyncPeriod)
fmt.Fprintf(buf, "APIAddress: %s\n", a.APIAddress)
fmt.Fprintf(buf, "EnableGrpcTracing: %v\n", a.APIAddress)
fmt.Fprintf(buf, "MaxReceivedMessageSize: %d\n", a.MaxReceivedMessageSize)
fmt.Fprintf(buf, "MaxConcurrentStreams: %d\n", a.MaxConcurrentStreams)
fmt.Fprintf(buf, "LoggingOptions: %#v\n", *a.LoggingOptions)
fmt.Fprintf(buf, "IntrospectionOptions: %#v\n", *a.IntrospectionOptions)
fmt.Fprintf(buf, "Insecure: %v\n", a.Insecure)
fmt.Fprintf(buf, "AccessListFile: %s\n", a.AccessListFile)
fmt.Fprintf(buf, "EnableServer: %v\n", a.EnableServer)
fmt.Fprintf(buf, "KeyFile: %s\n", a.CredentialOptions.KeyFile)
fmt.Fprintf(buf, "CertificateFile: %s\n", a.CredentialOptions.CertificateFile)
fmt.Fprintf(buf, "CACertificateFile: %s\n", a.CredentialOptions.CACertificateFile)
fmt.Fprintf(buf, "ConfigFilePath: %s\n", a.ConfigPath)
fmt.Fprintf(buf, "MeshConfigFile: %s\n", a.MeshConfigFile)
fmt.Fprintf(buf, "DomainSuffix: %s\n", a.DomainSuffix)
fmt.Fprintf(buf, "DisableResourceReadyCheck: %v\n", a.DisableResourceReadyCheck)
return buf.String()
}