Commit 48da7f37 authored by Edmund Ochieng's avatar Edmund Ochieng

re-enable the nginx ingress controller

parent 82cf96b1
package gitlab
import (
nginxv1alpha1 "github.com/nginxinc/nginx-ingress-operator/pkg/apis/k8s/v1alpha1"
gitlabv1beta1 "gitlab.com/gitlab-org/gl-openshift/gitlab-operator/api/v1beta1"
gitlabutils "gitlab.com/gitlab-org/gl-openshift/gitlab-operator/controllers/utils"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
......@@ -142,3 +143,32 @@ func getRegistryIngressCert(cr *gitlabv1beta1.GitLab) []extensionsv1beta1.Ingres
},
}
}
// IngressController is a GitLab controller for exposing GitLab instances
func IngressController(cr *gitlabv1beta1.GitLab) *nginxv1alpha1.NginxIngressController {
labels := gitlabutils.Label(cr.Name, "ingress-controller", gitlabutils.GitlabType)
var replicas int32 = 1
return &nginxv1alpha1.NginxIngressController{
ObjectMeta: metav1.ObjectMeta{
Name: "gitlab-ingress-controller",
Namespace: cr.Namespace,
Labels: labels,
},
Spec: nginxv1alpha1.NginxIngressControllerSpec{
EnableCRDs: true,
Image: nginxv1alpha1.Image{
Repository: "docker.io/nginx/nginx-ingress",
Tag: "1.8.0-ubi",
PullPolicy: "Always",
},
// IngressClass: "gitlab",
// UseIngressClassOnly: true,
NginxPlus: false,
Replicas: &replicas,
ServiceType: "NodePort",
Type: "deployment",
},
}
}
......@@ -598,6 +598,11 @@ func (r *GitLabReconciler) reconcileRoute(cr *gitlabv1beta1.GitLab) error {
func (r *GitLabReconciler) reconcileIngress(cr *gitlabv1beta1.GitLab) error {
controller := gitlabctl.IngressController(cr)
if err := r.createKubernetesResource(controller, cr); err != nil {
return err
}
var ingresses []*extensionsv1beta1.Ingress
gitlab := gitlabctl.Ingress(cr)
......
......@@ -32,7 +32,7 @@ import (
certmanagerv1beta1 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1beta1"
// miniov1 "github.com/minio/operator/pkg/apis/minio.min.io/v1"
// nginxv1alpha1 "github.com/nginxinc/nginx-ingress-operator/pkg/apis/k8s/v1alpha1"
nginxv1alpha1 "github.com/nginxinc/nginx-ingress-operator/pkg/apis/k8s/v1alpha1"
routev1 "github.com/openshift/api/route/v1"
appsv1beta1 "gitlab.com/gitlab-org/gl-openshift/gitlab-operator/api/v1beta1"
"gitlab.com/gitlab-org/gl-openshift/gitlab-operator/controllers"
......@@ -57,7 +57,7 @@ func init() {
// utilruntime.Must(miniov1.AddToScheme(scheme))
// utilruntime.Must(nginxv1alpha1.SchemeBuilder.AddToScheme(scheme))
utilruntime.Must(nginxv1alpha1.SchemeBuilder.AddToScheme(scheme))
// +kubebuilder:scaffold:scheme
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment