Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func NewLocalFeatureFlagsProvider(p *providers.Provider) (providers.ClowderProvi
}

func (ff *localFeatureFlagsProvider) EnvProvide() error {

dataInit := createDefaultFFSecMap

namespacedName := providers.GetNamespacedName(ff.Env, "featureflags")
Expand Down Expand Up @@ -217,8 +216,9 @@ func (ff *localFeatureFlagsProvider) EnvProvide() error {

func createDefaultFFSecMap() map[string]string {
return map[string]string{
"adminAccessToken": "*:*." + utils.RandHexString(32),
"clientAccessToken": "default:development." + utils.RandHexString(32),
"adminAccessToken": "*:*." + utils.RandHexString(32),
"clientAccessToken": "default:development." + utils.RandHexString(32),
"frontendAccessToken": "default:*.proxy-123",
}
}

Expand Down Expand Up @@ -265,10 +265,11 @@ func makeLocalFFEdgeIngress(ff *localFeatureFlagsProvider) error {
ingress.Spec = networking.IngressSpec{
IngressClassName: &ingressClass,
Rules: []networking.IngressRule{{
Host: ff.Env.Status.Hostname,
IngressRuleValue: networking.IngressRuleValue{
HTTP: &networking.HTTPIngressRuleValue{
Paths: []networking.HTTPIngressPath{{
Path: "/api/client/features",
Path: "/api/frontend",
PathType: &prefixPathType,
Backend: networking.IngressBackend{
Service: &networking.IngressServiceBackend{
Expand Down Expand Up @@ -325,6 +326,7 @@ func makeLocalFeatureFlags(_ *crd.ClowdEnvironment, o obj.ClowdObject, objMap pr
envVars = provutils.AppendEnvVarsFromSecret(envVars, nn.Name,
provutils.NewSecretEnvVar("INIT_CLIENT_API_TOKENS", "clientAccessToken"),
provutils.NewSecretEnvVar("INIT_ADMIN_API_TOKENS", "adminAccessToken"),
provutils.NewSecretEnvVar("INIT_FRONTEND_API_TOKENS", "frontendAccessToken"),
)

ports := []core.ContainerPort{{
Expand Down
2 changes: 1 addition & 1 deletion tests/kuttl/test-ff-local/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ spec:
- http:
paths:
- pathType: Prefix
path: /api/client/features
path: /api/frontend
backend:
service:
name: test-ff-local-featureflags-edge
Expand Down
8 changes: 4 additions & 4 deletions tests/kuttl/test-ff-local/test_feature_flags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ http_retry() {
}

get_request_edge() {
local TOKEN="$1"
local ENDPOINT="$2"
local RETRIES="$3"
local TOKEN="default:*.proxy-123"
local ENDPOINT="$1"
local RETRIES="$2"
http_retry "$RETRIES" "GET" "$TOKEN" "test-ff-local-featureflags-edge:3063${ENDPOINT}"
}

Expand Down Expand Up @@ -119,7 +119,7 @@ if [ 'true' != "$(get_request "$CLIENT_TOKEN" "/api/client/features/$FEATURE_TOG
fi

echo "Testing that feature toggle '$FEATURE_TOGGLE_NAME' is available through edge service..."
if ! get_request_edge "$CLIENT_TOKEN" "/api/client/features/$FEATURE_TOGGLE_NAME" 15; then
if ! get_request_edge "/api/frontend/$FEATURE_TOGGLE_NAME"; 15 then
echo "Feature toggle '$FEATURE_TOGGLE_NAME' should be available through edge"
exit 1
fi
Loading