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 37 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7e7ca2a
Check for outdated app image reference in LTPA Job
kabicin Oct 22, 2024
ad90a5e
Create cache.go
kabicin Oct 22, 2024
c58f65d
Pull RCO max concurrent reconcile changes
kabicin Oct 23, 2024
ecceeb2
Add DecisionTree cache logic + temp flag
kabicin Oct 24, 2024
6837156
Set reconcilers to block for ResourceSharing mutex
kabicin Oct 24, 2024
fd4beb9
Operator config map to retry reconcile when failed to get
kabicin Oct 25, 2024
4a270d9
Add experimental CR config
kabicin Oct 25, 2024
43b93ee
Create concurrent reconcile func
kabicin Oct 25, 2024
df17b93
Concurrently reconcile semeru cloud compiler
kabicin Oct 25, 2024
9eac1cc
Update experimental.go
kabicin Oct 25, 2024
d15b0b2
Concurrently reconcile deployment/statefulset
kabicin Oct 25, 2024
35c7ab3
Concurrently reconcile routes/ingress
kabicin Oct 25, 2024
5bd67ae
Limit use of instance mutex
kabicin Oct 28, 2024
b0014d9
Set default value for passwordEncryptionMetadata
kabicin Oct 30, 2024
fe0872f
Update experimental.go
kabicin Oct 30, 2024
53b14bd
Add namespace lock
kabicin Oct 30, 2024
8413bf7
Unlock password encryption mutex
kabicin Oct 30, 2024
eb7193b
Add debug stmt
kabicin Oct 30, 2024
1dec781
Set passwordEncryptionMetadata to not nil
kabicin Oct 30, 2024
ab0a27e
remove namespace mutex
kabicin Oct 30, 2024
5d45323
Move long tasks to begin concurrent reconcile
kabicin Oct 30, 2024
1847706
set 4 max concurrent reconciles
kabicin Oct 30, 2024
ca96620
Update openlibertyapplication_controller.go
kabicin Oct 31, 2024
5bf5422
Update openlibertyapplication_controller.go
kabicin Oct 31, 2024
18579e4
Add manageErroingInstances
kabicin Oct 31, 2024
d17142d
Provide detailed error message and cleanup
kabicin Oct 31, 2024
f4dc31d
Perform service certificate check with LTPA in concurrent reconcile
kabicin Oct 31, 2024
e91adc4
Update openlibertyapplication_controller.go
kabicin Oct 31, 2024
ce75d6a
Create instances sync.Map
kabicin Nov 1, 2024
ae94569
Set outer-scoped ltpaKeysLastRotation in reconcileLTPAKeys
kabicin Nov 1, 2024
47b2a24
Add debug stmt
kabicin Nov 1, 2024
ffdbf18
Create manageResourceCaching flag
kabicin Nov 4, 2024
d3e9b9a
Update zz_generated.deepcopy.go
kabicin Nov 4, 2024
333f8f9
Set max concurrent reconciles to 1
kabicin Nov 4, 2024
0672f9c
Remove extra concurrent reconciles declaration
kabicin Nov 26, 2024
3fff5bc
Temp disable rate limiter
kabicin Nov 26, 2024
c60d62a
Merge branch 'main' into ltpa-opti
kabicin Nov 29, 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
61 changes: 35 additions & 26 deletions api/v1/openlibertyapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,106 +62,110 @@ type OpenLibertyApplicationSpec struct {
// +operator-sdk:csv:customresourcedefinitions:order=10,type=spec,displayName="Manage LTPA",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
ManageLTPA *bool `json:"manageLTPA,omitempty"`

// Enable management of shared resources using the operator's in-memory cache. Defaults to true.
// +operator-sdk:csv:customresourcedefinitions:order=11,type=spec,displayName="Manage Resource Caching",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
ManageResourceCaching *bool `json:"manageResourceCaching,omitempty"`

// Enable management of TLS certificates. Defaults to true.
// +operator-sdk:csv:customresourcedefinitions:order=11,type=spec,displayName="Manage TLS",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
// +operator-sdk:csv:customresourcedefinitions:order=12,type=spec,displayName="Manage TLS",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
ManageTLS *bool `json:"manageTLS,omitempty"`

// Number of pods to create. Defaults to 1. Not applicable when .spec.autoscaling or .spec.createKnativeService is specified.
// +operator-sdk:csv:customresourcedefinitions:order=12,type=spec,displayName="Replicas",xDescriptors="urn:alm:descriptor:com.tectonic.ui:podCount"
// +operator-sdk:csv:customresourcedefinitions:order=13,type=spec,displayName="Replicas",xDescriptors="urn:alm:descriptor:com.tectonic.ui:podCount"
Replicas *int32 `json:"replicas,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:order=13,type=spec,displayName="Auto Scaling"
// +operator-sdk:csv:customresourcedefinitions:order=14,type=spec,displayName="Auto Scaling"
Autoscaling *OpenLibertyApplicationAutoScaling `json:"autoscaling,omitempty"`

// Resource requests and limits for the application container.
// +operator-sdk:csv:customresourcedefinitions:order=14,type=spec,displayName="Resource Requirements",xDescriptors="urn:alm:descriptor:com.tectonic.ui:resourceRequirements"
// +operator-sdk:csv:customresourcedefinitions:order=15,type=spec,displayName="Resource Requirements",xDescriptors="urn:alm:descriptor:com.tectonic.ui:resourceRequirements"
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:order=15,type=spec,displayName="Probes"
// +operator-sdk:csv:customresourcedefinitions:order=16,type=spec,displayName="Probes"
Probes *OpenLibertyApplicationProbes `json:"probes,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:order=16,type=spec,displayName="Deployment"
// +operator-sdk:csv:customresourcedefinitions:order=17,type=spec,displayName="Deployment"
Deployment *OpenLibertyApplicationDeployment `json:"deployment,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:order=17,type=spec,displayName="StatefulSet"
// +operator-sdk:csv:customresourcedefinitions:order=18,type=spec,displayName="StatefulSet"
StatefulSet *OpenLibertyApplicationStatefulSet `json:"statefulSet,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:order=18,type=spec,displayName="Service"
// +operator-sdk:csv:customresourcedefinitions:order=19,type=spec,displayName="Service"
Service *OpenLibertyApplicationService `json:"service,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:order=19,type=spec,displayName="Route"
// +operator-sdk:csv:customresourcedefinitions:order=20,type=spec,displayName="Route"
Route *OpenLibertyApplicationRoute `json:"route,omitempty"`

// Configures the Semeru Cloud Compiler to handle Just-In-Time (JIT) compilation requests from the application.
// +operator-sdk:csv:customresourcedefinitions:order=20,type=spec,displayName="Semeru Cloud Compiler"
// +operator-sdk:csv:customresourcedefinitions:order=21,type=spec,displayName="Semeru Cloud Compiler"
SemeruCloudCompiler *OpenLibertyApplicationSemeruCloudCompiler `json:"semeruCloudCompiler,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:order=21,type=spec,displayName="Network Policy"
// +operator-sdk:csv:customresourcedefinitions:order=22,type=spec,displayName="Network Policy"
NetworkPolicy *OpenLibertyApplicationNetworkPolicy `json:"networkPolicy,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:order=22,type=spec,displayName="Serviceability"
// +operator-sdk:csv:customresourcedefinitions:order=23,type=spec,displayName="Serviceability"
Serviceability *OpenLibertyApplicationServiceability `json:"serviceability,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:order=23,type=spec,displayName="Single Sign-On"
// +operator-sdk:csv:customresourcedefinitions:order=24,type=spec,displayName="Single Sign-On"
SSO *OpenLibertyApplicationSSO `json:"sso,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:order=24,type=spec,displayName="Monitoring"
// +operator-sdk:csv:customresourcedefinitions:order=25,type=spec,displayName="Monitoring"
Monitoring *OpenLibertyApplicationMonitoring `json:"monitoring,omitempty"`

// An array of environment variables for the application container.
// +listType=map
// +listMapKey=name
// +operator-sdk:csv:customresourcedefinitions:order=25,type=spec,displayName="Environment Variables"
// +operator-sdk:csv:customresourcedefinitions:order=26,type=spec,displayName="Environment Variables"
Env []corev1.EnvVar `json:"env,omitempty"`

// List of sources to populate environment variables in the application container.
// +listType=atomic
// +operator-sdk:csv:customresourcedefinitions:order=26,type=spec,displayName="Environment Variables from Sources"
// +operator-sdk:csv:customresourcedefinitions:order=27,type=spec,displayName="Environment Variables from Sources"
EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"`

// Represents a volume with data that is accessible to the application container.
// +listType=map
// +listMapKey=name
// +operator-sdk:csv:customresourcedefinitions:order=27,type=spec,displayName="Volumes"
// +operator-sdk:csv:customresourcedefinitions:order=28,type=spec,displayName="Volumes"
Volumes []corev1.Volume `json:"volumes,omitempty"`

// Represents where to mount the volumes into the application container.
// +listType=atomic
// +operator-sdk:csv:customresourcedefinitions:order=28,type=spec,displayName="Volume Mounts"
// +operator-sdk:csv:customresourcedefinitions:order=29,type=spec,displayName="Volume Mounts"
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`

// List of containers to run before other containers in a pod.
// +listType=map
// +listMapKey=name
// +operator-sdk:csv:customresourcedefinitions:order=29,type=spec,displayName="Init Containers"
// +operator-sdk:csv:customresourcedefinitions:order=30,type=spec,displayName="Init Containers"
InitContainers []corev1.Container `json:"initContainers,omitempty"`

// List of sidecar containers. These are additional containers to be added to the pods.
// +listType=map
// +listMapKey=name
// +operator-sdk:csv:customresourcedefinitions:order=30,type=spec,displayName="Sidecar Containers"
// +operator-sdk:csv:customresourcedefinitions:order=31,type=spec,displayName="Sidecar Containers"
SidecarContainers []corev1.Container `json:"sidecarContainers,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:order=31,type=spec,displayName="Affinity"
// +operator-sdk:csv:customresourcedefinitions:order=32,type=spec,displayName="Affinity"
Affinity *OpenLibertyApplicationAffinity `json:"affinity,omitempty"`

// Security context for the application container.
// +operator-sdk:csv:customresourcedefinitions:order=32,type=spec,displayName="Security Context"
// +operator-sdk:csv:customresourcedefinitions:order=33,type=spec,displayName="Security Context"
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:order=33,type=spec,displayName="Topology Spread Constraints"
// +operator-sdk:csv:customresourcedefinitions:order=34,type=spec,displayName="Topology Spread Constraints"
TopologySpreadConstraints *OpenLibertyApplicationTopologySpreadConstraints `json:"topologySpreadConstraints,omitempty"`

// Disable information about services being injected into the application pod's environment variables. Default to false.
// +operator-sdk:csv:customresourcedefinitions:order=34,type=spec,displayName="Disable Service Links",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
// +operator-sdk:csv:customresourcedefinitions:order=35,type=spec,displayName="Disable Service Links",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
DisableServiceLinks *bool `json:"disableServiceLinks,omitempty"`

// Tolerations to be added to application pods. Tolerations allow the scheduler to schedule pods on nodes with matching taints.
// +operator-sdk:csv:customresourcedefinitions:order=34,type=spec,displayName="Tolerations"
// +operator-sdk:csv:customresourcedefinitions:order=36,type=spec,displayName="Tolerations"
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

// DNS settings for the application pod.
// +operator-sdk:csv:customresourcedefinitions:order=35,type=spec,displayName="DNS"
// +operator-sdk:csv:customresourcedefinitions:order=37,type=spec,displayName="DNS"
DNS *OpenLibertyApplicationDNS `json:"dns,omitempty"`
}

Expand Down Expand Up @@ -1622,3 +1626,8 @@ func convertFromCommonStatusEndpointScope(c common.StatusEndpointScope) StatusEn
panic(c)
}
}

// GetManageResourceCaching returns whether the app instance should use the in-memory cache when managing shared resources
func (cr *OpenLibertyApplication) GetManageResourceCaching() *bool {
return cr.Spec.ManageResourceCaching
}
5 changes: 5 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.

Original file line number Diff line number Diff line change
Expand Up @@ -2519,6 +2519,10 @@ spec:
description: Enable management of password encryption key sharing
amongst Liberty containers. Defaults to false.
type: boolean
manageResourceCaching:
description: Enable management of shared resources using the operator's
in-memory cache. Defaults to true.
type: boolean
manageTLS:
description: Enable management of TLS certificates. Defaults to true.
type: boolean
Expand Down
Loading