Skip to content

Commit 83230e6

Browse files
Expose Korifi Workloads using GatewayAPI
- cfroute resources and the Gateway API httproute resources are in a one to one relationship: - This simlpifies the cfroute_controller logic and removes the need of finalizing cfroutes. - The finalizer deletion logic is left in place so that legacy routes on live systems can be deleted. - The httproute resources that back the cfroutes simply reuse the cfroute name. - Remove all Contour references from the go code and the helm chart - Remove the `contourRouter.include` helm value as the CFRoute controller is no longer contour specific and does not need to be excluded from the deployment. - Update docs to reflect the switch to the Gateway API. - Create a new ADR to record the decision to use the GatewayAPI for Ingress Co-authored-by: Georgi Sabev <georgethebeatle@gmail.com>
1 parent 980fe26 commit 83230e6

25 files changed

+343
-566
lines changed

README.helm.md

-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ Here are all the values that can be set for the chart:
4141
- `containerRegistrySecret` (_String_): Deprecated in favor of containerRegistrySecrets.
4242
- `containerRegistrySecrets` (_Array_): List of `Secret` names to use when pushing or pulling from package, droplet and kpack builder repositories. Required if eksContainerRegistryRoleARN not set. Ignored if eksContainerRegistryRoleARN is set.
4343
- `containerRepositoryPrefix` (_String_): The prefix of the container repository where package and droplet images will be pushed. This is suffixed with the app GUID and `-packages` or `-droplets`. For example, a value of `index.docker.io/korifi/` will result in `index.docker.io/korifi/<appGUID>-packages` and `index.docker.io/korifi/<appGUID>-droplets` being pushed.
44-
- `contourRouter`:
45-
- `include` (_Boolean_): Deploy the `contour-router` component.
4644
- `controllers`:
4745
- `extraVCAPApplicationValues`: Key-value pairs that are going to be set in the VCAP_APPLICATION env var on apps. Nested values are not supported.
4846
- `image` (_String_): Reference to the controllers container image.

controllers/api/v1alpha1/cfroute_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
)
2626

2727
const (
28+
// Deprecated. Used for removing leftover finalizers
2829
CFRouteFinalizerName = "cfRoute.korifi.cloudfoundry.org"
2930

3031
ValidStatus CurrentStatus = "valid"

controllers/config/config.go

+11-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package config
22

33
import (
4-
"path/filepath"
54
"time"
65

76
"go.uber.org/zap/zapcore"
@@ -14,16 +13,13 @@ type ControllerConfig struct {
1413
IncludeKpackImageBuilder bool `yaml:"includeKpackImageBuilder"`
1514
IncludeJobTaskRunner bool `yaml:"includeJobTaskRunner"`
1615
IncludeStatefulsetRunner bool `yaml:"includeStatefulsetRunner"`
17-
IncludeContourRouter bool `yaml:"includeContourRouter"`
1816

1917
// core controllers
2018
CFProcessDefaults CFProcessDefaults `yaml:"cfProcessDefaults"`
2119
CFStagingResources CFStagingResources `yaml:"cfStagingResources"`
2220
CFRootNamespace string `yaml:"cfRootNamespace"`
2321
ContainerRegistrySecretNames []string `yaml:"containerRegistrySecretNames"`
2422
TaskTTL string `yaml:"taskTTL"`
25-
WorkloadsTLSSecretName string `yaml:"workloads_tls_secret_name"`
26-
WorkloadsTLSSecretNamespace string `yaml:"workloads_tls_secret_namespace"`
2723
BuilderName string `yaml:"builderName"`
2824
RunnerName string `yaml:"runnerName"`
2925
NamespaceLabels map[string]string `yaml:"namespaceLabels"`
@@ -37,11 +33,12 @@ type ControllerConfig struct {
3733
JobTTL string `yaml:"jobTTL"`
3834

3935
// kpack-image-builder
40-
ClusterBuilderName string `yaml:"clusterBuilderName"`
41-
BuilderServiceAccount string `yaml:"builderServiceAccount"`
42-
BuilderReadinessTimeout string `yaml:"builderReadinessTimeout"`
43-
ContainerRepositoryPrefix string `yaml:"containerRepositoryPrefix"`
44-
ContainerRegistryType string `yaml:"containerRegistryType"`
36+
ClusterBuilderName string `yaml:"clusterBuilderName"`
37+
BuilderServiceAccount string `yaml:"builderServiceAccount"`
38+
BuilderReadinessTimeout string `yaml:"builderReadinessTimeout"`
39+
ContainerRepositoryPrefix string `yaml:"containerRepositoryPrefix"`
40+
ContainerRegistryType string `yaml:"containerRegistryType"`
41+
Networking Networking `yaml:"networking"`
4542
}
4643

4744
type CFProcessDefaults struct {
@@ -56,6 +53,11 @@ type CFStagingResources struct {
5653
MemoryMB int64 `yaml:"memoryMB"`
5754
}
5855

56+
type Networking struct {
57+
GatewayName string `yaml:"gatewayName"`
58+
GatewayNamespace string `yaml:"gatewayNamespace"`
59+
}
60+
5961
const (
6062
defaultTaskTTL = 30 * 24 * time.Hour
6163
defaultTimeout int64 = 60
@@ -94,13 +96,6 @@ func GetLogLevelFromPath(path string) (zapcore.Level, error) {
9496
return cfg.LogLevel, nil
9597
}
9698

97-
func (c ControllerConfig) WorkloadsTLSSecretNameWithNamespace() string {
98-
if c.WorkloadsTLSSecretName == "" {
99-
return ""
100-
}
101-
return filepath.Join(c.WorkloadsTLSSecretNamespace, c.WorkloadsTLSSecretName)
102-
}
103-
10499
func (c ControllerConfig) ParseTaskTTL() (time.Duration, error) {
105100
if c.TaskTTL == "" {
106101
return defaultTaskTTL, nil

controllers/config/config_test.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@ var _ = Describe("LoadFromPath", func() {
4343
CFRootNamespace: "rootNamespace",
4444
ContainerRegistrySecretNames: []string{"packageRegistrySecretName"},
4545
TaskTTL: "taskTTL",
46-
WorkloadsTLSSecretName: "workloadsTLSSecretName",
47-
WorkloadsTLSSecretNamespace: "workloadsTLSSecretNamespace",
4846
BuilderName: "buildReconciler",
4947
RunnerName: "statefulset-runner",
5048
JobTTL: "jobTTL",
5149
LogLevel: zapcore.DebugLevel,
5250
SpaceFinalizerAppDeletionTimeout: tools.PtrTo(int64(42)),
51+
Networking: config.Networking{
52+
GatewayName: "gw-name",
53+
GatewayNamespace: "gw-ns",
54+
},
5355
}
5456
})
5557

@@ -81,15 +83,17 @@ var _ = Describe("LoadFromPath", func() {
8183
CFRootNamespace: "rootNamespace",
8284
ContainerRegistrySecretNames: []string{"packageRegistrySecretName"},
8385
TaskTTL: "taskTTL",
84-
WorkloadsTLSSecretName: "workloadsTLSSecretName",
85-
WorkloadsTLSSecretNamespace: "workloadsTLSSecretNamespace",
8686
BuilderName: "buildReconciler",
8787
RunnerName: "statefulset-runner",
8888
NamespaceLabels: map[string]string{},
8989
ExtraVCAPApplicationValues: map[string]any{},
9090
JobTTL: "jobTTL",
9191
LogLevel: zapcore.DebugLevel,
9292
SpaceFinalizerAppDeletionTimeout: tools.PtrTo(int64(42)),
93+
Networking: config.Networking{
94+
GatewayName: "gw-name",
95+
GatewayNamespace: "gw-ns",
96+
},
9397
}))
9498
})
9599

0 commit comments

Comments
 (0)