@@ -306,15 +306,26 @@ type WebSphereLibertyApplicationService struct {
306306 // +operator-sdk:csv:customresourcedefinitions:order=15,type=spec,displayName="Certificate Secret Reference",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
307307 CertificateSecretRef * string `json:"certificateSecretRef,omitempty"`
308308
309+ // Configure service certificate.
310+ // +operator-sdk:csv:customresourcedefinitions:order=16,type=spec,displayName="Service Certificate"
311+ Certificate * WebSphereLibertyApplicationCertificate `json:"certificate,omitempty"`
312+
309313 // An array consisting of service ports.
310- // +operator-sdk:csv:customresourcedefinitions:order=16 ,type=spec
314+ // +operator-sdk:csv:customresourcedefinitions:order=17 ,type=spec
311315 Ports []corev1.ServicePort `json:"ports,omitempty"`
312316
313317 // Expose the application as a bindable service. Defaults to false.
314- // +operator-sdk:csv:customresourcedefinitions:order=17 ,type=spec,displayName="Bindable",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
318+ // +operator-sdk:csv:customresourcedefinitions:order=18 ,type=spec,displayName="Bindable",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
315319 Bindable * bool `json:"bindable,omitempty"`
316320}
317321
322+ // Configure service certificate.
323+ type WebSphereLibertyApplicationCertificate struct {
324+ // Annotations to be added to the service certificate.
325+ // +operator-sdk:csv:customresourcedefinitions:order=13,type=spec,displayName="Annotations",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
326+ Annotations map [string ]string `json:"annotations,omitempty"`
327+ }
328+
318329// Defines the network policy
319330type WebSphereLibertyApplicationNetworkPolicy struct {
320331 // Disable the creation of the network policy. Defaults to false.
@@ -802,6 +813,9 @@ func (cr *WebSphereLibertyApplication) GetService() common.BaseComponentService
802813
803814// GetNetworkPolicy returns network policy settings
804815func (cr * WebSphereLibertyApplication ) GetNetworkPolicy () common.BaseComponentNetworkPolicy {
816+ if cr .Spec .NetworkPolicy == nil {
817+ return nil
818+ }
805819 return cr .Spec .NetworkPolicy
806820}
807821
@@ -1029,30 +1043,43 @@ func (s *WebSphereLibertyApplicationService) GetCertificateSecretRef() *string {
10291043 return s .CertificateSecretRef
10301044}
10311045
1046+ // GetCertificate returns a service certificate configuration
1047+ func (s * WebSphereLibertyApplicationService ) GetCertificate () common.BaseComponentCertificate {
1048+ if s .Certificate == nil {
1049+ return nil
1050+ }
1051+ return s .Certificate
1052+ }
1053+
1054+ // GetAnnotations returns annotations to be added to certificate request
1055+ func (c * WebSphereLibertyApplicationCertificate ) GetAnnotations () map [string ]string {
1056+ return c .Annotations
1057+ }
1058+
10321059// GetBindable returns whether the application should be exposable as a service
10331060func (s * WebSphereLibertyApplicationService ) GetBindable () * bool {
10341061 return s .Bindable
10351062}
10361063
10371064// GetNamespaceLabels returns the namespace selector labels that should be used for the ingress rule
10381065func (np * WebSphereLibertyApplicationNetworkPolicy ) GetNamespaceLabels () map [string ]string {
1039- if np == nil || np .NamespaceLabels = = nil {
1040- return nil
1066+ if np .NamespaceLabels ! = nil {
1067+ return * np . NamespaceLabels
10411068 }
1042- return * np . NamespaceLabels
1069+ return nil
10431070}
10441071
10451072// GetFromLabels returns the pod selector labels that should be used for the ingress rule
10461073func (np * WebSphereLibertyApplicationNetworkPolicy ) GetFromLabels () map [string ]string {
1047- if np == nil || np .FromLabels = = nil {
1048- return nil
1074+ if np .FromLabels ! = nil {
1075+ return * np . FromLabels
10491076 }
1050- return * np . FromLabels
1077+ return nil
10511078}
10521079
10531080// IsDisabled returns whether the network policy should be created or not
10541081func (np * WebSphereLibertyApplicationNetworkPolicy ) IsDisabled () bool {
1055- return np != nil && np .Disable != nil && * np .Disable
1082+ return np .Disable != nil && * np .Disable
10561083}
10571084
10581085// GetLabels returns labels to be added on ServiceMonitor
0 commit comments