application

package
v0.0.0-...-9250c3b Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActivityLogEntryResourceTypeApplication activitylog.ActivityLogEntryResourceType = "APP"
)

Variables

Functions

func AddSearch

func AddSearch(client search.Client, watcher *watcher.Watcher[*nais_io_v1alpha1.Application])

func ErrorsPerSecondForIngress

func ErrorsPerSecondForIngress(ctx context.Context, obj *IngressMetrics) (float64, error)

func NewIngressWatcher

func NewIngressWatcher(ctx context.Context, mgr *watcher.Manager) *watcher.Watcher[*netv1.Ingress]

func RequestsPerSecondForIngress

func RequestsPerSecondForIngress(ctx context.Context, obj *IngressMetrics) (float64, error)

func Restart

func Restart(ctx context.Context, teamSlug slug.Slug, environmentName, name string) error

func StateCounts

func StateCounts(ctx context.Context, apps []*Application) (running, notRunning, unknown int)

StateCounts computes the number of applications in each state for a given list of applications.

Types

type Application

type Application struct {
	workload.Base
	Spec *nais_io_v1alpha1.ApplicationSpec `json:"-"`
}

func Get

func Get(ctx context.Context, teamSlug slug.Slug, environment, name string) (*Application, error)

func GetByIdent

func GetByIdent(ctx context.Context, id ident.Ident) (*Application, error)

func ListAllForTeam

func ListAllForTeam(ctx context.Context, teamSlug slug.Slug, orderBy *ApplicationOrder, filter *TeamApplicationsFilter) []*Application

func ListAllForTeamInEnvironment

func ListAllForTeamInEnvironment(ctx context.Context, teamSlug slug.Slug, environmentName string) []*Application

func ListAllInEnvironment

func ListAllInEnvironment(ctx context.Context, environment string) []*Application

func (*Application) GetConfigs

func (a *Application) GetConfigs() []string

GetConfigs returns a list of config names used by the application

func (*Application) GetSecrets

func (a *Application) GetSecrets() []string

GetSecrets returns a list of secret names used by the application

func (Application) ID

func (a Application) ID() ident.Ident

func (*Application) Ingresses

func (a *Application) Ingresses() []*Ingress

func (Application) IsActivityLogger

func (Application) IsActivityLogger()

func (Application) IsNode

func (Application) IsNode()

func (Application) IsSearchNode

func (Application) IsSearchNode()

func (Application) IsWorkload

func (Application) IsWorkload()

func (*Application) Resources

func (a *Application) Resources() *ApplicationResources

type ApplicationDeletedActivityLogEntry

type ApplicationDeletedActivityLogEntry struct {
	activitylog.GenericActivityLogEntry
}

type ApplicationEdge

type ApplicationEdge = pagination.Edge[*Application]

type ApplicationFacets

type ApplicationFacets struct {
	Environments []model.StringFacetItem     `json:"environments"`
	States       []ApplicationStateFacetItem `json:"states"`
}

func ComputeFacets

func ComputeFacets(ctx context.Context, allApps []*Application, filter *TeamApplicationsFilter) (*ApplicationFacets, error)

ComputeFacets computes facets for an application query.

type ApplicationInstance

type ApplicationInstance struct {
	Name     string    `json:"name"`
	Restarts int       `json:"restarts"`
	Created  time.Time `json:"created"`

	ImageString                string                 `json:"-"`
	EnvironmentName            string                 `json:"-"`
	TeamSlug                   slug.Slug              `json:"-"`
	ApplicationName            string                 `json:"-"`
	ApplicationContainerStatus corev1.ContainerStatus `json:"-"`
}

func ListAllInstances

func ListAllInstances(ctx context.Context, teamSlug slug.Slug, environmentName, appName string) ([]*ApplicationInstance, error)

func (ApplicationInstance) ID

func (ApplicationInstance) Image

func (ApplicationInstance) IsNode

func (ApplicationInstance) IsNode()

func (*ApplicationInstance) State

func (*ApplicationInstance) Status

type ApplicationInstanceConnection

type ApplicationInstanceConnection = pagination.Connection[*ApplicationInstance]

func ListInstances

func ListInstances(ctx context.Context, teamSlug slug.Slug, environmentName, appName string, page *pagination.Pagination) (*ApplicationInstanceConnection, error)

type ApplicationInstanceEdge

type ApplicationInstanceEdge = pagination.Edge[*ApplicationInstance]

type ApplicationInstanceState

type ApplicationInstanceState string
const (
	ApplicationInstanceStateRunning    ApplicationInstanceState = "RUNNING"
	ApplicationInstanceStateStarting   ApplicationInstanceState = "STARTING"
	ApplicationInstanceStateFailing    ApplicationInstanceState = "FAILING"
	ApplicationInstanceStateTerminated ApplicationInstanceState = "TERMINATED"
	ApplicationInstanceStateUnknown    ApplicationInstanceState = "UNKNOWN"
)

func (ApplicationInstanceState) IsValid

func (e ApplicationInstanceState) IsValid() bool

func (ApplicationInstanceState) MarshalGQL

func (e ApplicationInstanceState) MarshalGQL(w io.Writer)

func (ApplicationInstanceState) String

func (e ApplicationInstanceState) String() string

func (*ApplicationInstanceState) UnmarshalGQL

func (e *ApplicationInstanceState) UnmarshalGQL(v any) error

type ApplicationInstanceStatus

type ApplicationInstanceStatus struct {
	State             ApplicationInstanceState `json:"state"`
	Message           string                   `json:"message"`
	Ready             bool                     `json:"ready"`
	LastExitReason    *string                  `json:"lastExitReason,omitempty"`
	LastExitCode      *int                     `json:"lastExitCode,omitempty"`
	LastExitTimestamp *time.Time               `json:"lastExitTimestamp,omitempty"`
}

type ApplicationManifest

type ApplicationManifest struct {
	Content string `json:"content"`
}

func Manifest

func Manifest(ctx context.Context, teamSlug slug.Slug, environmentName, name string) (*ApplicationManifest, error)

func (ApplicationManifest) IsWorkloadManifest

func (ApplicationManifest) IsWorkloadManifest()

type ApplicationOrder

type ApplicationOrder struct {
	Field     ApplicationOrderField `json:"field"`
	Direction model.OrderDirection  `json:"direction"`
}

type ApplicationOrderField

type ApplicationOrderField string

func (ApplicationOrderField) IsValid

func (e ApplicationOrderField) IsValid() bool

func (ApplicationOrderField) MarshalGQL

func (e ApplicationOrderField) MarshalGQL(w io.Writer)

func (ApplicationOrderField) String

func (e ApplicationOrderField) String() string

func (*ApplicationOrderField) UnmarshalGQL

func (e *ApplicationOrderField) UnmarshalGQL(v any) error

type ApplicationResources

type ApplicationResources struct {
	Limits   *workload.WorkloadResourceQuantity `json:"limits"`
	Requests *workload.WorkloadResourceQuantity `json:"requests"`
	Scaling  *ApplicationScaling                `json:"scaling"`
}

func (ApplicationResources) IsWorkloadResources

func (ApplicationResources) IsWorkloadResources()

type ApplicationRestartedActivityLogEntry

type ApplicationRestartedActivityLogEntry struct {
	activitylog.GenericActivityLogEntry
}

type ApplicationScaledActivityLogEntry

type ApplicationScaledActivityLogEntry struct {
	activitylog.GenericActivityLogEntry

	Data *ApplicationScaledActivityLogEntryData `json:"data"`
}

type ApplicationScaledActivityLogEntryData

type ApplicationScaledActivityLogEntryData struct {
	NewSize   int              `json:"newSize,string"`
	Direction ScalingDirection `json:"direction"`
}

type ApplicationScaling

type ApplicationScaling struct {
	MinInstances int               `json:"minInstances"`
	MaxInstances int               `json:"maxInstances"`
	Strategies   []ScalingStrategy `json:"strategies"`
}

type ApplicationState

type ApplicationState int
const (
	ApplicationStateUnknown ApplicationState = iota
	ApplicationStateRunning
	ApplicationStateNotRunning
)

func GetState

func GetState(ctx context.Context, obj *Application) (ApplicationState, error)

func (ApplicationState) IsValid

func (e ApplicationState) IsValid() bool

func (ApplicationState) MarshalGQL

func (e ApplicationState) MarshalGQL(w io.Writer)

func (ApplicationState) String

func (e ApplicationState) String() string

func (*ApplicationState) UnmarshalGQL

func (e *ApplicationState) UnmarshalGQL(v any) error

type ApplicationStateFacetItem

type ApplicationStateFacetItem struct {
	State ApplicationState `json:"state"`
	Count int              `json:"count"`
}

type ApplicationUpdatedActivityLogEntry

type ApplicationUpdatedActivityLogEntry struct {
	activitylog.GenericActivityLogEntry

	Data *ApplicationUpdatedActivityLogEntryData `json:"data"`
}

type ApplicationUpdatedActivityLogEntryData

type ApplicationUpdatedActivityLogEntryData struct {
	ChangedFields     []*activitylog.ResourceChangedField `json:"changedFields"`
	GitHubActorClaims *activitylog.GitHubActorClaims      `json:"gitHubActorClaims,omitempty"`
}

type CPUScalingStrategy

type CPUScalingStrategy struct {
	Threshold int `json:"threshold"`
}

func (CPUScalingStrategy) IsScalingStrategy

func (CPUScalingStrategy) IsScalingStrategy()

type DeleteApplicationInput

type DeleteApplicationInput struct {
	Name            string    `json:"name"`
	TeamSlug        slug.Slug `json:"teamSlug"`
	EnvironmentName string    `json:"environmentName"`
}

type DeleteApplicationPayload

type DeleteApplicationPayload struct {
	TeamSlug *slug.Slug `json:"-"`
	Success  bool       `json:"-"`
}

func Delete

func Delete(ctx context.Context, teamSlug slug.Slug, environmentName, name string) (*DeleteApplicationPayload, error)

type Ingress

type Ingress struct {
	URL             string    `json:"url"`
	EnvironmentName string    `json:"-"`
	TeamSlug        slug.Slug `json:"-"`
	ApplicationName string    `json:"-"`
}

type IngressMetricSample

type IngressMetricSample struct {
	Timestamp time.Time `json:"timestamp"`
	Value     float64   `json:"value"`
}

func SeriesForIngress

func SeriesForIngress(ctx context.Context, obj *IngressMetrics, input IngressMetricsInput) ([]*IngressMetricSample, error)

type IngressMetrics

type IngressMetrics struct {
	Ingress *Ingress `json:"-"`
}

type IngressMetricsClient

type IngressMetricsClient interface {
	Query(ctx context.Context, environment string, query string, opts ...promclient.QueryOption) (prom.Vector, error)
	QueryRange(ctx context.Context, environment string, query string, promRange promv1.Range) (prom.Value, promv1.Warnings, error)
}

type IngressMetricsInput

type IngressMetricsInput struct {
	Start time.Time          `json:"start"`
	End   time.Time          `json:"end"`
	Type  IngressMetricsType `json:"type"`
}

func (*IngressMetricsInput) Step

func (w *IngressMetricsInput) Step() int

type IngressMetricsType

type IngressMetricsType string
const (
	IngressMetricsTypeRequestsPerSecond IngressMetricsType = "REQUESTS_PER_SECOND"
	IngressMetricsTypeErrorsPerSecond   IngressMetricsType = "ERRORS_PER_SECOND"
)

func (IngressMetricsType) IsValid

func (e IngressMetricsType) IsValid() bool

func (IngressMetricsType) MarshalGQL

func (e IngressMetricsType) MarshalGQL(w io.Writer)

func (IngressMetricsType) String

func (e IngressMetricsType) String() string

func (*IngressMetricsType) UnmarshalGQL

func (e *IngressMetricsType) UnmarshalGQL(v any) error

type IngressType

type IngressType string
const (
	IngressTypeUnknown       IngressType = "UNKNOWN"
	IngressTypeExternal      IngressType = "EXTERNAL"
	IngressTypeInternal      IngressType = "INTERNAL"
	IngressTypeAuthenticated IngressType = "AUTHENTICATED"
)

func GetIngressType

func GetIngressType(ctx context.Context, ingress *Ingress) IngressType

func (IngressType) IsValid

func (e IngressType) IsValid() bool

func (IngressType) MarshalGQL

func (e IngressType) MarshalGQL(w io.Writer)

func (IngressType) String

func (e IngressType) String() string

func (*IngressType) UnmarshalGQL

func (e *IngressType) UnmarshalGQL(v any) error

type KafkaLagScalingStrategy

type KafkaLagScalingStrategy struct {
	Threshold     int    `json:"threshold"`
	ConsumerGroup string `json:"consumerGroup"`
	TopicName     string `json:"topicName"`
}

func (KafkaLagScalingStrategy) IsScalingStrategy

func (KafkaLagScalingStrategy) IsScalingStrategy()

type RestartApplicationInput

type RestartApplicationInput struct {
	Name            string    `json:"name"`
	TeamSlug        slug.Slug `json:"teamSlug"`
	EnvironmentName string    `json:"environmentName"`
}

type RestartApplicationPayload

type RestartApplicationPayload struct {
	TeamSlug        slug.Slug `json:"-"`
	ApplicationName string    `json:"-"`
	EnvironmentName string    `json:"-"`
}

type ScalingDirection

type ScalingDirection string
const (
	ScalingDirectionUp   ScalingDirection = "UP"
	ScalingDirectionDown ScalingDirection = "DOWN"
)

func (ScalingDirection) IsValid

func (e ScalingDirection) IsValid() bool

func (ScalingDirection) MarshalGQL

func (e ScalingDirection) MarshalGQL(w io.Writer)

func (ScalingDirection) String

func (e ScalingDirection) String() string

func (*ScalingDirection) UnmarshalGQL

func (e *ScalingDirection) UnmarshalGQL(v any) error

type ScalingStrategy

type ScalingStrategy interface {
	IsScalingStrategy()
}

type TeamApplicationsFilter

type TeamApplicationsFilter struct {
	Name         string             `json:"name"`
	Environments []string           `json:"environments"`
	States       []ApplicationState `json:"states"`
}

type TeamInventoryCountApplications

type TeamInventoryCountApplications struct {
	Total      int       `json:"total"`
	Running    int       `json:"running"`
	NotRunning int       `json:"notRunning"`
	Unknown    int       `json:"unknown"`
	TeamSlug   slug.Slug `json:"-"`
}

type UpdateApplicationInput

type UpdateApplicationInput struct {
	Name                 string                                             `json:"name"`
	TeamSlug             slug.Slug                                          `json:"teamSlug"`
	EnvironmentName      string                                             `json:"environmentName"`
	EnvironmentVariables []*workload.UpdateWorkloadEnvironmentVariableInput `json:"environmentVariables,omitempty"`
	Replicas             *UpdateApplicationReplicasInput                    `json:"replicas,omitempty"`
	Image                *string                                            `json:"image,omitempty"`
}

type UpdateApplicationPayload

type UpdateApplicationPayload struct {
	TeamSlug        slug.Slug `json:"-"`
	ApplicationName string    `json:"-"`
	EnvironmentName string    `json:"-"`
}

type UpdateApplicationReplicasInput

type UpdateApplicationReplicasInput struct {
	Min int `json:"min"`
	Max int `json:"max"`
}

Jump to

Keyboard shortcuts

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