Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apis/core/v1beta1/featureflagsource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ import (
type FeatureFlagSourceSpec struct {
// ManagemetPort defines the port to serve management on, defaults to 8014
// +optional
// +kubebuilder:default:=8014
ManagementPort int32 `json:"managementPort"`

// Port defines the port to listen on, defaults to 8013
// +optional
// +kubebuilder:default:=8013
Port int32 `json:"port"`

// SocketPath defines the unix socket path to listen on
Expand All @@ -40,6 +42,7 @@ type FeatureFlagSourceSpec struct {

// Evaluator sets an evaluator, defaults to 'json'
// +optional
// +kubebuilder:default:="json"
Evaluator string `json:"evaluator"`

// SyncProviders define the syncProviders and associated configuration to be applied to the sidecar
Expand All @@ -61,10 +64,12 @@ type FeatureFlagSourceSpec struct {

// LogFormat allows for the sidecar log format to be overridden, defaults to 'json'
// +optional
// +kubebuilder:default:="json"
LogFormat string `json:"logFormat"`

// EnvVarPrefix defines the prefix to be applied to all environment variables applied to the sidecar, default FLAGD
// +optional
// +kubebuilder:default:="FLAGD"
EnvVarPrefix string `json:"envVarPrefix"`

// RolloutOnChange dictates whether annotated deployments will be restarted when configuration changes are
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/core.openfeature.dev_featureflagsources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ spec:
description: DefaultSyncProvider defines the default sync provider
type: string
envVarPrefix:
default: FLAGD
description: EnvVarPrefix defines the prefix to be applied to all
environment variables applied to the sidecar, default FLAGD
type: string
Expand Down Expand Up @@ -173,13 +174,16 @@ spec:
type: object
type: array
evaluator:
default: json
description: Evaluator sets an evaluator, defaults to 'json'
type: string
logFormat:
default: json
description: LogFormat allows for the sidecar log format to be overridden,
defaults to 'json'
type: string
managementPort:
default: 8014
description: ManagemetPort defines the port to serve management on,
defaults to 8014
format: int32
Expand All @@ -189,6 +193,7 @@ spec:
flag of flagd sidecar. Default false (disabled).
type: string
port:
default: 8013
description: Port defines the port to listen on, defaults to 8013
format: int32
type: integer
Expand Down
8 changes: 8 additions & 0 deletions docs/crds.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ FeatureFlagSourceSpec defines the desired state of FeatureFlagSource
<td>string</td>
<td>
EnvVarPrefix defines the prefix to be applied to all environment variables applied to the sidecar, default FLAGD<br/>
<br/>
<i>Default</i>: FLAGD<br/>
</td>
<td>false</td>
</tr><tr>
Expand All @@ -294,13 +296,17 @@ are added at the lowest index, all values will have the EnvVarPrefix applied, de
<td>string</td>
<td>
Evaluator sets an evaluator, defaults to 'json'<br/>
<br/>
<i>Default</i>: json<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>logFormat</b></td>
<td>string</td>
<td>
LogFormat allows for the sidecar log format to be overridden, defaults to 'json'<br/>
<br/>
<i>Default</i>: json<br/>
</td>
<td>false</td>
</tr><tr>
Expand All @@ -310,6 +316,7 @@ are added at the lowest index, all values will have the EnvVarPrefix applied, de
ManagemetPort defines the port to serve management on, defaults to 8014<br/>
<br/>
<i>Format</i>: int32<br/>
<i>Default</i>: 8014<br/>
</td>
<td>false</td>
</tr><tr>
Expand All @@ -326,6 +333,7 @@ are added at the lowest index, all values will have the EnvVarPrefix applied, de
Port defines the port to listen on, defaults to 8013<br/>
<br/>
<i>Format</i>: int32<br/>
<i>Default</i>: 8013<br/>
</td>
<td>false</td>
</tr><tr>
Expand Down
90 changes: 90 additions & 0 deletions test/e2e/chainsaw/flagd-with-custom-ports/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: flagd-sample
app.kubernetes.io/managed-by: open-feature-operator
app.kubernetes.io/name: flagd-sample
name: flagd-sample
namespace: ($namespace)
ownerReferences:
- apiVersion: core.openfeature.dev/v1beta1
kind: Flagd
name: flagd-sample
spec:
replicas: 1
selector:
matchLabels:
app: flagd-sample
template:
metadata:
labels:
app: flagd-sample
app.kubernetes.io/managed-by: open-feature-operator
app.kubernetes.io/name: flagd-sample
spec:
containers:
- name: flagd
# renovate: datasource=github-tags depName=open-feature/flagd/flagd
image: ghcr.io/open-feature/flagd:v0.11.1
ports:
- containerPort: 8014
name: management
protocol: TCP
- containerPort: 8013
name: flagd
protocol: TCP
- containerPort: 8016
name: ofrep
protocol: TCP
- containerPort: 8015
name: sync
protocol: TCP
env:
- name: FLAGD_MANAGEMENT_PORT
value: "9999"
- name: FLAGD_PORT
value: "8888"
- name: FLAGD_EVALUATOR
value: json
- name: FLAGD_LOG_FORMAT
value: json
- name: FLAGD_RESOLVER
value: rpc
serviceAccount: default
serviceAccountName: default
---
apiVersion: v1
kind: Service
metadata:
labels:
app: flagd-sample
app.kubernetes.io/managed-by: open-feature-operator
app.kubernetes.io/name: flagd-sample
name: flagd-sample
namespace: ($namespace)
ownerReferences:
- apiVersion: core.openfeature.dev/v1beta1
kind: Flagd
name: flagd-sample
spec:
ports:
- name: flagd
port: 8013
protocol: TCP
targetPort: 8013
- name: ofrep
port: 8016
protocol: TCP
targetPort: 8016
- name: sync
port: 8015
protocol: TCP
targetPort: 8015
- name: metrics
port: 8014
protocol: TCP
targetPort: 8014
selector:
app: flagd-sample
type: ClusterIP
34 changes: 34 additions & 0 deletions test/e2e/chainsaw/flagd-with-custom-ports/00-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: core.openfeature.dev/v1beta1
kind: FeatureFlag
metadata:
name: featureflag-sample
spec:
flagSpec:
flags:
"simple-flag":
state: "ENABLED"
variants:
"on": true
"off": false
defaultVariant: "on"
---
apiVersion: core.openfeature.dev/v1beta1
kind: FeatureFlagSource
metadata:
name: end-to-end
spec:
sources:
- source: featureflag-sample
provider: kubernetes
port: 8888
managementPort: 9999
evaluator: json
---
apiVersion: core.openfeature.dev/v1beta1
kind: Flagd
metadata:
name: flagd-sample
spec:
serviceType: ClusterIP
serviceAccountName: default
featureFlagSource: end-to-end
17 changes: 17 additions & 0 deletions test/e2e/chainsaw/flagd-with-custom-ports/chainsaw-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: flagd-custom-ports
spec:
steps:
- name: step-00
try:
- apply:
file: ../assets/gateway-api.yaml
- name: step-01
try:
- apply:
file: 00-install.yaml
- assert:
file: 00-assert.yaml
Loading