github.com/aporeto-inc/trireme-lib@v10.358.0+incompatible/utils/cri/common.go (about)

     1  package cri
     2  
     3  // Type is the type to be given at startup
     4  type Type string
     5  
     6  // Different enforcer types
     7  const (
     8  	TypeNone       Type = "none"       // TypeNone is the default enforcer type
     9  	TypeDocker     Type = "docker"     // TypeDocker is enforcerd which uses CRI docker
    10  	TypeCRIO       Type = "crio"       // TypeDaemonset is enforcerd which uses CRIO CRI
    11  	TypeContainerD Type = "containerd" // TypeContainerD is a enforcerd which uses containerD CRI
    12  )
    13  
    14  // Container returns true iff the enforcer supports containers
    15  func (d Type) Container() bool {
    16  	return d.Docker() || d.CRIO() || d.ContainerD()
    17  }
    18  
    19  // CRIO returns true if the enforcer is using CRI for container management
    20  func (d Type) CRIO() bool {
    21  	return d == TypeCRIO
    22  }
    23  
    24  // Docker returns true if the enforcer supports docker
    25  func (d Type) Docker() bool {
    26  	return d == TypeDocker
    27  }
    28  
    29  // ContainerD returns true if enforcerd is using ContainerD CRI
    30  func (d Type) ContainerD() bool {
    31  	return d == TypeContainerD
    32  }
    33  
    34  // SupportRuncProxy returns true iff the enforcer supports runc proxy
    35  func (d Type) SupportRuncProxy() bool {
    36  	return d.Docker() || d.CRIO() || d.ContainerD()
    37  }