Documentation
¶
Index ¶
- Constants
- Variables
- type AWSAccessValidationOutput
- type AccountsSvc
- type BYOKSetupInstruction
- type CheckNameAvailabilityOutput
- type Domain
- type ErrClusterAlreadyExists
- type ErrGRPCCall
- type ErrIAMUnauthorized
- type InfraContext
- type PublishMsg
- type ResType
- type ResourceDispatcher
- type ResourceEventPublisher
- type ResourceType
- type UpdateAndDeleteOpts
Constants ¶
View Source
const (
DefaultGlobalVPNName = "default"
)
Variables ¶
View Source
var ErrClusterNotFound error = fmt.Errorf("cluster not found")
View Source
var Module = fx.Module("domain", fx.Provide( func( env *env.Env, clusterRepo repos.DbRepo[*entities.Cluster], byokClusterRepo repos.DbRepo[*entities.BYOKCluster], nodeRepo repos.DbRepo[*entities.Node], nodePoolRepo repos.DbRepo[*entities.NodePool], secretRepo repos.DbRepo[*entities.CloudProviderSecret], domainNameRepo repos.DbRepo[*entities.DomainEntry], resourceDispatcher ResourceDispatcher, helmReleaseRepo repos.DbRepo[*entities.HelmRelease], gvpnConnRepo repos.DbRepo[*entities.GlobalVPNConnection], gvpnRepo repos.DbRepo[*entities.GlobalVPN], gvpnDevicesRepo repos.DbRepo[*entities.GlobalVPNDevice], freeDeviceIpRepo repos.DbRepo[*entities.FreeDeviceIP], claimDeviceIPRepo repos.DbRepo[*entities.ClaimDeviceIP], freeClusterSvcCIDRRepo repos.DbRepo[*entities.FreeClusterSvcCIDR], claimClusterSvcCIDRRepo repos.DbRepo[*entities.ClaimClusterSvcCIDR], pvcRepo repos.DbRepo[*entities.PersistentVolumeClaim], pvRepo repos.DbRepo[*entities.PersistentVolume], namespaceRepo repos.DbRepo[*entities.Namespace], volumeAttachmentRepo repos.DbRepo[*entities.VolumeAttachment], k8sClient k8s.Client, iamClient iam.IAMClient, consoleClient console.ConsoleClient, accountsSvc AccountsSvc, moSvc ports.MessageOfficeService, logger *slog.Logger, resourceEventPublisher ResourceEventPublisher, helmClient helm.Client, ) (Domain, error) { open, err := os.Open(env.MsvcTemplateFilePath) if err != nil { return nil, errors.NewE(err) } b, err := io.ReadAll(open) if err != nil { return nil, errors.NewE(err) } var templates []*entities.MsvcTemplate if err := yaml.Unmarshal(b, &templates); err != nil { return nil, errors.NewE(err) } msvcTemplatesMap := map[string]map[string]*entities.MsvcTemplateEntry{} for _, t := range templates { if _, ok := msvcTemplatesMap[t.Category]; !ok { msvcTemplatesMap[t.Category] = make(map[string]*entities.MsvcTemplateEntry, len(t.Items)) } for i := range t.Items { msvcTemplatesMap[t.Category][t.Items[i].Name] = &t.Items[i] } } return &domain{ msvcTemplatesMap: msvcTemplatesMap, msvcTemplates: templates, logger: logger, env: env, clusterRepo: clusterRepo, gvpnConnRepo: gvpnConnRepo, claimDeviceIPRepo: claimDeviceIPRepo, freeDeviceIpRepo: freeDeviceIpRepo, freeClusterSvcCIDRRepo: freeClusterSvcCIDRRepo, claimClusterSvcCIDRRepo: claimClusterSvcCIDRRepo, gvpnRepo: gvpnRepo, gvpnDevicesRepo: gvpnDevicesRepo, byokClusterRepo: byokClusterRepo, nodeRepo: nodeRepo, nodePoolRepo: nodePoolRepo, secretRepo: secretRepo, domainEntryRepo: domainNameRepo, resDispatcher: resourceDispatcher, k8sClient: k8sClient, iamClient: iamClient, consoleClient: consoleClient, accountsSvc: accountsSvc, moSvc: moSvc, resourceEventPublisher: resourceEventPublisher, helmReleaseRepo: helmReleaseRepo, pvcRepo: pvcRepo, volumeAttachmentRepo: volumeAttachmentRepo, pvRepo: pvRepo, namespaceRepo: namespaceRepo, helmClient: helmClient, }, nil }), )
Functions ¶
This section is empty.
Types ¶
type AccountsSvc ¶
type BYOKSetupInstruction ¶
type Domain ¶
type Domain interface {
CheckNameAvailability(ctx InfraContext, typeArg ResType, clusterName *string, name string) (*CheckNameAvailabilityOutput, error)
CreateGlobalVPN(ctx InfraContext, cluster entities.GlobalVPN) (*entities.GlobalVPN, error)
UpdateGlobalVPN(ctx InfraContext, cluster entities.GlobalVPN) (*entities.GlobalVPN, error)
DeleteGlobalVPN(ctx InfraContext, name string) error
ListGlobalVPN(ctx InfraContext, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.GlobalVPN], error)
GetGlobalVPN(ctx InfraContext, name string) (*entities.GlobalVPN, error)
CreateGlobalVPNDevice(ctx InfraContext, device entities.GlobalVPNDevice) (*entities.GlobalVPNDevice, error)
UpdateGlobalVPNDevice(ctx InfraContext, device entities.GlobalVPNDevice) (*entities.GlobalVPNDevice, error)
DeleteGlobalVPNDevice(ctx InfraContext, gvpn string, device string) error
ListGlobalVPNDevice(ctx InfraContext, gvpn string, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.GlobalVPNDevice], error)
GetGlobalVPNDevice(ctx InfraContext, gvpn string, device string) (*entities.GlobalVPNDevice, error)
GetGlobalVPNDeviceWgConfig(ctx InfraContext, gvpn string, device string) (string, error)
CreateCluster(ctx InfraContext, cluster entities.Cluster) (*entities.Cluster, error)
UpdateCluster(ctx InfraContext, cluster entities.Cluster) (*entities.Cluster, error)
DeleteCluster(ctx InfraContext, name string) error
CreateBYOKCluster(ctx InfraContext, cluster entities.BYOKCluster) (*entities.BYOKCluster, error)
UpdateBYOKCluster(ctx InfraContext, clusterName string, displayName string) (*entities.BYOKCluster, error)
ListBYOKCluster(ctx InfraContext, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.BYOKCluster], error)
GetBYOKCluster(ctx InfraContext, name string) (*entities.BYOKCluster, error)
GetBYOKClusterSetupInstructions(ctx InfraContext, name string, onlyHelmValues bool) ([]BYOKSetupInstruction, error)
RenderHelmKloudliteAgent(ctx context.Context, accountName string, clusterName string, clusterToken string) ([]byte, error)
DeleteBYOKCluster(ctx InfraContext, name string) error
UpsertBYOKClusterKubeconfig(ctx InfraContext, clusterName string, kubeconfig []byte) error
UpgradeHelmKloudliteAgent(ctx InfraContext, clusterName string) error
ListClusters(ctx InfraContext, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.Cluster], error)
GetCluster(ctx InfraContext, name string) (*entities.Cluster, error)
GetClusterAdminKubeconfig(ctx InfraContext, clusterName string) (*string, error)
OnClusterDeleteMessage(ctx InfraContext, cluster entities.Cluster) error
OnClusterUpdateMessage(ctx InfraContext, cluster entities.Cluster, status types.ResourceStatus, opts UpdateAndDeleteOpts) error
MarkClusterOnlineAt(ctx InfraContext, clusterName string, timestamp *time.Time) error
CreateProviderSecret(ctx InfraContext, secret entities.CloudProviderSecret) (*entities.CloudProviderSecret, error)
UpdateProviderSecret(ctx InfraContext, secret entities.CloudProviderSecret) (*entities.CloudProviderSecret, error)
DeleteProviderSecret(ctx InfraContext, secretName string) error
ListProviderSecrets(ctx InfraContext, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.CloudProviderSecret], error)
GetProviderSecret(ctx InfraContext, name string) (*entities.CloudProviderSecret, error)
ValidateProviderSecretAWSAccess(ctx InfraContext, name string) (*AWSAccessValidationOutput, error)
ListDomainEntries(ctx InfraContext, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.DomainEntry], error)
GetDomainEntry(ctx InfraContext, name string) (*entities.DomainEntry, error)
CreateDomainEntry(ctx InfraContext, domainName entities.DomainEntry) (*entities.DomainEntry, error)
UpdateDomainEntry(ctx InfraContext, domainName entities.DomainEntry) (*entities.DomainEntry, error)
DeleteDomainEntry(ctx InfraContext, name string) error
CreateNodePool(ctx InfraContext, clusterName string, nodePool entities.NodePool) (*entities.NodePool, error)
UpdateNodePool(ctx InfraContext, clusterName string, nodePool entities.NodePool) (*entities.NodePool, error)
DeleteNodePool(ctx InfraContext, clusterName string, poolName string) error
ListNodePools(ctx InfraContext, clusterName string, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.NodePool], error)
GetNodePool(ctx InfraContext, clusterName string, poolName string) (*entities.NodePool, error)
OnNodePoolDeleteMessage(ctx InfraContext, clusterName string, nodePool entities.NodePool) error
OnNodePoolUpdateMessage(ctx InfraContext, clusterName string, nodePool entities.NodePool, status types.ResourceStatus, opts UpdateAndDeleteOpts) error
OnNodepoolApplyError(ctx InfraContext, clusterName string, name string, errMsg string, opts UpdateAndDeleteOpts) error
// ListGlobalVPNs(ctx InfraContext, clusterName string) (*entities.GlobalVPNConnection, error)
EnsureGlobalVPNConnection(ctx InfraContext, clusterName string, groupName string, dispatchAddr *entities.DispatchAddr) (*entities.GlobalVPNConnection, error)
OnGlobalVPNConnectionDeleteMessage(ctx InfraContext, clusterName string, clusterConn entities.GlobalVPNConnection) error
OnGlobalVPNConnectionUpdateMessage(ctx InfraContext, dispatchAddr entities.DispatchAddr, clusterConn entities.GlobalVPNConnection, status types.ResourceStatus, opts UpdateAndDeleteOpts) error
OnGlobalVPNConnectionApplyError(ctx InfraContext, clusterName string, name string, errMsg string, opts UpdateAndDeleteOpts) error
ListNodes(ctx InfraContext, clusterName string, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.Node], error)
GetNode(ctx InfraContext, clusterName string, nodeName string) (*entities.Node, error)
OnNodeUpdateMessage(ctx InfraContext, clusterName string, node entities.Node) error
OnNodeDeleteMessage(ctx InfraContext, clusterName string, node entities.Node) error
ListHelmReleases(ctx InfraContext, clusterName string, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.HelmRelease], error)
GetHelmRelease(ctx InfraContext, clusterName string, serviceName string) (*entities.HelmRelease, error)
CreateHelmRelease(ctx InfraContext, clusterName string, service entities.HelmRelease) (*entities.HelmRelease, error)
UpdateHelmRelease(ctx InfraContext, clusterName string, service entities.HelmRelease) (*entities.HelmRelease, error)
DeleteHelmRelease(ctx InfraContext, clusterName string, name string) error
OnHelmReleaseApplyError(ctx InfraContext, clusterName string, name string, errMsg string, opts UpdateAndDeleteOpts) error
OnHelmReleaseDeleteMessage(ctx InfraContext, clusterName string, service entities.HelmRelease) error
OnHelmReleaseUpdateMessage(ctx InfraContext, clusterName string, service entities.HelmRelease, status types.ResourceStatus, opts UpdateAndDeleteOpts) error
ListManagedSvcTemplates() ([]*entities.MsvcTemplate, error)
GetManagedSvcTemplate(category string, name string) (*entities.MsvcTemplateEntry, error)
// kubernetes native resources
ListPVCs(ctx InfraContext, clusterName string, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.PersistentVolumeClaim], error)
GetPVC(ctx InfraContext, clusterName string, pvcName string) (*entities.PersistentVolumeClaim, error)
OnPVCUpdateMessage(ctx InfraContext, clusterName string, pvc entities.PersistentVolumeClaim, status types.ResourceStatus, opts UpdateAndDeleteOpts) error
OnPVCDeleteMessage(ctx InfraContext, clusterName string, pvc entities.PersistentVolumeClaim) error
ListNamespaces(ctx InfraContext, clusterName string, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.Namespace], error)
GetNamespace(ctx InfraContext, clusterName string, namespace string) (*entities.Namespace, error)
OnNamespaceUpdateMessage(ctx InfraContext, clusterName string, namespace entities.Namespace, status types.ResourceStatus, opts UpdateAndDeleteOpts) error
OnNamespaceDeleteMessage(ctx InfraContext, clusterName string, namespace entities.Namespace) error
ListPVs(ctx InfraContext, clusterName string, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.PersistentVolume], error)
GetPV(ctx InfraContext, clusterName string, pvName string) (*entities.PersistentVolume, error)
OnPVUpdateMessage(ctx InfraContext, clusterName string, pv entities.PersistentVolume, status types.ResourceStatus, opts UpdateAndDeleteOpts) error
OnPVDeleteMessage(ctx InfraContext, clusterName string, pv entities.PersistentVolume) error
DeletePV(ctx InfraContext, clusterName string, pvName string) error
OnIngressUpdateMessage(ctx InfraContext, clusterName string, ingress networkingv1.Ingress, status types.ResourceStatus, opts UpdateAndDeleteOpts) error
OnIngressDeleteMessage(ctx InfraContext, clusterName string, ingress networkingv1.Ingress) error
ListVolumeAttachments(ctx InfraContext, clusterName string, search map[string]repos.MatchFilter, pagination repos.CursorPagination) (*repos.PaginatedRecord[*entities.VolumeAttachment], error)
GetVolumeAttachment(ctx InfraContext, clusterName string, volAttachmentName string) (*entities.VolumeAttachment, error)
OnVolumeAttachmentUpdateMessage(ctx InfraContext, clusterName string, volumeAttachment entities.VolumeAttachment, status types.ResourceStatus, opts UpdateAndDeleteOpts) error
OnVolumeAttachmentDeleteMessage(ctx InfraContext, clusterName string, volumeAttachment entities.VolumeAttachment) error
}
type ErrClusterAlreadyExists ¶
func (ErrClusterAlreadyExists) Error ¶
func (e ErrClusterAlreadyExists) Error() string
type ErrGRPCCall ¶
type ErrGRPCCall struct {
Err error
}
func (ErrGRPCCall) Error ¶
func (e ErrGRPCCall) Error() string
type ErrIAMUnauthorized ¶
type ErrIAMUnauthorized struct {
}
func (ErrIAMUnauthorized) Error ¶
func (e ErrIAMUnauthorized) Error() string
type InfraContext ¶
type InfraContext struct {
context.Context
UserId repos.ID
UserEmail string
UserName string
AccountName string
}
func (InfraContext) GetUserEmail ¶
func (i InfraContext) GetUserEmail() string
func (InfraContext) GetUserId ¶
func (i InfraContext) GetUserId() repos.ID
func (InfraContext) GetUserName ¶
func (i InfraContext) GetUserName() string
type PublishMsg ¶
type PublishMsg string
const ( PublishAdd PublishMsg = "added" PublishDelete PublishMsg = "deleted" PublishUpdate PublishMsg = "updated" )
type ResType ¶
type ResType string
const ( ResTypeCluster ResType = "cluster" ResTypeBYOKCluster ResType = "byok_cluster" ResTypeGlobalVPNDevice ResType = "global_vpn_device" ResTypeClusterManagedService ResType = "cluster_managed_service" ResTypeProviderSecret ResType = "providersecret" ResTypeNodePool ResType = "nodepool" ResTypeHelmRelease ResType = "helm_release" )
type ResourceDispatcher ¶
type ResourceDispatcher interface {
ApplyToTargetCluster(ctx InfraContext, dispatchAddr *entities.DispatchAddr, obj client.Object, recordVersion int) error
DeleteFromTargetCluster(ctx InfraContext, dispatchAddr *entities.DispatchAddr, obj client.Object) error
}
type ResourceEventPublisher ¶
type ResourceEventPublisher interface {
PublishInfraEvent(ctx InfraContext, resourceType ResourceType, resName string, update PublishMsg)
PublishResourceEvent(ctx InfraContext, clusterName string, resourceType ResourceType, resName string, update PublishMsg)
}
type ResourceType ¶
type ResourceType string
const ( ResourceTypeCluster ResourceType = "cluster" ResourceTypeClusterGroup ResourceType = "cluster_group" ResourceTypeBYOKCluster ResourceType = "byok_cluster" ResourceTypeDomainEntries ResourceType = "domain_entries" ResourceTypeHelmRelease ResourceType = "helm_release" ResourceTypeNodePool ResourceType = "nodepool" ResourceTypeClusterConnection ResourceType = "cluster_connection" ResourceTypeClusterManagedService ResourceType = "cluster_managed_service" ResourceTypePVC ResourceType = "persistance_volume_claim" ResourceTypePV ResourceType = "persistance_volume" ResourceTypeVolumeAttachment ResourceType = "volume_attachment" )
type UpdateAndDeleteOpts ¶
Source Files
¶
- api.go
- byok-clusters.go
- clusters.go
- domain-entries.go
- domain.go
- global-vpn-cluster-connection.go
- global-vpn-devices.go
- global-vpn.go
- helm-release.go
- iam-checks.go
- ingress.go
- msvc-templates.go
- names.go
- namespaces.go
- nodepool.go
- nodes.go
- ports.go
- provider-secret-aws.go
- provider-secrets.go
- pv.go
- pvc.go
- volume-attachment.go
Click to show internal directories.
Click to hide internal directories.