Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 18, 2024
2 parents c244767 + 42e77a8 commit 964e992
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 22 deletions.
20 changes: 8 additions & 12 deletions .github/workflows/test-build-update-helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ env:

jobs:
test:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Checkout code
Expand All @@ -48,7 +48,7 @@ jobs:
run: make test

validate-build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Checkout code
Expand All @@ -66,7 +66,7 @@ jobs:
run: make build

validate-image-build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Checkout code
Expand All @@ -80,7 +80,7 @@ jobs:
permissions:
contents: read
packages: write
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/main'
needs:
- test
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
git push --tags
helm-update:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/main'
needs:
- build-push-image
Expand All @@ -153,10 +153,6 @@ jobs:
run: |
sed -i 's/tag: .*/tag: \"${{ github.run_id }}\"/' charts/fga-operator/values.yaml
- name: Update Chart.yaml version
run: |
sed -i -E 's/(version: [0-9]+\.[0-9]+\.[0-9]+).*/\1-${{ github.run_id }}/' charts/fga-operator/Chart.yaml
- name: Commit updated files
run: |
git add charts/fga-operator/values.yaml charts/fga-operator/Chart.yaml
Expand All @@ -167,7 +163,7 @@ jobs:
git push origin HEAD:${{ env.BRANCH }}
helm-release:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/main'
permissions:
contents: write
Expand Down Expand Up @@ -213,7 +209,7 @@ jobs:
contents: read
packages: read
security-events: write
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs:
- build-push-image

Expand Down Expand Up @@ -260,7 +256,7 @@ jobs:
scan-repo:
permissions:
security-events: write
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Checkout repository
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

## [Unreleased]

## [1.0.0] - 2024-10-18

First stable release 🚀

### Changed
- `RECONCILIATION_INTERVAL` now set to 10 s.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ All command line flags has defaults and hence none of them are mandatory.
|-------------------------|---------------------------------------------------------------------------------------------------------------|---------|-----------|-----------------------------------------------------------------------|
| OPENFGA_API_URL | Url to OpenFGA. | - | Yes | "http://127.0.0.1:8089", "http://openfga.demo.svc.cluster.local:8080" |
| OPENFGA_API_TOKEN | Preshared key used for authentication to OpenFGA. | - | Yes | "foobar", "some_token" |
| RECONCILIATION_INTERVAL | The time interval between reconciliation loops, unless an `AuthorizationModelRequest` is created or modified. | "45s" | No | "45s", "5m", "3h" |
| RECONCILIATION_INTERVAL | The time interval between reconciliation loops, unless an `AuthorizationModelRequest` is created or modified. | "10s" | No | "45s", "5m", "3h" |


## Events
Expand Down
2 changes: 1 addition & 1 deletion charts/fga-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ description: |
The operator manages and automates the deployment and reference of OpenFGA
resources like stores and authroization models.
type: application
version: 0.1.0-11408839528
version: 1.0.0
appVersion: "0.1.0"
2 changes: 1 addition & 1 deletion charts/fga-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ controllerManager:
# Image configuration for the controller manager
image:
repository: ghcr.io/3schwartz/fga-operator
tag: "11408839528"
tag: "11409204295"

# Resource requests and limits for the controller manager container
resources:
Expand Down
10 changes: 5 additions & 5 deletions operator/internal/configurations/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ import (
)

const ReconciliationInterval = "RECONCILIATION_INTERVAL"
const DefaultReconciliationInterval = 10 * time.Second

func GetReconciliationInterval(setupLog logr.Logger) time.Duration {
defaultDuration := 45 * time.Second
reconciliationInterval := os.Getenv(ReconciliationInterval)

if reconciliationInterval == "" {
setupLog.Info(fmt.Sprintf("%s not set, using default", ReconciliationInterval), "defaultDuration", defaultDuration)
return defaultDuration
setupLog.Info(fmt.Sprintf("%s not set, using default", ReconciliationInterval), "defaultDuration", DefaultReconciliationInterval)
return DefaultReconciliationInterval
}

requeueAfter, err := time.ParseDuration(reconciliationInterval)
if err != nil {
setupLog.Error(err, fmt.Sprintf("Invalid %s value, using default", ReconciliationInterval), "reconciliationInterval", reconciliationInterval, "defaultDuration", defaultDuration)
return defaultDuration
setupLog.Error(err, fmt.Sprintf("Invalid %s value, using default", ReconciliationInterval), "reconciliationInterval", reconciliationInterval, "defaultDuration", DefaultReconciliationInterval)
return DefaultReconciliationInterval
}

setupLog.Info(fmt.Sprintf("Using %s from environment", ReconciliationInterval), "requeueAfter", requeueAfter)
Expand Down
4 changes: 2 additions & 2 deletions operator/internal/configurations/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestGetRequeueAfterFromEnv(t *testing.T) {
description string
}{
// Test case with no environment variable set (default value should be used)
{"", 45 * time.Second, fmt.Sprintf("%s not set, expect default value of 45 seconds", ReconciliationInterval)},
{"", DefaultReconciliationInterval, fmt.Sprintf("%s not set, expect default value", ReconciliationInterval)},

// Test case with valid second values
{"30s", 30 * time.Second, fmt.Sprintf("%s set to 30 seconds", ReconciliationInterval)},
Expand All @@ -38,7 +38,7 @@ func TestGetRequeueAfterFromEnv(t *testing.T) {
{"3h", 3 * time.Hour, fmt.Sprintf("%s set to 3 hours", ReconciliationInterval)},

// Test case with invalid value (default should be used)
{"invalid-value", 45 * time.Second, fmt.Sprintf("%s set to invalid value, expect default value of 45 seconds", ReconciliationInterval)},
{"invalid-value", DefaultReconciliationInterval, fmt.Sprintf("%s set to invalid value, expect default value", ReconciliationInterval)},
}

// Iterate over each test case
Expand Down

0 comments on commit 964e992

Please sign in to comment.