@@ -44,6 +44,11 @@ import (
4444 kodiakv1alpha1 "github.com/mNi-Cloud/kodiak/api/v1alpha1"
4545)
4646
47+ const (
48+ schemeHTTP = "http"
49+ schemeHTTPS = "https"
50+ )
51+
4752// ControlServerReconciler reconciles a ControlServer object
4853type ControlServerReconciler struct {
4954 client.Client
@@ -125,7 +130,7 @@ func (r *ControlServerReconciler) Reconcile(ctx context.Context, req ctrl.Reques
125130 return ctrl.Result {RequeueAfter : 10 * time .Second }, nil
126131 }
127132
128- if err := r .reconcileDeployment (ctx , & resource , portCfg , configHash , adminSecret , oidcSecret ); err != nil {
133+ if err := r .reconcileDeployment (ctx , & resource , portCfg , configHash , adminSecret ); err != nil {
129134 logger .Error (err , "failed to reconcile deployment" )
130135 r .updateStatusWithError (ctx , & resource , "DeploymentError" , err )
131136 return ctrl.Result {RequeueAfter : 10 * time .Second }, nil
@@ -320,7 +325,7 @@ func (r *ControlServerReconciler) reconcileService(ctx context.Context, resource
320325 return err
321326}
322327
323- func (r * ControlServerReconciler ) reconcileDeployment (ctx context.Context , resource * kodiakv1alpha1.ControlServer , ports portConfiguration , configHash string , adminSecret * corev1.Secret , oidcSecret * corev1. Secret ) error {
328+ func (r * ControlServerReconciler ) reconcileDeployment (ctx context.Context , resource * kodiakv1alpha1.ControlServer , ports portConfiguration , configHash string , adminSecret * corev1.Secret ) error {
324329 deploy := & appsv1.Deployment {
325330 ObjectMeta : metav1.ObjectMeta {
326331 Name : deploymentName (resource ),
@@ -731,9 +736,9 @@ func renderControlServerConfig(resource *kodiakv1alpha1.ControlServer, includeAd
731736}
732737
733738func controlServerEndpoint (resource * kodiakv1alpha1.ControlServer , ports portConfiguration ) string {
734- scheme := "https"
739+ scheme := schemeHTTPS
735740 if resource .Spec .Config .TLS != nil && resource .Spec .Config .TLS .Disable {
736- scheme = "http"
741+ scheme = schemeHTTP
737742 }
738743
739744 if resource .Spec .Config .PublicAddr != "" {
@@ -922,16 +927,16 @@ func sanitizePublicAddr(candidate string, tlsConfig *kodiakv1alpha1.TLSConfig, n
922927 return fmt .Sprintf ("%s:%d" , host , listenPort )
923928 }
924929
925- scheme := "https"
930+ scheme := schemeHTTPS
926931 if tlsConfig != nil && tlsConfig .Disable {
927- scheme = "http"
932+ scheme = schemeHTTP
928933 }
929934
930935 addr := trimScheme (candidate )
931936
932937 if _ , _ , err := net .SplitHostPort (addr ); err != nil {
933938 defaultPort := 443
934- if scheme == "http" {
939+ if scheme == schemeHTTP {
935940 defaultPort = 80
936941 }
937942 addr = fmt .Sprintf ("%s:%d" , addr , defaultPort )
0 commit comments