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
18 changes: 0 additions & 18 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,6 @@ jobs:
ref: ${{github.event.pull_request.head.sha}}
fetch-depth: 0

# Setting up helm binary
- name: Set up Helm
uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5
with:
version: v3.20.2

- name: Helm chart unit tests
uses: d3adb5/helm-unittest-action@850bc76597579183998069830d5fa8c3ef0ea34a # v2
with:
charts: deployments/kubernetes/chart/reloader
helm-version: v3.20.2
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
Expand All @@ -88,11 +75,6 @@ jobs:
- name: Run golangci-lint
run: make lint

- name: Helm Lint
run: |
cd deployments/kubernetes/chart/reloader
helm lint
- name: Install kubectl
run: |
curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VERSION}/bin/linux/amd64/kubectl"
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/pull_request_helm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Pull Request Workflow for Helm Chart changes

on:
pull_request:
branches:
- master
- 'v**'
paths:
- 'deployments/kubernetes/chart/reloader/**'

# Default to no GITHUB_TOKEN permissions; each job opts into the minimum it needs.
permissions: {}

jobs:
helm:
permissions:
contents: read
runs-on: ubuntu-latest
name: Helm Lint & Unit Tests
steps:
- name: Check out code
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
ref: ${{ github.event.pull_request.head.sha }}

# Setting up helm binary
- name: Set up Helm
uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5
with:
version: v3.20.2

- name: Helm chart unit tests
uses: d3adb5/helm-unittest-action@850bc76597579183998069830d5fa8c3ef0ea34a # v2
with:
charts: deployments/kubernetes/chart/reloader
helm-version: v3.20.2
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Helm Lint
run: |
cd deployments/kubernetes/chart/reloader
helm lint
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ RUN go mod download
# Copy the go source
COPY cmd/ cmd/
COPY internal/ internal/
COPY pkg/ pkg/

# Build
RUN CGO_ENABLED=0 \
Expand Down
13 changes: 7 additions & 6 deletions cmd/reloader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ import (
"k8s.io/client-go/discovery"
controllerruntime "sigs.k8s.io/controller-runtime"

"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/internal/pkg/config/flags"
"github.com/stakater/Reloader/internal/pkg/controller"
"github.com/stakater/Reloader/internal/pkg/csi"
"github.com/stakater/Reloader/internal/pkg/metadata"
"github.com/stakater/Reloader/internal/pkg/metrics"
"github.com/stakater/Reloader/internal/pkg/openshift"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/pkg/metadata"
)

// Environment variable names for pod identity in HA mode.
Expand All @@ -49,20 +50,20 @@ func newReloaderCommand() *cobra.Command {
RunE: run,
}

config.BindFlags(cmd.PersistentFlags(), cfg)
flags.BindFlags(cmd.PersistentFlags(), cfg)
return cmd
}

func run(cmd *cobra.Command, args []string) error {
// Configure logging first so ApplyFlags can surface namespace-scope warnings
// through a ready logger instead of returning them to the caller.
log, err := configureLogging(config.LoggingFlags())
log, err := configureLogging(flags.LoggingFlags())
if err != nil {
return fmt.Errorf("configuring logging: %w", err)
}
controllerruntime.SetLogger(log)

if err := config.ApplyFlags(cfg, log); err != nil {
if err := flags.ApplyFlags(cfg, log); err != nil {
return fmt.Errorf("applying flags: %w", err)
}

Expand Down Expand Up @@ -116,7 +117,7 @@ func run(cmd *cobra.Command, args []string) error {
log.V(1).Info("Failed to create discovery client", "error", discErr)
}

if config.ShouldAutoDetectOpenShift() {
if flags.ShouldAutoDetectOpenShift() {
if discoveryClient != nil && openshift.HasDeploymentConfigSupport(discoveryClient, log) {
cfg.DeploymentConfigEnabled = true
}
Expand Down
12 changes: 6 additions & 6 deletions deployments/kubernetes/chart/reloader/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ maintainers:
email: rasheed@stakater.com
- name: faizanahmad055
email: faizan@stakater.com
dependencies:
- name: reloader-enterprise
alias: enterprise
version: 0.1.0
repository: oci://ghcr.io/stakater/charts
condition: enterprise.enabled
# dependencies:
# - name: reloader-enterprise
# alias: enterprise
# version: 0.1.0
# repository: oci://ghcr.io/stakater/charts
# condition: enterprise.enabled
2 changes: 1 addition & 1 deletion internal/pkg/alerting/alerter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"time"

"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
)

// AlertMessage contains the details of a reload event to be sent as an alert.
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/alerting/alerter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"testing"
"time"

"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
)

// testServer creates a test HTTP server that captures the request body.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config
package flags

import (
"fmt"
Expand All @@ -9,6 +9,8 @@ import (
"github.com/spf13/pflag"
"github.com/spf13/viper"
"k8s.io/apimachinery/pkg/labels"

"github.com/stakater/Reloader/pkg/config"
)

// v is the viper instance for configuration.
Expand All @@ -23,7 +25,7 @@ func init() {

// BindFlags binds configuration flags to the provided flag set.
// Call this before parsing flags, then call ApplyFlags after parsing.
func BindFlags(fs *pflag.FlagSet, cfg *Config) {
func BindFlags(fs *pflag.FlagSet, cfg *config.Config) {
// Auto reload
fs.Bool(
"auto-reload-all", cfg.AutoReloadAll,
Expand Down Expand Up @@ -275,7 +277,7 @@ func LoggingFlags() (format, level string) {
// ApplyFlags applies flag values from viper to the config struct. Call this
// after parsing flags. It finalizes namespace scope and logs any warnings it
// produces through the given logger.
func ApplyFlags(cfg *Config, log logr.Logger) error {
func ApplyFlags(cfg *config.Config, log logr.Logger) error {
// Boolean flags
cfg.AutoReloadAll = v.GetBool("auto-reload-all")
cfg.SyncAfterRestart = v.GetBool("sync-after-restart")
Expand All @@ -297,7 +299,7 @@ func ApplyFlags(cfg *Config, log logr.Logger) error {
}

// String flags
cfg.ReloadStrategy = ReloadStrategy(v.GetString("reload-strategy"))
cfg.ReloadStrategy = config.ReloadStrategy(v.GetString("reload-strategy"))
cfg.WebhookURL = v.GetString("webhook-url")
cfg.LogFormat = v.GetString("log-format")
cfg.LogLevel = v.GetString("log-level")
Expand Down
Loading
Loading