Documentation
¶
Overview ¶
Package install is responsible for installation and uninstallation of KubeArmor while autogenerating the configuration
SPDX-License-Identifier: Apache-2.0 Copyright 2021 Authors of KubeArmor
Index ¶
- Constants
- Variables
- func CheckAndRemoveKAVmInstallation() bool
- func CreateCustomResourceDefinition(crdName string) apiextensions.CustomResourceDefinition
- func DetectArchitecture() (string, error)
- func DetectRuntimes() []string
- func GenerateCA() (*x509.Certificate, *rsa.PrivateKey, error)
- func GenerateCSR(namespace string, serviceName string) (*x509.Certificate, *rsa.PrivateKey, error)
- func GeneratePki(namespace string, serviceName string) (*bytes.Buffer, *bytes.Buffer, *bytes.Buffer, error)
- func K8sInstaller(c *k8s.Client, o Options) error
- func K8sLegacyInstaller(c *k8s.Client, o Options) error
- func K8sLegacyUninstaller(c *k8s.Client, o Options) error
- func K8sUninstaller(c *k8s.Client, o Options) error
- func RemoveSystemd() error
- func SignCSR(caCrt *x509.Certificate, caKey *rsa.PrivateKey, csrCrt *x509.Certificate, ...) ([]byte, error)
- func UpdateImageRegistry(registry, image string, preserveUpstream bool) string
- type Config
- type KubeArmorConfig
- type Options
- type TagResponse
Constants ¶
const ( PodmanRuntime = "podman" DockerRuntime = "docker" SystemdRuntime = "systemd" RemoteHost = "docker.io" ImageName = "kubearmor/kubearmor-systemd" DefaultComposeFile = "./docker-compose.yaml" DefaultSystemdFileConfig = "kubearmor-systemd.json" ConfigPath = "/opt/kubearmor/kubearmor.yaml" DockerHubURL = "https://hub.docker.com/v2/repositories/kubearmor/kubearmor-systemd/tags/" )
Variables ¶
var ( KubeArmorOperatorClusterRoleName = "kubearmor-operator-clusterrole" KubeArmorOperatorManageClusterRoleName = "kubearmor-operator-manage-kubearmor-clusterrole" KubeArmorOperatorManageControllerClusterRoleName = "kubearmor-operator-manage-controller-clusterrole" KubeArmorClusterRoleName = "kubearmor-clusterrole" RelayClusterRoleName = "kubearmor-relay-clusterrole" KubeArmorControllerClusterRoleName = "kubearmor-controller-clusterrole" KubeArmorSnitchClusterRoleName = "kubearmor-snitch" KubeArmorControllerProxyClusterRoleName = "kubearmor-controller-proxy-role" )
var ( KubeArmorSnitchClusterroleBindingName = "kubearmor-snitch-binding" RelayClusterRoleBindingName = "kubearmor-relay-clusterrolebinding" KubeArmorControllerProxyClusterRoleBindingName = "kubearmor-controller-proxy-rolebinding" KubeArmorControllerClusterRoleBindingName = "kubearmor-controller-clusterrolebinding" KubeArmorClusterRoleBindingName = "kubearmor-clusterrolebinding" KubeArmorOperatorManageControllerClusterRoleBindingName = "kubearmor-operator-manage-controller-clusterrole-binding" KubeArmorOperatorManageClusterRoleBindingName = "kubearmor-operator-manage-kubearmor-clusterrole-binding" KubeArmorOperatorClusterRoleBindingName = "kubearmor-operator-clusterrole-binding" )
var DefaultSystemdFile string
Functions ¶
func CheckAndRemoveKAVmInstallation ¶ added in v1.4.0
func CheckAndRemoveKAVmInstallation() bool
func CreateCustomResourceDefinition ¶
func CreateCustomResourceDefinition(crdName string) apiextensions.CustomResourceDefinition
CreateCustomResourceDefinition creates the CRD and add it into Kubernetes.
func DetectArchitecture ¶ added in v1.4.0
func DetectRuntimes ¶ added in v1.4.0
func DetectRuntimes() []string
func GenerateCA ¶ added in v0.7.4
func GenerateCA() (*x509.Certificate, *rsa.PrivateKey, error)
GenerateCA - generate private key and a cert for a CA
func GenerateCSR ¶ added in v0.7.4
func GenerateCSR(namespace string, serviceName string) (*x509.Certificate, *rsa.PrivateKey, error)
GenerateCSR - generate certificate signing request
func GeneratePki ¶ added in v0.7.4
func GeneratePki(namespace string, serviceName string) (*bytes.Buffer, *bytes.Buffer, *bytes.Buffer, error)
GeneratePki - generate pub/priv keypair
func K8sInstaller ¶
K8sInstaller using operator for karmor
func K8sLegacyInstaller ¶ added in v1.2.0
K8sInstaller for karmor install
func K8sLegacyUninstaller ¶ added in v1.2.0
func K8sUninstaller ¶
K8sUninstaller for karmor uninstall
func RemoveSystemd ¶ added in v1.4.0
func RemoveSystemd() error
func SignCSR ¶ added in v0.7.4
func SignCSR(caCrt *x509.Certificate, caKey *rsa.PrivateKey, csrCrt *x509.Certificate, csrKey *rsa.PrivateKey) ([]byte, error)
SignCSR - signs a certificate signing request essentially approving it using the given CA
func UpdateImageRegistry ¶ added in v1.1.0
UpdateImageRegistry will update the registry address of the image
Types ¶
type KubeArmorConfig ¶ added in v1.4.0
type KubeArmorConfig struct {
KubeArmorTag string
KubeArmorInitImage string
KubeArmorImage string
ImagePullPolicy string
Hostname string
KubeArmorVisibility string `json:"visibility"`
KubeArmorHostVisibility string `json:"hostVisibility"`
EnableKubeArmorHostPolicy bool `json:"enableKubeArmorHostPolicy"`
EnableKubeArmorPolicy bool `json:"enableKubeArmorPolicy"`
KubeArmorFilePosture string `json:"defaultFilePosture"`
KubeArmorNetworkPosture string `json:"defaultNetworkPosture"`
KubeArmorCapPosture string `json:"defaultCapabilitiesPosture"`
KubeArmorHostFilePosture string `json:"hostDefaultFilePosture"`
KubeArmorHostNetworkPosture string `json:"hostDefaultNetworkPosture"`
KubeArmorHostCapPosture string `json:"hostDefaultCapabilitiesPosture"`
EnableKubeArmorVm bool `json:"enableKubeArmorVm"`
KubeArmorAlertThrottling bool `json:"alertThrottling"`
KubeArmorMaxAlertsPerSec int `json:"maxAlertPerSec"`
KubeArmorThrottleSec int `json:"throttleSec"`
ComposeCmd string
ComposeVersion string
AgentName string
PackageName string
ServiceName string
AgentDir string
ConfigFilePath string
ServiceTemplateString string
KubeArmorPort string
ConfigTemplateString string
Mode utils.VMMode
ORASClient *auth.Client
PlainHTTP bool
UserConfigPath string
SecureContainers bool
}
func SetKAConfig ¶ added in v1.4.0
func SetKAConfig(installOptions *Options) (*KubeArmorConfig, error)
func (*KubeArmorConfig) DeployKASystemd ¶ added in v1.4.0
func (config *KubeArmorConfig) DeployKASystemd() error
func (*KubeArmorConfig) DeployKAdocker ¶ added in v1.4.0
func (config *KubeArmorConfig) DeployKAdocker() error
func (*KubeArmorConfig) SystemdInstall ¶ added in v1.4.0
func (config *KubeArmorConfig) SystemdInstall() error
func (*KubeArmorConfig) ValidateEnv ¶ added in v1.4.0
func (installOptions *KubeArmorConfig) ValidateEnv() (string, error)
type Options ¶
type Options struct {
Namespace string
InitImage string
KubearmorImage string
ControllerImage string
OperatorImage string
RelayImage string
ImageRegistry string
Audit string
Block string
HostAudit string
HostBlock string
Visibility string
HostVisibility string
Force bool
Local bool
Save bool
Verify bool
Legacy bool
SkipDeploy bool
KubeArmorTag string
KubeArmorRelayTag string
KubeArmorControllerTag string
KubeArmorOperatorTag string
PreserveUpstream bool
Env envOption
AlertThrottling bool
MaxAlertPerSec int
ThrottleSec int
AnnotateExisting bool
NonK8s bool
VmMode utils.VMMode
ComposeCmd string
ComposeVersion string
ImagePullPolicy string
SecureContainers bool
}
Options for karmor install