Documentation ¶
Index ¶
- func AddResourceGroups(c *gin.Context)
- func AddSecretTag(c *gin.Context)
- func AddSecrets(c *gin.Context)
- func CheckBucket(c *gin.Context)
- func ContainsString(sl []string, v string) bool
- func CreateBucket(c *gin.Context)
- func DeleteBucket(c *gin.Context)
- func DeleteSecretTag(c *gin.Context)
- func DeleteSecrets(c *gin.Context)
- func ErrorResponseFrom(err error) *pkgCommon.ErrorResponse
- func GetBucket(c *gin.Context)
- func GetClusterConfig(c *gin.Context)
- func GetClusterNodes(c *gin.Context)
- func GetDeploymentImages(c *gin.Context)
- func GetK8sConfig(c *gin.Context) ([]byte, bool)
- func GetPodDetails(c *gin.Context)
- func GetReleaseScanLog(c *gin.Context) (map[string]bool, bool)
- func GetResourceGroups(c *gin.Context)
- func GetSecret(c *gin.Context)
- func GetSecretTags(c *gin.Context)
- func GetWhitelistSet(c *gin.Context) (map[string]bool, bool)
- func InstallSecretToCluster(c *gin.Context)
- func InstallSecretsToCluster(c *gin.Context)
- func ListAllBuckets(c *gin.Context)
- func ListBuckets(c *gin.Context)
- func ListClusterSecrets(c *gin.Context)
- func ListHelmReleases(c *gin.Context, releases []intlHelm.Release, releaseMap map[string]bool) []pkgHelm.ListDeploymentResponse
- func ListImages(c *gin.Context)
- func ListManagedBuckets(c *gin.Context)
- func ListSecrets(c *gin.Context)
- func MergeSecretInCluster(c *gin.Context)
- func MetaHandler(router *gin.Engine, subpath string) gin.HandlerFunc
- func NewImageDeploymentsHandler(releaseLister ReleaseLister, clusterService ClusterService, ...) imageDeploymentsHandler
- func OrganizationMiddleware(c *gin.Context)
- func UpdateSecrets(c *gin.Context)
- func ValidateSecret(c *gin.Context)
- type AnchoreProxy
- type BucketNotFoundError
- type BucketQueryData
- type BucketResponseItem
- type ClusterAPI
- func (a *ClusterAPI) ClusterCheck(c *gin.Context)
- func (a *ClusterAPI) CreateCluster(c *gin.Context)
- func (a *ClusterAPI) GetBootstrapInfo(c *gin.Context)
- func (a *ClusterAPI) GetCluster(c *gin.Context)
- func (a *ClusterAPI) GetClusters(c *gin.Context)
- func (a *ClusterAPI) ProxyToCluster(c *gin.Context)
- func (a *ClusterAPI) ReRunPostHooks(c *gin.Context)
- func (a *ClusterAPI) UpdateCluster(c *gin.Context)
- func (a *ClusterAPI) UpdateNodePools(c *gin.Context)
- type ClusterAuthAPI
- type ClusterCreators
- type ClusterDeleters
- type ClusterService
- type ClusterUpdaters
- type CreateAmazonObjectStoreBucketProperties
- type CreateAzureObjectStoreBucketProperties
- type CreateBucketRequest
- type CreateBucketResponse
- type CreateGoogleObjectStoreBucketProperties
- type CreateResourceGroupRequest
- type CreateResourceGroupResponse
- type EndpointLister
- type GetClusterNodePool
- type GetClusterResponse
- type InstallSecretRequest
- type InstallSecretRequestSpecItem
- type InstallSecretResponse
- type InstallSecretsToClusterRequest
- type LabelValidator
- type NetworkAPI
- type NetworkInfo
- type NodeResourceSummary
- type NodepoolManagerAPI
- type OIDC
- type OrganizationAPI
- type ReleaseChecker
- type ReleaseLister
- type Resource
- type ResourceSummary
- type RouteTableInfo
- type ScanLogHandler
- type SecretNotFoundError
- type SecurityHandler
- type SubnetInfo
- type UpdateClusterResponse
- type UserAPI
- type WhitelistHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddResourceGroups ¶
AddResourceGroups creates a new resource group
func AddSecretTag ¶
AddSecretTag adds a tag to a given secret in Vault
func CheckBucket ¶
CheckBucket checks if the given there is a bucket exists with the given name
func ContainsString ¶
func CreateBucket ¶
CreateBucket creates an objectstore bucket (blob container in case of Azure) and also creates all requirements for them (eg.; ResourceGroup and StorageAccount in case of Azure). These information are also stored to a database.
func DeleteBucket ¶
DeleteBucket deletes object storage buckets (object storage container in case of Azure) that can be accessed with the credentials from the given secret
func DeleteSecretTag ¶
DeleteSecretTag removes a tag from a given secret in Vault
func DeleteSecrets ¶
DeleteSecrets delete a secret with the given secret id
func ErrorResponseFrom ¶
func ErrorResponseFrom(err error) *pkgCommon.ErrorResponse
ErrorResponseFrom translates the given error into a components.ErrorResponse
func GetBucket ¶
GetBucket handler for retrieving bucket details by name it retrieves all the managed buckets and filters them by name
func GetClusterConfig ¶
GetClusterConfig gets a cluster config
func GetDeploymentImages ¶
GetDeploymentImages list all used images in deployment
func GetK8sConfig ¶
GetK8sConfig returns the Kubernetes config
func GetReleaseScanLog ¶
GetReleaseScanLog will return a ReleaseScanlog
func GetResourceGroups ¶
GetResourceGroups lists resource groups by secret
func GetSecretTags ¶
GetSecretTags returns tags of a secret by ID
func GetWhitelistSet ¶
GetWhitelistSet will return a WhitelistSet
func InstallSecretToCluster ¶
InstallSecretToCluster installs a particular secret to a cluster's namespace.
func InstallSecretsToCluster ¶
InstallSecretsToCluster add all secrets from a repo to a cluster's namespace combined into one global secret named as the repo
func ListAllBuckets ¶
ListAllBuckets handles bucket list requests. The handler method directs the flow to the appropriate retrieval strategy based on the request header details
func ListBuckets ¶
ListBuckets returns the list of object storage buckets (object storage container in case of Azure) that can be accessed with the credentials from the given secret.
func ListHelmReleases ¶
func ListHelmReleases(c *gin.Context, releases []intlHelm.Release, releaseMap map[string]bool) []pkgHelm.ListDeploymentResponse
ListHelmReleases list helm releases
func ListManagedBuckets ¶
ListManagedBuckets lists managed buckets for the user when no secret is provided
func ListSecrets ¶
ListSecrets returns the user all secrets, if the secret type or tag is filled then a filtered response is returned
func MergeSecretInCluster ¶
MergeSecretInCluster installs a particular secret to a cluster's namespace.
func MetaHandler ¶
func MetaHandler(router *gin.Engine, subpath string) gin.HandlerFunc
MetaHandler lists routes with their available methods
func NewImageDeploymentsHandler ¶
func NewImageDeploymentsHandler(releaseLister ReleaseLister, clusterService ClusterService, logger internalCommon.Logger) imageDeploymentsHandler
func OrganizationMiddleware ¶
OrganizationMiddleware parses the organization id from the request, queries it from the database and saves it to the current context.
func UpdateSecrets ¶
UpdateSecrets updates the given secret in Vault
Types ¶
type AnchoreProxy ¶
type AnchoreProxy struct {
// contains filtered or unexported fields
}
func NewAnchoreProxy ¶
func NewAnchoreProxy( basePath string, configProvider anchore.ConfigProvider, errorHandler common.ErrorHandler, logger common.Logger, ) AnchoreProxy
func (AnchoreProxy) Proxy ¶
func (ap AnchoreProxy) Proxy() gin.HandlerFunc
type BucketNotFoundError ¶
type BucketNotFoundError struct {
// contains filtered or unexported fields
}
SecretNotFoundError signals that a given bucket was not found
func (BucketNotFoundError) Error ¶
func (err BucketNotFoundError) Error() string
Error returns error message as string
func (BucketNotFoundError) NotFound ¶
func (err BucketNotFoundError) NotFound() bool
NotFound signals a not found error
type BucketQueryData ¶
type BucketQueryData struct { CloudType []string Include []string StorageAccount []string ResourceGroup []string }
BucketQueryData encapsulates query parameter data
type BucketResponseItem ¶
type BucketResponseItem struct { Name string `json:"name" binding:"required"` Managed bool `json:"managed" binding:"required"` Location string `json:"location,omitempty"` Cloud string `json:"cloud,omitempty"` Notes *string `json:"notes,omitempty"` SecretInfo *secretData `json:"secret"` Azure *objectstore.BlobStoragePropsForAzure `json:"aks,omitempty"` Status string `json:"status"` StatusMsg string `json:"statusMessage"` }
BucketResponseItem encapsulates bucket and secret details to be returned it's purpose is to properly format the response details - especially the secret details
type ClusterAPI ¶
type ClusterAPI struct {
// contains filtered or unexported fields
}
ClusterAPI implements the Cluster API actions.
func NewClusterAPI ¶
func NewClusterAPI( clusterManager *cluster.Manager, clusterGetter common.ClusterGetter, workflowClient client.Client, logger logrus.FieldLogger, errorHandler emperror.Handler, externalBaseURL string, externalBaseURLInsecure bool, clusterCreators ClusterCreators, clusterUpdaters ClusterUpdaters, clientFactory common.DynamicClientFactory, helmService cluster.HelmService, authConfig auth.Config, distributionConfig cmd.DistributionConfig, clientSecretGetter clusterAuth.ClusterClientSecretGetter, ) *ClusterAPI
NewClusterAPI returns a new ClusterAPI instance.
func (*ClusterAPI) ClusterCheck ¶
func (a *ClusterAPI) ClusterCheck(c *gin.Context)
ClusterCheck checks the cluster ready
func (*ClusterAPI) CreateCluster ¶
func (a *ClusterAPI) CreateCluster(c *gin.Context)
CreateCluster creates a K8S cluster in the cloud.
func (*ClusterAPI) GetBootstrapInfo ¶
func (a *ClusterAPI) GetBootstrapInfo(c *gin.Context)
GetBootstrapInfo
func (*ClusterAPI) GetCluster ¶
func (a *ClusterAPI) GetCluster(c *gin.Context)
GetCluster fetches a K8S cluster in the cloud
func (*ClusterAPI) GetClusters ¶
func (a *ClusterAPI) GetClusters(c *gin.Context)
GetClusters fetches all the K8S clusters from the cloud.
func (*ClusterAPI) ProxyToCluster ¶
func (a *ClusterAPI) ProxyToCluster(c *gin.Context)
ProxyToCluster sets up a proxy and forwards all requests to the cluster's API server.
func (*ClusterAPI) ReRunPostHooks ¶
func (a *ClusterAPI) ReRunPostHooks(c *gin.Context)
ReRunPostHooks reruns cluster posthooks.
func (*ClusterAPI) UpdateCluster ¶
func (a *ClusterAPI) UpdateCluster(c *gin.Context)
UpdateCluster updates a K8S cluster in the cloud (e.g. autoscale)
func (*ClusterAPI) UpdateNodePools ¶
func (a *ClusterAPI) UpdateNodePools(c *gin.Context)
UpdateNodePools updates node pools
type ClusterAuthAPI ¶
type ClusterAuthAPI struct {
// contains filtered or unexported fields
}
func NewClusterAuthAPI ¶
func NewClusterAuthAPI( clusterGetter common.ClusterGetter, clusterAuthService auth.ClusterAuthService, tokenSigningKey string, issuerURL string, insecureSkipVerify bool, redirectURI string, ) (*ClusterAuthAPI, error)
func (*ClusterAuthAPI) RegisterRoutes ¶
func (api *ClusterAuthAPI) RegisterRoutes(clusterRouter gin.IRouter, authRouter gin.IRouter)
type ClusterCreators ¶
type ClusterCreators struct { PKEOnAzure azureDriver.ClusterCreator EKSAmazon eksdriver.EksClusterCreator PKEOnVsphere vsphereDriver.VspherePKEClusterCreator }
type ClusterDeleters ¶
type ClusterDeleters struct { PKEOnAzure azureDriver.ClusterDeleter EKSAmazon eksdriver.EKSClusterDeleter }
type ClusterService ¶
type ClusterService interface { // Retrieves the kuebernetes configuration as a slice of bytes GetKubeConfig(ctx context.Context, clusterID uint) ([]byte, error) }
Cluster collects operations to extract cluster related information
type ClusterUpdaters ¶
type ClusterUpdaters struct { PKEOnAzure azureDriver.ClusterUpdater EKSAmazon eksdriver.EksClusterUpdater PKEOnVsphere vsphereDriver.ClusterUpdater }
type CreateAmazonObjectStoreBucketProperties ¶
type CreateAmazonObjectStoreBucketProperties struct {
Location string `json:"location" binding:"required"`
}
CreateAmazonObjectStoreBucketProperties describes the properties of S3 bucket creation request
type CreateAzureObjectStoreBucketProperties ¶
type CreateAzureObjectStoreBucketProperties struct { Location string `json:"location" binding:"required"` StorageAccount string `json:"storageAccount"` ResourceGroup string `json:"resourceGroup"` }
CreateAzureObjectStoreBucketProperties describes an Azure ObjectStore Container Creation request
type CreateBucketRequest ¶
type CreateBucketRequest struct { SecretId string `json:"secretId"` SecretName string `json:"secretName"` Name string `json:"name" binding:"required"` Properties struct { Amazon *CreateAmazonObjectStoreBucketProperties `json:"amazon,omitempty"` Azure *CreateAzureObjectStoreBucketProperties `json:"azure,omitempty"` Google *CreateGoogleObjectStoreBucketProperties `json:"google,omitempty"` } `json:"properties" binding:"required"` }
CreateBucketRequest to create bucket
type CreateBucketResponse ¶
type CreateBucketResponse struct { BucketName string `json:"name"` CloudType string `json:"cloud"` }
CreateBucketResponse describes a storage bucket creation response
type CreateGoogleObjectStoreBucketProperties ¶
type CreateGoogleObjectStoreBucketProperties struct {
Location string `json:"location,required"`
}
CreateGoogleObjectStoreBucketProperties describes Google Object Store Bucket creation request
type CreateResourceGroupRequest ¶
type CreateResourceGroupRequest struct { Name string `json:"name" binding:"required"` Location string `json:"location" binding:"required"` SecretId string `json:"secretId" binding:"required"` }
CreateResourceGroupRequest describes the resource group create request
type CreateResourceGroupResponse ¶
type CreateResourceGroupResponse struct {
Name string `json:"name" binding:"required"`
}
CreateResourceGroupResponse describes the resource group create response
type EndpointLister ¶
type EndpointLister struct {
// contains filtered or unexported fields
}
func MakeEndpointLister ¶
func MakeEndpointLister(clusterService ClusterService, releaseChecker ReleaseChecker, logger common.Logger) EndpointLister
func (EndpointLister) ListEndpoints ¶
func (el EndpointLister) ListEndpoints(c *gin.Context)
ListEndpoints lists service public endpoints
type GetClusterNodePool ¶
type GetClusterNodePool struct { Autoscaling bool `json:"autoscaling"` Count int `json:"count,omitempty"` InstanceType string `json:"instanceType,omitempty"` SpotPrice string `json:"spotPrice,omitempty"` Preemptible bool `json:"preemptible,omitempty"` MinCount int `json:"minCount,omitempty"` MaxCount int `json:"maxCount,omitempty"` Image string `json:"image,omitempty"` Version string `json:"version,omitempty"` ResourceSummary map[string]NodeResourceSummary `json:"resourceSummary,omitempty"` Labels map[string]string `json:"labels,omitempty"` Vcpu int `json:"vcpu,omitempty"` Ram int `json:"ram,omitempty"` Template string `json:"template,omitempty"` CreatedAt time.Time `json:"createdAt,omitempty"` CreatorName string `json:"creatorName,omitempty"` CreatorID uint `json:"creatorId,omitempty"` }
GetClusterNodePool describes a cluster's node pool.
type GetClusterResponse ¶
type GetClusterResponse struct { ID uint `json:"id"` Status string `json:"status"` StatusMessage string `json:"statusMessage,omitempty"` Name string `json:"name"` // If region not available fall back to Location Region string `json:"region,omitempty"` Location string `json:"location"` Cloud string `json:"cloud"` Distribution string `json:"distribution"` Spot bool `json:"spot,omitempty"` OIDC OIDC `json:"oidc"` Logging bool `json:"logging"` Monitoring bool `json:"monitoring"` SecurityScan bool `json:"securityscan"` // TODO: keep one of the following? Version string `json:"version,omitempty"` MasterVersion string `json:"masterVersion,omitempty"` SecretID string `json:"secretId"` SecretName string `json:"secretName"` Endpoint string `json:"endpoint,omitempty"` NodePools map[string]GetClusterNodePool `json:"nodePools,omitempty"` TotalSummary *ResourceSummary `json:"totalSummary,omitempty"` CreatedAt time.Time `json:"createdAt,omitempty"` CreatorName string `json:"creatorName,omitempty"` CreatorID uint `json:"creatorId,omitempty"` }
GetClusterResponse contains the details of a cluster.
type InstallSecretRequest ¶
type InstallSecretRequest struct { SourceSecretName string `json:"sourceSecretName,omitempty"` Namespace string `json:"namespace"` Spec map[string]InstallSecretRequestSpecItem `json:"spec,omitempty"` }
Models copied from generated client package. TODO: import these from a generated server model package
type InstallSecretResponse ¶
type InstallSecretResponse struct {
Name string `json:"name"`
}
type InstallSecretsToClusterRequest ¶
type InstallSecretsToClusterRequest struct { Namespace string `json:"namespace" binding:"required"` Query secret.ListSecretsQuery `json:"query" binding:"required"` }
InstallSecretsToClusterRequest describes an InstallSecretToCluster request
type LabelValidator ¶
type LabelValidator interface { // ValidateKey validates a label key. ValidateKey(key string) error // ValidateValue validates a label value. ValidateValue(value string) error }
LabelValidator validates Kubernetes object labels.
type NetworkAPI ¶
type NetworkAPI struct {
// contains filtered or unexported fields
}
NetworkAPI implements network functions
func NewNetworkAPI ¶
func NewNetworkAPI(logger logrus.FieldLogger) *NetworkAPI
NewNetworkAPI returns a new NetworkAPI instance
func (*NetworkAPI) ListRouteTables ¶
func (a *NetworkAPI) ListRouteTables(ctx *gin.Context)
ListRouteTables lists all route tables of the specified VPC network
func (*NetworkAPI) ListVPCNetworks ¶
func (a *NetworkAPI) ListVPCNetworks(ctx *gin.Context)
ListVPCNetworks lists all VPC networks of the specified organization
func (*NetworkAPI) ListVPCSubnets ¶
func (a *NetworkAPI) ListVPCSubnets(ctx *gin.Context)
ListVPCSubnets lists all subnetworks of the specified VPC network
type NetworkInfo ¶
type NetworkInfo struct { CIDRs []string `json:"cidrs" binding:"required"` ID string `json:"id" binding:"required"` Name string `json:"name,omitempty"` }
NetworkInfo encapsulates VPC network information to be returned
type NodeResourceSummary ¶
type NodeResourceSummary struct { ResourceSummary Status string `json:"status,omitempty"` }
type NodepoolManagerAPI ¶
type NodepoolManagerAPI struct {
// contains filtered or unexported fields
}
NodePoolManagerAPI implements the Node pool Label Management API actions.
func NewNodepoolManagerAPI ¶
func NewNodepoolManagerAPI( clusterGetter common.ClusterGetter, clientFactory common.DynamicClientFactory, labelValidator LabelValidator, logger logrus.FieldLogger, errorHandler emperror.Handler, ) *NodepoolManagerAPI
NewNodepoolManagerAPI returns a new NodepoolManagerAPI instance.
func (*NodepoolManagerAPI) GetNodepoolLabelSets ¶
func (n *NodepoolManagerAPI) GetNodepoolLabelSets(c *gin.Context)
type OrganizationAPI ¶
type OrganizationAPI struct {
// contains filtered or unexported fields
}
OrganizationAPI implements organization functions.
func NewOrganizationAPI ¶
func NewOrganizationAPI(organizationSyncer auth.OIDCOrganizationSyncer, refreshTokenStore auth.RefreshTokenStore, helmConfig helm.Config) *OrganizationAPI
NewOrganizationAPI returns a new OrganizationAPI instance.
func (*OrganizationAPI) DeleteOrganization ¶
func (a *OrganizationAPI) DeleteOrganization(c *gin.Context)
DeleteOrganization deletes an organization by id.
func (*OrganizationAPI) GetOrganizations ¶
func (a *OrganizationAPI) GetOrganizations(c *gin.Context)
GetOrganizations returns all organizations the user belongs to or a specific one from those by id.
func (*OrganizationAPI) SyncOrganizations ¶
func (a *OrganizationAPI) SyncOrganizations(c *gin.Context)
SyncOrganizations synchronizes github organizations.
type ReleaseChecker ¶
type ReleaseLister ¶
type ReleaseLister interface { // ListReleases lists helm releases for the given input parameters ListReleases(ctx context.Context, organizationID uint, clusterID uint, releaseFilter helm.ReleaseFilter, options helm.Options) ([]helm.Release, error) }
ReleaseLister helm operation abstraction interface
type Resource ¶
type Resource struct { Capacity string `json:"capacity,omitempty"` Allocatable string `json:"allocatable,omitempty"` Limit string `json:"limit,omitempty"` Request string `json:"request,omitempty"` }
Resource describes a resource summary with capacity/request/limit/allocatable
type ResourceSummary ¶
type ResourceSummary struct { CPU *Resource `json:"cpu,omitempty"` Memory *Resource `json:"memory,omitempty"` }
ResourceSummary describes a node's resource summary with CPU and Memory capacity/request/limit/allocatable
type RouteTableInfo ¶
type RouteTableInfo struct { ID string `json:"id" binding:"required"` Name string `json:"name,omitempty"` }
RouteTableInfo encapsulates VPC route table information to be returned
type ScanLogHandler ¶
type SecretNotFoundError ¶
type SecretNotFoundError struct {
// contains filtered or unexported fields
}
SecretNotFoundError signals that a given secret was not found
func (SecretNotFoundError) Error ¶
func (err SecretNotFoundError) Error() string
Error returns error message as string
type SecurityHandler ¶
type SecurityHandler interface { WhitelistHandler ScanLogHandler }
SecurityHandler defines security related handler functions intended to be used for defining routes
func NewSecurityApiHandlers ¶
func NewSecurityApiHandlers( clusterGetter apiCommon.ClusterGetter, errorHandler internalCommon.ErrorHandler, logger internalCommon.Logger, ) SecurityHandler
type SubnetInfo ¶
type SubnetInfo struct { CIDRs []string `json:"cidrs" binding:"required"` ID string `json:"id" binding:"required"` Location string `json:"location,omitempty"` Name string `json:"name,omitempty"` }
SubnetInfo encapsulates VPC subnetwork information to be returned
type UpdateClusterResponse ¶
type UpdateClusterResponse struct {
Status int `json:"status"`
}
UpdateClusterResponse describes Pipeline's UpdateCluster API response
type UserAPI ¶
type UserAPI struct {
// contains filtered or unexported fields
}
UserAPI implements user functions.
func NewUserAPI ¶
NewUserAPI returns a new UserAPI instance.
func (*UserAPI) GetCurrentUser ¶
GetCurrentUser responds with the authenticated user
Source Files ¶
- anchore_proxy.go
- bucket.go
- bucket_messages.go
- cluster.go
- cluster_auth.go
- cluster_create.go
- cluster_get.go
- cluster_posthook.go
- cluster_secret.go
- cluster_update.go
- common_stuff.go
- custom.go
- error.go
- error_handler.go
- helm.go
- images.go
- log.go
- meta.go
- network.go
- npls.go
- organization.go
- resourcegroup.go
- resourcegroup_messages.go
- secrets.go
- security.go
- user.go