Skip to content

Commit 8bd91c9

Browse files
authored
Generate and share LTPA key (#533)
* Create Job to mount LTPA keys * Mount shared ltpa.xml into Liberty pods * Isolate the ltpa.keys file in dir and allow writes * Fix Pod log buffer refresh * Delete Liberty app if LTPA secret is not found * Add RBAC and script for LTPA Job * Remove RestConfig from wlapp controller * Load LTPA script from fs, add resource version ENV * Generate random password for ltpa keys file * Add .spec.manageLTPA to enable LTPA key sharing * Add comments * Remove redundant spec update * Fix keysFileName to use ${server.config.dir} * Add indexed completion to LTPA Job * Move LTPA code into one file, share keys across ns * Update ltpa_keys_sharing.go * Prevent deleting the LTPA Job * Update create_ltpa_keys.sh * Remove initContainer for loading LTPA keys * Update ltpa_keys_sharing.go * Add Job RBAC permissions * Move create_ltpa_keys.sh script, add RBAC perm * Fix naming/labels & don't delete LTPA xml w/ app * Update status messages * Restart LTPA keys generation on app image change
1 parent 21db19c commit 8bd91c9

20 files changed

+7896
-2094
lines changed

api/v1/webspherelibertyapplication_types.go

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,91 +73,95 @@ type WebSphereLibertyApplicationSpec struct {
7373
// +operator-sdk:csv:customresourcedefinitions:order=8,type=spec,displayName="Expose",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
7474
Expose *bool `json:"expose,omitempty"`
7575

76+
// Enable management of LTPA key sharing amongst Liberty containers. Defaults to false.
77+
// +operator-sdk:csv:customresourcedefinitions:order=9,type=spec,displayName="Manage LTPA",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
78+
ManageLTPA *bool `json:"manageLTPA,omitempty"`
79+
7680
// Enable management of TLS certificates. Defaults to true.
77-
// +operator-sdk:csv:customresourcedefinitions:order=8,type=spec,displayName="Manage TLS",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
81+
// +operator-sdk:csv:customresourcedefinitions:order=10,type=spec,displayName="Manage TLS",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
7882
ManageTLS *bool `json:"manageTLS,omitempty"`
7983

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

84-
// +operator-sdk:csv:customresourcedefinitions:order=10,type=spec,displayName="Auto Scaling"
88+
// +operator-sdk:csv:customresourcedefinitions:order=12,type=spec,displayName="Auto Scaling"
8589
Autoscaling *WebSphereLibertyApplicationAutoScaling `json:"autoscaling,omitempty"`
8690

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

91-
// +operator-sdk:csv:customresourcedefinitions:order=12,type=spec,displayName="Probes"
95+
// +operator-sdk:csv:customresourcedefinitions:order=14,type=spec,displayName="Probes"
9296
Probes *WebSphereLibertyApplicationProbes `json:"probes,omitempty"`
9397

94-
// +operator-sdk:csv:customresourcedefinitions:order=13,type=spec,displayName="Deployment"
98+
// +operator-sdk:csv:customresourcedefinitions:order=15,type=spec,displayName="Deployment"
9599
Deployment *WebSphereLibertyApplicationDeployment `json:"deployment,omitempty"`
96100

97-
// +operator-sdk:csv:customresourcedefinitions:order=14,type=spec,displayName="StatefulSet"
101+
// +operator-sdk:csv:customresourcedefinitions:order=16,type=spec,displayName="StatefulSet"
98102
StatefulSet *WebSphereLibertyApplicationStatefulSet `json:"statefulSet,omitempty"`
99103

100-
// +operator-sdk:csv:customresourcedefinitions:order=15,type=spec,displayName="Service"
104+
// +operator-sdk:csv:customresourcedefinitions:order=17,type=spec,displayName="Service"
101105
Service *WebSphereLibertyApplicationService `json:"service,omitempty"`
102106

103-
// +operator-sdk:csv:customresourcedefinitions:order=16,type=spec,displayName="Route"
107+
// +operator-sdk:csv:customresourcedefinitions:order=18,type=spec,displayName="Route"
104108
Route *WebSphereLibertyApplicationRoute `json:"route,omitempty"`
105109

106110
// Configures the Semeru Cloud Compiler to handle Just-In-Time (JIT) compilation requests from the application.
107-
// +operator-sdk:csv:customresourcedefinitions:order=17,type=spec,displayName="Semeru Cloud Compiler"
111+
// +operator-sdk:csv:customresourcedefinitions:order=19,type=spec,displayName="Semeru Cloud Compiler"
108112
SemeruCloudCompiler *WebSphereLibertyApplicationSemeruCloudCompiler `json:"semeruCloudCompiler,omitempty"`
109113

110-
// +operator-sdk:csv:customresourcedefinitions:order=18,type=spec,displayName="Network Policy"
114+
// +operator-sdk:csv:customresourcedefinitions:order=20,type=spec,displayName="Network Policy"
111115
NetworkPolicy *WebSphereLibertyApplicationNetworkPolicy `json:"networkPolicy,omitempty"`
112116

113-
// +operator-sdk:csv:customresourcedefinitions:order=19,type=spec,displayName="Serviceability"
117+
// +operator-sdk:csv:customresourcedefinitions:order=21,type=spec,displayName="Serviceability"
114118
Serviceability *WebSphereLibertyApplicationServiceability `json:"serviceability,omitempty"`
115119

116-
// +operator-sdk:csv:customresourcedefinitions:order=20,type=spec,displayName="Single Sign-On"
120+
// +operator-sdk:csv:customresourcedefinitions:order=22,type=spec,displayName="Single Sign-On"
117121
SSO *WebSphereLibertyApplicationSSO `json:"sso,omitempty"`
118122

119-
// +operator-sdk:csv:customresourcedefinitions:order=21,type=spec,displayName="Monitoring"
123+
// +operator-sdk:csv:customresourcedefinitions:order=23,type=spec,displayName="Monitoring"
120124
Monitoring *WebSphereLibertyApplicationMonitoring `json:"monitoring,omitempty"`
121125

122126
// An array of environment variables for the application container.
123127
// +listType=map
124128
// +listMapKey=name
125-
// +operator-sdk:csv:customresourcedefinitions:order=22,type=spec,displayName="Environment Variables"
129+
// +operator-sdk:csv:customresourcedefinitions:order=24,type=spec,displayName="Environment Variables"
126130
Env []corev1.EnvVar `json:"env,omitempty"`
127131

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

133137
// Represents a volume with data that is accessible to the application container.
134138
// +listType=map
135139
// +listMapKey=name
136-
// +operator-sdk:csv:customresourcedefinitions:order=24,type=spec,displayName="Volumes"
140+
// +operator-sdk:csv:customresourcedefinitions:order=26,type=spec,displayName="Volumes"
137141
Volumes []corev1.Volume `json:"volumes,omitempty"`
138142

139143
// Represents where to mount the volumes into the application container.
140144
// +listType=atomic
141-
// +operator-sdk:csv:customresourcedefinitions:order=25,type=spec,displayName="Volume Mounts"
145+
// +operator-sdk:csv:customresourcedefinitions:order=27,type=spec,displayName="Volume Mounts"
142146
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
143147

144148
// List of containers to run before other containers in a pod.
145149
// +listType=map
146150
// +listMapKey=name
147-
// +operator-sdk:csv:customresourcedefinitions:order=26,type=spec,displayName="Init Containers"
151+
// +operator-sdk:csv:customresourcedefinitions:order=28,type=spec,displayName="Init Containers"
148152
InitContainers []corev1.Container `json:"initContainers,omitempty"`
149153

150154
// List of sidecar containers. These are additional containers to be added to the pods.
151155
// +listType=map
152156
// +listMapKey=name
153-
// +operator-sdk:csv:customresourcedefinitions:order=27,type=spec,displayName="Sidecar Containers"
157+
// +operator-sdk:csv:customresourcedefinitions:order=29,type=spec,displayName="Sidecar Containers"
154158
SidecarContainers []corev1.Container `json:"sidecarContainers,omitempty"`
155159

156-
// +operator-sdk:csv:customresourcedefinitions:order=28,type=spec,displayName="Affinity"
160+
// +operator-sdk:csv:customresourcedefinitions:order=30,type=spec,displayName="Affinity"
157161
Affinity *WebSphereLibertyApplicationAffinity `json:"affinity,omitempty"`
158162

159163
// Security context for the application container.
160-
// +operator-sdk:csv:customresourcedefinitions:order=29,type=spec,displayName="Security Context"
164+
// +operator-sdk:csv:customresourcedefinitions:order=31,type=spec,displayName="Security Context"
161165
SecurityContext *corev1.SecurityContext `json:"securityContext,omitempty"`
162166
}
163167

@@ -800,6 +804,11 @@ func (cr *WebSphereLibertyApplication) GetExpose() *bool {
800804
return cr.Spec.Expose
801805
}
802806

807+
// GetManageLTPA returns the LTPA key sharing status
808+
func (cr *WebSphereLibertyApplication) GetManageLTPA() *bool {
809+
return cr.Spec.ManageLTPA
810+
}
811+
803812
// GetManageTLS returns deployment's node and pod affinity settings
804813
func (cr *WebSphereLibertyApplication) GetManageTLS() *bool {
805814
return cr.Spec.ManageTLS

api/v1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)