Skip to content

Commit aef1010

Browse files
authored
fix: flagd path defaults (#658)
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
1 parent dcab14a commit aef1010

File tree

6 files changed

+29
-20
lines changed

6 files changed

+29
-20
lines changed

apis/core/v1beta1/flagd_types.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,19 @@ type IngressSpec struct {
7676
PathType networkingv1.PathType `json:"pathType,omitempty"`
7777

7878
// FlagdPath is the path to be used for accessing the flagd flag evaluation API
79+
// Default: /flagd.evaluation.v1.Service
7980
// +optional
8081
FlagdPath string `json:"flagdPath,omitempty"`
8182

8283
// OFREPPath is the path to be used for accessing the OFREP API
84+
// Default: /ofrep
8385
// +optional
84-
OFREPPath string `json:"ofrepPath"`
86+
OFREPPath string `json:"ofrepPath,omitempty"`
8587

8688
// SyncPath is the path to be used for accessing the sync API
89+
// Default: /flagd.sync.v1.Service
8790
// +optional
88-
SyncPath string `json:"syncPath"`
91+
SyncPath string `json:"syncPath,omitempty"`
8992
}
9093

9194
// FlagdStatus defines the observed state of Flagd

config/crd/bases/core.openfeature.dev_flagds.yaml

+9-6
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ spec:
5656
description: Enabled enables/disables the ingress for flagd
5757
type: boolean
5858
flagdPath:
59-
description: FlagdPath is the path to be used for accessing the
60-
flagd flag evaluation API
59+
description: |-
60+
FlagdPath is the path to be used for accessing the flagd flag evaluation API
61+
Default: /flagd.evaluation.v1.Service
6162
type: string
6263
hosts:
6364
description: Hosts list of hosts to be added to the ingress
@@ -69,16 +70,18 @@ spec:
6970
class to be used for flagd
7071
type: string
7172
ofrepPath:
72-
description: OFREPPath is the path to be used for accessing the
73-
OFREP API
73+
description: |-
74+
OFREPPath is the path to be used for accessing the OFREP API
75+
Default: /ofrep
7476
type: string
7577
pathType:
7678
description: PathType is the path type to be used for the ingress
7779
rules
7880
type: string
7981
syncPath:
80-
description: SyncPath is the path to be used for accessing the
81-
sync API
82+
description: |-
83+
SyncPath is the path to be used for accessing the sync API
84+
Default: /flagd.sync.v1.Service
8285
type: string
8386
tls:
8487
description: TLS configuration for the ingress

controllers/core/flagd/resources/ingress.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import (
66

77
api "github.com/open-feature/open-feature-operator/apis/core/v1beta1"
88
"github.com/open-feature/open-feature-operator/common"
9-
"github.com/open-feature/open-feature-operator/controllers/core/flagd/common"
9+
resources "github.com/open-feature/open-feature-operator/controllers/core/flagd/common"
1010
networkingv1 "k8s.io/api/networking/v1"
1111
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1212
"sigs.k8s.io/controller-runtime/pkg/client"
1313
)
1414

1515
const (
16-
defaultFlagdPath = "/flagd"
16+
defaultFlagdPath = "/flagd.evaluation.v1.Service"
1717
defaultOFREPPath = "/ofrep"
18-
defaultSyncPath = "/sync"
18+
defaultSyncPath = "/flagd.sync.v1.Service"
1919
)
2020

2121
type FlagdIngress struct {

controllers/core/flagd/resources/ingress_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func TestFlagdIngress_getIngress(t *testing.T) {
7171
HTTP: &networkingv1.HTTPIngressRuleValue{
7272
Paths: []networkingv1.HTTPIngressPath{
7373
{
74-
Path: "/flagd",
74+
Path: "/flagd.evaluation.v1.Service",
7575
PathType: &pathType,
7676
Backend: networkingv1.IngressBackend{
7777
Service: &networkingv1.IngressServiceBackend{
@@ -97,7 +97,7 @@ func TestFlagdIngress_getIngress(t *testing.T) {
9797
},
9898
},
9999
{
100-
Path: "/sync",
100+
Path: "/flagd.sync.v1.Service",
101101
PathType: &pathType,
102102
Backend: networkingv1.IngressBackend{
103103
Service: &networkingv1.IngressServiceBackend{
@@ -119,7 +119,7 @@ func TestFlagdIngress_getIngress(t *testing.T) {
119119
HTTP: &networkingv1.HTTPIngressRuleValue{
120120
Paths: []networkingv1.HTTPIngressPath{
121121
{
122-
Path: "/flagd",
122+
Path: "/flagd.evaluation.v1.Service",
123123
PathType: &pathType,
124124
Backend: networkingv1.IngressBackend{
125125
Service: &networkingv1.IngressServiceBackend{
@@ -145,7 +145,7 @@ func TestFlagdIngress_getIngress(t *testing.T) {
145145
},
146146
},
147147
{
148-
Path: "/sync",
148+
Path: "/flagd.sync.v1.Service",
149149
PathType: &pathType,
150150
Backend: networkingv1.IngressBackend{
151151
Service: &networkingv1.IngressServiceBackend{

docs/crds.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,8 @@ Ingress
942942
<td><b>flagdPath</b></td>
943943
<td>string</td>
944944
<td>
945-
FlagdPath is the path to be used for accessing the flagd flag evaluation API<br/>
945+
FlagdPath is the path to be used for accessing the flagd flag evaluation API
946+
Default: /flagd.evaluation.v1.Service<br/>
946947
</td>
947948
<td>false</td>
948949
</tr><tr>
@@ -963,7 +964,8 @@ Ingress
963964
<td><b>ofrepPath</b></td>
964965
<td>string</td>
965966
<td>
966-
OFREPPath is the path to be used for accessing the OFREP API<br/>
967+
OFREPPath is the path to be used for accessing the OFREP API
968+
Default: /ofrep<br/>
967969
</td>
968970
<td>false</td>
969971
</tr><tr>
@@ -977,7 +979,8 @@ Ingress
977979
<td><b>syncPath</b></td>
978980
<td>string</td>
979981
<td>
980-
SyncPath is the path to be used for accessing the sync API<br/>
982+
SyncPath is the path to be used for accessing the sync API
983+
Default: /flagd.sync.v1.Service<br/>
981984
</td>
982985
<td>false</td>
983986
</tr><tr>

test/e2e/chainsaw/flagd-with-ingress-default-paths/00-assert.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ spec:
104104
name: flagd-sample
105105
port:
106106
number: 8013
107-
path: /flagd
107+
path: /flagd.evaluation.v1.Service
108108
pathType: ImplementationSpecific
109109
- backend:
110110
service:
@@ -118,5 +118,5 @@ spec:
118118
name: flagd-sample
119119
port:
120120
number: 8015
121-
path: /sync
121+
path: /flagd.sync.v1.Service
122122
pathType: ImplementationSpecific

0 commit comments

Comments
 (0)