cmd

package
v0.0.0-...-686bfca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 77 Imported by: 0

Documentation

Overview

* Copyright (c) 2023 Baidu, Inc. All Rights Reserved. * * 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. *

Index

Constants

View Source
const (
	// AutoCIDR indicates that a CIDR should be allocated
	AutoCIDR = "auto"

	// ConfigModifyQueueSize is the size of the event queue for serializing
	// configuration updates to the daemon
	ConfigModifyQueueSize = 10
)

Variables

View Source
var (

	// RootCmd represents the base command when called without any subcommands
	RootCmd = &cobra.Command{
		Use:   "agent",
		Short: "Run the cce ipam v2 agent",
		Run: func(cmd *cobra.Command, args []string) {
			cmdRefDir := viper.GetString(option.CMDRef)
			if cmdRefDir != "" {
				genMarkdown(cmd, cmdRefDir)
				os.Exit(0)
			}

			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()
		},
	}
)

Functions

func Execute

func Execute()

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 NewDeleteENIHandler

func NewDeleteENIHandler(d *Daemon) eniapi.DeleteEniHandler

NewDeleteENIHandler handle incoming requests to delete addresses.

func NewDeleteIPAMIPHandler

func NewDeleteIPAMIPHandler(d *Daemon) ipamapi.DeleteIpamIPHandler

NewDeleteIPAMIPHandler handle incoming requests to delete addresses.

func NewGetEndpointExtpluginStatusHandler

func NewGetEndpointExtpluginStatusHandler(d *Daemon) endpointapi.GetEndpointExtpluginStatusHandler

NewGetEndpointExtpluginStatusHandler creates a new getEndpointExtpluginStatus from the daemon.

func NewGetMetricsHandler

func NewGetMetricsHandler(d *Daemon) restapi.GetMetricsHandler

NewGetMetricsHandler returns the metrics handler

func NewPostEniHandler

func NewPostEniHandler(d *Daemon) eniapi.PostEniHandler

NewPostEniHandler creates a new postENI from the daemon.

func NewPostIPAMHandler

func NewPostIPAMHandler(d *Daemon) ipamapi.PostIpamHandler

NewPostIPAMHandler creates a new postIPAM from the daemon.

func NewPostIPAMIPHandler

func NewPostIPAMIPHandler(d *Daemon) ipamapi.PostIpamIPHandler

NewPostIPAMIPHandler creates a new postIPAM from the daemon.

func NewPutEndpointProbeHandler

func NewPutEndpointProbeHandler(d *Daemon) endpointapi.PutEndpointProbeHandler

NewGetEndpointExtpluginStatusHandler creates a new getEndpointExtpluginStatus from the daemon.

Types

type Daemon

type Daemon struct {
	// contains filtered or unexported fields
}

Daemon is the cce daemon that is in charge of perform all necessary plumbing, monitoring when a LXC starts.

func NewDaemon

func NewDaemon(ctx context.Context, cancel context.CancelFunc) (*Daemon, error)

NewDaemon creates and returns a new Daemon with the parameters set in c.

func (*Daemon) Close

func (d *Daemon) Close()

Close shuts down a daemon

func (*Daemon) DebugEnabled

func (d *Daemon) DebugEnabled() bool

DebugEnabled returns if debug mode is enabled.

func (*Daemon) DumpIPAM

func (d *Daemon) DumpIPAM() *models.IPAMStatus

DumpIPAM dumps in the form of a map, the list of reserved IPv4 and IPv6 addresses.

func (*Daemon) GetCompilationLock

func (d *Daemon) GetCompilationLock() *lock.RWMutex

GetCompilationLock returns the mutex responsible for synchronizing compilation of BPF programs.

func (*Daemon) GetNodeSuffix

func (d *Daemon) GetNodeSuffix() string

GetNodeSuffix returns the suffix to be appended to kvstore keys of this agent

func (*Daemon) GetOptions

func (d *Daemon) GetOptions() *option.IntOptions

GetOptions returns the datapath configuration options of the daemon.

func (*Daemon) K8sCacheIsSynced

func (d *Daemon) K8sCacheIsSynced() bool

K8sCacheIsSynced returns true if the agent has fully synced its k8s cache with the API server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL