diff --git a/apis/mattermost/v1beta1/mattermost_types.go b/apis/mattermost/v1beta1/mattermost_types.go index 8f18c6c9d..d5fad3dd3 100644 --- a/apis/mattermost/v1beta1/mattermost_types.go +++ b/apis/mattermost/v1beta1/mattermost_types.go @@ -183,7 +183,7 @@ type Ingress struct { type AWSLoadBalancerController struct { // An AWS ALB Ingress will be created instead of nginx // +optional - Enable bool `json:"enable,omitempty"` + Enabled bool `json:"enable,omitempty"` // Certificate arn for the ALB, required if SSL enabled // +optional diff --git a/controllers/mattermost/mattermost/mattermost.go b/controllers/mattermost/mattermost/mattermost.go index ed129a7b8..8cc9e46fb 100644 --- a/controllers/mattermost/mattermost/mattermost.go +++ b/controllers/mattermost/mattermost/mattermost.go @@ -188,7 +188,7 @@ func (r *MattermostReconciler) checkMattermostIngress(mattermost *mmv1beta.Matte var desired *networkingv1.Ingress desired = mattermostApp.GenerateIngressV1Beta(mattermost) - if mattermost.Spec.AWSLoadBalancerController.Enable { + if mattermost.Spec.AWSLoadBalancerController.Enabled { desired = mattermostApp.GenerateALBIngressV1Beta(mattermost) } diff --git a/pkg/mattermost/mattermost_v1beta.go b/pkg/mattermost/mattermost_v1beta.go index e8862ca5c..9fa9ad99f 100644 --- a/pkg/mattermost/mattermost_v1beta.go +++ b/pkg/mattermost/mattermost_v1beta.go @@ -37,10 +37,12 @@ func GenerateServiceV1Beta(mattermost *mmv1beta.Mattermost) *corev1.Service { "service.alpha.kubernetes.io/tolerate-unready-endpoints": "true", } - if mattermost.Spec.AWSLoadBalancerController.Enable { - // Create a NodePort service because the ALB requires it - service := newServiceV1Beta(mattermost, mergeStringMaps(baseAnnotations, mattermost.Spec.ServiceAnnotations)) - return configureMattermostServiceNodePort(service) + if mattermost.Spec.AWSLoadBalancerController != nil { + if mattermost.Spec.AWSLoadBalancerController.Enabled { + // Create a NodePort service because the ALB requires it + service := newServiceV1Beta(mattermost, mergeStringMaps(baseAnnotations, mattermost.Spec.ServiceAnnotations)) + return configureMattermostServiceNodePort(service) + } } if mattermost.Spec.UseServiceLoadBalancer {