Skip to content

Commit 1efc67f

Browse files
authored
Password encryption and multi resource sharing (#611)
* Add resource sharing impl. * Add suffixes to LTPA Role/RoleBinding * Update Role/RoleBinding ref * Remove ownerReference from mirrored password encryption key * Update ltpa_keys_sharing.go * Remove /tree folder and early status/annotation update * Prevent resource deletion in finalizer, revert 1.3.3 operand version * Remove annotations/refs when resource sharing is off * Switch to rand/v2 package for suffix generation * Update tree_test.go * Remove ownerReference on LTPA Job and ConfigMap * Rebase on k8s-128 (#608) * Set resource tracker to autodetect operand version * Remove unused param * Update bundle manifests
1 parent 8838700 commit 1efc67f

35 files changed

+4601
-434
lines changed

Diff for: api/v1/openlibertyapplication_types.go

+34-25
Original file line numberDiff line numberDiff line change
@@ -54,102 +54,106 @@ type OpenLibertyApplicationSpec struct {
5454
// +operator-sdk:csv:customresourcedefinitions:order=8,type=spec,displayName="Expose",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
5555
Expose *bool `json:"expose,omitempty"`
5656

57+
// Enable management of password encryption key sharing amongst Liberty containers. Defaults to false.
58+
// +operator-sdk:csv:customresourcedefinitions:order=9,type=spec,displayName="Manage Password Encryption",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
59+
ManagePasswordEncryption *bool `json:"managePasswordEncryption,omitempty"`
60+
5761
// Enable management of LTPA key sharing amongst Liberty containers. Defaults to false.
58-
// +operator-sdk:csv:customresourcedefinitions:order=9,type=spec,displayName="Manage LTPA",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
62+
// +operator-sdk:csv:customresourcedefinitions:order=10,type=spec,displayName="Manage LTPA",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
5963
ManageLTPA *bool `json:"manageLTPA,omitempty"`
6064

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

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

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

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

76-
// +operator-sdk:csv:customresourcedefinitions:order=14,type=spec,displayName="Probes"
80+
// +operator-sdk:csv:customresourcedefinitions:order=15,type=spec,displayName="Probes"
7781
Probes *OpenLibertyApplicationProbes `json:"probes,omitempty"`
7882

79-
// +operator-sdk:csv:customresourcedefinitions:order=15,type=spec,displayName="Deployment"
83+
// +operator-sdk:csv:customresourcedefinitions:order=16,type=spec,displayName="Deployment"
8084
Deployment *OpenLibertyApplicationDeployment `json:"deployment,omitempty"`
8185

82-
// +operator-sdk:csv:customresourcedefinitions:order=16,type=spec,displayName="StatefulSet"
86+
// +operator-sdk:csv:customresourcedefinitions:order=17,type=spec,displayName="StatefulSet"
8387
StatefulSet *OpenLibertyApplicationStatefulSet `json:"statefulSet,omitempty"`
8488

85-
// +operator-sdk:csv:customresourcedefinitions:order=17,type=spec,displayName="Service"
89+
// +operator-sdk:csv:customresourcedefinitions:order=18,type=spec,displayName="Service"
8690
Service *OpenLibertyApplicationService `json:"service,omitempty"`
8791

88-
// +operator-sdk:csv:customresourcedefinitions:order=18,type=spec,displayName="Route"
92+
// +operator-sdk:csv:customresourcedefinitions:order=19,type=spec,displayName="Route"
8993
Route *OpenLibertyApplicationRoute `json:"route,omitempty"`
9094

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

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

98-
// +operator-sdk:csv:customresourcedefinitions:order=21,type=spec,displayName="Serviceability"
102+
// +operator-sdk:csv:customresourcedefinitions:order=22,type=spec,displayName="Serviceability"
99103
Serviceability *OpenLibertyApplicationServiceability `json:"serviceability,omitempty"`
100104

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

104-
// +operator-sdk:csv:customresourcedefinitions:order=23,type=spec,displayName="Monitoring"
108+
// +operator-sdk:csv:customresourcedefinitions:order=24,type=spec,displayName="Monitoring"
105109
Monitoring *OpenLibertyApplicationMonitoring `json:"monitoring,omitempty"`
106110

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

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

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

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

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

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

141-
// +operator-sdk:csv:customresourcedefinitions:order=30,type=spec,displayName="Affinity"
145+
// +operator-sdk:csv:customresourcedefinitions:order=31,type=spec,displayName="Affinity"
142146
Affinity *OpenLibertyApplicationAffinity `json:"affinity,omitempty"`
143147

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

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

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

155159
// Tolerations to be added to application pods. Tolerations allow the scheduler to schedule pods on nodes with matching taints.
@@ -769,6 +773,11 @@ func (cr *OpenLibertyApplication) GetExpose() *bool {
769773
return cr.Spec.Expose
770774
}
771775

776+
// GetManagePasswordEncryption returns the Password Encryption key sharing status
777+
func (cr *OpenLibertyApplication) GetManagePasswordEncryption() *bool {
778+
return cr.Spec.ManagePasswordEncryption
779+
}
780+
772781
// GetManageLTPA returns the LTPA key sharing status
773782
func (cr *OpenLibertyApplication) GetManageLTPA() *bool {
774783
return cr.Spec.ManageLTPA

Diff for: api/v1/zz_generated.deepcopy.go

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: bundle/manifests/apps.openliberty.io_openlibertyapplications.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -2515,6 +2515,10 @@ spec:
25152515
description: Enable management of LTPA key sharing amongst Liberty
25162516
containers. Defaults to false.
25172517
type: boolean
2518+
managePasswordEncryption:
2519+
description: Enable management of password encryption key sharing
2520+
amongst Liberty containers. Defaults to false.
2521+
type: boolean
25182522
manageTLS:
25192523
description: Enable management of TLS certificates. Defaults to true.
25202524
type: boolean

Diff for: bundle/manifests/open-liberty.clusterserviceversion.yaml

+54-48
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,10 @@ spec:
287287
- description: Specifies one or more scopes to request.
288288
displayName: Scope
289289
path: sso.oidc[0].scope
290-
- description: Enable management of LTPA key sharing amongst Liberty containers.
291-
Defaults to false.
292-
displayName: Manage LTPA
293-
path: manageLTPA
290+
- description: Enable management of password encryption key sharing amongst
291+
Liberty containers. Defaults to false.
292+
displayName: Manage Password Encryption
293+
path: managePasswordEncryption
294294
x-descriptors:
295295
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
296296
- description: The port exposed by the container.
@@ -301,9 +301,10 @@ spec:
301301
- description: Specifies the required authentication method.
302302
displayName: Token Endpoint Auth Method
303303
path: sso.oidc[0].tokenEndpointAuthMethod
304-
- description: Enable management of TLS certificates. Defaults to true.
305-
displayName: Manage TLS
306-
path: manageTLS
304+
- description: Enable management of LTPA key sharing amongst Liberty containers.
305+
Defaults to false.
306+
displayName: Manage LTPA
307+
path: manageLTPA
307308
x-descriptors:
308309
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
309310
- displayName: Service Type
@@ -316,29 +317,29 @@ spec:
316317
path: sso.oidc[0].hostNameVerificationEnabled
317318
x-descriptors:
318319
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
319-
- description: Number of pods to create. Defaults to 1. Not applicable when
320-
.spec.autoscaling or .spec.createKnativeService is specified.
321-
displayName: Replicas
322-
path: replicas
320+
- description: Enable management of TLS certificates. Defaults to true.
321+
displayName: Manage TLS
322+
path: manageTLS
323323
x-descriptors:
324-
- urn:alm:descriptor:com.tectonic.ui:podCount
324+
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
325325
- description: Node proxies this port into your service.
326326
displayName: Node Port
327327
path: service.nodePort
328328
x-descriptors:
329329
- urn:alm:descriptor:com.tectonic.ui:number
330-
- displayName: Auto Scaling
331-
path: autoscaling
330+
- description: Number of pods to create. Defaults to 1. Not applicable when
331+
.spec.autoscaling or .spec.createKnativeService is specified.
332+
displayName: Replicas
333+
path: replicas
334+
x-descriptors:
335+
- urn:alm:descriptor:com.tectonic.ui:podCount
332336
- description: The name for the port exposed by the container.
333337
displayName: Port Name
334338
path: service.portName
335339
x-descriptors:
336340
- urn:alm:descriptor:com.tectonic.ui:text
337-
- description: Resource requests and limits for the application container.
338-
displayName: Resource Requirements
339-
path: resources
340-
x-descriptors:
341-
- urn:alm:descriptor:com.tectonic.ui:resourceRequirements
341+
- displayName: Auto Scaling
342+
path: autoscaling
342343
- description: Annotations to be added to the service.
343344
displayName: Service Annotations
344345
path: service.annotations
@@ -349,104 +350,109 @@ spec:
349350
path: service.certificate.annotations
350351
x-descriptors:
351352
- urn:alm:descriptor:com.tectonic.ui:text
352-
- displayName: Probes
353-
path: probes
353+
- description: Resource requests and limits for the application container.
354+
displayName: Resource Requirements
355+
path: resources
356+
x-descriptors:
357+
- urn:alm:descriptor:com.tectonic.ui:resourceRequirements
354358
- description: The port that the operator assigns to containers inside pods.
355359
Defaults to the value of .spec.service.port.
356360
displayName: Target Port
357361
path: service.targetPort
358362
x-descriptors:
359363
- urn:alm:descriptor:com.tectonic.ui:number
360-
- displayName: Deployment
361-
path: deployment
364+
- displayName: Probes
365+
path: probes
362366
- description: 'A name of a secret that already contains TLS key, certificate
363367
and CA to be mounted in the pod. The following keys are valid in the secret:
364368
ca.crt, tls.crt, and tls.key.'
365369
displayName: Certificate Secret Reference
366370
path: service.certificateSecretRef
367371
x-descriptors:
368372
- urn:alm:descriptor:com.tectonic.ui:text
373+
- displayName: Deployment
374+
path: deployment
369375
- description: Configure service certificate.
370376
displayName: Service Certificate
371377
path: service.certificate
378+
- description: An array consisting of service ports.
379+
displayName: Ports
380+
path: service.ports
372381
- displayName: StatefulSet
373382
path: statefulSet
374383
- displayName: Service
375384
path: service
376-
- description: An array consisting of service ports.
377-
displayName: Ports
378-
path: service.ports
379-
- displayName: Route
380-
path: route
381385
- description: Expose the application as a bindable service. Defaults to false.
382386
displayName: Bindable
383387
path: service.bindable
384388
x-descriptors:
385389
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
390+
- displayName: Route
391+
path: route
386392
- description: Configures the Semeru Cloud Compiler to handle Just-In-Time (JIT)
387393
compilation requests from the application.
388394
displayName: Semeru Cloud Compiler
389395
path: semeruCloudCompiler
390-
- displayName: Network Policy
391-
path: networkPolicy
392396
- description: Specifies the strategy to replace old deployment pods with new
393397
pods.
394398
displayName: Deployment Update Strategy
395399
path: deployment.updateStrategy
396400
x-descriptors:
397401
- urn:alm:descriptor:com.tectonic.ui:updateStrategy
402+
- displayName: Network Policy
403+
path: networkPolicy
398404
- displayName: Serviceability
399405
path: serviceability
400406
- displayName: Single Sign-On
401407
path: sso
402-
- displayName: Monitoring
403-
path: monitoring
404408
- description: Specifies the strategy to replace old StatefulSet pods with new
405409
pods.
406410
displayName: StatefulSet Update Strategy
407411
path: statefulSet.updateStrategy
412+
- displayName: Monitoring
413+
path: monitoring
414+
- displayName: Storage
415+
path: statefulSet.storage
408416
- description: An array of environment variables for the application container.
409417
displayName: Environment Variables
410418
path: env
411-
- displayName: Storage
412-
path: statefulSet.storage
413-
- description: List of sources to populate environment variables in the application
414-
container.
415-
displayName: Environment Variables from Sources
416-
path: envFrom
417419
- description: A convenient field to set the size of the persisted storage.
418420
displayName: Storage Size
419421
path: statefulSet.storage.size
420422
x-descriptors:
421423
- urn:alm:descriptor:com.tectonic.ui:text
424+
- description: List of sources to populate environment variables in the application
425+
container.
426+
displayName: Environment Variables from Sources
427+
path: envFrom
422428
- description: A convenient field to request the storage class of the persisted
423429
storage. The name can not be specified or updated after the storage is created.
424430
displayName: Storage Class Name
425431
path: statefulSet.storage.className
426432
x-descriptors:
427433
- urn:alm:descriptor:com.tectonic.ui:text
428-
- description: Represents a volume with data that is accessible to the application
429-
container.
430-
displayName: Volumes
431-
path: volumes
432434
- description: The directory inside the container where this persisted storage
433435
will be bound to.
434436
displayName: Storage Mount Path
435437
path: statefulSet.storage.mountPath
436438
x-descriptors:
437439
- urn:alm:descriptor:com.tectonic.ui:text
438-
- description: Represents where to mount the volumes into the application container.
439-
displayName: Volume Mounts
440-
path: volumeMounts
441-
- description: List of containers to run before other containers in a pod.
442-
displayName: Init Containers
443-
path: initContainers
440+
- description: Represents a volume with data that is accessible to the application
441+
container.
442+
displayName: Volumes
443+
path: volumes
444444
- description: A YAML object that represents a volumeClaimTemplate component
445445
of a StatefulSet.
446446
displayName: Storage Volume Claim Template
447447
path: statefulSet.storage.volumeClaimTemplate
448448
x-descriptors:
449449
- urn:alm:descriptor:com.tectonic.ui:PersistentVolumeClaim
450+
- description: Represents where to mount the volumes into the application container.
451+
displayName: Volume Mounts
452+
path: volumeMounts
453+
- description: List of containers to run before other containers in a pod.
454+
displayName: Init Containers
455+
path: initContainers
450456
- description: List of sidecar containers. These are additional containers to
451457
be added to the pods.
452458
displayName: Sidecar Containers

0 commit comments

Comments
 (0)