cloudsupport

package
v0.0.125 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 24 Imported by: 8

Documentation

Index

Constants

View Source
const (
	TypeApiServerInfo       workloadinterface.ObjectType = "APIServerInfo"
	ApiServerInfoGroup      string                       = "apiserverinfo.kubescape.cloud"
	ApiServerInfoVersion    string                       = "v1beta0"
	ApiServerInfoApiVersion string                       = ApiServerInfoGroup + "/" + ApiServerInfoVersion
)
View Source
const (
	TypeCloudProviderDescription workloadinterface.ObjectType = "CloudProviderDescribe" // DEPRECATED
	CloudProviderDescriptionKind                              = "ClusterDescription"    // DEPRECATED
	KS_CLOUD_PROVIDER_ENV_VAR                                 = "KS_CLOUD_PROVIDER"
	KS_KUBE_CLUSTER_ENV_VAR                                   = "KS_KUBE_CLUSTER"
)

Variables

This section is empty.

Functions

func CheckIsACRImage

func CheckIsACRImage(imageTag string) bool

func CheckIsECRImage

func CheckIsECRImage(imageTag string) bool

CheckIsECRImage check if this image is suspected as ECR hosted image

func CheckIsGCRImage

func CheckIsGCRImage(imageTag string) bool

func GetCloudProvider

func GetCloudProvider(currContext string) string

Try to lookup from env var and then from current context

func GetCloudVendorRegistryCredentials

func GetCloudVendorRegistryCredentials(imageTag string) (map[string]types.AuthConfig, error)

func GetDescribeRepositoriesFromCloudProvider added in v0.0.95

func GetDescribeRepositoriesFromCloudProvider(cluster string, cloudProvider string) (workloadinterface.IMetadata, error)

GetDescribeRepositoriesFromCloudProvider returns image repository descriptions from the cloud provider wrapped in IMetadata obj

func GetDescriptiveInfoFromCloudProvider

func GetDescriptiveInfoFromCloudProvider(cluster string, cloudProvider string) (workloadinterface.IMetadata, error)

GetDescriptiveInfoFromCloudProvider returns the cluster description from the cloud provider wrapped in IMetadata obj

func GetImageRegistryCredentials

func GetImageRegistryCredentials(imageTag string, pod *corev1.Pod) (map[string]types.AuthConfig, error)

DEPRECATED GetImageRegistryCredentials returns various credentials for images in the pod imageTag empty means returns all of the credentials for all images in pod spec containers pod.ObjectMeta.Namespace must be well setted

func GetKubeContextName

func GetKubeContextName() string

func GetListEntitiesForPoliciesFromCloudProvider added in v0.0.97

func GetListEntitiesForPoliciesFromCloudProvider(cluster string, cloudProvider string) (workloadinterface.IMetadata, error)

GetListEntitiesForPoliciesFromCloudProvider returns EntitiesForpolicies from the cloud provider wrapped in IMetadata obj

func GetLoginDetailsForAzurCR

func GetLoginDetailsForAzurCR(imageTag string) (string, string, error)

GetLoginDetailsForAzurCR return user name + password to use

func GetLoginDetailsForECR

func GetLoginDetailsForECR(imageTag string) (string, string, error)

GetLoginDetailsForECR return user name + password using the default iam-role OR ~/.aws/config of the machine

func GetLoginDetailsForGCR

func GetLoginDetailsForGCR(imageTag string) (string, string, error)

GetLoginDetailsForGCR return user name + password to use

func GetPolicyVersionFromCloudProvider added in v0.0.103

func GetPolicyVersionFromCloudProvider(cluster string, cloudProvider string) (workloadinterface.IMetadata, error)

GetPolicyVersionFromCloudProvider returns PolicyVersion from the cloud provider wrapped in IMetadata obj

func GetWorkloadImageRegistryCredentials

func GetWorkloadImageRegistryCredentials(imageTag string, workload k8sinterface.IWorkload) (map[string]types.AuthConfig, error)

GetImageRegistryCredentials returns various credentials for images in the pod imageTag empty means returns all of the credentials for all images in pod spec containers pod.ObjectMeta.Namespace must be well setted

func GetWorkloadsImages

func GetWorkloadsImages(workload k8sinterface.IWorkload) map[string]string

GetWorkloadsImages returns map[<image name>]<container name>

func IsRunningInCloudProvider

func IsRunningInCloudProvider(cluster string) bool

Types

type ApiServerInfo added in v0.0.84

type ApiServerInfo struct {
	ApiVersion string            `json:"apiVersion"` // apiVersion: apiserverinfo.kubescape.cloud/v1beta0
	Kind       string            `json:"kind"`       // kind: APIServerInfo
	Metadata   ApiServerMetadata `json:"metadata"`
	Data       interface{}       `json:"data"` // currently only *version.Info
}

ApiServerInfo is a struct that holds the information about the api server. It implements the IMetadata interface.

An example of the object is:

{
    "apiVersion": "apiserverinfo.kubescape.cloud/v1beta0",
    "kind": "APIServerInfo",
    "metadata": {
        "name": "version"
    },
    "data": {
        "major": "1",
        "minor": "22",
        "gitVersion": "v1.22.11-gke.400",
        "gitCommit": "b4e1ab06be827438def8aee0021791b413a0961d",
        "gitTreeState": "clean",
        "buildDate": "2022-06-24T09:27:38Z",
        "goVersion": "go1.16.15b7",
        "compiler": "gc",
        "platform": "linux/amd64"
    }
}

func NewApiServerInfo added in v0.0.84

func NewApiServerInfo() *ApiServerInfo

func NewApiServerVersionInfo added in v0.0.84

func NewApiServerVersionInfo(version *version.Info) *ApiServerInfo

func (*ApiServerInfo) GetApiVersion added in v0.0.84

func (apiServerInfo *ApiServerInfo) GetApiVersion() string

func (*ApiServerInfo) GetID added in v0.0.84

func (apiServerInfo *ApiServerInfo) GetID() string

func (*ApiServerInfo) GetKind added in v0.0.84

func (apiServerInfo *ApiServerInfo) GetKind() string

func (*ApiServerInfo) GetName added in v0.0.84

func (apiServerInfo *ApiServerInfo) GetName() string

func (*ApiServerInfo) GetNamespace added in v0.0.84

func (apiServerInfo *ApiServerInfo) GetNamespace() string

ApiServerInfo implements the Imetadata interface Getters

func (*ApiServerInfo) GetObject added in v0.0.84

func (apiServerInfo *ApiServerInfo) GetObject() map[string]interface{}

func (*ApiServerInfo) GetObjectType added in v0.0.84

func (apiServerInfo *ApiServerInfo) GetObjectType() workloadinterface.ObjectType

func (*ApiServerInfo) GetWorkload added in v0.0.84

func (apiServerInfo *ApiServerInfo) GetWorkload() map[string]interface{}

func (*ApiServerInfo) SetApiServerVersion added in v0.0.84

func (apiServerInfo *ApiServerInfo) SetApiServerVersion(version *version.Info)

func (*ApiServerInfo) SetApiVersion added in v0.0.84

func (apiServerInfo *ApiServerInfo) SetApiVersion(apiVersion string)

func (*ApiServerInfo) SetKind added in v0.0.84

func (apiServerInfo *ApiServerInfo) SetKind(kind string)

func (*ApiServerInfo) SetName added in v0.0.84

func (apiServerInfo *ApiServerInfo) SetName(name string)

func (*ApiServerInfo) SetNamespace added in v0.0.84

func (apiServerInfo *ApiServerInfo) SetNamespace(namespace string)

Setters

func (*ApiServerInfo) SetObject added in v0.0.84

func (apiServerInfo *ApiServerInfo) SetObject(object map[string]interface{})

func (*ApiServerInfo) SetProvider added in v0.0.84

func (ApiServerInfo *ApiServerInfo) SetProvider(provider string)

func (*ApiServerInfo) SetWorkload added in v0.0.84

func (apiServerInfo *ApiServerInfo) SetWorkload(workload map[string]interface{})

type ApiServerMetadata added in v0.0.84

type ApiServerMetadata struct {
	Name     string `json:"name"`               // Name of the info object. e.g. "version"
	Provider string `json:"provider,omitempty"` // Provider of the info object. e.g. "kubernetes"
}

func (*ApiServerMetadata) GetName added in v0.0.84

func (apiServerMetadata *ApiServerMetadata) GetName() string

ApiserverMetadata getters / setters

func (*ApiServerMetadata) GetProvider added in v0.0.84

func (apiServerMetadata *ApiServerMetadata) GetProvider() string

func (*ApiServerMetadata) SetName added in v0.0.84

func (apiServerMetadata *ApiServerMetadata) SetName(name string)

func (*ApiServerMetadata) SetProvider added in v0.0.84

func (apiServerMetadata *ApiServerMetadata) SetProvider(provider string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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