-
Notifications
You must be signed in to change notification settings - Fork 2.8k
/
daemon_main.go
2134 lines (1689 loc) · 95.1 KB
/
daemon_main.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium
package cmd
import (
"context"
"fmt"
"net"
"os"
"path"
"path/filepath"
"regexp"
"strings"
"time"
"github.com/go-openapi/loads"
gops "github.com/google/gops/agent"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/vishvananda/netlink"
"google.golang.org/grpc"
"github.com/cilium/cilium/api/v1/server"
"github.com/cilium/cilium/api/v1/server/restapi"
"github.com/cilium/cilium/pkg/aws/eni"
bgpv1 "github.com/cilium/cilium/pkg/bgpv1/agent"
"github.com/cilium/cilium/pkg/bgpv1/gobgp"
"github.com/cilium/cilium/pkg/bpf"
"github.com/cilium/cilium/pkg/cgroups"
"github.com/cilium/cilium/pkg/common"
"github.com/cilium/cilium/pkg/components"
"github.com/cilium/cilium/pkg/controller"
"github.com/cilium/cilium/pkg/datapath/connector"
"github.com/cilium/cilium/pkg/datapath/iptables"
"github.com/cilium/cilium/pkg/datapath/link"
linuxdatapath "github.com/cilium/cilium/pkg/datapath/linux"
"github.com/cilium/cilium/pkg/datapath/linux/ipsec"
"github.com/cilium/cilium/pkg/datapath/linux/probes"
linuxrouting "github.com/cilium/cilium/pkg/datapath/linux/routing"
"github.com/cilium/cilium/pkg/datapath/loader"
"github.com/cilium/cilium/pkg/datapath/maps"
datapathOption "github.com/cilium/cilium/pkg/datapath/option"
"github.com/cilium/cilium/pkg/defaults"
"github.com/cilium/cilium/pkg/endpoint"
"github.com/cilium/cilium/pkg/envoy"
"github.com/cilium/cilium/pkg/flowdebug"
"github.com/cilium/cilium/pkg/hubble/exporter/exporteroption"
"github.com/cilium/cilium/pkg/hubble/observer/observeroption"
"github.com/cilium/cilium/pkg/identity"
ipamOption "github.com/cilium/cilium/pkg/ipam/option"
"github.com/cilium/cilium/pkg/ipmasq"
"github.com/cilium/cilium/pkg/k8s"
"github.com/cilium/cilium/pkg/k8s/watchers"
"github.com/cilium/cilium/pkg/kvstore"
"github.com/cilium/cilium/pkg/labels"
"github.com/cilium/cilium/pkg/labelsfilter"
"github.com/cilium/cilium/pkg/loadinfo"
"github.com/cilium/cilium/pkg/logging"
"github.com/cilium/cilium/pkg/logging/logfields"
"github.com/cilium/cilium/pkg/maglev"
"github.com/cilium/cilium/pkg/maps/ctmap"
"github.com/cilium/cilium/pkg/maps/ctmap/gc"
"github.com/cilium/cilium/pkg/maps/lbmap"
"github.com/cilium/cilium/pkg/maps/nat"
"github.com/cilium/cilium/pkg/maps/neighborsmap"
"github.com/cilium/cilium/pkg/maps/policymap"
"github.com/cilium/cilium/pkg/metrics"
monitorAPI "github.com/cilium/cilium/pkg/monitor/api"
"github.com/cilium/cilium/pkg/node"
nodeTypes "github.com/cilium/cilium/pkg/node/types"
"github.com/cilium/cilium/pkg/option"
"github.com/cilium/cilium/pkg/pidfile"
"github.com/cilium/cilium/pkg/policy"
"github.com/cilium/cilium/pkg/pprof"
"github.com/cilium/cilium/pkg/sysctl"
"github.com/cilium/cilium/pkg/version"
wireguard "github.com/cilium/cilium/pkg/wireguard/agent"
wireguardTypes "github.com/cilium/cilium/pkg/wireguard/types"
)
const (
// list of supported verbose debug groups
argDebugVerboseFlow = "flow"
argDebugVerboseKvstore = "kvstore"
argDebugVerboseEnvoy = "envoy"
argDebugVerboseDatapath = "datapath"
argDebugVerbosePolicy = "policy"
apiTimeout = 60 * time.Second
daemonSubsys = "daemon"
// fatalSleep is the duration Cilium should sleep before existing in case
// of a log.Fatal is issued or a CLI flag is specified but does not exist.
fatalSleep = 2 * time.Second
)
var (
log = logging.DefaultLogger.WithField(logfields.LogSubsys, daemonSubsys)
bootstrapTimestamp = time.Now()
// RootCmd represents the base command when called without any subcommands
RootCmd = &cobra.Command{
Use: "cilium-agent",
Short: "Run the cilium agent",
Run: func(cmd *cobra.Command, args []string) {
cmdRefDir := viper.GetString(option.CMDRef)
if cmdRefDir != "" {
genMarkdown(cmd, cmdRefDir)
os.Exit(0)
}
// Open socket for using gops to get stacktraces of the agent.
addr := fmt.Sprintf("127.0.0.1:%d", viper.GetInt(option.GopsPort))
addrField := logrus.Fields{"address": addr}
if err := gops.Listen(gops.Options{
Addr: addr,
ReuseSocketAddrAndPort: true,
}); err != nil {
log.WithError(err).WithFields(addrField).Fatal("Cannot start gops server")
}
log.WithFields(addrField).Info("Started gops server")
bootstrapStats.earlyInit.Start()
initEnv(cmd)
bootstrapStats.earlyInit.End(true)
runDaemon()
},
}
bootstrapStats = bootstrapStatistics{}
)
// Execute sets up gops, installs the cleanup signal handler and invokes
// the root command. This function only returns when an interrupt
// signal has been received. This is intended to be called by main.main().
func Execute() {
bootstrapStats.overall.Start()
interruptCh := cleaner.registerSigHandler()
if err := RootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
<-interruptCh
}
func skipInit(basePath string) bool {
switch basePath {
case components.CiliumAgentName, components.CiliumDaemonTestName:
return false
default:
return true
}
}
func init() {
setupSleepBeforeFatal()
initializeFlags()
registerBootstrapMetrics()
}
func setupSleepBeforeFatal() {
RootCmd.SetFlagErrorFunc(func(_ *cobra.Command, e error) error {
time.Sleep(fatalSleep)
return e
})
logrus.RegisterExitHandler(func() {
time.Sleep(fatalSleep)
},
)
}
func initializeFlags() {
if skipInit(path.Base(os.Args[0])) {
log.Debug("Skipping preparation of cilium-agent environment")
return
}
cobra.OnInitialize(option.InitConfig(RootCmd, "Cilium", "ciliumd"))
// Reset the help function to also exit, as we block elsewhere in interrupts
// and would not exit when called with -h.
oldHelpFunc := RootCmd.HelpFunc()
RootCmd.SetHelpFunc(func(c *cobra.Command, a []string) {
oldHelpFunc(c, a)
os.Exit(0)
})
flags := RootCmd.Flags()
// Validators
option.Config.FixedIdentityMappingValidator = option.Validator(func(val string) (string, error) {
vals := strings.Split(val, "=")
if len(vals) != 2 {
return "", fmt.Errorf(`invalid fixed identity: expecting "<numeric-identity>=<identity-name>" got %q`, val)
}
ni, err := identity.ParseNumericIdentity(vals[0])
if err != nil {
return "", fmt.Errorf(`invalid numeric identity %q: %s`, val, err)
}
if !identity.IsUserReservedIdentity(ni) {
return "", fmt.Errorf(`invalid numeric identity %q: valid numeric identity is between %d and %d`,
val, identity.UserReservedNumericIdentity.Uint32(), identity.MinimalNumericIdentity.Uint32())
}
lblStr := vals[1]
lbl := labels.ParseLabel(lblStr)
if lbl.IsReservedSource() {
return "", fmt.Errorf(`invalid source %q for label: %s`, labels.LabelSourceReserved, lblStr)
}
return val, nil
})
// Env bindings
flags.Int(option.AgentHealthPort, defaults.AgentHealthPort, "TCP port for agent health status API")
option.BindEnv(option.AgentHealthPort)
flags.Int(option.ClusterHealthPort, defaults.ClusterHealthPort, "TCP port for cluster-wide network connectivity health API")
option.BindEnv(option.ClusterHealthPort)
flags.StringSlice(option.AgentLabels, []string{}, "Additional labels to identify this agent")
option.BindEnv(option.AgentLabels)
flags.Bool(option.AllowICMPFragNeeded, defaults.AllowICMPFragNeeded, "Allow ICMP Fragmentation Needed type packets for purposes like TCP Path MTU.")
option.BindEnv(option.AllowICMPFragNeeded)
flags.String(option.AllowLocalhost, option.AllowLocalhostAuto, "Policy when to allow local stack to reach local endpoints { auto | always | policy }")
option.BindEnv(option.AllowLocalhost)
flags.Bool(option.AnnotateK8sNode, defaults.AnnotateK8sNode, "Annotate Kubernetes node")
option.BindEnv(option.AnnotateK8sNode)
flags.Duration(option.ARPPingRefreshPeriod, defaults.ARPBaseReachableTime, "Period for remote node ARP entry refresh (set 0 to disable)")
option.BindEnv(option.ARPPingRefreshPeriod)
flags.Bool(option.EnableL2NeighDiscovery, true, "Enables L2 neighbor discovery used by kube-proxy-replacement and IPsec")
option.BindEnv(option.EnableL2NeighDiscovery)
flags.Bool(option.AutoCreateCiliumNodeResource, defaults.AutoCreateCiliumNodeResource, "Automatically create CiliumNode resource for own node on startup")
option.BindEnv(option.AutoCreateCiliumNodeResource)
flags.String(option.BPFRoot, "", "Path to BPF filesystem")
option.BindEnv(option.BPFRoot)
flags.Bool(option.EnableBPFClockProbe, false, "Enable BPF clock source probing for more efficient tick retrieval")
option.BindEnv(option.EnableBPFClockProbe)
flags.String(option.CGroupRoot, "", "Path to Cgroup2 filesystem")
option.BindEnv(option.CGroupRoot)
flags.Bool(option.SockopsEnableName, defaults.SockopsEnable, "Enable sockops when kernel supported")
option.BindEnv(option.SockopsEnableName)
flags.Int(option.ClusterIDName, 0, "Unique identifier of the cluster")
option.BindEnv(option.ClusterIDName)
flags.String(option.ClusterName, defaults.ClusterName, "Name of the cluster")
option.BindEnv(option.ClusterName)
flags.String(option.ClusterMeshConfigName, "", "Path to the ClusterMesh configuration directory")
option.BindEnv(option.ClusterMeshConfigName)
flags.StringSlice(option.CompilerFlags, []string{}, "Extra CFLAGS for BPF compilation")
flags.MarkHidden(option.CompilerFlags)
option.BindEnv(option.CompilerFlags)
flags.String(option.ConfigFile, "", `Configuration file (default "$HOME/ciliumd.yaml")`)
option.BindEnv(option.ConfigFile)
flags.String(option.ConfigDir, "", `Configuration directory that contains a file for each option`)
option.BindEnv(option.ConfigDir)
flags.Duration(option.ConntrackGCInterval, time.Duration(0), "Overwrite the connection-tracking garbage collection interval")
option.BindEnv(option.ConntrackGCInterval)
flags.BoolP(option.DebugArg, "D", false, "Enable debugging mode")
option.BindEnv(option.DebugArg)
flags.StringSlice(option.DebugVerbose, []string{}, "List of enabled verbose debug groups")
option.BindEnv(option.DebugVerbose)
flags.StringSlice(option.Devices, []string{}, "List of devices facing cluster/external network (used for BPF NodePort, BPF masquerading and host firewall); supports '+' as wildcard in device name, e.g. 'eth+'")
option.BindEnv(option.Devices)
flags.String(option.DirectRoutingDevice, "", "Device name used to connect nodes in direct routing mode (used by BPF NodePort, BPF host routing; if empty, automatically set to a device with k8s InternalIP/ExternalIP or with a default route)")
option.BindEnv(option.DirectRoutingDevice)
flags.String(option.LBDevInheritIPAddr, "", fmt.Sprintf("Device name which IP addr is inherited by devices running LB BPF program (--%s)", option.Devices))
option.BindEnv(option.LBDevInheritIPAddr)
flags.String(option.DatapathMode, defaults.DatapathMode, "Datapath mode name")
option.BindEnv(option.DatapathMode)
flags.StringP(option.IpvlanMasterDevice, "", "undefined", "Device facing external network acting as ipvlan master")
option.BindEnv(option.IpvlanMasterDevice)
flags.MarkDeprecated(option.IpvlanMasterDevice, "This option will be removed in v1.12")
flags.Bool(option.DisableConntrack, false, "Disable connection tracking")
option.BindEnv(option.DisableConntrack)
flags.MarkDeprecated(option.DisableConntrack, "This option is no-op and it will be removed in v1.13")
flags.Bool(option.EnableEndpointRoutes, defaults.EnableEndpointRoutes, "Use per endpoint routes instead of routing via cilium_host")
option.BindEnv(option.EnableEndpointRoutes)
flags.Bool(option.EnableHealthChecking, defaults.EnableHealthChecking, "Enable connectivity health checking")
option.BindEnv(option.EnableHealthChecking)
flags.Bool(option.EnableHealthCheckNodePort, defaults.EnableHealthCheckNodePort, "Enables a healthcheck nodePort server for NodePort services with 'healthCheckNodePort' being set")
option.BindEnv(option.EnableHealthCheckNodePort)
flags.StringSlice(option.EndpointStatus, []string{},
"Enable additional CiliumEndpoint status features ("+strings.Join(option.EndpointStatusValues(), ",")+")")
option.BindEnv(option.EndpointStatus)
flags.Bool(option.EnableEndpointHealthChecking, defaults.EnableEndpointHealthChecking, "Enable connectivity health checking between virtual endpoints")
option.BindEnv(option.EnableEndpointHealthChecking)
flags.Bool(option.EnableLocalNodeRoute, defaults.EnableLocalNodeRoute, "Enable installation of the route which points the allocation prefix of the local node")
option.BindEnv(option.EnableLocalNodeRoute)
flags.Bool(option.EnableIPv4Name, defaults.EnableIPv4, "Enable IPv4 support")
option.BindEnv(option.EnableIPv4Name)
flags.Bool(option.EnableIPv6Name, defaults.EnableIPv6, "Enable IPv6 support")
option.BindEnv(option.EnableIPv6Name)
flags.Bool(option.EnableIPv6NDPName, defaults.EnableIPv6NDP, "Enable IPv6 NDP support")
option.BindEnv(option.EnableIPv6NDPName)
flags.String(option.IPv6MCastDevice, "", "Device that joins a Solicited-Node multicast group for IPv6")
option.BindEnv(option.IPv6MCastDevice)
flags.Bool(option.EnableRemoteNodeIdentity, defaults.EnableRemoteNodeIdentity, "Enable use of remote node identity")
option.BindEnv(option.EnableRemoteNodeIdentity)
flags.String(option.EncryptInterface, "", "Transparent encryption interface")
option.BindEnv(option.EncryptInterface)
flags.Bool(option.EncryptNode, defaults.EncryptNode, "Enables encrypting traffic from non-Cilium pods and host networking")
option.BindEnv(option.EncryptNode)
flags.StringSlice(option.IPv4PodSubnets, []string{}, "List of IPv4 pod subnets to preconfigure for encryption")
option.BindEnv(option.IPv4PodSubnets)
flags.StringSlice(option.IPv6PodSubnets, []string{}, "List of IPv6 pod subnets to preconfigure for encryption")
option.BindEnv(option.IPv6PodSubnets)
flags.String(option.EndpointInterfaceNamePrefix, "", "Prefix of interface name shared by all endpoints")
option.BindEnv(option.EndpointInterfaceNamePrefix)
flags.MarkDeprecated(option.EndpointInterfaceNamePrefix, "This option no longer has any effect and will be removed in v1.13.")
flags.StringSlice(option.ExcludeLocalAddress, []string{}, "Exclude CIDR from being recognized as local address")
option.BindEnv(option.ExcludeLocalAddress)
flags.Bool(option.DisableCiliumEndpointCRDName, false, "Disable use of CiliumEndpoint CRD")
option.BindEnv(option.DisableCiliumEndpointCRDName)
flags.String(option.EgressMasqueradeInterfaces, "", "Limit egress masquerading to interface selector")
option.BindEnv(option.EgressMasqueradeInterfaces)
flags.Bool(option.BPFSocketLBHostnsOnly, false, "Skip socket LB for services when inside a pod namespace, in favor of service LB at the pod interface. Socket LB is still used when in the host namespace. Required by service mesh (e.g., Istio, Linkerd).")
option.BindEnv(option.BPFSocketLBHostnsOnly)
flags.Bool(option.EnableHostReachableServices, false, "Enable reachability of services for host applications")
option.BindEnv(option.EnableHostReachableServices)
flags.StringSlice(option.HostReachableServicesProtos, []string{option.HostServicesTCP, option.HostServicesUDP}, "Only enable reachability of services for host applications for specific protocols")
option.BindEnv(option.HostReachableServicesProtos)
flags.MarkDeprecated(option.HostReachableServicesProtos, "This option will be removed in v1.13")
flags.Bool(option.EnableAutoDirectRoutingName, defaults.EnableAutoDirectRouting, "Enable automatic L2 routing between nodes")
option.BindEnv(option.EnableAutoDirectRoutingName)
flags.Bool(option.EnableBPFTProxy, defaults.EnableBPFTProxy, "Enable BPF-based proxy redirection, if support available")
option.BindEnv(option.EnableBPFTProxy)
flags.Bool(option.EnableHostLegacyRouting, defaults.EnableHostLegacyRouting, "Enable the legacy host forwarding model which does not bypass upper stack in host namespace")
option.BindEnv(option.EnableHostLegacyRouting)
flags.Bool(option.EnableXTSocketFallbackName, defaults.EnableXTSocketFallback, "Enable fallback for missing xt_socket module")
option.BindEnv(option.EnableXTSocketFallbackName)
flags.String(option.EnablePolicy, option.DefaultEnforcement, "Enable policy enforcement")
option.BindEnv(option.EnablePolicy)
flags.Bool(option.EnableExternalIPs, defaults.EnableExternalIPs, fmt.Sprintf("Enable k8s service externalIPs feature (requires enabling %s)", option.EnableNodePort))
option.BindEnv(option.EnableExternalIPs)
flags.Bool(option.K8sEnableEndpointSlice, defaults.K8sEnableEndpointSlice, "Enables k8s EndpointSlice feature in Cilium if the k8s cluster supports it")
option.BindEnv(option.K8sEnableEndpointSlice)
flags.Bool(option.K8sEnableAPIDiscovery, defaults.K8sEnableAPIDiscovery, "Enable discovery of Kubernetes API groups and resources with the discovery API")
option.BindEnv(option.K8sEnableAPIDiscovery)
flags.Bool(option.EnableL7Proxy, defaults.EnableL7Proxy, "Enable L7 proxy for L7 policy enforcement")
option.BindEnv(option.EnableL7Proxy)
flags.Bool(option.EnableTracing, false, "Enable tracing while determining policy (debugging)")
option.BindEnv(option.EnableTracing)
flags.Bool(option.EnableUnreachableRoutes, false, "Add unreachable routes on pod deletion")
option.BindEnv(option.EnableUnreachableRoutes)
flags.Bool(option.EnableWellKnownIdentities, defaults.EnableWellKnownIdentities, "Enable well-known identities for known Kubernetes components")
option.BindEnv(option.EnableWellKnownIdentities)
flags.String(option.EnvoyLog, "", "Path to a separate Envoy log file, if any")
option.BindEnv(option.EnvoyLog)
flags.Bool(option.EnableIPSecName, defaults.EnableIPSec, "Enable IPSec support")
option.BindEnv(option.EnableIPSecName)
flags.String(option.IPSecKeyFileName, "", "Path to IPSec key file")
option.BindEnv(option.IPSecKeyFileName)
flags.Bool(option.EnableWireguard, false, "Enable wireguard")
option.BindEnv(option.EnableWireguard)
flags.Bool(option.EnableWireguardUserspaceFallback, false, "Enables the fallback to the wireguard userspace implementation")
option.BindEnv(option.EnableWireguardUserspaceFallback)
flags.Bool(option.ForceLocalPolicyEvalAtSource, defaults.ForceLocalPolicyEvalAtSource, "Force policy evaluation of all local communication at the source endpoint")
option.BindEnv(option.ForceLocalPolicyEvalAtSource)
flags.Bool(option.HTTPNormalizePath, true, "Use Envoy HTTP path normalization options, which currently includes RFC 3986 path normalization, Envoy merge slashes option, and unescaping and redirecting for paths that contain escaped slashes. These are necessary to keep path based access control functional, and should not interfere with normal operation. Set this to false only with caution.")
option.BindEnv(option.HTTPNormalizePath)
flags.String(option.HTTP403Message, "", "Message returned in proxy L7 403 body")
flags.MarkHidden(option.HTTP403Message)
option.BindEnv(option.HTTP403Message)
flags.Uint(option.HTTPRequestTimeout, 60*60, "Time after which a forwarded HTTP request is considered failed unless completed (in seconds); Use 0 for unlimited")
option.BindEnv(option.HTTPRequestTimeout)
flags.Uint(option.HTTPIdleTimeout, 0, "Time after which a non-gRPC HTTP stream is considered failed unless traffic in the stream has been processed (in seconds); defaults to 0 (unlimited)")
option.BindEnv(option.HTTPIdleTimeout)
flags.Uint(option.HTTPMaxGRPCTimeout, 0, "Time after which a forwarded gRPC request is considered failed unless completed (in seconds). A \"grpc-timeout\" header may override this with a shorter value; defaults to 0 (unlimited)")
option.BindEnv(option.HTTPMaxGRPCTimeout)
flags.Uint(option.HTTPRetryCount, 3, "Number of retries performed after a forwarded request attempt fails")
option.BindEnv(option.HTTPRetryCount)
flags.Uint(option.HTTPRetryTimeout, 0, "Time after which a forwarded but uncompleted request is retried (connection failures are retried immediately); defaults to 0 (never)")
option.BindEnv(option.HTTPRetryTimeout)
flags.Uint(option.ProxyConnectTimeout, 1, "Time after which a TCP connect attempt is considered failed unless completed (in seconds)")
option.BindEnv(option.ProxyConnectTimeout)
flags.Uint(option.ProxyGID, 1337, "Group ID for proxy control plane sockets.")
option.BindEnv(option.ProxyGID)
flags.Int(option.ProxyPrometheusPort, 0, "Port to serve Envoy metrics on. Default 0 (disabled).")
option.BindEnv(option.ProxyPrometheusPort)
flags.Int(option.ProxyMaxRequestsPerConnection, 0, "Set Envoy HTTP option max_requests_per_connection. Default 0 (disable)")
option.BindEnv(option.ProxyMaxRequestsPerConnection)
flags.Int64(option.ProxyMaxConnectionDuration, 0, "Set Envoy HTTP option max_connection_duration seconds. Default 0 (disable)")
option.BindEnv(option.ProxyMaxConnectionDuration)
flags.Bool(option.DisableEnvoyVersionCheck, false, "Do not perform Envoy binary version check on startup")
flags.MarkHidden(option.DisableEnvoyVersionCheck)
// Disable version check if Envoy build is disabled
option.BindEnvWithLegacyEnvFallback(option.DisableEnvoyVersionCheck, "CILIUM_DISABLE_ENVOY_BUILD")
flags.Var(option.NewNamedMapOptions(option.FixedIdentityMapping, &option.Config.FixedIdentityMapping, option.Config.FixedIdentityMappingValidator),
option.FixedIdentityMapping, "Key-value for the fixed identity mapping which allows to use reserved label for fixed identities, e.g. 128=kv-store,129=kube-dns")
option.BindEnv(option.FixedIdentityMapping)
flags.Duration(option.IdentityChangeGracePeriod, defaults.IdentityChangeGracePeriod, "Time to wait before using new identity on endpoint identity change")
option.BindEnv(option.IdentityChangeGracePeriod)
flags.Duration(option.IdentityRestoreGracePeriod, defaults.IdentityRestoreGracePeriod, "Time to wait before releasing unused restored CIDR identities during agent restart")
option.BindEnv(option.IdentityRestoreGracePeriod)
flags.String(option.IdentityAllocationMode, option.IdentityAllocationModeKVstore, "Method to use for identity allocation")
option.BindEnv(option.IdentityAllocationMode)
flags.String(option.IPAM, ipamOption.IPAMClusterPool, "Backend to use for IPAM")
option.BindEnv(option.IPAM)
flags.String(option.IPv4Range, AutoCIDR, "Per-node IPv4 endpoint prefix, e.g. 10.16.0.0/16")
option.BindEnv(option.IPv4Range)
flags.String(option.IPv6Range, AutoCIDR, "Per-node IPv6 endpoint prefix, e.g. fd02:1:1::/96")
option.BindEnv(option.IPv6Range)
flags.String(option.IPv6ClusterAllocCIDRName, defaults.IPv6ClusterAllocCIDR, "IPv6 /64 CIDR used to allocate per node endpoint /96 CIDR")
option.BindEnv(option.IPv6ClusterAllocCIDRName)
flags.String(option.IPv4ServiceRange, AutoCIDR, "Kubernetes IPv4 services CIDR if not inside cluster prefix")
option.BindEnv(option.IPv4ServiceRange)
flags.String(option.IPv6ServiceRange, AutoCIDR, "Kubernetes IPv6 services CIDR if not inside cluster prefix")
option.BindEnv(option.IPv6ServiceRange)
flags.Bool(option.K8sEventHandover, defaults.K8sEventHandover, "Enable k8s event handover to kvstore for improved scalability")
option.BindEnv(option.K8sEventHandover)
flags.String(option.K8sAPIServer, "", "Kubernetes API server URL")
option.BindEnv(option.K8sAPIServer)
flags.String(option.K8sKubeConfigPath, "", "Absolute path of the kubernetes kubeconfig file")
option.BindEnv(option.K8sKubeConfigPath)
flags.String(option.K8sNamespaceName, "", "Name of the Kubernetes namespace in which Cilium is deployed in")
option.BindEnv(option.K8sNamespaceName)
flags.Bool(option.JoinClusterName, false, "Join a Cilium cluster via kvstore registration")
option.BindEnv(option.JoinClusterName)
flags.Bool(option.K8sRequireIPv4PodCIDRName, false, "Require IPv4 PodCIDR to be specified in node resource")
option.BindEnv(option.K8sRequireIPv4PodCIDRName)
flags.Bool(option.K8sRequireIPv6PodCIDRName, false, "Require IPv6 PodCIDR to be specified in node resource")
option.BindEnv(option.K8sRequireIPv6PodCIDRName)
flags.Uint(option.K8sServiceCacheSize, defaults.K8sServiceCacheSize, "Cilium service cache size for kubernetes")
option.BindEnv(option.K8sServiceCacheSize)
flags.MarkHidden(option.K8sServiceCacheSize)
flags.String(option.K8sWatcherEndpointSelector, defaults.K8sWatcherEndpointSelector, "K8s endpoint watcher will watch for these k8s endpoints")
option.BindEnv(option.K8sWatcherEndpointSelector)
flags.Bool(option.KeepConfig, false, "When restoring state, keeps containers' configuration in place")
option.BindEnv(option.KeepConfig)
flags.String(option.KVStore, "", "Key-value store type")
option.BindEnv(option.KVStore)
flags.Duration(option.KVstoreLeaseTTL, defaults.KVstoreLeaseTTL, "Time-to-live for the KVstore lease.")
flags.MarkHidden(option.KVstoreLeaseTTL)
option.BindEnv(option.KVstoreLeaseTTL)
flags.Int(option.KVstoreMaxConsecutiveQuorumErrorsName, defaults.KVstoreMaxConsecutiveQuorumErrors, "Max acceptable kvstore consecutive quorum errors before the agent assumes permanent failure")
option.BindEnv(option.KVstoreMaxConsecutiveQuorumErrorsName)
flags.Duration(option.KVstorePeriodicSync, defaults.KVstorePeriodicSync, "Periodic KVstore synchronization interval")
option.BindEnv(option.KVstorePeriodicSync)
flags.Duration(option.KVstoreConnectivityTimeout, defaults.KVstoreConnectivityTimeout, "Time after which an incomplete kvstore operation is considered failed")
option.BindEnv(option.KVstoreConnectivityTimeout)
flags.Duration(option.IPAllocationTimeout, defaults.IPAllocationTimeout, "Time after which an incomplete CIDR allocation is considered failed")
option.BindEnv(option.IPAllocationTimeout)
flags.Var(option.NewNamedMapOptions(option.KVStoreOpt, &option.Config.KVStoreOpt, nil),
option.KVStoreOpt, "Key-value store options e.g. etcd.address=127.0.0.1:4001")
option.BindEnv(option.KVStoreOpt)
flags.Duration(option.K8sSyncTimeoutName, defaults.K8sSyncTimeout, "Timeout for synchronizing k8s resources before exiting")
flags.MarkHidden(option.K8sSyncTimeoutName)
option.BindEnv(option.K8sSyncTimeoutName)
flags.Duration(option.AllocatorListTimeoutName, defaults.AllocatorListTimeout, "Timeout for listing allocator state before exiting")
option.BindEnv(option.AllocatorListTimeoutName)
flags.String(option.LabelPrefixFile, "", "Valid label prefixes file path")
option.BindEnv(option.LabelPrefixFile)
flags.StringSlice(option.Labels, []string{}, "List of label prefixes used to determine identity of an endpoint")
option.BindEnv(option.Labels)
flags.String(option.KubeProxyReplacement, option.KubeProxyReplacementPartial, fmt.Sprintf(
"auto-enable available features for kube-proxy replacement (%q), "+
"or enable only selected features (will panic if any selected feature cannot be enabled) (%q) "+
"or enable all features (will panic if any feature cannot be enabled) (%q), "+
"or completely disable it (ignores any selected feature) (%q)",
option.KubeProxyReplacementProbe, option.KubeProxyReplacementPartial,
option.KubeProxyReplacementStrict, option.KubeProxyReplacementDisabled))
option.BindEnv(option.KubeProxyReplacement)
flags.String(option.KubeProxyReplacementHealthzBindAddr, defaults.KubeProxyReplacementHealthzBindAddr, "The IP address with port for kube-proxy replacement health check server to serve on (set to '0.0.0.0:10256' for all IPv4 interfaces and '[::]:10256' for all IPv6 interfaces). Set empty to disable.")
option.BindEnv(option.KubeProxyReplacementHealthzBindAddr)
flags.Bool(option.EnableHostPort, true, fmt.Sprintf("Enable k8s hostPort mapping feature (requires enabling %s)", option.EnableNodePort))
option.BindEnv(option.EnableHostPort)
flags.Bool(option.EnableNodePort, false, "Enable NodePort type services by Cilium")
option.BindEnv(option.EnableNodePort)
flags.Bool(option.EnableSVCSourceRangeCheck, true, "Enable check of service source ranges (currently, only for LoadBalancer)")
option.BindEnv(option.EnableSVCSourceRangeCheck)
flags.String(option.AddressScopeMax, fmt.Sprintf("%d", defaults.AddressScopeMax), "Maximum local address scope for ipcache to consider host addresses")
flags.MarkHidden(option.AddressScopeMax)
option.BindEnv(option.AddressScopeMax)
flags.Bool(option.EnableBandwidthManager, false, "Enable BPF bandwidth manager")
option.BindEnv(option.EnableBandwidthManager)
flags.Bool(option.EnableBBR, false, "Enable BBR for the bandwidth manager")
option.BindEnv(option.EnableBBR)
flags.Bool(option.EnableRecorder, false, "Enable BPF datapath pcap recorder")
option.BindEnv(option.EnableRecorder)
flags.Bool(option.EnableLocalRedirectPolicy, false, "Enable Local Redirect Policy")
option.BindEnv(option.EnableLocalRedirectPolicy)
flags.Bool(option.EnableMKE, false, "Enable BPF kube-proxy replacement for MKE environments")
flags.MarkHidden(option.EnableMKE)
option.BindEnv(option.EnableMKE)
flags.String(option.CgroupPathMKE, "", "Cgroup v1 net_cls mount path for MKE environments")
flags.MarkHidden(option.CgroupPathMKE)
option.BindEnv(option.CgroupPathMKE)
flags.String(option.NodePortMode, option.NodePortModeSNAT, "BPF NodePort mode (\"snat\", \"dsr\", \"hybrid\")")
flags.MarkHidden(option.NodePortMode)
option.BindEnv(option.NodePortMode)
flags.String(option.NodePortAlg, option.NodePortAlgRandom, "BPF load balancing algorithm (\"random\", \"maglev\")")
flags.MarkHidden(option.NodePortAlg)
option.BindEnv(option.NodePortAlg)
flags.String(option.NodePortAcceleration, option.NodePortAccelerationDisabled, fmt.Sprintf(
"BPF NodePort acceleration via XDP (\"%s\", \"%s\")",
option.NodePortAccelerationNative, option.NodePortAccelerationDisabled))
flags.MarkHidden(option.NodePortAcceleration)
option.BindEnv(option.NodePortAcceleration)
flags.String(option.LoadBalancerMode, option.NodePortModeSNAT, "BPF load balancing mode (\"snat\", \"dsr\", \"hybrid\")")
option.BindEnv(option.LoadBalancerMode)
flags.String(option.LoadBalancerAlg, option.NodePortAlgRandom, "BPF load balancing algorithm (\"random\", \"maglev\")")
option.BindEnv(option.LoadBalancerAlg)
flags.String(option.LoadBalancerDSRDispatch, option.DSRDispatchOption, "BPF load balancing DSR dispatch method (\"opt\", \"ipip\")")
option.BindEnv(option.LoadBalancerDSRDispatch)
flags.String(option.LoadBalancerDSRL4Xlate, option.DSRL4XlateFrontend, "BPF load balancing DSR L4 DNAT method for IPIP (\"frontend\", \"backend\")")
option.BindEnv(option.LoadBalancerDSRL4Xlate)
flags.String(option.LoadBalancerRSSv4CIDR, "", "BPF load balancing RSS outer source IPv4 CIDR prefix for IPIP")
option.BindEnv(option.LoadBalancerRSSv4CIDR)
flags.String(option.LoadBalancerRSSv6CIDR, "", "BPF load balancing RSS outer source IPv6 CIDR prefix for IPIP")
option.BindEnv(option.LoadBalancerRSSv6CIDR)
flags.String(option.LoadBalancerAcceleration, option.NodePortAccelerationDisabled, fmt.Sprintf(
"BPF load balancing acceleration via XDP (\"%s\", \"%s\")",
option.NodePortAccelerationNative, option.NodePortAccelerationDisabled))
option.BindEnv(option.LoadBalancerAcceleration)
flags.Uint(option.MaglevTableSize, maglev.DefaultTableSize, "Maglev per service backend table size (parameter M)")
option.BindEnv(option.MaglevTableSize)
flags.String(option.MaglevHashSeed, maglev.DefaultHashSeed, "Maglev cluster-wide hash seed (base64 encoded)")
option.BindEnv(option.MaglevHashSeed)
flags.Bool(option.EnableAutoProtectNodePortRange, true,
"Append NodePort range to net.ipv4.ip_local_reserved_ports if it overlaps "+
"with ephemeral port range (net.ipv4.ip_local_port_range)")
option.BindEnv(option.EnableAutoProtectNodePortRange)
flags.StringSlice(option.NodePortRange, []string{fmt.Sprintf("%d", option.NodePortMinDefault), fmt.Sprintf("%d", option.NodePortMaxDefault)}, "Set the min/max NodePort port range")
option.BindEnv(option.NodePortRange)
flags.Bool(option.NodePortBindProtection, true, "Reject application bind(2) requests to service ports in the NodePort range")
option.BindEnv(option.NodePortBindProtection)
flags.Bool(option.EnableSessionAffinity, false, "Enable support for service session affinity")
option.BindEnv(option.EnableSessionAffinity)
flags.Bool(option.EnableServiceTopology, false, "Enable support for service topology aware hints")
option.BindEnv(option.EnableServiceTopology)
flags.Bool(option.EnableIdentityMark, true, "Enable setting identity mark for local traffic")
option.BindEnv(option.EnableIdentityMark)
flags.Bool(option.EnableHostFirewall, false, "Enable host network policies")
option.BindEnv(option.EnableHostFirewall)
flags.String(option.NativeRoutingCIDR, "",
fmt.Sprintf("Allows to explicitly specify the IPv4 CIDR for native routing. "+
"When specified, Cilium assumes networking for this CIDR is preconfigured and hands traffic destined for that range to the Linux network stack without applying any SNAT. "+
"Generally speaking, specifying a native routing CIDR implies that Cilium can depend on the underlying networking stack to route packets to their destination. "+
"To offer a concrete example, if Cilium is configured to use direct routing and the Kubernetes CIDR is included in the native routing CIDR, the user must configure the routes to reach pods, either manually or by setting the auto-direct-node-routes flag. "+
"Deprecated in favor of --%s", option.IPv4NativeRoutingCIDR))
option.BindEnv(option.NativeRoutingCIDR)
flags.MarkDeprecated(option.NativeRoutingCIDR, "This option will be removed in v1.12")
flags.String(option.IPv4NativeRoutingCIDR, "", "Allows to explicitly specify the IPv4 CIDR for native routing. "+
"When specified, Cilium assumes networking for this CIDR is preconfigured and hands traffic destined for that range to the Linux network stack without applying any SNAT. "+
"Generally speaking, specifying a native routing CIDR implies that Cilium can depend on the underlying networking stack to route packets to their destination. "+
"To offer a concrete example, if Cilium is configured to use direct routing and the Kubernetes CIDR is included in the native routing CIDR, the user must configure the routes to reach pods, either manually or by setting the auto-direct-node-routes flag.")
option.BindEnv(option.IPv4NativeRoutingCIDR)
flags.String(option.IPv6NativeRoutingCIDR, "", "Allows to explicitly specify the IPv6 CIDR for native routing. "+
"When specified, Cilium assumes networking for this CIDR is preconfigured and hands traffic destined for that range to the Linux network stack without applying any SNAT. "+
"Generally speaking, specifying a native routing CIDR implies that Cilium can depend on the underlying networking stack to route packets to their destination. "+
"To offer a concrete example, if Cilium is configured to use direct routing and the Kubernetes CIDR is included in the native routing CIDR, the user must configure the routes to reach pods, either manually or by setting the auto-direct-node-routes flag.")
option.BindEnv(option.IPv6NativeRoutingCIDR)
flags.String(option.LibDir, defaults.LibraryPath, "Directory path to store runtime build environment")
option.BindEnv(option.LibDir)
flags.StringSlice(option.LogDriver, []string{}, "Logging endpoints to use for example syslog")
option.BindEnv(option.LogDriver)
flags.Var(option.NewNamedMapOptions(option.LogOpt, &option.Config.LogOpt, nil),
option.LogOpt, `Log driver options for cilium-agent, `+
`configmap example for syslog driver: {"syslog.level":"info","syslog.facility":"local5","syslog.tag":"cilium-agent"}`)
option.BindEnv(option.LogOpt)
flags.Bool(option.LogSystemLoadConfigName, false, "Enable periodic logging of system load")
option.BindEnv(option.LogSystemLoadConfigName)
flags.String(option.LoopbackIPv4, defaults.LoopbackIPv4, "IPv4 address for service loopback SNAT")
option.BindEnv(option.LoopbackIPv4)
flags.Bool(option.EnableIPv4Masquerade, true, "Masquerade IPv4 traffic from endpoints leaving the host")
option.BindEnv(option.EnableIPv4Masquerade)
flags.Bool(option.EnableIPv6Masquerade, true, "Masquerade IPv6 traffic from endpoints leaving the host")
option.BindEnv(option.EnableIPv6Masquerade)
flags.Bool(option.EnableBPFMasquerade, false, "Masquerade packets from endpoints leaving the host with BPF instead of iptables")
option.BindEnv(option.EnableBPFMasquerade)
flags.String(option.DeriveMasqIPAddrFromDevice, "", "Device name from which Cilium derives the IP addr for BPF masquerade")
flags.MarkHidden(option.DeriveMasqIPAddrFromDevice)
option.BindEnv(option.DeriveMasqIPAddrFromDevice)
flags.Bool(option.EnableIPMasqAgent, false, "Enable BPF ip-masq-agent")
option.BindEnv(option.EnableIPMasqAgent)
flags.Bool(option.EnableIPv4EgressGateway, false, "Enable egress gateway for IPv4")
option.BindEnv(option.EnableIPv4EgressGateway)
flags.Bool(option.EnableEnvoyConfig, false, "Enable Envoy Config CRDs")
option.BindEnv(option.EnableEnvoyConfig)
flags.Duration(option.EnvoyConfigTimeout, defaults.EnvoyConfigTimeout, "Timeout duration for Envoy Config acknowledgements")
option.BindEnv(option.EnvoyConfigTimeout)
flags.String(option.IPMasqAgentConfigPath, "/etc/config/ip-masq-agent", "ip-masq-agent configuration file path")
option.BindEnv(option.IPMasqAgentConfigPath)
flags.Bool(option.InstallIptRules, true, "Install base iptables rules for cilium to mainly interact with kube-proxy (and masquerading)")
option.BindEnv(option.InstallIptRules)
flags.Duration(option.IPTablesLockTimeout, 5*time.Second, "Time to pass to each iptables invocation to wait for xtables lock acquisition")
option.BindEnv(option.IPTablesLockTimeout)
flags.Bool(option.IPTablesRandomFully, false, "Set iptables flag random-fully on masquerading rules")
option.BindEnv(option.IPTablesRandomFully)
flags.Int(option.MaxCtrlIntervalName, 0, "Maximum interval (in seconds) between controller runs. Zero is no limit.")
flags.MarkHidden(option.MaxCtrlIntervalName)
option.BindEnv(option.MaxCtrlIntervalName)
flags.StringSlice(option.Metrics, []string{}, "Metrics that should be enabled or disabled from the default metric list. (+metric_foo to enable metric_foo , -metric_bar to disable metric_bar)")
option.BindEnv(option.Metrics)
flags.Bool(option.EnableMonitorName, true, "Enable the monitor unix domain socket server")
option.BindEnv(option.EnableMonitorName)
flags.String(option.MonitorAggregationName, "None",
"Level of monitor aggregation for traces from the datapath")
option.BindEnvWithLegacyEnvFallback(option.MonitorAggregationName, "CILIUM_MONITOR_AGGREGATION_LEVEL")
flags.Int(option.MonitorQueueSizeName, 0, "Size of the event queue when reading monitor events")
option.BindEnv(option.MonitorQueueSizeName)
flags.Int(option.MTUName, 0, "Overwrite auto-detected MTU of underlying network")
option.BindEnv(option.MTUName)
flags.String(option.ProcFs, "/proc", "Root's proc filesystem path")
option.BindEnv(option.ProcFs)
flags.Int(option.RouteMetric, 0, "Overwrite the metric used by cilium when adding routes to its 'cilium_host' device")
option.BindEnv(option.RouteMetric)
flags.Bool(option.PrependIptablesChainsName, true, "Prepend custom iptables chains instead of appending")
option.BindEnvWithLegacyEnvFallback(option.PrependIptablesChainsName, "CILIUM_PREPEND_IPTABLES_CHAIN")
flags.String(option.IPv6NodeAddr, "auto", "IPv6 address of node")
option.BindEnv(option.IPv6NodeAddr)
flags.String(option.IPv4NodeAddr, "auto", "IPv4 address of node")
option.BindEnv(option.IPv4NodeAddr)
flags.String(option.ReadCNIConfiguration, "", "Read to the CNI configuration at specified path to extract per node configuration")
option.BindEnv(option.ReadCNIConfiguration)
flags.Bool(option.Restore, true, "Restores state, if possible, from previous daemon")
option.BindEnv(option.Restore)
flags.String(option.SidecarIstioProxyImage, k8s.DefaultSidecarIstioProxyImageRegexp,
"Regular expression matching compatible Istio sidecar istio-proxy container image names")
option.BindEnv(option.SidecarIstioProxyImage)
flags.Bool(option.SingleClusterRouteName, false,
"Use a single cluster route instead of per node routes")
option.BindEnv(option.SingleClusterRouteName)
flags.String(option.SocketPath, defaults.SockPath, "Sets daemon's socket path to listen for connections")
option.BindEnv(option.SocketPath)
flags.String(option.StateDir, defaults.RuntimePath, "Directory path to store runtime state")
option.BindEnv(option.StateDir)
flags.StringP(option.TunnelName, "t", "", fmt.Sprintf("Tunnel mode {%s} (default \"vxlan\" for the \"veth\" datapath mode)", option.GetTunnelModes()))
option.BindEnv(option.TunnelName)
flags.Int(option.TunnelPortName, 0, fmt.Sprintf("Tunnel port (default %d for \"vxlan\" and %d for \"geneve\")", defaults.TunnelPortVXLAN, defaults.TunnelPortGeneve))
option.BindEnv(option.TunnelPortName)
flags.Int(option.TracePayloadlen, 128, "Length of payload to capture when tracing")
option.BindEnv(option.TracePayloadlen)
flags.Bool(option.Version, false, "Print version information")
option.BindEnv(option.Version)
flags.Bool(option.PProf, false, "Enable serving the pprof debugging API")
option.BindEnv(option.PProf)
flags.Int(option.PProfPort, 6060, "Port that the pprof listens on")
option.BindEnv(option.PProfPort)
flags.Bool(option.EnableXDPPrefilter, false, "Enable XDP prefiltering")
option.BindEnv(option.EnableXDPPrefilter)
flags.String(option.PrefilterDevice, "undefined", "Device facing external network for XDP prefiltering")
option.BindEnv(option.PrefilterDevice)
flags.MarkDeprecated(option.PrefilterDevice,
fmt.Sprintf("This option will be removed in v1.12. Use --%s and --%s instead.",
option.EnableXDPPrefilter, option.Devices))
flags.String(option.PrefilterMode, option.ModePreFilterNative, "Prefilter mode via XDP (\"native\", \"generic\")")
option.BindEnv(option.PrefilterMode)
flags.MarkDeprecated(option.PrefilterMode,
fmt.Sprintf("This option will be removed in v1.12. Use --%s instead.", option.LoadBalancerAcceleration))
flags.Bool(option.PreAllocateMapsName, defaults.PreAllocateMaps, "Enable BPF map pre-allocation")
option.BindEnv(option.PreAllocateMapsName)
// We expect only one of the possible variables to be filled. The evaluation order is:
// --prometheus-serve-addr, CILIUM_PROMETHEUS_SERVE_ADDR, then PROMETHEUS_SERVE_ADDR
// The second environment variable (without the CILIUM_ prefix) is here to
// handle the case where someone uses a new image with an older spec, and the
// older spec used the older variable name.
flags.String(option.PrometheusServeAddr, "", "IP:Port on which to serve prometheus metrics (pass \":Port\" to bind on all interfaces, \"\" is off)")
option.BindEnvWithLegacyEnvFallback(option.PrometheusServeAddr, "PROMETHEUS_SERVE_ADDR")
flags.Int(option.CTMapEntriesGlobalTCPName, option.CTMapEntriesGlobalTCPDefault, "Maximum number of entries in TCP CT table")
option.BindEnvWithLegacyEnvFallback(option.CTMapEntriesGlobalTCPName, "CILIUM_GLOBAL_CT_MAX_TCP")
flags.String(option.CertsDirectory, defaults.CertsDirectory, "Root directory to find certificates specified in L7 TLS policy enforcement")
option.BindEnv(option.CertsDirectory)
flags.Int(option.CTMapEntriesGlobalAnyName, option.CTMapEntriesGlobalAnyDefault, "Maximum number of entries in non-TCP CT table")
option.BindEnvWithLegacyEnvFallback(option.CTMapEntriesGlobalAnyName, "CILIUM_GLOBAL_CT_MAX_ANY")
flags.Duration(option.CTMapEntriesTimeoutTCPName, 21600*time.Second, "Timeout for established entries in TCP CT table")
option.BindEnv(option.CTMapEntriesTimeoutTCPName)
flags.Duration(option.CTMapEntriesTimeoutAnyName, 60*time.Second, "Timeout for entries in non-TCP CT table")
option.BindEnv(option.CTMapEntriesTimeoutAnyName)
flags.Duration(option.CTMapEntriesTimeoutSVCTCPName, 21600*time.Second, "Timeout for established service entries in TCP CT table")
option.BindEnv(option.CTMapEntriesTimeoutSVCTCPName)
flags.Duration(option.CTMapEntriesTimeoutSVCAnyName, 60*time.Second, "Timeout for service entries in non-TCP CT table")
option.BindEnv(option.CTMapEntriesTimeoutSVCAnyName)
flags.Duration(option.CTMapEntriesTimeoutSYNName, 60*time.Second, "Establishment timeout for entries in TCP CT table")
option.BindEnv(option.CTMapEntriesTimeoutSYNName)
flags.Duration(option.CTMapEntriesTimeoutFINName, 10*time.Second, "Teardown timeout for entries in TCP CT table")
option.BindEnv(option.CTMapEntriesTimeoutFINName)
flags.Duration(option.MonitorAggregationInterval, 5*time.Second, "Monitor report interval when monitor aggregation is enabled")
option.BindEnv(option.MonitorAggregationInterval)
flags.StringSlice(option.MonitorAggregationFlags, option.MonitorAggregationFlagsDefault, "TCP flags that trigger monitor reports when monitor aggregation is enabled")
option.BindEnv(option.MonitorAggregationFlags)
flags.Int(option.NATMapEntriesGlobalName, option.NATMapEntriesGlobalDefault, "Maximum number of entries for the global BPF NAT table")
option.BindEnv(option.NATMapEntriesGlobalName)
flags.Int(option.NeighMapEntriesGlobalName, option.NATMapEntriesGlobalDefault, "Maximum number of entries for the global BPF neighbor table")
option.BindEnv(option.NeighMapEntriesGlobalName)
flags.Int(option.PolicyMapEntriesName, policymap.MaxEntries, "Maximum number of entries in endpoint policy map (per endpoint)")
option.BindEnv(option.PolicyMapEntriesName)
flags.Int(option.SockRevNatEntriesName, option.SockRevNATMapEntriesDefault, "Maximum number of entries for the SockRevNAT BPF map")
option.BindEnv(option.SockRevNatEntriesName)
flags.Float64(option.MapEntriesGlobalDynamicSizeRatioName, 0.0, "Ratio (0.0-1.0) of total system memory to use for dynamic sizing of CT, NAT and policy BPF maps. Set to 0.0 to disable dynamic BPF map sizing (default: 0.0)")
option.BindEnv(option.MapEntriesGlobalDynamicSizeRatioName)
flags.String(option.CMDRef, "", "Path to cmdref output directory")
flags.MarkHidden(option.CMDRef)
option.BindEnv(option.CMDRef)
flags.Int(option.GopsPort, defaults.GopsPortAgent, "Port for gops server to listen on")
option.BindEnv(option.GopsPort)
flags.Int(option.ToFQDNsMinTTL, 0, fmt.Sprintf("The minimum time, in seconds, to use DNS data for toFQDNs policies. (default %d )", defaults.ToFQDNsMinTTL))
option.BindEnv(option.ToFQDNsMinTTL)
flags.Int(option.ToFQDNsProxyPort, 0, "Global port on which the in-agent DNS proxy should listen. Default 0 is a OS-assigned port.")
option.BindEnv(option.ToFQDNsProxyPort)
flags.StringVar(&option.Config.FQDNRejectResponse, option.FQDNRejectResponseCode, option.FQDNProxyDenyWithRefused, fmt.Sprintf("DNS response code for rejecting DNS requests, available options are '%v'", option.FQDNRejectOptions))
option.BindEnv(option.FQDNRejectResponseCode)
flags.Int(option.ToFQDNsMaxIPsPerHost, defaults.ToFQDNsMaxIPsPerHost, "Maximum number of IPs to maintain per FQDN name for each endpoint")
option.BindEnv(option.ToFQDNsMaxIPsPerHost)
flags.Int(option.DNSMaxIPsPerRestoredRule, defaults.DNSMaxIPsPerRestoredRule, "Maximum number of IPs to maintain for each restored DNS rule")
option.BindEnv(option.DNSMaxIPsPerRestoredRule)
flags.Bool(option.DNSPolicyUnloadOnShutdown, false, "Unload DNS policy rules on graceful shutdown")
option.BindEnv(option.DNSPolicyUnloadOnShutdown)
flags.Int(option.ToFQDNsMaxDeferredConnectionDeletes, defaults.ToFQDNsMaxDeferredConnectionDeletes, "Maximum number of IPs to retain for expired DNS lookups with still-active connections")
option.BindEnv(option.ToFQDNsMaxDeferredConnectionDeletes)
flags.DurationVar(&option.Config.ToFQDNsIdleConnectionGracePeriod, option.ToFQDNsIdleConnectionGracePeriod, defaults.ToFQDNsIdleConnectionGracePeriod, "Time during which idle but previously active connections with expired DNS lookups are still considered alive (default 0s)")
option.BindEnv(option.ToFQDNsIdleConnectionGracePeriod)
flags.DurationVar(&option.Config.FQDNProxyResponseMaxDelay, option.FQDNProxyResponseMaxDelay, 100*time.Millisecond, "The maximum time the DNS proxy holds an allowed DNS response before sending it along. Responses are sent as soon as the datapath is updated with the new IP information.")
option.BindEnv(option.FQDNProxyResponseMaxDelay)
flags.String(option.ToFQDNsPreCache, defaults.ToFQDNsPreCache, "DNS cache data at this path is preloaded on agent startup")
option.BindEnv(option.ToFQDNsPreCache)
flags.Bool(option.ToFQDNsEnableDNSCompression, defaults.ToFQDNsEnableDNSCompression, "Allow the DNS proxy to compress responses to endpoints that are larger than 512 Bytes or the EDNS0 option, if present")
option.BindEnv(option.ToFQDNsEnableDNSCompression)
flags.Int(option.PolicyQueueSize, defaults.PolicyQueueSize, "size of queues for policy-related events")
option.BindEnv(option.PolicyQueueSize)
flags.Int(option.EndpointQueueSize, defaults.EndpointQueueSize, "size of EventQueue per-endpoint")
option.BindEnv(option.EndpointQueueSize)
flags.Duration(option.EndpointGCInterval, 5*time.Minute, "Periodically monitor local endpoint health via link status on this interval and garbage collect them if they become unhealthy, set to 0 to disable")
flags.MarkHidden(option.EndpointGCInterval)
option.BindEnv(option.EndpointGCInterval)
flags.Bool(option.SelectiveRegeneration, true, "only regenerate endpoints which need to be regenerated upon policy changes")
flags.MarkHidden(option.SelectiveRegeneration)
option.BindEnv(option.SelectiveRegeneration)
flags.String(option.WriteCNIConfigurationWhenReady, "", fmt.Sprintf("Write the CNI configuration as specified via --%s to path when agent is ready", option.ReadCNIConfiguration))
option.BindEnv(option.WriteCNIConfigurationWhenReady)
flags.Duration(option.PolicyTriggerInterval, defaults.PolicyTriggerInterval, "Time between triggers of policy updates (regenerations for all endpoints)")
flags.MarkHidden(option.PolicyTriggerInterval)
option.BindEnv(option.PolicyTriggerInterval)
flags.Bool(option.DisableCNPStatusUpdates, false, `Do not send CNP NodeStatus updates to the Kubernetes api-server (recommended to run with "cnp-node-status-gc-interval=0" in cilium-operator)`)
option.BindEnv(option.DisableCNPStatusUpdates)
flags.Bool(option.PolicyAuditModeArg, false, "Enable policy audit (non-drop) mode")
option.BindEnv(option.PolicyAuditModeArg)
flags.Bool(option.EnableHubble, false, "Enable hubble server")
option.BindEnv(option.EnableHubble)
flags.String(option.HubbleSocketPath, defaults.HubbleSockPath, "Set hubble's socket path to listen for connections")
option.BindEnv(option.HubbleSocketPath)
flags.String(option.HubbleListenAddress, "", `An additional address for Hubble server to listen to, e.g. ":4244"`)
option.BindEnv(option.HubbleListenAddress)
flags.Bool(option.HubbleTLSDisabled, false, "Allow Hubble server to run on the given listen address without TLS.")
option.BindEnv(option.HubbleTLSDisabled)
flags.String(option.HubbleTLSCertFile, "", "Path to the public key file for the Hubble server. The file must contain PEM encoded data.")
option.BindEnv(option.HubbleTLSCertFile)
flags.String(option.HubbleTLSKeyFile, "", "Path to the private key file for the Hubble server. The file must contain PEM encoded data.")
option.BindEnv(option.HubbleTLSKeyFile)
flags.StringSlice(option.HubbleTLSClientCAFiles, []string{}, "Paths to one or more public key files of client CA certificates to use for TLS with mutual authentication (mTLS). The files must contain PEM encoded data. When provided, this option effectively enables mTLS.")
option.BindEnv(option.HubbleTLSClientCAFiles)
flags.Int(option.HubbleEventBufferCapacity, observeroption.Default.MaxFlows.AsInt(), "Capacity of Hubble events buffer. The provided value must be one less than an integer power of two and no larger than 65535 (ie: 1, 3, ..., 2047, 4095, ..., 65535)")
option.BindEnv(option.HubbleEventBufferCapacity)
flags.Int(option.HubbleEventQueueSize, 0, "Buffer size of the channel to receive monitor events.")
option.BindEnv(option.HubbleEventQueueSize)
flags.String(option.HubbleMetricsServer, "", "Address to serve Hubble metrics on.")
option.BindEnv(option.HubbleMetricsServer)
flags.StringSlice(option.HubbleMetrics, []string{}, "List of Hubble metrics to enable.")
option.BindEnv(option.HubbleMetrics)
flags.String(option.HubbleExportFilePath, exporteroption.Default.Path, "Filepath to write Hubble events to.")
option.BindEnv(option.HubbleExportFilePath)