Documentation
¶
Index ¶
- func CheckClusterVersionSkew(ctx context.Context, userInfoGetter provider.UserInfoGetter, ...) ([]string, error)
- func ConvertInternalEventToExternal(event corev1.Event) apiv1.Event
- func ConvertInternalProjectToExternal(kubermaticProject *kubermaticapiv1.Project, projectOwners []apiv1.User, ...) *apiv1.Project
- func ConvertInternalSSHKeysToExternal(internalKeys []*kubermaticapiv1.UserSSHKey) []*apiv1.SSHKey
- func DecodeClusterID(c context.Context, r *http.Request) (string, error)
- func DecodeDcReq(c context.Context, r *http.Request) (interface{}, error)
- func DecodeEmptyReq(c context.Context, r *http.Request) (interface{}, error)
- func DecodeGetClusterReq(c context.Context, r *http.Request) (interface{}, error)
- func DecodeGetProject(c context.Context, r *http.Request) (interface{}, error)
- func DecodeProjectRequest(c context.Context, r *http.Request) (interface{}, error)
- func DecodeSSHKeyID(c context.Context, r *http.Request) (string, error)
- func FilterEventsByType(events []kubermaticapiv1.Event, eventType string) []kubermaticapiv1.Event
- func ForwardPort(log *zap.SugaredLogger, forwarder *portforward.PortForwarder) error
- func GetClusterClient(ctx context.Context, userInfoGetter provider.UserInfoGetter, ...) (ctrlruntimeclient.Client, error)
- func GetEvents(ctx context.Context, client ctrlruntimeclient.Client, obj metav1.Object, ...) ([]kubermaticapiv1.Event, error)
- func GetOwnersForProject(userInfo *provider.UserInfo, project *kubermaticv1.Project, ...) ([]apiv1.User, error)
- func GetPortForwarder(coreClient corev1interface.CoreV1Interface, cfg *rest.Config, namespace string, ...) (*portforward.PortForwarder, chan struct{}, error)
- func GetProject(ctx context.Context, userInfoGetter provider.UserInfoGetter, ...) (*kubermaticv1.Project, error)
- func GetReadyPod(client corev1interface.PodInterface, labelSelector string) (*corev1.Pod, error)
- func IsBringYourOwnProvider(spec kubermaticv1.CloudSpec) (bool, error)
- func KubernetesErrorToHTTPError(err error) error
- func WaitForPortForwarder(p *portforward.PortForwarder, errChan <-chan error) error
- func WriteHTTPError(log *zap.SugaredLogger, w http.ResponseWriter, err error)
- type CredentialsData
- type DCReq
- type GetClusterReq
- type GetProjectRq
- type OIDCConfiguration
- type ProjectIDGetter
- type ProjectReq
- type ResourceMetricsInfo
- type ServerMetrics
- type SupportManager
- type UpdateManager
- type UserIDGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckClusterVersionSkew ¶
func CheckClusterVersionSkew(ctx context.Context, userInfoGetter provider.UserInfoGetter, clusterProvider provider.ClusterProvider, cluster *kubermaticapiv1.Cluster, projectID string) ([]string, error)
CheckClusterVersionSkew returns a list of machines and/or machine deployments that are running kubelet at a version incompatible with the cluster's control plane.
func ConvertInternalEventToExternal ¶
ConvertInternalEventToExternal converts Kubernetes Events to Kubermatic ones (used in the API).
func ConvertInternalSSHKeysToExternal ¶
func ConvertInternalSSHKeysToExternal(internalKeys []*kubermaticapiv1.UserSSHKey) []*apiv1.SSHKey
func DecodeEmptyReq ¶ added in v2.16.3
func DecodeGetClusterReq ¶
func DecodeGetProject ¶
func DecodeProjectRequest ¶
func DecodeSSHKeyID ¶ added in v2.16.3
func FilterEventsByType ¶
func FilterEventsByType(events []kubermaticapiv1.Event, eventType string) []kubermaticapiv1.Event
FilterEventsByType filters Kubernetes Events based on their type. Empty type string will return all of them.
func ForwardPort ¶
func ForwardPort(log *zap.SugaredLogger, forwarder *portforward.PortForwarder) error
func GetClusterClient ¶
func GetClusterClient(ctx context.Context, userInfoGetter provider.UserInfoGetter, clusterProvider provider.ClusterProvider, cluster *kubermaticv1.Cluster, projectID string) (ctrlruntimeclient.Client, error)
func GetEvents ¶
func GetEvents(ctx context.Context, client ctrlruntimeclient.Client, obj metav1.Object, objNamespace string) ([]kubermaticapiv1.Event, error)
GetEvents returns events related to an object in a given namespace.
func GetOwnersForProject ¶
func GetOwnersForProject(userInfo *provider.UserInfo, project *kubermaticv1.Project, memberProvider provider.ProjectMemberProvider, userProvider provider.UserProvider) ([]apiv1.User, error)
func GetPortForwarder ¶
func GetPortForwarder( coreClient corev1interface.CoreV1Interface, cfg *rest.Config, namespace string, labelSelector string, containerPort int) (*portforward.PortForwarder, chan struct{}, error)
While it is tempting to write our own roundTripper to do all the reading/writing in memory instead of opening a TCP port it has some drawbacks:
- net/http.ReadResponse does not work with websockets, because its body is hardcoded to be an io.ReadCloster and not an io.ReadWriteCloser:
- https://github.com/golang/go/blob/361ab73305788c4bf35359a02d8873c36d654f1b/src/net/http/transfer.go#L550
- https://github.com/golang/go/blob/361ab73305788c4bf35359a02d8873c36d654f1b/src/net/http/httputil/reverseproxy.go#L518
- RoundTripping is a bit more complicated than just read and write, mimicking that badly is likely to be more expensive than doing the extra round via the TCP socket: https://github.com/golang/go/blob/361ab73305788c4bf35359a02d8873c36d654f1b/src/net/http/transport.go#L454
func GetProject ¶
func GetProject(ctx context.Context, userInfoGetter provider.UserInfoGetter, projectProvider provider.ProjectProvider, privilegedProjectProvider provider.PrivilegedProjectProvider, projectID string, options *provider.ProjectGetOptions) (*kubermaticv1.Project, error)
func GetReadyPod ¶
func GetReadyPod(client corev1interface.PodInterface, labelSelector string) (*corev1.Pod, error)
GetReadyPod returns a pod matching provided label selector if it is posting ready status, error otherwise. Namespace can be ensured by creating proper PodInterface client.
func IsBringYourOwnProvider ¶
func IsBringYourOwnProvider(spec kubermaticv1.CloudSpec) (bool, error)
IsBringYourOwnProvider determines whether the spec holds BringYourOwn provider
func KubernetesErrorToHTTPError ¶
kubernetesErrorToHTTPError constructs HTTPError only if the given err is of type *StatusError. Otherwise unmodified err will be returned to the caller.
func WaitForPortForwarder ¶
func WaitForPortForwarder(p *portforward.PortForwarder, errChan <-chan error) error
WaitForPortForwarder waits until started port forwarder is ready, or emits an error to provided errChan
func WriteHTTPError ¶
func WriteHTTPError(log *zap.SugaredLogger, w http.ResponseWriter, err error)
WriteHTTPError writes an http error out. If debug is enabled, it also gets logged.
Types ¶
type CredentialsData ¶
type CredentialsData struct { Ctx context.Context KubermaticCluster *kubermaticv1.Cluster Client ctrlruntimeclient.Client }
func (CredentialsData) Cluster ¶
func (d CredentialsData) Cluster() *kubermaticv1.Cluster
func (CredentialsData) GetGlobalSecretKeySelectorValue ¶
func (d CredentialsData) GetGlobalSecretKeySelectorValue(configVar *providerconfig.GlobalSecretKeySelector, key string) (string, error)
type DCReq ¶
type DCReq struct { ProjectReq // in: path // required: true DC string `json:"dc"` }
DCReq represent a request for datacenter specific data in a given project
func (DCReq) GetSeedCluster ¶
func (req DCReq) GetSeedCluster() apiv1.SeedCluster
GetSeedCluster returns the SeedCluster object
type GetClusterReq ¶
type GetClusterReq struct { DCReq // in: path // required: true ClusterID string `json:"cluster_id"` }
GetClusterReq defines HTTP request for deleteCluster and getClusterKubeconfig endpoints swagger:parameters getCluster getClusterKubeconfig getOidcClusterKubeconfig listAWSSizesNoCredentials getClusterHealth getClusterUpgrades getClusterMetrics getClusterNodeUpgrades listGCPZonesNoCredentials listGCPNetworksNoCredentials listAWSZonesNoCredentials listAWSSubnetsNoCredentials listAlibabaInstanceTypesNoCredentials listNamespace
type GetProjectRq ¶
type GetProjectRq struct {
ProjectReq
}
GetProjectRq defines HTTP request for getProject endpoint swagger:parameters getProject getUsersForProject listClustersForProject listServiceAccounts listClustersV2
type OIDCConfiguration ¶
type OIDCConfiguration struct { // URL holds OIDC Issuer URL address URL string // ClientID holds OIDC ClientID ClientID string // ClientSecret holds OIDC ClientSecret ClientSecret string // CookieHashKey is required, used to authenticate the cookie value using HMAC // It is recommended to use a key with 32 or 64 bytes. CookieHashKey string // CookieSecureMode if true then cookie received only with HTTPS otherwise with HTTP. CookieSecureMode bool // OfflineAccessAsScope if true then "offline_access" scope will be used // otherwise 'access_type=offline" query param will be passed OfflineAccessAsScope bool }
OIDCConfiguration is a struct that holds OIDC provider configuration data, read from command line arguments
type ProjectIDGetter ¶
type ProjectIDGetter interface {
GetProjectID() string
}
ProjectIDGetter knows how to get project ID from the request
type ProjectReq ¶
type ProjectReq struct { // in: path // required: true ProjectID string `json:"project_id"` }
ProjectReq represents a request for project-specific data
func (ProjectReq) GetProjectID ¶
func (pr ProjectReq) GetProjectID() string
GetProjectID returns the ID of a requested project
type ResourceMetricsInfo ¶
type ResourceMetricsInfo struct { Name string Metrics corev1.ResourceList Available corev1.ResourceList }
ResourceMetricsInfo is a struct that holds the node metrics
type ServerMetrics ¶
type ServerMetrics struct { HTTPRequestsTotal *prometheus.CounterVec HTTPRequestsDuration *prometheus.HistogramVec InitNodeDeploymentFailures *prometheus.CounterVec }
ServerMetrics defines metrics used by the API.
type SupportManager ¶ added in v2.18.0
type SupportManager interface {
GetIncompatibilities() []*version.ProviderIncompatibility
}
type UpdateManager ¶
type UpdateManager interface { GetVersions(string) ([]*version.Version, error) // TODO: GetVersionsV2 is a temporary function that will replace GetVersions once the new handler will be used by the UI (https://github.com/kubermatic/kubermatic/pull/7590) GetVersionsV2(string, kubermaticv1.ProviderType, ...version.ConditionType) ([]*version.Version, error) GetDefault() (*version.Version, error) GetPossibleUpdates(from, clusterType string, provider kubermaticv1.ProviderType, condition ...version.ConditionType) ([]*version.Version, error) }
UpdateManager specifies a set of methods to handle cluster versions & updates
type UserIDGetter ¶
type UserIDGetter interface {
GetUserID() string
}
UserIDGetter knows how to get user ID from the request