Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize resource sharing with concurrent reconciles #643

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
95539a0
Check for outdated app image reference in LTPA Job
kabicin Oct 22, 2024
7a15f27
Create cache.go
kabicin Oct 22, 2024
4019039
Pull RCO max concurrent reconcile changes
kabicin Oct 23, 2024
991a466
Pull RCO concurrent reconcile fix
kabicin Oct 24, 2024
4a63aba
Add DecisionTree cache logic + temp flag
kabicin Oct 24, 2024
02622ce
Set reconcilers to block for ResourceSharing mutex
kabicin Oct 24, 2024
646c84e
Operator config map to retry reconcile when failed to get
kabicin Oct 25, 2024
7d800a6
Add experimental CR config
kabicin Oct 25, 2024
0ca4251
Create concurrent reconcile func
kabicin Oct 25, 2024
d20bbbd
Concurrently reconcile semeru cloud compiler
kabicin Oct 25, 2024
4e9dbb4
Update experimental.go
kabicin Oct 25, 2024
e5bea14
Concurrently reconcile deployment/statefulset
kabicin Oct 25, 2024
1bf4760
Concurrently reconcile routes/ingress
kabicin Oct 25, 2024
14f8ec2
Limit use of instance mutex
kabicin Oct 28, 2024
1ffab6a
Merge branch 'main' into ltpa-opti
kabicin Oct 30, 2024
3219346
Set default value for passwordEncryptionMetadata
kabicin Oct 30, 2024
3afb72b
Merge branch 'ltpa-opti' of https://github.com/OpenLiberty/open-liber…
kabicin Oct 30, 2024
554a2cb
Update experimental.go
kabicin Oct 30, 2024
42001b2
Add namespace lock
kabicin Oct 30, 2024
41d90a5
Unlock password encryption mutex
kabicin Oct 30, 2024
64e7f64
Add debug stmt
kabicin Oct 30, 2024
71d9131
Set passwordEncryptionMetadata to not nil
kabicin Oct 30, 2024
5ddb916
remove namespace mutex
kabicin Oct 30, 2024
00c3730
Move long tasks to begin concurrent reconcile
kabicin Oct 30, 2024
b07803a
set 4 max concurrent reconciles
kabicin Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions api/v1/openlibertyapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,25 @@ type OpenLibertyApplicationSpec struct {
// DNS settings for the application pod.
// +operator-sdk:csv:customresourcedefinitions:order=35,type=spec,displayName="DNS"
DNS *OpenLibertyApplicationDNS `json:"dns,omitempty"`

Experimental *OpenLibertyApplicationExperimental `json:"experimental,omitempty"`

ManageCache *bool `json:"enableCaching,omitempty"`
}

// Defines the Experimental concurrency feature
type OpenLibertyApplicationExperimental struct {
// If set to true, it will enable experimental mode (concurrency) when reconciling the application instance, otherwise does nothing. Defaults to false.
// +operator-sdk:csv:customresourcedefinitions:order=1,type=spec,displayName="Manage Concurrency"
ManageConcurrency *bool `json:"manageConcurrency,omitempty"`

// The maximum number of go-routines to be spawned that will create ephemeral Pods (i.e. Jobs) in the cluster at a single time. Defaults to 3.
// +operator-sdk:csv:customresourcedefinitions:order=2,type=spec,displayName="Ephemeral Pod Worker Pool Size"
EphemeralPodWorkerPoolSize *int `json:"ephemeralPodWorkerPoolSize,omitempty"`

// If set to true, it will enable caching when reading the Decision Tree data structure, otherwise does nothing. Defaults to false.
// +operator-sdk:csv:customresourcedefinitions:order=3,type=spec,displayName="Manage Cache"
ManageCache *bool `json:"manageCache,omitempty"`
}

// Defines the DNS
Expand Down Expand Up @@ -1589,3 +1608,32 @@ func convertFromCommonStatusEndpointScope(c common.StatusEndpointScope) StatusEn
panic(c)
}
}

// GetExperimental returns the experimental config for this application instance
func (cr *OpenLibertyApplication) GetExperimental() *OpenLibertyApplicationExperimental {
if cr.Spec.Experimental == nil {
return nil
}
return cr.Spec.Experimental
}

func (exp *OpenLibertyApplicationExperimental) GetEphemeralPodWorkerPoolSize() *int {
if exp.EphemeralPodWorkerPoolSize == nil {
return nil
}
return exp.EphemeralPodWorkerPoolSize
}

func (exp *OpenLibertyApplicationExperimental) GetManageCache() *bool {
if exp.ManageCache == nil {
return nil
}
return exp.ManageCache
}

func (exp *OpenLibertyApplicationExperimental) GetManageConcurrency() *bool {
if exp.ManageConcurrency == nil {
return nil
}
return exp.ManageConcurrency
}
40 changes: 40 additions & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions bundle/manifests/apps.openliberty.io_openlibertyapplications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,8 @@ spec:
to ClusterFirst.
type: string
type: object
enableCaching:
type: boolean
env:
description: An array of environment variables for the application
container.
Expand Down Expand Up @@ -1192,6 +1194,25 @@ spec:
type: object
type: array
x-kubernetes-list-type: atomic
experimental:
description: Defines the Experimental concurrency feature
properties:
ephemeralPodWorkerPoolSize:
description: The maximum number of go-routines to be spawned that
will create ephemeral Pods (i.e. Jobs) in the cluster at a single
time. Defaults to 3.
type: integer
manageCache:
description: If set to true, it will enable caching when reading
the Decision Tree data structure, otherwise does nothing. Defaults
to false.
type: boolean
manageConcurrency:
description: If set to true, it will enable experimental mode
(concurrency) when reconciling the application instance, otherwise
does nothing. Defaults to false.
type: boolean
type: object
expose:
description: Expose the application externally via a Route, a Knative
Route or an Ingress resource.
Expand Down
16 changes: 15 additions & 1 deletion bundle/manifests/open-liberty.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ metadata:
categories: Application Runtime
certified: "true"
containerImage: icr.io/appcafe/open-liberty-operator:daily
createdAt: "2024-09-20T19:04:14Z"
createdAt: "2024-10-25T14:31:38Z"
description: Deploy and manage containerized Liberty applications
features.operators.openshift.io/disconnected: "true"
features.operators.openshift.io/fips-compliant: "true"
Expand Down Expand Up @@ -162,6 +162,11 @@ spec:
- description: The DNS Policy for the application pod. Defaults to ClusterFirst.
displayName: DNS Policy
path: dns.policy
- description: If set to true, it will enable experimental mode (concurrency)
when reconciling the application instance, otherwise does nothing. Defaults
to false.
displayName: Manage Concurrency
path: experimental.manageConcurrency
- description: Whether the Service Account token should be mounted into the
application pods. Defaults to true.
displayName: Mount Service Account Token
Expand Down Expand Up @@ -191,6 +196,11 @@ spec:
- description: The DNS Config for the application pod.
displayName: DNS Config
path: dns.config
- description: The maximum number of go-routines to be spawned that will create
ephemeral Pods (i.e. Jobs) in the cluster at a single time. Defaults to
3.
displayName: Ephemeral Pod Worker Pool Size
path: experimental.ephemeralPodWorkerPoolSize
- description: Name of the service account to use for deploying the application.
A service account is automatically created if it's not specified.
displayName: Service Account Name
Expand Down Expand Up @@ -220,6 +230,10 @@ spec:
path: autoscaling.targetCPUUtilizationPercentage
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:number
- description: If set to true, it will enable caching when reading the Decision
Tree data structure, otherwise does nothing. Defaults to false.
displayName: Manage Cache
path: experimental.manageCache
- displayName: GitHub
path: sso.github
- description: Specifies the name of the claim. Use its value as the user group
Expand Down
21 changes: 21 additions & 0 deletions config/crd/bases/apps.openliberty.io_openlibertyapplications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,8 @@ spec:
to ClusterFirst.
type: string
type: object
enableCaching:
type: boolean
env:
description: An array of environment variables for the application
container.
Expand Down Expand Up @@ -1188,6 +1190,25 @@ spec:
type: object
type: array
x-kubernetes-list-type: atomic
experimental:
description: Defines the Experimental concurrency feature
properties:
ephemeralPodWorkerPoolSize:
description: The maximum number of go-routines to be spawned that
will create ephemeral Pods (i.e. Jobs) in the cluster at a single
time. Defaults to 3.
type: integer
manageCache:
description: If set to true, it will enable caching when reading
the Decision Tree data structure, otherwise does nothing. Defaults
to false.
type: boolean
manageConcurrency:
description: If set to true, it will enable experimental mode
(concurrency) when reconciling the application instance, otherwise
does nothing. Defaults to false.
type: boolean
type: object
expose:
description: Expose the application externally via a Route, a Knative
Route or an Ingress resource.
Expand Down
14 changes: 14 additions & 0 deletions config/manifests/bases/open-liberty.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ spec:
- description: The DNS Policy for the application pod. Defaults to ClusterFirst.
displayName: DNS Policy
path: dns.policy
- description: If set to true, it will enable experimental mode (concurrency)
when reconciling the application instance, otherwise does nothing. Defaults
to false.
displayName: Manage Concurrency
path: experimental.manageConcurrency
- description: Whether the Service Account token should be mounted into the
application pods. Defaults to true.
displayName: Mount Service Account Token
Expand Down Expand Up @@ -103,6 +108,11 @@ spec:
- description: The DNS Config for the application pod.
displayName: DNS Config
path: dns.config
- description: The maximum number of go-routines to be spawned that will create
ephemeral Pods (i.e. Jobs) in the cluster at a single time. Defaults to
3.
displayName: Ephemeral Pod Worker Pool Size
path: experimental.ephemeralPodWorkerPoolSize
- description: Name of the service account to use for deploying the application.
A service account is automatically created if it's not specified.
displayName: Service Account Name
Expand Down Expand Up @@ -132,6 +142,10 @@ spec:
path: autoscaling.targetCPUUtilizationPercentage
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:number
- description: If set to true, it will enable caching when reading the Decision
Tree data structure, otherwise does nothing. Defaults to false.
displayName: Manage Cache
path: experimental.manageCache
- displayName: GitHub
path: sso.github
- description: Specifies the name of the claim. Use its value as the user group
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/OpenLiberty/open-liberty-operator
go 1.23

require (
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20240920184731-58836ec570f6
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20241024152417-442bb576f90a
github.com/cert-manager/cert-manager v1.13.6
github.com/go-logr/logr v1.3.0
github.com/openshift/api v0.0.0-20230928134114-673ed0cfc7f1
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ contrib.go.opencensus.io/exporter/prometheus v0.4.2 h1:sqfsYl5GIY/L570iT+l93ehxa
contrib.go.opencensus.io/exporter/prometheus v0.4.2/go.mod h1:dvEHbiKmgvbr5pjaF9fpw1KeYcjrnC1J8B+JKjsZyRQ=
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20240920184731-58836ec570f6 h1:ltEk49dxle0XgNgVSGWspfBqcx2nkd1SBMLoWOD1ETA=
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20240920184731-58836ec570f6/go.mod h1:Q//a3yubxjR3+COorasymYRuuiDPs0Usgl9YuADkD6U=
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20241023211710-e7e9ab1cd634 h1:w4SV1J0KRVnrDPmp5Xz++U61jSSQL/ao5RlVhlyzLM4=
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20241023211710-e7e9ab1cd634/go.mod h1:Q//a3yubxjR3+COorasymYRuuiDPs0Usgl9YuADkD6U=
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20241024152417-442bb576f90a h1:9kPg02fOV56zvjpSuzwSJh1hrH9/wwigTnS7XbD+e2Q=
github.com/application-stacks/runtime-component-operator v1.0.0-20220602-0850.0.20241024152417-442bb576f90a/go.mod h1:Q//a3yubxjR3+COorasymYRuuiDPs0Usgl9YuADkD6U=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
Expand Down
Loading