Skip to content

Commit 3933c54

Browse files
committed
Remove Route handling
As Route/Ingress are dependent of the cluster and because how TLS might be configured and handled it is safer to keep that burden outside of the sf-operator control. This change acts in that direction by removing the Route/TLS/Let'sEncrypt support. The sf-operator dev CLI, `create demo-env` ensure the Route resource exists. The doc is amended to reflect that change, and a new ADR is added. Change-Id: Ia71077b028223a878206c37a0a6cd5fddac885d1
1 parent 1eba028 commit 3933c54

30 files changed

Lines changed: 102 additions & 785 deletions

api/v1/softwarefactory_types.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,6 @@ type SoftwareFactorySpec struct {
546546
// at https://`service`.`FQDN`
547547
FQDN string `json:"fqdn"`
548548

549-
// LetsEncrypt settings for enabling using LetsEncrypt for Routes/TLS
550-
LetsEncrypt *LetsEncryptSpec `json:"letsEncrypt,omitempty"`
551-
552549
// Enable log forwarding to a [Fluent Bit HTTP input](https://docs.fluentbit.io/manual/pipeline/inputs/http)
553550
FluentBitLogForwarding *FluentBitForwarderSpec `json:"FluentBitLogForwarding,omitempty"`
554551

api/v1/zz_generated.deepcopy.go

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

cli/cmd/dev/dev.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"k8s.io/apimachinery/pkg/selection"
4040
"k8s.io/client-go/rest"
4141

42+
apiroutev1 "github.com/openshift/api/route/v1"
4243
"github.com/spf13/cobra"
4344
ctrl "sigs.k8s.io/controller-runtime"
4445
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -54,8 +55,16 @@ var defaultHost = "microshift.dev"
5455

5556
var errMissingArg = errors.New("missing argument")
5657

57-
func createDemoEnv(env cliutils.ENV, restConfig *rest.Config, fqdn string, reposPath, sfOperatorRepoPath string, keepDemoTenantDefinition bool) {
58+
func ensureGatewayRoute(env *cliutils.ENV, fqdn string) {
59+
route := base.MkHTTPSRoute("sf-gateway", env.Ns, fqdn, "gateway", "/", 8080)
60+
exists, _ := cliutils.GetM(env, "gateway", &apiroutev1.Route{})
61+
if !exists {
62+
cliutils.CreateROrDie(env, &route)
63+
}
64+
}
5865

66+
func createDemoEnv(env cliutils.ENV, restConfig *rest.Config, fqdn string, reposPath, sfOperatorRepoPath string, keepDemoTenantDefinition bool) {
67+
ensureGatewayRoute(&env, fqdn)
5968
gerrit.EnsureGerrit(&env, fqdn)
6069
ctrl.Log.Info("Making sure Gerrit is up and ready...")
6170
gerrit.EnsureGerritAccess(fqdn)

cli/cmd/dev/gerrit/gerrit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ func (g *GerritCMDContext) ensureStatefulSetOrDie() {
382382
func (g *GerritCMDContext) ensureGerritIngressesOrDie() {
383383
name := "gerrit"
384384
route := base.MkHTTPSRoute(name, g.env.Ns, name+"."+g.fqdn,
385-
gerritHTTPDPortName, "/", gerritHTTPDPort, map[string]string{}, nil)
385+
gerritHTTPDPortName, "/", gerritHTTPDPort)
386386
g.ensureRouteOrDie(route)
387387
}
388388

cli/cmd/initialize.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,6 @@ func initializeSFManifest(withAuth bool, withBuilder bool, full bool, connection
118118

119119
manifest.Spec.GitServer.Storage.Size = oneGi
120120

121-
leSpec := sfv1.LetsEncryptSpec{
122-
Server: sfv1.LEServerStaging,
123-
}
124-
manifest.Spec.LetsEncrypt = &leSpec
125-
126121
manifest.Spec.MariaDB.DBStorage.Size = oneGi
127122
manifest.Spec.MariaDB.LogStorage.Size = oneGi
128123

cli/cmd/sf.go

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,51 +21,20 @@ package cmd
2121
*/
2222

2323
import (
24-
"errors"
25-
"os"
26-
2724
bootstraptenantconfigrepo "github.com/softwarefactory-project/sf-operator/cli/cmd/bootstrap-tenant-config-repo"
2825
"github.com/spf13/cobra"
29-
ctrl "sigs.k8s.io/controller-runtime"
3026
)
3127

32-
func sfConfigureCmd(kmd *cobra.Command, args []string) {
33-
if args[0] == "TLS" {
34-
TLSConfigureCmd(kmd, args)
35-
} else {
36-
ctrl.Log.Error(errors.New("unknown argument"), args[0]+" is not a supported target")
37-
os.Exit(1)
38-
}
39-
}
40-
4128
func MkSFCmd() *cobra.Command {
4229

43-
var (
44-
CAPath string
45-
CertificatePath string
46-
KeyPath string
47-
48-
sfCmd = &cobra.Command{
49-
Use: "SF",
50-
Short: "subcommands related to managing a Software Factory resource",
51-
Long: `Use these subcommands to perform management tasks at the resource level.`,
52-
}
53-
54-
configureCmd = &cobra.Command{
55-
Use: "configure {TLS}",
56-
Short: "configure {TLS}",
57-
Long: "Configure a SF resource. The resource can be the TLS certificates",
58-
ValidArgs: []string{"TLS"},
59-
Run: sfConfigureCmd,
60-
}
61-
)
62-
configureCmd.Flags().StringVar(&CAPath, "CA", "", "path to the PEM-encoded Certificate Authority file")
63-
configureCmd.Flags().StringVar(&CertificatePath, "cert", "", "path to the domain certificate file")
64-
configureCmd.Flags().StringVar(&KeyPath, "key", "", "path to the private key file")
30+
var sfCmd = &cobra.Command{
31+
Use: "SF",
32+
Short: "subcommands related to managing a Software Factory resource",
33+
Long: `Use these subcommands to perform management tasks at the resource level.`,
34+
}
6535

6636
sfCmd.AddCommand(MkBackupCmd())
6737
sfCmd.AddCommand(MkRestoreCmd())
68-
sfCmd.AddCommand(configureCmd)
6938
sfCmd.AddCommand(bootstraptenantconfigrepo.MkBootstrapCmd())
7039

7140
return sfCmd

cli/cmd/tls.go

Lines changed: 0 additions & 144 deletions
This file was deleted.

config/crd/bases/sf.softwarefactory-project.io_softwarefactories.yaml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -137,23 +137,6 @@ spec:
137137
- size
138138
type: object
139139
type: object
140-
letsEncrypt:
141-
description: LetsEncrypt settings for enabling using LetsEncrypt for
142-
Routes/TLS
143-
properties:
144-
server:
145-
description: |-
146-
Specify the Lets encrypt server.
147-
Valid values are:
148-
"staging",
149-
"prod"
150-
enum:
151-
- prod
152-
- staging
153-
type: string
154-
required:
155-
- server
156-
type: object
157140
logserver:
158141
default:
159142
loopDelay: 3600

controllers/gateway.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,5 @@ func (r *SFController) DeployHTTPDGateway() bool {
6464
r.CreateR(&current)
6565
}
6666

67-
isDeploymentReady := r.IsDeploymentReady(&current)
68-
69-
routeReady := r.ensureHTTPSRoute(
70-
ident, r.cr.Spec.FQDN,
71-
ident, "/", port, map[string]string{}, r.cr.Spec.LetsEncrypt)
72-
73-
isReady := isDeploymentReady && routeReady
74-
75-
return isReady
67+
return r.IsDeploymentReady(&current)
7668
}

controllers/libs/base/base.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -329,20 +329,15 @@ func MkHeadlessServicePod(name string, ns string, podName string, ports []int32,
329329

330330
// MkHTTPSRoute produces a Route on top of a Service
331331
func MkHTTPSRoute(
332-
name string, ns string, host string, serviceName string, path string,
333-
port int, annotations map[string]string, customTLS *apiroutev1.TLSConfig) apiroutev1.Route {
332+
name string, ns string, host string, serviceName string, path string, port int) apiroutev1.Route {
334333
tls := apiroutev1.TLSConfig{
335334
InsecureEdgeTerminationPolicy: apiroutev1.InsecureEdgeTerminationPolicyRedirect,
336335
Termination: apiroutev1.TLSTerminationEdge,
337336
}
338-
if customTLS != nil {
339-
tls = *customTLS
340-
}
341337
return apiroutev1.Route{
342338
ObjectMeta: metav1.ObjectMeta{
343-
Name: name,
344-
Namespace: ns,
345-
Annotations: annotations,
339+
Name: name,
340+
Namespace: ns,
346341
},
347342
Spec: apiroutev1.RouteSpec{
348343
TLS: &tls,

0 commit comments

Comments
 (0)