Skip to content

Commit 3148eb6

Browse files
committed
update the env variable descriptions
1 parent acfb6a1 commit 3148eb6

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

pubsub-lib/JetStreamUtil.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,12 @@ type NatsTopic struct {
125125
}
126126
type ConfigJson struct {
127127
// StreamConfigJson is a json string of map[string]NatsStreamConfig
128-
StreamConfigJson string `env:"STREAM_CONFIG_JSON"`
128+
StreamConfigJson string `env:"STREAM_CONFIG_JSON" description:"This is json map of nats stream configurations per stream. eg: {"ORCHESTRATOR":{"max_age":3600,"replicas":1}}"`
129+
129130
// ConsumerConfigJson is a json string of map[string]NatsConsumerConfig
130131
// eg: "{\"ARGO_PIPELINE_STATUS_UPDATE_DURABLE-1\" : \"{\"natsMsgProcessingBatchSize\" : 3, \"natsMsgBufferSize\" : 3, \"ackWaitInSecs\": 300}\"}"
131-
ConsumerConfigJson string `env:"CONSUMER_CONFIG_JSON"`
132+
ConsumerConfigJson string `env:"CONSUMER_CONFIG_JSON" description:"ConsumerConfigJson is a json string of map[string]NatsConsumerConfig" `
133+
132134
}
133135

134136
var natsTopicMapping = map[string]NatsTopic{

pubsub-lib/NatsClient.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ type NatsClientConfig struct {
3636

3737
// consumer wise
3838
// NatsMsgProcessingBatchSize is the number of messages that will be processed in one go
39-
NatsMsgProcessingBatchSize int `env:"NATS_MSG_PROCESSING_BATCH_SIZE" envDefault:"1"`
39+
NatsMsgProcessingBatchSize int `env:"NATS_MSG_PROCESSING_BATCH_SIZE" envDefault:"1" description:"NatsMsgProcessingBatchSize is the number of messages that will be processed in one go"`
40+
4041

4142
// NatsMsgBufferSize is the number of messages that will be buffered in memory (channel size)
4243
// it is recommended to set this value equal to NatsMsgProcessingBatchSize as we want to process maximum messages in the buffer in one go.
@@ -45,10 +46,10 @@ type NatsClientConfig struct {
4546
// NatsMsgBufferSize can be configured independently of NatsMsgProcessingBatchSize if needed by setting its value to positive value in env.
4647
// if NatsMsgBufferSize set to a non-positive value then it will take the value of NatsMsgProcessingBatchSize.
4748
// Note: always get this value by calling GetNatsMsgBufferSize method
48-
NatsMsgBufferSize int `env:"NATS_MSG_BUFFER_SIZE" envDefault:"-1"`
49-
NatsMsgMaxAge int `env:"NATS_MSG_MAX_AGE" envDefault:"86400"`
50-
NatsMsgAckWaitInSecs int `env:"NATS_MSG_ACK_WAIT_IN_SECS" envDefault:"120"`
51-
NatsMsgReplicas int `env:"NATS_MSG_REPLICAS" envDefault:"0"`
49+
NatsMsgBufferSize int `env:"NATS_MSG_BUFFER_SIZE" envDefault:"-1" description:"NatsMsgBufferSize is the number of messages that will be buffered in memory (channel size)"`
50+
NatsMsgMaxAge int `env:"NATS_MSG_MAX_AGE" envDefault:"86400" description:"Age for the message to persist"`
51+
NatsMsgAckWaitInSecs int `env:"NATS_MSG_ACK_WAIT_IN_SECS" envDefault:"120" description:"Time to wait for acknowledging the message"`
52+
NatsMsgReplicas int `env:"NATS_MSG_REPLICAS" envDefault:"0" description:"Replica count for runnings nats instance"`
5253
}
5354

5455
func (ncc NatsClientConfig) GetNatsMsgBufferSize() int {

utils/grpc/GrpcConfig.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package grpc
33
import "github.com/caarlos0/env"
44

55
type Configuration struct {
6-
KubelinkMaxRecvMsgSize int `env:"KUBELINK_GRPC_MAX_RECEIVE_MSG_SIZE" envDefault:"20"` // In mb
7-
KubelinkMaxSendMsgSize int `env:"KUBELINK_GRPC_MAX_SEND_MSG_SIZE" envDefault:"4"` // In mb
6+
KubelinkMaxRecvMsgSize int `env:"KUBELINK_GRPC_MAX_RECEIVE_MSG_SIZE" envDefault:"20" description:"Message size to receive from kubelink"` // In mb
7+
KubelinkMaxSendMsgSize int `env:"KUBELINK_GRPC_MAX_SEND_MSG_SIZE" envDefault:"4" description:"Message size to send to kubelink"` // In mb
88
}
99

1010
func GetConfiguration() (*Configuration, error) {

utils/k8s/bean.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,19 @@ func GetResourceKey(obj *unstructured.Unstructured) ResourceKey {
185185
}
186186

187187
type CustomK8sHttpTransportConfig struct {
188-
UseCustomTransport bool `env:"USE_CUSTOM_HTTP_TRANSPORT" envDefault:"false"`
189-
TimeOut int `env:"K8s_TCP_TIMEOUT" envDefault:"30"`
190-
KeepAlive int `env:"K8s_TCP_KEEPALIVE" envDefault:"30"`
191-
TLSHandshakeTimeout int `env:"K8s_TLS_HANDSHAKE_TIMEOUT" envDefault:"10"`
192-
MaxIdleConnsPerHost int `env:"K8s_CLIENT_MAX_IDLE_CONNS_PER_HOST" envDefault:"25"`
193-
IdleConnTimeout int `env:"K8s_TCP_IDLE_CONN_TIMEOUT" envDefault:"300"`
188+
UseCustomTransport bool `env:"USE_CUSTOM_HTTP_TRANSPORT" envDefault:"false" description:"There is an issue in updating cluster bearer token with same cluster url due to transport layer token caching in k8s client lib. so we added a custom transport while calling k8s api server. this flag controls the usage of this transport.(custom or k8s)"`
189+
TimeOut int `env:"K8s_TCP_TIMEOUT" envDefault:"30" description:"Is the maximum amount of time a dial will wait for a connect to complete, required only if USE_CUSTOM_HTTP_TRANSPORT is true."`
190+
KeepAlive int `env:"K8s_TCP_KEEPALIVE" envDefault:"30" description:"Specifies the interval between keep-alive probes for an active, required only if USE_CUSTOM_HTTP_TRANSPORT is true."`
191+
TLSHandshakeTimeout int `env:"K8s_TLS_HANDSHAKE_TIMEOUT" envDefault:"10" description:"Specifies the maximum amount of time to wait for a TLS handshake. Zero means no timeout, required only if USE_CUSTOM_HTTP_TRANSPORT is true."`
192+
MaxIdleConnsPerHost int `env:"K8s_CLIENT_MAX_IDLE_CONNS_PER_HOST" envDefault:"25" description:"k8s client max idle connections per host"`
193+
IdleConnTimeout int `env:"K8s_TCP_IDLE_CONN_TIMEOUT" envDefault:"300" description:"Maximum amount of time an idle (keep-alive) connection will remain idle before closing itself, required only if USE_CUSTOM_HTTP_TRANSPORT is true."`
194194
}
195195

196196
type LocalDevMode bool
197197

198198
type RuntimeConfig struct {
199-
LocalDevMode LocalDevMode `env:"RUNTIME_CONFIG_LOCAL_DEV" envDefault:"false"`
199+
LocalDevMode LocalDevMode `env:"RUNTIME_CONFIG_LOCAL_DEV" envDefault:"false" description: "Used in local development process. Allows to read from local kube config file path for default cluster operations."`
200+
200201
}
201202

202203
func GetRuntimeConfig() (*RuntimeConfig, error) {

0 commit comments

Comments
 (0)