Compare commits

...

1896 Commits

Author SHA1 Message Date
Matheus Pimenta 4ca8fb011f
Merge pull request #1007 from cappyzawa/remove-servername-pinning
runtime/secrets: remove ServerName pinning from TLS config
2025-08-14 14:36:26 +01:00
cappyzawa 8ce7a0dc67
Prepare for release
Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-08-14 22:04:01 +09:00
cappyzawa a254eaccd7
runtime/secrets: remove ServerName pinning from TLS config
Remove ServerName pinning functionality that can cause TLS
verification failures in production environments with redirects,
proxies, and multi-host scenarios.

The Go standard library automatically handles SNI and hostname
verification based on the actual connection target, providing
better compatibility and security than fixed ServerName values.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-08-14 22:03:28 +09:00
Stefan Prodan 6bf77f094c
Merge pull request #1006 from fluxcd/oci-rename-util
oci: Expose `RenameWithFallback` utility
2025-08-12 13:37:27 +03:00
Stefan Prodan b0abad5db0
oci: Expose `RenameWithFallback` utility
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-08-12 13:21:31 +03:00
Stefan Prodan 621a899e4c
Merge pull request #1005 from fluxcd/dependabot/github_actions/ci-914c47a322
build(deps): bump the ci group across 1 directory with 7 updates
2025-08-12 08:47:31 +03:00
dependabot[bot] 2c7a66601d
build(deps): bump the ci group across 1 directory with 7 updates
Bumps the ci group with 7 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `4.2.2` | `5.0.0` |
| [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) | `4.2.1` | `4.3.1` |
| [actions/cache](https://github.com/actions/cache) | `4.2.3` | `4.2.4` |
| [google-github-actions/auth](https://github.com/google-github-actions/auth) | `2.1.10` | `2.1.12` |
| [google-github-actions/setup-gcloud](https://github.com/google-github-actions/setup-gcloud) | `2.1.4` | `2.2.0` |
| [docker/login-action](https://github.com/docker/login-action) | `3.4.0` | `3.5.0` |
| [github/codeql-action](https://github.com/github/codeql-action) | `3.29.2` | `3.29.8` |



Updates `actions/checkout` from 4.2.2 to 5.0.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](11bd71901b...08c6903cd8)

Updates `aws-actions/configure-aws-credentials` from 4.2.1 to 4.3.1
- [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases)
- [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md)
- [Commits](b475783126...7474bc4690)

Updates `actions/cache` from 4.2.3 to 4.2.4
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](5a3ec84eff...0400d5f644)

Updates `google-github-actions/auth` from 2.1.10 to 2.1.12
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](ba79af0395...b7593ed2ef)

Updates `google-github-actions/setup-gcloud` from 2.1.4 to 2.2.0
- [Release notes](https://github.com/google-github-actions/setup-gcloud/releases)
- [Changelog](https://github.com/google-github-actions/setup-gcloud/blob/main/CHANGELOG.md)
- [Commits](77e7a554d4...cb1e50a993)

Updates `docker/login-action` from 3.4.0 to 3.5.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](74a5d14239...184bdaa072)

Updates `github/codeql-action` from 3.29.2 to 3.29.8
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](181d5eefc2...76621b61de)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
- dependency-name: aws-actions/configure-aws-credentials
  dependency-version: 4.3.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: actions/cache
  dependency-version: 4.2.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: google-github-actions/auth
  dependency-version: 2.1.12
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: google-github-actions/setup-gcloud
  dependency-version: 2.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: docker/login-action
  dependency-version: 3.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-version: 3.29.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-12 04:34:29 +00:00
Matheus Pimenta 4bb23ecbdb
Merge pull request #1002 from dipti-pai/azure-privatecloud-oidc
auth/azure: Add support for custom Azure cloud configurations
2025-08-07 19:39:47 +01:00
Dipti Pai d6fbf47b79 auth/azure: Add support for custom Azure cloud configurations
- Read Azure endpoint configuration from JSON file.
- JSON file path is configured via AZURE_ENVIRONMENT_FILEPATH env variable.
- Unit tests.

Signed-off-by: Dipti Pai <diptipai89@outlook.com>
2025-08-07 11:23:52 -07:00
Matheus Pimenta a849bcf3b7
Merge pull request #1004 from fluxcd/auth-hc-refactor
auth: Refactor usage of http client from options
2025-08-07 16:55:43 +01:00
Matheus Pimenta a795fdc737
auth: Refactor usage of http client from options
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-08-07 15:59:34 +01:00
Matheus Pimenta 11982f6ab4
Merge pull request #1003 from cappyzawa/feat/http-client-timeout
auth: add 10-second timeout to HTTP client for token acquisition
2025-08-07 11:08:12 +01:00
cappyzawa a2c5712e16
Prepare for release
Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-08-07 10:42:03 +09:00
cappyzawa 48209adba5
auth: add 10-second timeout to HTTP client for token acquisition
Improve the GetHTTPClient() method to always return an HTTP client
with a 10-second timeout, preventing indefinite hangs during token
acquisition from cloud provider STS services.

The oauth2 library may not properly handle context cancellation
internally, so setting a timeout at the HTTP client level provides
reliable protection against indefinite hangs when making requests
to cloud provider endpoints for token exchange.

This ensures token acquisition completes within a reasonable time
frame while maintaining existing proxy configuration support.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-08-07 10:34:13 +09:00
Matheus Pimenta f227e67fdd
Merge pull request #1001 from cappyzawa/feat/github-app-support-authmethodsfromsecret
runtime/secrets: add GitHub App support to AuthMethodsFromSecret
2025-08-06 13:03:29 +01:00
cappyzawa 5f5e254bd2
Prepare for release
Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-08-06 14:48:09 +09:00
cappyzawa c3282981b7
runtime/secrets: add GitHub App support to AuthMethodsFromSecret
Enable unified GitHub App authentication handling across Flux controllers
by integrating GitHub App support into the existing AuthMethodsFromSecret
pattern used by other controllers.

This improves consistency and reduces code duplication when controllers
need to handle GitHub App authentication. The implementation uses a type
alias for direct compatibility with existing pkg/git/github APIs while
maintaining package independence.

Remove unused GitHubAppAuth struct to avoid confusion with the new
GitHubAppData type alias.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-08-05 20:50:59 +09:00
Matheus Pimenta f01e8d6848
Merge pull request #999 from abhijith-darshan/feat/gh_app_ca
git/github: Add support for mTLS to GitHub App transport
2025-08-02 21:39:16 +01:00
Matheus Pimenta e77a11bc22
Prepare for release
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-08-02 21:19:00 +01:00
abhijith-darshan 9fd9628968
git/github: Add support for mTLS to GitHub App transport
This commit ensures if available, a custom ca.crt is appended to system cert pool and set to the github app transport tls configuration

Signed-off-by: abhijith-darshan <abhijith.darshan@hotmail.com>

Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-08-02 21:17:30 +01:00
Matheus Pimenta 04d916d0c5
Merge pull request #997 from cappyzawa/feat/tls-config-from-secret-ref-options
runtime/secrets: add TLSConfigOption support to TLSConfigFromSecretRef
2025-07-29 23:46:30 +01:00
cappyzawa 4642dabf28
Prepare for release
Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-30 07:19:18 +09:00
cappyzawa 27b414e80f
runtime/secrets: add TLSConfigOption support to TLSConfigFromSecretRef
Add TLSConfigOption support to TLSConfigFromSecretRef function to
maintain consistency with TLSConfigFromSecret. This enables the same
configuration options (like WithSystemCertPool) for both functions.

The change maintains backward compatibility by using variadic parameters.
Also added test coverage for the new functionality.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-30 07:17:36 +09:00
Matheus Pimenta dbf1d227b0
Merge pull request #995 from cappyzawa/feat/tls-config-options
runtime/secrets: add WithSystemCertPool for CA handling
2025-07-29 17:43:51 +01:00
cappyzawa cb022f764d
Prepare for release
Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-30 01:27:10 +09:00
cappyzawa 488ca0955a
runtime/secrets: add WithSystemCertPool for CA handling
Flux controllers require different CA certificate handling modes:
- Replace mode (default): trust only user-provided CA certificates
- Extend mode: trust both system and user-provided CA certificates

This change adds functional options to TLSConfigFromSecret and
AuthMethodsFromSecret to support both modes. The default behavior
remains unchanged (replace mode) for security, while controllers
can opt-in to extend mode using WithSystemCertPool().

This enables unified secret handling across all Flux components
while maintaining backward compatibility and controller-specific
CA trust requirements.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-30 01:26:30 +09:00
Matheus Pimenta 1c8c7bb531
Merge pull request #993 from cappyzawa/feat/remove-insecure-parameter
runtime/secrets: remove insecure parameter from TLS funcs
2025-07-28 16:00:07 +01:00
cappyzawa e98aecf00e
Prepare for release
Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-28 23:40:32 +09:00
cappyzawa b59d18da0a
runtime/secrets: remove insecure parameter from TLS funcs
Remove the insecure boolean parameter from TLSConfigFromSecret
and TLSConfigFromSecretRef functions to enforce Flux security
policy that prohibits bypassing TLS certificate validation.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-28 23:39:49 +09:00
Stefan Prodan 44b53bd4ae
Merge pull request #992 from fluxcd/ssa-manager-exact-match
ssa: Add exact match option to field manager removal
2025-07-28 12:42:34 +03:00
Stefan Prodan ff888a4ac7
ssa: Add exact match option to field manager removal
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-07-28 00:21:32 +03:00
Matheus Pimenta 95760a79c9
Merge pull request #991 from cappyzawa/feat/runtime-secrets-targeturl-insecure
runtime/secrets: add targetURL and insecure to TLS functions
2025-07-21 15:38:06 +01:00
cappyzawa 60b1dea324
Prepare for release
Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-21 00:30:30 +09:00
cappyzawa 7930b7b806
runtime/secrets: add targetURL and insecure to TLS functions
Add targetURL and insecure parameters to TLSConfigFromSecret and
TLSConfigFromSecretRef to resolve ServerName regression issues in
virtual hosting environments.

The migration to runtime/secrets caused TLS handshake failures
because Go cannot automatically set ServerName when custom
tls.Config is provided to http.Transport.TLSClientConfig.

This change enables proper SNI support by extracting hostname
from targetURL and setting tlsConfig.ServerName. The insecure
parameter provides consistent InsecureSkipVerify handling across
all Flux controllers.

Implement Functional Options Pattern for AuthMethodsFromSecret
with WithTLS() option to support mixed authentication scenarios
while maintaining backward compatibility through default values.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-21 00:27:20 +09:00
Matheus Pimenta ea0856db0e
Merge pull request #990 from ymettier/bug-nested-map-slice-slice
chartutil: Fix sort not recursing for slices
2025-07-19 13:32:17 +01:00
Yves Mettier 525798301f chartutil: Fix sort not recursing for slices
Signed-off-by: Yves Mettier <ymettier@free.fr>
2025-07-19 13:11:15 +01:00
Matheus Pimenta 4f64822f3a
Merge pull request #989 from cappyzawa/feat/runtime-secrets-token-auth-support
runtime/secrets: add TokenAuth detection support
2025-07-18 15:44:06 +01:00
cappyzawa a75690c399
Prepare for release
Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-18 23:25:14 +09:00
cappyzawa 447804609f
runtime/secrets: add TokenAuth detection support
Add TokenAuth detection to AuthMethodsFromSecret. TokenAuth uses "token"
key while BearerAuth uses "bearerToken" key, enabling unified token-based
authentication through runtime/secrets.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-18 20:17:34 +09:00
cappyzawa 754624dafa
runtime/secrets: simplify BearerAuth to string type
BearerAuth represents a single string value and doesn't need struct
wrapping. This change improves memory efficiency and aligns with Go
idioms for simple value types.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-18 20:17:34 +09:00
Matheus Pimenta d93949611e
Merge pull request #988 from fluxcd/restconfig-azure-cloud
[RFC-0010] auth/azure: Support all Azure clouds for remote clusters at the controller level
2025-07-18 08:08:21 +01:00
Matheus Pimenta ef45e8d331
[RFC-0010] auth/azure: Support all Azure clouds for remote clusters at the controller level
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-17 17:40:34 +01:00
Matheus Pimenta c3b108fc36
Merge pull request #983 from cappyzawa/feature/detect-auth-from-secret
runtime/secrets: add AuthMethodsFromSecret for multiple auth support
2025-07-17 17:36:43 +01:00
Matheus Pimenta fddd5f143b
Prepare for release
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-17 17:18:47 +01:00
cappyzawa 22e822f7d9
runtime/secrets: support multiple authentication methods in secrets
Add AuthMethodsFromSecret function to handle secrets containing
multiple authentication credentials, enabling combinations like
Basic Auth + TLS or Bearer Token + SSH authentication.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-18 01:08:40 +09:00
Matheus Pimenta dc9bf746cb
Merge pull request #986 from jvcdk/bugfix/retryable-http-should-honor-http-code-429
runtime/events: Fix rate limits error handling in recorder
2025-07-16 14:32:23 +01:00
Matheus Pimenta 8804d2f561
Prepare for release
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-16 14:14:32 +01:00
Jørn Villesen Christensen 269920c337
runtime/events: Fix rate limits error handling in recorder
The notification controller sends a 429 Too Many Requests message when a message is duplicated. Thus if we
receive a 429, we should discard the message.

Signed-off-by: Jørn Villesen Christensen <11997038+jvcdk@users.noreply.github.com>
2025-07-16 14:14:06 +01:00
Matheus Pimenta 2e38bdab2d
Merge pull request #985 from fluxcd/test-watch-helm
runtime/controller: Add test case for watching all configs except helm storage
2025-07-16 08:43:29 +01:00
Matheus Pimenta 7528b2cc9c
runtime/controller: Add test case for watching all configs except helm storage
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-16 08:25:01 +01:00
Matheus Pimenta 86263bb10b
Merge pull request #984 from fluxcd/watch-configs-empty-everything
runtime/controller: Fix watch configs for empty label selector
2025-07-16 08:16:34 +01:00
Matheus Pimenta 7c029aeb7b
runtime/controller: Fix watch configs for empty label selector
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-16 07:53:15 +01:00
Matheus Pimenta 7a820924bf
Merge pull request #982 from fluxcd/watch-label
Introduce label selector for watching ConfigMaps and Secrets
2025-07-15 18:59:36 +01:00
Matheus Pimenta 252071547d
runtime/controller: Use controller_test package for tests
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-15 18:46:11 +01:00
Matheus Pimenta 200b6b6972
runtime/controller: Introduce flag for watching config resources
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-15 18:46:11 +01:00
Matheus Pimenta 237b27666d
apis/meta: Introduce label for watching config resources
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-15 18:46:06 +01:00
Stefan Prodan c706ea8774
Merge pull request #944 from fluxcd/dependabot/github_actions/ci-08ea3624a6
build(deps): bump the ci group across 1 directory with 3 updates
2025-07-15 09:04:13 +03:00
dependabot[bot] f63a79748e
build(deps): bump the ci group across 1 directory with 3 updates
Bumps the ci group with 3 updates in the / directory: [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action), [ossf/scorecard-action](https://github.com/ossf/scorecard-action) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `docker/setup-buildx-action` from 3.10.0 to 3.11.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](b5ca514318...18ce135bb5)

Updates `ossf/scorecard-action` from 2.4.1 to 2.4.2
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](f49aabe0b5...05b42c6244)

Updates `github/codeql-action` from 3.28.17 to 3.29.0
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](60168efe1c...ce28f5bb42)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-version: 3.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: ossf/scorecard-action
  dependency-version: 2.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-version: 3.29.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-14 23:05:02 +00:00
Stefan Prodan 578210e99f
Merge pull request #981 from fluxcd/fix-permissions-gha
ci: Fix missing permissions for `preview-release` workflow
2025-07-14 20:07:58 +03:00
Stefan Prodan 0a9d0bb2a8
ci: Fix missing permissions for `preview-release` workflow
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-07-14 19:35:37 +03:00
Matheus Pimenta c866cff616
Merge pull request #980 from fluxcd/fix-typo
github: Remove redundant options
2025-07-14 16:17:00 +01:00
Matheus Pimenta 72ea7ac97f
github: Remove redundant options
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-14 15:56:18 +01:00
Matheus Pimenta 66a0184e4d
Merge pull request #979 from fluxcd/preview-release
Add Preview Release workflow
2025-07-14 13:39:07 +01:00
Matheus Pimenta e9a43c60b3
Add Preview Release workflow
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-14 13:27:15 +01:00
Matheus Pimenta 6d798f4353
Merge pull request #960 from fluxcd/restconfig
[RFC-0010] Introduce authentication for clusters
2025-07-14 12:29:40 +01:00
Matheus Pimenta 8bef64b166
[RFC-0010] Introduce authentication for clusters
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-14 11:27:08 +01:00
Stefan Prodan 97cc6ae9e4
Merge pull request #978 from fluxcd/make-sops-secret
runtime/secrets: Add `MakeSOPSSecret`
2025-07-14 13:23:05 +03:00
Stefan Prodan e4649aeb4c
runtime/secrets: Add `MakeSOPSSecret`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-07-14 13:03:49 +03:00
Stefan Prodan 5d6f266ea7
Merge pull request #977 from fluxcd/set-secret-gvk
runtime/secrets: Set GVK on generated secrets
2025-07-14 12:29:31 +03:00
Stefan Prodan 5aaefdfd83
runtime/secrets: Set GVK on generated secrets
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-07-14 12:12:33 +03:00
Matheus Pimenta 7bbf65e375
Merge pull request #976 from fluxcd/refactor-deps-sort
runtime/dependency: Simplify dependency sorting algorithm
2025-07-14 09:30:37 +01:00
Matheus Pimenta d41b5b4983
runtime/dependency: Simplify dependency sorting algorithm
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-14 01:00:45 +01:00
Matheus Pimenta cd4fe98d56
Merge pull request #974 from fluxcd/fix-bump-detection
tools: Fix module bump detection for bumps that cause other bumps
2025-07-13 15:56:36 +01:00
Matheus Pimenta d63225ec17
tools: Fix module bump detection for bumps that cause other bumps
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-13 15:44:14 +01:00
Stefan Prodan b58975195e
Merge pull request #973 from fluxcd/readme-update
List the GitOps Toolkit Go SDK packages
2025-07-13 17:33:26 +03:00
Stefan Prodan 93ecf129b5
List the GitOps Toolkit Go SDK package
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-07-13 15:28:30 +03:00
Matheus Pimenta f30f3eb1dc
Merge pull request #972 from fluxcd/tools
tools: Introduce CLI tools for helping with Flux development tasks
2025-07-13 12:40:52 +01:00
Matheus Pimenta da8d033dfc
tools: Introduce CLI tools for helping with Flux development tasks
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-13 12:21:58 +01:00
Stefan Prodan a3804267aa
Merge pull request #971 from fluxcd/secrets-gha
runtime/secrets: Add `MakeGitHubAppSecret` & `MakeSSHSecret`
2025-07-13 14:15:45 +03:00
Stefan Prodan 6d156d81e1
runtime/secrets: Add server-side apply helper
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-07-13 12:09:12 +03:00
Stefan Prodan 022e5483ca
runtime/secrets: Standardise key names
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-12 18:11:49 +01:00
Stefan Prodan ddfc64b0ad
runtime/secrets: Add `MakeSSHSecret`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-07-12 18:18:04 +03:00
Stefan Prodan 18c2741e48
runtime/secrets: Add `MakeGitHubAppSecret`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-07-12 17:23:53 +03:00
Matheus Pimenta 856b04da5d
Merge pull request #970 from cappyzawa/add-client-based-secret-variants
runtime/secrets: add client-based API variants for TLS and Proxy functions
2025-07-12 04:49:19 +01:00
cappyzawa 14d994dcd5
runtime/secrets: separate API reading from Secret conversion
Separate file responsibilities in the runtime/secrets package:
- reader.go: API server reading functions (XXXFromSecretRef)
- converter.go: Secret conversion functions (XXXFromSecret)

The client-based API variants (TLSConfigFromSecretRef,
ProxyURLFromSecretRef) provide convenient auto-fetching for
use cases where Secrets contain only relevant data without
mixed authentication information.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-12 05:22:26 +09:00
cappyzawa c929dfc8af
runtime/secrets: add client-based API variants
Add new client-based API functions that automatically fetch secrets
from the API server:

- TLSConfigFromSecretRef: Creates TLS config from secret reference
- ProxyURLFromSecretRef: Creates proxy URL from secret reference

These functions provide convenience wrappers around the existing
Secret pointer-based APIs, reducing boilerplate for common use cases
like spec.certSecretRef and spec.proxySecretRef.

The functions internally use the existing TLSConfigFromSecret and
ProxyURLFromSecret implementations, ensuring consistent behavior
and maintaining all legacy field support.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-12 05:09:32 +09:00
Matheus Pimenta 9e79277372
Merge pull request #968 from cappyzawa/feat/runtime-secrets-pointer-based-api
runtime/secrets: migrate to Secret pointer-based APIs
2025-07-11 12:51:39 +01:00
cappyzawa 9ee2d52b4b
runtime/secrets: migrate to Secret pointer-based APIs
Migrate runtime/secrets package APIs from client-based Secret
fetching to Secret pointer-based APIs to solve double Secret
fetch problems and improve architecture through separation
of concerns.

API Changes:
- TLSConfigFromSecret: changed from (ctx, client, name, namespace)
  to (ctx, secret) signature
- ProxyURLFromSecret: changed from (ctx, client, name, namespace)
  to (ctx, secret) signature
- BasicAuthFromSecret: changed from (ctx, client, name, namespace)
  to (ctx, secret) signature
- PullSecretsFromServiceAccount: renamed to
  PullSecretsFromServiceAccountRef with (ctx, client, saRef)
  signature using types.NamespacedName for type safety

Additional improvements:
- Improved constant naming for better clarity (TLSKeyKey to
  TLSPrivateKeyKey, ProxyAddressKey to AddressKey)
- Added Legacy prefix to legacy field constants for distinction
- Move Secret retrieval responsibility to callers, eliminating
  double fetch scenarios while maintaining legacy field support

These changes move Secret retrieval responsibility to callers,
eliminating double fetch scenarios while maintaining all
existing functionality including legacy field support.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-11 20:19:59 +09:00
Matheus Pimenta e04986eb42
Merge pull request #967 from fluxcd/bump-pkg
Prepare for release
2025-07-11 09:36:36 +01:00
Matheus Pimenta 59d65f6222
Prepare for release
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-10 22:50:53 +01:00
Stefan Prodan 607f4b2d84
Merge pull request #966 from fluxcd/update-deps-1.33.2
Update dependencies to Kubernetes v1.33.2
2025-07-10 17:28:52 +03:00
Stefan Prodan c895e9f68f
Update dependencies to Kubernetes v1.33.2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-07-10 16:41:41 +03:00
Matheus Pimenta 6c8e4c1892
Merge pull request #962 from dgunzy/fix/ignore-paths-diff
Fix scanManifests to respect ignore patterns
2025-07-10 11:30:12 +01:00
Daniel Guns 1649a3c36d Add ignorepaths to scan manifests to fix --ignore-paths flag
Fixes #4921

Signed-off-by: Daniel Guns <danbguns@gmail.com>
2025-07-10 07:14:27 -03:00
Stefan Prodan 07494843c9
Merge pull request #965 from fluxcd/oci-insecure-transport
oci: Add `insecure` option to retry transport
2025-07-10 12:32:14 +03:00
Stefan Prodan 647e4790e3
oci: Add `insecure` option to retry transport
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-07-10 10:43:41 +03:00
Stefan Prodan 53191111ba
Merge pull request #964 from fluxcd/fix-ssa-wait
ssa: Fix waiting for classes in `ApplyAllStaged`
2025-07-08 19:03:31 +03:00
Stefan Prodan 1a2d666360
ssa: Fix waiting for classes in `ApplyAllStaged`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-07-08 18:38:31 +03:00
Stefan Prodan 534b608a89
Merge pull request #963 from fluxcd/ssa-staged
ssa: Staged apply for `ClusterRoles` and `Classes`
2025-07-08 17:47:20 +03:00
Matheus Pimenta 69c9e52ecd
Add test for non-cluster-admin service account deploying CR+CRB
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-07-08 15:26:22 +01:00
Stefan Prodan 2f61fd67e3
ssa: Add `ClusterRole` and `Classes` to `ApplyAllStaged`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-07-08 12:44:37 +03:00
Stefan Prodan 14aaf932a7
ssa: Move `ClusterRole` up in kind order
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-07-08 12:42:04 +03:00
Stefan Prodan 24b87dc71e
ssa: Add `IsClusterRole` and `IsClassDefinition`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-07-08 12:30:09 +03:00
Stefan Prodan c94a1a436a
ssa: Remove deprecated `SetNativeKindsDefaults`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-07-08 11:17:29 +03:00
Matheus Pimenta d07717ff22
Merge pull request #961 from cappyzawa/fix/runtime-secrets-logger-from-context
runtime/secrets: use context-based logger retrieval
2025-07-02 18:50:04 +01:00
cappyzawa ec70e5a451
runtime/secrets: use context-based logger retrieval
Update TLSConfigFromSecret to retrieve logger from context using
log.FromContext(ctx) instead of accepting logger as parameter.
This aligns with Flux's pattern of obtaining loggers from context.

The function signature changes from:
  TLSConfigFromSecret(ctx, client, name, namespace, logger)
to:
  TLSConfigFromSecret(ctx, client, name, namespace)

Tests updated to inject loggers into context using log.IntoContext()
for proper logger behavior verification.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-07-03 02:25:00 +09:00
Matheus Pimenta 3671c3a960
Merge pull request #958 from cappyzawa/update-kustomize-v5.7.0
kustomize: Update kustomize to v5.7.0
2025-06-30 10:47:35 +01:00
cappyzawa 692aef15c1
kustomize: Update kustomize to v5.7.0
Update kustomize dependency from v5.6.0 to v5.7.0 which includes
a fix for handling multiple $patch: delete strategic merge patches
in a single patch file that was causing panics.

Changes:
- Update kustomize/api from v0.19.0 to v0.20.0
- Update kustomize/kyaml from v0.19.0 to v0.20.0
- Update sigs.k8s.io/yaml from v1.4.0 to v1.5.0

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-30 11:19:03 +09:00
Matheus Pimenta 21cbf19670
Merge pull request #952 from dgunzy/fix-invalid-cabundle-crd-reconciliation
fix: Remove CABundle from CRD objects if the cert is invalid
2025-06-29 15:45:04 +01:00
Daniel Guns 703cbcae7c
fix(ssa): remove invalid CABundle from CRD patches
Starting with Kubernetes 1.31, CRDs with invalid certs in
spec.conversion.webhook.clientConfig.caBundle are rejected by the API.
Validate the bundle and remove the field from SSA patch if validation fails.

Fixes #800

Signed-off-by: Daniel Guns <danbguns@gmail.com>
2025-06-29 11:32:31 -03:00
Matheus Pimenta 645523ed6a
Merge pull request #955 from cappyzawa/add-deprecated-field-logging
runtime/secrets: add legacy field logging to TLS functions
2025-06-28 18:25:34 +01:00
cappyzawa 88a990f702
runtime/secrets: add legacy field logging to TLS functions
Add logging functionality to TLSConfigFromSecret that warns when legacy
field names (certFile, keyFile, caFile) are used instead of standard
Kubernetes field names (tls.crt, tls.key, ca.crt).

Legacy field support is always enabled to ensure consistency across all
Flux APIs, and logging is required to encourage migration to standard
field names in preparation for eventual v2 API transition.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-29 02:09:10 +09:00
Matheus Pimenta 264a3b326b
Merge pull request #954 from fluxcd/fix-rsa-hk-algos
fix: Support rsa-sha2-512 and rsa-sha2-256 host key algos when ssh-rsa is supported
2025-06-27 09:14:58 +01:00
Matheus Pimenta 343e4db1c8
Add test for cloning Azure DevOps Git repository with SSH
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-06-27 08:58:01 +01:00
Matheus Pimenta 780892cf52
Support rsa-sha2-512 and rsa-sha2-256 host key algos when ssh-rsa is supported
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-06-27 08:57:22 +01:00
Matheus Pimenta e5de5fadd4
Merge pull request #951 from cappyzawa/remove-runtime-tls-package
runtime/tls: remove deprecated package
2025-06-25 19:16:27 +01:00
cappyzawa aab4541927
runtime/tls: remove deprecated package
Remove the runtime/tls package which uses deprecated field names
(certFile, keyFile, caFile) for TLS secrets. This functionality
is superseded by the runtime/secrets package which provides
better API design and supports both standard field names
(tls.crt, tls.key, ca.crt) and deprecated field names via options.

Investigation confirmed that this package is not used by any
FluxCD controllers (source-controller, kustomize-controller,
helm-controller, notification-controller, image-automation-controller)
and can be safely removed.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-26 03:00:29 +09:00
Matheus Pimenta 5d705429d0
Merge pull request #950 from cappyzawa/add-runtime-secrets-package
runtime/secrets: add package for consolidated secret handling
2025-06-25 18:46:44 +01:00
cappyzawa deb3fae05d
fixup! fixup! runtime/secrets: add package for consolidated secret handling
Remove unnecessary JSON injection test case

Remove the 'registry with JSON injection attempt' test case as it
doesn't provide practical value - it's testing Go's json.Marshal
escaping behavior rather than actual security concerns. We already
have a proper 'registry with special characters in credentials'
test case that covers real-world scenarios.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-25 02:46:10 +09:00
cappyzawa 9eb2c69533
fixup! fixup! fixup! fixup! runtime/secrets: add package for consolidated secret handling
Add secret references to error messages in all public functions

Based on review feedback from stefanprodan and matheuscscp:

- Update KeyNotFoundError to include Secret field for consistent
  error formatting with secret reference
- Add secret references to ProxyURLFromSecret error messages
- Add serviceaccount references to PullSecretsFromServiceAccount
  error messages
- Update getSecret to use consistent error formatting with secret
  references
- Remove unused formatResourceError function
- Update all test expectations to match new error message format

All error messages now consistently include resource references
in the format 'namespace/name' with single quotes for better
user experience.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-25 02:11:20 +09:00
cappyzawa 94fce87753
fixup! fixup! fixup! runtime/secrets: add package for consolidated secret handling
improve TLS validation error messages

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-25 01:16:36 +09:00
cappyzawa 27e72a9870
fixup! fixup! runtime/secrets: add package for consolidated secret handling
improve JSON formatting for registry secrets

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-25 00:52:01 +09:00
cappyzawa 939a6967c0
fixup! fixup! runtime/secrets: add package for consolidated secret handling
refactor to share TLS certificate handling logic

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-24 23:49:12 +09:00
cappyzawa 86bf9bb8b1
fixup! runtime/secrets: add package for consolidated secret handling
MakeTLSSecret: unify API with TLSConfigFromSecret

Redesign MakeTLSSecret to support flexible certificate configurations:

- Support CA-only secrets (SecretTypeOpaque)
- Support cert+key-only secrets (SecretTypeTLS)
- Support both CA and cert+key (SecretTypeTLS with ca.crt)
- Use shared tlsCertificateData struct with validation methods
- Add WithCertKeyPair option for certificate and key pairs
- Remove redundant MakeCACertSecret function
- Automatic secret type selection based on contents

This change ensures API consistency between TLSConfigFromSecret
and MakeTLSSecret as requested in the review feedback.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-24 23:14:25 +09:00
cappyzawa 2abb73876b
fixup! runtime/secrets: add package for consolidated secret handling
PullSecretsFromServiceAccount: remove unnecessary if statement

Remove the unnecessary check for empty ImagePullSecrets as make() with
zero capacity returns the same result and improves code readability.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-24 22:58:29 +09:00
cappyzawa c79f432df7
fixup! runtime/secrets: add package for consolidated secret handling
TLSConfigFromSecret: support flexible certificate configurations

Implement review feedback from stefanprodan and matheuscscp:

- Support CA-only configuration for server verification
- Support cert+key-only for mTLS client authentication
- Support both CA and cert+key for full mTLS
- Add validation to error when cert exists without key or vice versa
- Simplify tlsCertificateData with method-based validation
- Update tests to handle different certificate scenarios dynamically

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-24 22:49:40 +09:00
cappyzawa b4cca3a7a6
fixup! runtime/secrets: add package for consolidated secret handling
runtime/secrets: refactor TLSConfigFromSecret for better separation of concerns

Split TLSConfigFromSecret into smaller functions with clear responsibilities:
- getTLSCertificateData: extracts certificate data from secrets
- buildTLSConfig: constructs TLS config from certificate data
- tlsCertificateData: custom struct to hold cert, key, and CA data

This improves code readability, testability, and follows single responsibility
principle. Also reorganized function order with exported functions first.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-24 13:36:35 +09:00
cappyzawa c4f35dc949
fixup! runtime/secrets: add package for consolidated secret handling
Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-24 09:26:10 +09:00
cappyzawa 7ab7028eed
fixup! runtime/secrets: add package for consolidated secret handling
Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-24 09:01:20 +09:00
cappyzawa 7ab67140d1
fixup! runtime/secrets: add package for consolidated secret handling
Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-23 23:01:56 +09:00
cappyzawa 86f98f4b56
fixup! runtime/secrets: add package for consolidated secret handling
Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-23 22:55:11 +09:00
cappyzawa b74e03de55
runtime/secrets: add package for consolidated secret handling
Add a new runtime/secrets package to consolidate secret handling
patterns across Flux. This package provides:

- TLSConfigFromSecret: creates TLS config from Kubernetes secrets
  with support for both standard (tls.crt, tls.key, ca.crt) and
  deprecated (certFile, keyFile, caFile) field names via options
- ProxyURLFromSecret: extracts proxy configuration from secrets
- BasicAuthFromSecret: retrieves basic auth credentials
- PullSecretsFromServiceAccount: resolves image pull secrets
- Make functions for creating various secret types (TLS, proxy,
  basic auth, registry, bearer token, generic token)

The package uses functional options pattern to configure behavior,
such as enabling support for deprecated field names.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-23 22:42:04 +09:00
Matheus Pimenta 2a76f6a42e
Merge pull request #946 from cappyzawa/fix-unsupported-provider-error
Fix unsupported provider error handling in GetArtifactRegistryCredentials
2025-06-20 17:13:05 +01:00
cappyzawa 64668951fb
authutils: fix unsupported provider error handling
Changes GetArtifactRegistryCredentials() to return a proper error for
unsupported providers instead of returning (nil, nil). This implements
the suggestion from reviewers in
https://github.com/fluxcd/image-reflector-controller/pull/786.

Changes:
- Add comprehensive tests for provider lookup behavior
- Create shared error.go with package-level error definitions
- Return ErrUnsupportedProvider for unsupported providers
- Update git.go to use shared ErrUnsupportedProvider
- Eliminate need for callers to check (nil, nil) return values

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2025-06-21 00:57:02 +09:00
Matheus Pimenta f42ddf3bea
Merge pull request #945 from fluxcd/sort-semver
Add sorting to version
2025-06-19 20:28:34 +01:00
Matheus Pimenta 1fc5c6d385
Add sorting to version
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-06-19 20:13:01 +01:00
Matheus Pimenta dcd0517161
Merge pull request #943 from fluxcd/fix-host-keys
Fix gogit host key negotiation to accept all key types
2025-06-12 17:47:39 +01:00
Matheus Pimenta 5827364f05
Fix gogit host key negotiation to accept all key types
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-06-12 17:30:37 +01:00
Matheus Pimenta 246bc825f6
Merge pull request #942 from fluxcd/force-annotation
Introduce `reconcile.fluxcd.io/forceAt` annotation
2025-06-11 12:22:50 +01:00
Matheus Pimenta 86ef319f22
Introduce reconcile.fluxcd.io/forceAt annotation
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-06-11 11:34:30 +01:00
Stefan Prodan 9be33b344d
Merge pull request #941 from fluxcd/crypto-v0.39.0
Update `golang.org/x/crypto` to v0.39.0
2025-06-10 12:21:53 +03:00
Stefan Prodan 895721986d
Update `golang.org/x/crypto` to v0.39.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-06-10 11:50:59 +03:00
Matheus Pimenta 406c48d1b5
Merge pull request #940 from fluxcd/release-git-pkgs
Release git/v0.32.0 and git/gogit/v0.34.0
2025-06-09 16:55:33 +01:00
Matheus Pimenta 229800534c
Release git/v0.32.0 and git/gogit/v0.34.0
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-06-09 16:21:03 +01:00
Matheus Pimenta 47a1b23f12
Merge pull request #938 from fluxcd/public-ecr
Fix support for public.ecr.aws
2025-06-09 13:50:16 +01:00
Matheus Pimenta a0d4442b24
Fix support for public.ecr.aws
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-06-09 13:15:12 +01:00
Stefan Prodan 53c7b2dc6a
Merge pull request #939 from kane8n/update-go-git
update go-git to v5.16.2
2025-06-09 10:48:27 +03:00
kane8n 77f008cd0d
update go-git
Signed-off-by: kane8n <takumi.kaneda@zozo.com>
2025-06-09 16:28:35 +09:00
Matheus Pimenta 8457869c58
Merge pull request #937 from fluxcd/azure-cli-auth
Introduce support for shelling out to Azure binaries in authentication
2025-06-05 23:44:48 +01:00
Matheus Pimenta cbef8664d2
Introduce support for shelling out to Azure binaries in authentication
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-06-05 19:54:19 +01:00
Matheus Pimenta 8ff9a02ba4
Merge pull request #936 from drsherluck/allow-public-ecr-aws-registry
Introduce authentication for public.ecr.aws
2025-06-05 11:38:59 +01:00
drsherluck 0e86a69366
Introduce authentication for public.ecr.aws
Signed-off-by: drsherluck <danilobett@gmail.com>
2025-06-05 11:56:29 +02:00
Matheus Pimenta 84030fc8a5
Merge pull request #932 from fluxcd/gcp-wif-int-test
[RFC-0010] Add integration test for GCP workload identity federation
2025-05-25 14:02:24 +01:00
Matheus Pimenta df7750718a
[RFC-0010] Add integration test for GCP workload identity federation
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-05-25 13:23:44 +01:00
Stefan Prodan 3d6f759b76
Merge pull request #931 from fluxcd/helm-v3.18.0
Update helm to v3.18.0
2025-05-23 13:21:33 +02:00
Stefan Prodan 6c13e0fa71
Update helm to v3.18.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-05-23 13:57:15 +03:00
Stefan Prodan 0e3c44ae07
Merge pull request #930 from fluxcd/controller-runtime-v0.21.0
Update controller-runtime to v0.21.0
2025-05-23 12:54:53 +02:00
Stefan Prodan 10f34ae524
Update controller-runtime to v0.21.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-05-23 13:09:16 +03:00
Matheus Pimenta 69fd2d1e91
Merge pull request #928 from fluxcd/auth-audience-cache-key
[RFC-0010] Add provider audience to cache key and decouple packages
2025-05-19 12:28:57 +01:00
Matheus Pimenta 82fd6879cc
[RFC-0010] Add provider audience to cache key and decouple packages
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-05-19 12:03:51 +01:00
Matheus Pimenta 7a72e48536
Merge pull request #927 from fluxcd/rfc-0010-feature-gate
[RFC-0010] Introduce feature gate for enabling object-level workload identity
2025-05-15 18:14:22 +01:00
Matheus Pimenta d1cd390cca
[RFC-0010] Introduce feature gate for enabling object-level workload identity
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-05-15 17:36:15 +01:00
Matheus Pimenta a556f82a7d
Merge pull request #926 from fluxcd/azure-int-tests
Enable scheduled Azure integration tests
2025-05-15 15:48:13 +01:00
Matheus Pimenta d8a62c14d8
Enable scheduled Azure integration tests
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-05-15 14:38:46 +01:00
Stefan Prodan a7adfff4d0
Merge pull request #922 from fluxcd/dependabot/github_actions/ci-1bf90fd100
build(deps): bump the ci group across 1 directory with 4 updates
2025-05-15 16:22:18 +03:00
dependabot[bot] b5058d47e4
build(deps): bump the ci group across 1 directory with 4 updates
Bumps the ci group with 4 updates in the / directory: [actions/setup-go](https://github.com/actions/setup-go), [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials), [google-github-actions/auth](https://github.com/google-github-actions/auth) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `actions/setup-go` from 5.4.0 to 5.5.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](0aaccfd150...d35c59abb0)

Updates `aws-actions/configure-aws-credentials` from 4.1.0 to 4.2.0
- [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases)
- [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md)
- [Commits](ececac1a45...f24d7193d9)

Updates `google-github-actions/auth` from 2.1.9 to 2.1.10
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](7b53cdc2a3...ba79af0395)

Updates `github/codeql-action` from 3.28.16 to 3.28.17
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](28deaeda66...60168efe1c)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: 5.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: aws-actions/configure-aws-credentials
  dependency-version: 4.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: google-github-actions/auth
  dependency-version: 2.1.10
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-version: 3.28.17
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-15 13:07:34 +00:00
Matheus Pimenta 8204f9259d
Merge pull request #925 from fluxcd/federation
[RFC-0010] Support cross-cloud object-level workload identity
2025-05-15 14:05:00 +01:00
Matheus Pimenta 4d58d6dae6
[RFC-0010] Support cross-cloud object-level workload identity
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-05-15 13:45:08 +01:00
Matheus Pimenta 284f5668cd
Merge pull request #924 from fluxcd/wi-int-tests
[RFC-0010] Add integration tests for object-level workload identity
2025-05-15 02:48:55 +01:00
Matheus Pimenta 0b6d5a6287
[RFC-0010] Add integration tests for object-level workload identity
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-05-15 02:17:58 +01:00
Stefan Prodan c6fe8f2e60
Merge pull request #923 from fluxcd/ssa/WaitForSetTermination
ssa: Implement `WaitForSetTermination`
2025-05-13 12:39:00 +03:00
Stefan Prodan bb9f4310f2
ssa: Implement `WaitForSetTermination`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-05-13 12:16:31 +03:00
Matheus Pimenta 48b92c67a6
Merge pull request #921 from fluxcd/remove-unneeded-line
Remove unneeded trim prefix from tests
2025-05-08 11:35:44 +01:00
Matheus Pimenta 49ad2043e7
Remove unneeded trim prefix from tests
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-05-08 11:20:35 +01:00
Matheus Pimenta 3ba849f456
Merge pull request #919 from fluxcd/auth-valid-registry
[RFC-0010] Validate artifact repository for all auth providers
2025-05-07 17:22:58 +01:00
Matheus Pimenta d89e633e83
[RFC-0010] Validate artifact repository for all auth providers
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-05-07 16:33:20 +01:00
Matheus Pimenta 1985bd8e68
Merge pull request #918 from fluxcd/gogit-agnostic
Package git/gogit should be agnostic of providers
2025-05-03 15:43:06 +01:00
Matheus Pimenta 5b6454abe7
Package git/gogit should be agnostic of providers
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-05-03 15:07:41 +01:00
Matheus Pimenta 00782ede38
Merge pull request #917 from fluxcd/test-auth-providers
[RFC-0010] Add tests for auth providers
2025-05-03 10:12:21 +01:00
Matheus Pimenta 3976c50177
[RFC-0010] Add tests for auth providers
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-05-03 09:57:13 +01:00
Matheus Pimenta 182841a21c
Merge pull request #916 from fluxcd/cache-op-label
Introduce operation label for cache event metric
2025-05-02 13:31:05 +01:00
Matheus Pimenta 1e414501bf
Introduce operation label for cache event metric
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-05-02 13:14:53 +01:00
Matheus Pimenta aa3cde994a
Merge pull request #909 from fluxcd/auth-azure
[RFC-0010] Add azure auth library
2025-05-02 12:49:35 +01:00
Matheus Pimenta 9e0e8bc257
[RFC-0010] Add azure auth library
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-05-02 12:33:04 +01:00
Matheus Pimenta 7eae0914af
Merge pull request #908 from fluxcd/auth-gcp
[RFC-0010] Add gcp auth library
2025-04-30 19:13:12 +01:00
Matheus Pimenta 9f689424c0
Merge pull request #907 from fluxcd/auth-aws
[RFC-0010] Add aws auth library
2025-04-30 19:12:29 +01:00
Matheus Pimenta bb7cb580fe
Merge pull request #906 from fluxcd/auth-core
[RFC-0010] Add core auth library
2025-04-30 19:11:47 +01:00
Matheus Pimenta 45fbfeeab8
[RFC-0010] Add gcp auth library
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-04-29 18:37:56 +01:00
Matheus Pimenta b846c78a8a
[RFC-0010] Add aws auth library
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-04-29 18:34:57 +01:00
Matheus Pimenta 1c55ceb7c8
[RFC-0010] Add core auth library
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-04-29 18:31:40 +01:00
Stefan Prodan d18e808fb5
Merge pull request #915 from fluxcd/semver-v3.3.0
Downgrade `Masterminds/semver` to v3.3.0
2025-04-29 15:13:25 +03:00
Stefan Prodan bfb4557f59
Downgrade `Masterminds/semver` to v3.3.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-04-29 14:49:18 +03:00
Stefan Prodan 7e9c75bbb6
Merge pull request #913 from fluxcd/update-deps-internal-k8s-1.33
Update internal dependencies
2025-04-28 13:06:18 +03:00
Stefan Prodan 9d7ac7b0f3
Update internal dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-04-28 12:33:24 +03:00
Stefan Prodan 7a0e0e2f50
Merge pull request #903 from fluxcd/dependabot/github_actions/ci-eefd586f05
build(deps): bump the ci group across 1 directory with 12 updates
2025-04-25 12:28:07 +03:00
dependabot[bot] 0b69606095
build(deps): bump the ci group across 1 directory with 12 updates
Bumps the ci group with 12 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [actions/setup-go](https://github.com/actions/setup-go) | `5.3.0` | `5.4.0` |
| [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) | `4.0.3` | `4.1.0` |
| [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) | `3.3.0` | `3.6.0` |
| [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `3.8.0` | `3.10.0` |
| [Azure/login](https://github.com/azure/login) | `2.2.0` | `2.3.0` |
| [actions/cache](https://github.com/actions/cache) | `4.2.0` | `4.2.3` |
| [google-github-actions/auth](https://github.com/google-github-actions/auth) | `2.1.7` | `2.1.8` |
| [google-github-actions/setup-gcloud](https://github.com/google-github-actions/setup-gcloud) | `2.1.2` | `2.1.4` |
| [docker/login-action](https://github.com/docker/login-action) | `3.3.0` | `3.4.0` |
| [ossf/scorecard-action](https://github.com/ossf/scorecard-action) | `2.4.0` | `2.4.1` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `4.6.0` | `4.6.2` |
| [github/codeql-action](https://github.com/github/codeql-action) | `3.28.8` | `3.28.14` |



Updates `actions/setup-go` from 5.3.0 to 5.4.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](f111f3307d...0aaccfd150)

Updates `aws-actions/configure-aws-credentials` from 4.0.3 to 4.1.0
- [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases)
- [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md)
- [Commits](4fc4975a85...ececac1a45)

Updates `docker/setup-qemu-action` from 3.3.0 to 3.6.0
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](53851d1459...29109295f8)

Updates `docker/setup-buildx-action` from 3.8.0 to 3.10.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](6524bf65af...b5ca514318)

Updates `Azure/login` from 2.2.0 to 2.3.0
- [Release notes](https://github.com/azure/login/releases)
- [Commits](a65d910e8a...a457da9ea1)

Updates `actions/cache` from 4.2.0 to 4.2.3
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](1bd1e32a3b...5a3ec84eff)

Updates `google-github-actions/auth` from 2.1.7 to 2.1.8
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](6fc4af4b14...71f986410d)

Updates `google-github-actions/setup-gcloud` from 2.1.2 to 2.1.4
- [Release notes](https://github.com/google-github-actions/setup-gcloud/releases)
- [Changelog](https://github.com/google-github-actions/setup-gcloud/blob/main/CHANGELOG.md)
- [Commits](6189d56e40...77e7a554d4)

Updates `docker/login-action` from 3.3.0 to 3.4.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](9780b0c442...74a5d14239)

Updates `ossf/scorecard-action` from 2.4.0 to 2.4.1
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](62b2cac7ed...f49aabe0b5)

Updates `actions/upload-artifact` from 4.6.0 to 4.6.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](65c4c4a1dd...ea165f8d65)

Updates `github/codeql-action` from 3.28.8 to 3.28.14
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](dd746615b3...fc7e4a0fa0)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: 5.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: aws-actions/configure-aws-credentials
  dependency-version: 4.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: docker/setup-qemu-action
  dependency-version: 3.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: docker/setup-buildx-action
  dependency-version: 3.10.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: Azure/login
  dependency-version: 2.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: actions/cache
  dependency-version: 4.2.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: google-github-actions/auth
  dependency-version: 2.1.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: google-github-actions/setup-gcloud
  dependency-version: 2.1.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: docker/login-action
  dependency-version: 3.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: ossf/scorecard-action
  dependency-version: 2.4.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: actions/upload-artifact
  dependency-version: 4.6.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-version: 3.28.14
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-25 09:03:14 +00:00
Stefan Prodan 1b76ef3df3
Merge pull request #912 from fluxcd/k8s-1.33
Update to Kubernetes 1.33.0 and Go 1.24.0
2025-04-25 12:00:14 +03:00
Stefan Prodan bcb62f2376
Update to Kubernetes 1.33.0 and Go 1.24.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-04-24 19:13:30 +03:00
Hidde Beydals 877b123dd5
Merge pull request #904 from fluxcd/git-mtls 2025-04-17 20:29:32 +02:00
Hidde Beydals ee8655f54d
Remove duplicate err return
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2025-04-16 23:02:05 +02:00
Hidde Beydals 3465f32bb9
Wire `ClientCert` and `ClientKey` into gogit client
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2025-04-16 23:02:05 +02:00
Hidde Beydals f069943a1a
Add `ClientCert` and `ClientKey` to Git auth options
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2025-04-16 23:02:03 +02:00
Matheus Pimenta 7579486043
Merge pull request #910 from fluxcd/renew-certs
Renew testdata certs
2025-04-16 21:52:27 +01:00
Matheus Pimenta b890f1b8ad
Renew testdata certs
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-04-16 19:26:22 +01:00
Stefan Prodan f7fc56552a
Merge pull request #905 from fluxcd/update-sops-action
actions: Update SOPS repository
2025-04-14 22:53:00 +03:00
Stefan Prodan 28f52c03bf
actions: Update SOPS repository
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-04-14 22:27:26 +03:00
Matheus Pimenta 155709e21f
Merge pull request #891 from fluxcd/fix-impersonator-namespace
Separate namespace field for ServiceAccount and KubeConfig
2025-03-27 11:31:13 +00:00
Matheus Pimenta 8af0b98beb
Fix: Impersonator namespace was used by both ServiceAccount and KubeConfig
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-03-26 16:05:40 +00:00
Matheus Pimenta d9ecb5264f
Merge pull request #890 from fluxcd/fix-impersonator-poller
Fix: Impersonator is always expected to create a status poller
2025-03-26 12:40:48 +00:00
Matheus Pimenta 3d48aecab0
Fix: Impersonator is always expected to create a status poller
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-03-26 12:02:44 +00:00
Matheus Pimenta 1f51922a3b
Merge pull request #875 from fluxcd/impersonated-status-reader
Use impersonated rest mapper for status poller
2025-03-26 10:53:53 +00:00
Matheus Pimenta 36a9d16dc4
Use impersonated rest mapper for status poller
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-03-26 10:42:02 +00:00
Matheus Pimenta 657c8956b3
Merge pull request #889 from fluxcd/unvendor-restmapper
Unvendor controller-runtime lazy rest mapper
2025-03-25 16:25:46 +00:00
Matheus Pimenta 221613dbb1
Unvendor controller-runtime lazy rest mapper
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-03-25 15:04:30 +00:00
Matheus Pimenta 090c3cece0
Merge pull request #886 from dipti-pai/move-github-provider
Move auth/github to git/github
2025-03-13 12:49:32 +00:00
Dipti Pai 84883b4b9f Move auth/github to git/github
Signed-off-by: Dipti Pai <diptipai89@outlook.com>
2025-03-12 22:04:34 -07:00
Matheus Pimenta 0d627fbd9d
Merge pull request #885 from fluxcd/gh-app-cache-key
Take the hash of all the parts in the GitHub App token cache key
2025-03-12 14:01:39 +00:00
Matheus Pimenta 4380ea74f0
Take the hash of all the parts in the GitHub App token cache key
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-03-12 13:36:09 +00:00
Matheus Pimenta 84d0d45835
Merge pull request #882 from kathleenfrench/kfrench/cel-eval-string
support string evaluation in CEL expressions
2025-03-11 19:37:24 +00:00
kathleen french 567773dfa6 support string evaluation in CEL expressions
Signed-off-by: kathleen french <kfrench@groq.com>
2025-03-11 14:44:56 -04:00
Matheus Pimenta 8b1f852228
Merge pull request #881 from fluxcd/token-cache-flags
Add CLI flags for the token cache and method to delete all events
2025-03-07 09:21:24 +00:00
Matheus Pimenta 4b34b012d9
Add CLI flags for the token cache and method to delete all events
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-03-07 08:52:21 +00:00
Matheus Pimenta c05eb6777c
Merge pull request #880 from fluxcd/cache-custom-metric-labels
Add option for custom event namespace label in cache metrics
2025-03-05 20:04:16 +00:00
Matheus Pimenta 4d91aae37f
Add option for custom event namespace label in cache metrics
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-03-05 19:28:10 +00:00
Matheus Pimenta 6be31fc144
Merge pull request #877 from fluxcd/token-cache-max-duration
Add max duration to token cache
2025-03-04 14:35:20 +00:00
Matheus Pimenta 1ec89e0237
Add max duration to token cache
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-03-04 14:18:35 +00:00
Matheus Pimenta ff04927148
Merge pull request #871 from fluxcd/github-app-token-cache
Add caching for GitHub App tokens
2025-03-01 02:13:05 +00:00
Matheus Pimenta 4cd4dbb5aa
Add caching for GitHub App tokens
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-03-01 01:56:13 +00:00
Matheus Pimenta 0c883c9f76
Merge pull request #870 from fluxcd/token-cache
Add cache specialized for access tokens
2025-03-01 01:12:40 +00:00
Matheus Pimenta a0eede9657
Add cache specialized for access tokens
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-03-01 00:57:21 +00:00
Stefan Prodan e0f6da054d
Merge pull request #873 from fluxcd/lazy-restmapper
Vendor the dynamic RESTMapper from controller-runtime v0.19
2025-02-25 14:10:49 +02:00
Stefan Prodan 60bfc04a1d
Update controller-runtime to v0.20.2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-02-24 22:15:42 +02:00
Stefan Prodan 7c5e477094
Vendor the lazy restmapper from controller-runtime v0.19
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-02-24 21:57:03 +02:00
Stefan Prodan 00d1ceb1c1
Merge pull request #844 from 94DanielBrown/main
chore: add function to group entries by action in changeset output
2025-02-11 15:11:19 +02:00
Daniel Brown 13f88325a4 chore: add function to group entries by action in changeset output
Signed-off-by: Daniel Brown <daniel.brown2@sainsburys.co.uk>
2025-02-11 12:47:31 +00:00
Matheus Pimenta c9112315f9
Merge pull request #868 from fluxcd/fix-panic
Fix panic on nil map entry assignment for custom event metadata
2025-02-11 11:45:02 +00:00
Matheus Pimenta 51166e72e8
Fix panic on nil map entry assignment for custom event metadata
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-02-11 11:26:28 +00:00
Stefan Prodan 7c90c14682
Merge pull request #862 from YvanGuidoin/rework-ssa-diffoptions
ssa: Align ResourceManager.Diff skipping resources with ResourceManager.Apply
2025-02-06 09:48:45 +00:00
Yvan 88a752ef1a Add tests for DiffOptions.IfNotPresentSelector
Signed-off-by: Yvan <y.guidoin@meteocontrol.com>
2025-02-06 09:06:13 +00:00
Yvan dd54c6aa61 Align ResourceManager.Diff Skipping resources with ResourceManager.Apply
Signed-off-by: Yvan <y.guidoin@meteocontrol.com>
2025-02-06 09:06:13 +00:00
Stefan Prodan e454462cfa
Merge pull request #864 from fluxcd/internal-deps-bump
Update internal dependencies
2025-01-31 14:33:20 +02:00
Stefan Prodan 2959020a4b
Update internal dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-01-31 14:10:21 +02:00
Matheus Pimenta c964ce7b91
Merge pull request #858 from fluxcd/custom-healthchecks-impl
[RFC-0009] Add CEL library with custom healthchecks to runtime
2025-01-31 10:59:03 +00:00
Matheus Pimenta 62d235c4b2
Add CEL library with custom healthchecks to runtime
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-01-31 10:44:31 +00:00
Stefan Prodan 243510fd12
Merge pull request #863 from fluxcd/dependabot/github_actions/ci-83dfb6cda2
build(deps): bump the ci group across 1 directory with 3 updates
2025-01-31 12:20:05 +02:00
dependabot[bot] 3cffbebd81
build(deps): bump the ci group across 1 directory with 3 updates
Bumps the ci group with 3 updates in the / directory: [actions/setup-go](https://github.com/actions/setup-go), [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `actions/setup-go` from 5.2.0 to 5.3.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](3041bf56c9...f111f3307d)

Updates `aws-actions/configure-aws-credentials` from 4.0.2 to 4.0.3
- [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases)
- [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md)
- [Commits](e3dd6a429d...4fc4975a85)

Updates `github/codeql-action` from 3.28.1 to 3.28.8
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](b6a472f63d...dd746615b3)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: aws-actions/configure-aws-credentials
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-31 09:59:22 +00:00
Matheus Pimenta 2f763a4fe9
Merge pull request #857 from fluxcd/custom-healthchecks
[RFC-0009] Add healthcheck expressions to kustomize types
2025-01-31 09:41:42 +00:00
Matheus Pimenta a6353b2bd9 Add healthcheck expressions to kustomize types
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-01-31 09:26:37 +00:00
Matheus Pimenta af0f283e51
Merge pull request #859 from fluxcd/cel-meta
[RFC-0009] Add InvalidCELExpressionReason to apis/meta
2025-01-31 09:26:19 +00:00
Matheus Pimenta 117893065c Add InvalidCELExpressionReason to apis/meta
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-01-30 10:55:49 +00:00
Stefan Prodan f39dac44d1
Merge pull request #861 from fluxcd/deps-kube-v0.32.1
Update dependencies
2025-01-30 12:26:48 +02:00
Stefan Prodan 70e88cb7cd
Update dependencies
- Kubernetes v1.32.1
- Kustomize v5.6.0
- Helm v3.17.0

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2025-01-30 12:09:48 +02:00
Stefan Prodan f59d360b7f
Merge pull request #850 from kane8n/support-sparse-checkout
git: Add support for sparse checkout
2025-01-29 21:50:22 +02:00
kane8n a033d2fb81 support sparse checkout
Signed-off-by: kane8n <takumi.kaneda@zozo.com>
2025-01-27 19:06:16 +09:00
Matheus Pimenta 528bc561be
Merge pull request #856 from fluxcd/get-revision
Add GetRevision() to Event API
2025-01-20 19:28:01 +00:00
Matheus Pimenta a18915210a
Add GetRevision() to Event API
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-01-20 19:15:02 +00:00
Matheus Pimenta 39b14b7b15
Merge pull request #855 from fluxcd/origin-revision
Add MetaOriginRevisionKey to Event API
2025-01-20 19:02:39 +00:00
Matheus Pimenta e58b98bda0
Add MetaOriginRevisionKey to Event API
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-01-20 18:48:53 +00:00
Max Jonas Werner 7317f57333
Merge pull request #854 from fluxcd/dependabot/github_actions/ci-546a3e5127
build(deps): bump the ci group with 3 updates
2025-01-14 08:20:19 +01:00
dependabot[bot] 58d1ca332d
build(deps): bump the ci group with 3 updates
Bumps the ci group with 3 updates: [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action), [actions/upload-artifact](https://github.com/actions/upload-artifact) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `docker/setup-qemu-action` from 3.2.0 to 3.3.0
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](49b3bc8e6b...53851d1459)

Updates `actions/upload-artifact` from 4.5.0 to 4.6.0
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](6f51ac03b9...65c4c4a1dd)

Updates `github/codeql-action` from 3.28.0 to 3.28.1
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](48ab28a6f5...b6a472f63d)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-13 20:25:39 +00:00
Matheus Pimenta 593fdc01b7
Merge pull request #853 from fluxcd/upgrade-event-api
Upgrade apis/event in runtime
2025-01-10 13:24:17 +00:00
Matheus Pimenta f201de8550
Upgrade apis/event in runtime
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-01-10 13:10:21 +00:00
Matheus Pimenta a38aa95b8c
Merge pull request #848 from fluxcd/rfc-0008
[RFC-0008] Custom Event Metadata from Annotations
2025-01-10 12:13:15 +00:00
Matheus Pimenta 1747288d4b [RFC-0008] Custom Event Metadata from Annotations
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2025-01-10 11:59:17 +00:00
Stefan Prodan d54623a3f7
Merge pull request #835 from ngearhart/update-ecr-parsing
Update ECR parsing regex to include non-public AWS partitions
2025-01-09 20:18:44 +02:00
Noah Gearhart 6c80137860
Update ECR parsing regex to include non-public AWS partitions
Signed-off-by: Noah Gearhart <noah.gearhart@darkwolfsolutions.com>
2025-01-09 13:00:19 -05:00
Stefan Prodan cb8e4a80a8
Merge pull request #852 from fluxcd/update-codeowners
Update CODEOWNERS
2025-01-09 19:42:27 +02:00
Sunny c005fbf15a Update CODEOWNERS
Signed-off-by: Sunny <github@darkowlzz.space>
2025-01-09 16:54:54 +00:00
Max Jonas Werner 12ec4f3e8c
Merge pull request #849 from fluxcd/dependabot/github_actions/ci-1509149478
build(deps): bump the ci group with 2 updates
2025-01-02 18:00:51 +01:00
dependabot[bot] d21a6ad9d4
build(deps): bump the ci group with 2 updates
Bumps the ci group with 2 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `actions/upload-artifact` from 4.4.3 to 4.5.0
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](b4b15b8c7c...6f51ac03b9)

Updates `github/codeql-action` from 3.27.9 to 3.28.0
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](df409f7d92...48ab28a6f5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-30 20:15:02 +00:00
Sunny a8278c8c78
Merge pull request #847 from fluxcd/int-perm-change
oci/int: Grant new permissions needed by AWS infra
2024-12-24 02:58:58 +05:30
Sunny 1af36ba0b6 oci/int: Grant new permissions needed by AWS infra
terraform-aws-eks version v20.31.4 introduced new tag policies that
require extra permissions. Refer
https://github.com/terraform-aws-modules/terraform-aws-eks/releases/tag/v20.31.4.

Signed-off-by: Sunny <github@darkowlzz.space>
2024-12-23 19:10:41 +05:30
Stefan Prodan 8c4af78352
Merge pull request #846 from fluxcd/recorder-for-scheme
Add event recorder constructor decoupled from runtime Manager
2024-12-20 09:11:33 +02:00
Stefan Prodan 07d36f3bc4
Add event recorder constructor decoupled from runtime Manager
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-12-19 18:13:23 +02:00
Max Jonas Werner 6f26195226
Merge pull request #845 from fluxcd/dependabot/github_actions/ci-215bb8138a
build(deps): bump the ci group across 1 directory with 4 updates
2024-12-17 08:03:31 +01:00
dependabot[bot] e661fccec5
build(deps): bump the ci group across 1 directory with 4 updates
Bumps the ci group with 4 updates in the / directory: [actions/setup-go](https://github.com/actions/setup-go), [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action), [actions/cache](https://github.com/actions/cache) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `actions/setup-go` from 5.1.0 to 5.2.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](41dfa10bad...3041bf56c9)

Updates `docker/setup-buildx-action` from 3.7.1 to 3.8.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](c47758b77c...6524bf65af)

Updates `actions/cache` from 4.1.2 to 4.2.0
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](6849a64899...1bd1e32a3b)

Updates `github/codeql-action` from 3.27.5 to 3.27.9
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](f09c1c0a94...df409f7d92)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-16 20:58:40 +00:00
Stefan Prodan 42918b3976
Merge pull request #843 from fluxcd/deps-int-k8s-1.32
Update internal dependencies
2024-12-12 14:09:20 +02:00
Stefan Prodan ad9c74a416
Update internal dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-12-12 13:29:15 +02:00
Stefan Prodan b9b6a10fda
Merge pull request #842 from fluxcd/k8s-1.32.0
Update dependencies to Kubernetes 1.32.0 and Go 1.23.0
2024-12-12 12:35:10 +02:00
Stefan Prodan 7b6cd90dbf
Update dependencies to Kubernetes 1.32.0 and Go 1.23.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-12-12 12:13:27 +02:00
Stefan Prodan b9c338a680
Merge pull request #841 from fluxcd/load-vars
Make the variables loading function public
2024-12-12 11:22:57 +02:00
Stefan Prodan cf1915ea85
Make the variables loading function public
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-12-11 19:24:59 +02:00
Stefan Prodan 84013d4161
Merge pull request #839 from fluxcd/workflow-tf-setup
workflows: Use setup-terraform install latest
2024-12-10 20:37:04 +02:00
Sunny b91dc119d6 workflows: Use setup-terraform install latest
The runner image ubuntu-latest is still on terraform v1.10.0, which has
a bug in terraform apply. Use setup-terraform to install the latest
version which has a fix for it.

Signed-off-by: Sunny <github@darkowlzz.space>
2024-12-10 14:57:24 +00:00
Stefan Prodan 5bf9095331
Merge pull request #838 from fluxcd/meta-v1.8.0
Update apis/meta version in chartutil and runtime
2024-12-10 11:45:07 +02:00
Stefan Prodan 05a2b81d09
Update apis/meta version in chartutil and runtime
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-12-10 11:26:57 +02:00
Stefan Prodan f58229dc91
Merge pull request #836 from fluxcd/chartutil
Add `chartutil` package and `ValuesReference` type to APIs
2024-12-10 11:23:50 +02:00
Stefan Prodan 8f0cbf5c3d
Add chartutil package and ValuesReference type to APIs
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-12-09 12:49:06 +02:00
Stefan Prodan 3431579a0c
Merge pull request #831 from fluxcd/distribution-v3.0.0-rc.1
Update internal Git dependencies
2024-12-06 15:18:28 +02:00
Stefan Prodan ca4bf2d554
Update internal Git dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-12-06 15:02:43 +02:00
Stefan Prodan bd582bc996
Merge pull request #830 from fluxcd/int-update
Update internal dependencies
2024-12-06 14:55:39 +02:00
Stefan Prodan bf705546f5
Update internal dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-12-06 14:15:22 +02:00
Sunny b83bd25dbf
Merge pull request #817 from fluxcd/refactor-cache
Simplify the cache
2024-12-06 03:59:15 +14:00
Sunny a29e42fdb2 cache: Return ErrNotFound error from Get()
Previously, when an item is not found in the cache, no error was
returned and instead the returned value was expected to be checked for
nil to determine if the object was found or not.

Considering that other cache functions like GetExpiration() and
SetExpiration() return ErrNotFound for items not in cache, it's more
consistent to return ErrNotFound for Get() as well.

Returning ErrNotFound from Get() makes it clear that the object was not
found, instead of needing to check the obtained value. There is no more
need to return a pointer to the item. Return the item value instead.
This changes the Store interface method signature for Get().

Signed-off-by: Sunny <github@darkowlzz.space>
2024-12-05 19:14:13 +05:30
Sunny 72d6f8c222 oci: Remove cache from auth and int tests code
OCI auth token caching will be done in the OCI client. Remove the cache
from auth package and its use in the integration tests.

Since the cache related changes introduced the auth token expiry time to
be returned from the auth provider logins, a new function
LoginWithExpiry() is introduced which returns the expiry time. The
original Login() remains as it is for backwards compatibility. A higher
level client can use LoginWithExpiry() to obtain the TTL of the auth
token to use with the cache.

Signed-off-by: Sunny <github@darkowlzz.space>
2024-12-05 19:14:07 +05:30
Sunny 061b9acc53 cache: Allow setting cache metrics prefix
Custom prefix allows using multiple instances of the cache in an
application with unique metrics.

Signed-off-by: Sunny <github@darkowlzz.space>
2024-12-05 18:53:57 +05:30
Sunny a961051470 Simplify the cache
- Remove dependency on kubernetes.
- Simplify the Store interface to only have Get, Set and Delete.
- Add new RecordCacheEvent() method in the cache implementations for
  recording the cache events, hit or miss, along with labels of the
  associated flux object being reconciled. The labels name, namespace
  and kind for this metric are not required to be configured when
  creating the cache. They are predefined in the created metrics
  recorder, similar to the runtime metrics recorder for the rest of
  flux. RecordCacheEvent() has to be called by the caller of cache
  operations explicitly along with the label information of the
  associated object being reconciled. The cache no longer has the
  knowledge of the object being reconciled, decoupled.
- With the decoupled cache and reconciling object for metrics, the
  storeOptions no longer need to have the generic type defined.
  Simplifying the usage.
- Add new DeleteCacheEvent() method in the cache implementations for
  deleting the cache events, hit or miss, which are associated with the
  object being reconciled. When the reconciling object is deleted, these
  metrics associated with the object must also be deleted.
- Updated all the tests to use simple string cache.
- Get() now returns a pointer instead of a separate exists boolean. If
  the pointer is nil, the item is not found in the cache.
- Get() takes a key and returns a cached item for it. GetByKey() is
  removed as Get() does the same.

Signed-off-by: Sunny <github@darkowlzz.space>
2024-12-05 18:53:51 +05:30
Sunny 9e2947d30f
Merge pull request #829 from fluxcd/helm-v3.16.3
Update dependencies
2024-12-06 03:19:50 +14:00
Stefan Prodan 802b6e3916
Update dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-12-05 12:44:57 +02:00
Stefan Prodan 19c00ade34
Merge pull request #828 from fluxcd/kustomize-v5.5
Update dependencies
2024-12-05 11:27:57 +02:00
Stefan Prodan f9cbcaf1db
Add doc to auth pkg
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-12-05 11:13:15 +02:00
Stefan Prodan 33f38290f8
Update dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-12-05 11:04:45 +02:00
Stefan Prodan 8262fd935f
Merge pull request #818 from dipti-pai/github-app-auth
[RFC-007] Implement GitHub app authentication for git repositories.
2024-12-05 10:38:21 +02:00
Dipti Pai 0431fecc3c [RFC-007] Implement GitHub app authentication for git repositories.
- Add github app based authentication method to fetch installation token in auth package.
- Add unit tests to test the github app authentication
- Add github provider options in git package.
- Use the github provider to clone from go-git package.
- Add unit tests to fetch git credentials and cloning the repository using github app authentication.
- Add e2e tests to test pull/push to git repositories using github app authentication.
- Update the github workflow to run e2etests from CI.

Signed-off-by: Dipti Pai <diptipai89@outlook.com>
2024-12-04 15:47:00 -08:00
Max Jonas Werner 4068cafcd8
Merge pull request #826 from fluxcd/dependabot/github_actions/ci-e249650f58
build(deps): bump github/codeql-action from 3.27.4 to 3.27.5 in the ci group
2024-11-26 08:32:20 +01:00
dependabot[bot] 21ff203d06
build(deps): bump github/codeql-action in the ci group
Bumps the ci group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 3.27.4 to 3.27.5
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](ea9e4e3799...f09c1c0a94)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-25 21:10:06 +00:00
Stefan Prodan aa0e9ce971
Merge pull request #825 from fluxcd/controller-runtime-v0.19.2
Update controller-runtime to v0.19.2
2024-11-23 11:09:32 +02:00
Stefan Prodan 1bdd74bb61
Update controller-runtime to v0.19.2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-11-23 10:49:17 +02:00
Stefan Prodan 1004b4bede
Merge pull request #824 from errordeveloper/update-to-unstructured
Update `ToUnstructured` to handle already unstructured case
2024-11-23 10:41:27 +02:00
Ilya Dmitrichenko cca401bfe5
Update `ToUnstructured` to handle already unstructured case
This version of the function is more robus, it's what is used in
Timoni, updating it hear would alow avoid copies in other places.

Signed-off-by: Ilya Dmitrichenko <idmitrichenko@coreweave.com>
2024-11-20 21:05:00 +00:00
Max Jonas Werner facd2c2085
Merge pull request #823 from fluxcd/dependabot/github_actions/ci-a188b925d2
build(deps): bump github/codeql-action from 3.27.0 to 3.27.4 in the ci group across 1 directory
2024-11-19 07:58:43 +01:00
dependabot[bot] c2dd238dc5
build(deps): bump github/codeql-action
Bumps the ci group with 1 update in the / directory: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 3.27.0 to 3.27.4
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](662472033e...ea9e4e3799)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 21:35:15 +00:00
Sunny 2cbdbf5051
Merge pull request #821 from fluxcd/int-set-env-vars
workflows/integration-*: set git and oci env vars
2024-11-08 17:46:42 +05:30
Sunny eae8e64287 workflows/integration-*: set git and oci env vars
With the recent changes to the integration tests, the type of tests
supported by the infrastructure need to be explicitly set.
OCI infrastructure is supported by all of our setup.
Git infrastructure is only set for Azure only. It is ineffective for now
as we don't have an azure account to run the tests at present.

Signed-off-by: Sunny <github@darkowlzz.space>
2024-11-07 19:35:39 +00:00
Max Jonas Werner 402f6cd324
Merge pull request #820 from fluxcd/dependabot/github_actions/ci-0ba8eb66b5
build(deps): bump the ci group with 2 updates
2024-11-05 09:24:06 +01:00
dependabot[bot] a40a3ec268
build(deps): bump the ci group with 2 updates
Bumps the ci group with 2 updates: [google-github-actions/auth](https://github.com/google-github-actions/auth) and [google-github-actions/setup-gcloud](https://github.com/google-github-actions/setup-gcloud).


Updates `google-github-actions/auth` from 2.1.6 to 2.1.7
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](8254fb75a3...6fc4af4b14)

Updates `google-github-actions/setup-gcloud` from 2.1.1 to 2.1.2
- [Release notes](https://github.com/google-github-actions/setup-gcloud/releases)
- [Changelog](https://github.com/google-github-actions/setup-gcloud/blob/main/CHANGELOG.md)
- [Commits](f0990588f1...6189d56e40)

---
updated-dependencies:
- dependency-name: google-github-actions/auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: google-github-actions/setup-gcloud
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-04 20:56:12 +00:00
Max Jonas Werner 929ca01665
Merge pull request #819 from fluxcd/dependabot/github_actions/ci-29a142de16
build(deps): bump the ci group across 1 directory with 5 updates
2024-10-29 11:41:11 +01:00
dependabot[bot] 1482ed6bc1
build(deps): bump the ci group across 1 directory with 5 updates
Bumps the ci group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `4.2.1` | `4.2.2` |
| [actions/setup-go](https://github.com/actions/setup-go) | `5.0.2` | `5.1.0` |
| [actions/cache](https://github.com/actions/cache) | `4.1.0` | `4.1.2` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `4.4.1` | `4.4.3` |
| [github/codeql-action](https://github.com/github/codeql-action) | `3.26.12` | `3.27.0` |



Updates `actions/checkout` from 4.2.1 to 4.2.2
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](eef61447b9...11bd71901b)

Updates `actions/setup-go` from 5.0.2 to 5.1.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](0a12ed9d6a...41dfa10bad)

Updates `actions/cache` from 4.1.0 to 4.1.2
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](2cdf405574...6849a64899)

Updates `actions/upload-artifact` from 4.4.1 to 4.4.3
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](604373da63...b4b15b8c7c)

Updates `github/codeql-action` from 3.26.12 to 3.27.0
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](c36620d31a...662472033e)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 20:26:15 +00:00
Stefan Prodan ac1007b57e
Merge pull request #814 from fluxcd/dependabot/github_actions/ci-94e703d2b0
build(deps): bump the ci group across 1 directory with 7 updates
2024-10-08 09:56:40 +03:00
dependabot[bot] 4924be35b4
build(deps): bump the ci group across 1 directory with 7 updates
Bumps the ci group with 7 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `4.1.7` | `4.2.1` |
| [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `3.6.1` | `3.7.1` |
| [Azure/login](https://github.com/azure/login) | `2.1.1` | `2.2.0` |
| [actions/cache](https://github.com/actions/cache) | `4.0.2` | `4.1.0` |
| [google-github-actions/auth](https://github.com/google-github-actions/auth) | `2.1.5` | `2.1.6` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `4.4.0` | `4.4.1` |
| [github/codeql-action](https://github.com/github/codeql-action) | `3.26.6` | `3.26.12` |



Updates `actions/checkout` from 4.1.7 to 4.2.1
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](692973e3d9...eef61447b9)

Updates `docker/setup-buildx-action` from 3.6.1 to 3.7.1
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](988b5a0280...c47758b77c)

Updates `Azure/login` from 2.1.1 to 2.2.0
- [Release notes](https://github.com/azure/login/releases)
- [Commits](6c251865b4...a65d910e8a)

Updates `actions/cache` from 4.0.2 to 4.1.0
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](0c45773b62...2cdf405574)

Updates `google-github-actions/auth` from 2.1.5 to 2.1.6
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](62cf5bd3e4...8254fb75a3)

Updates `actions/upload-artifact` from 4.4.0 to 4.4.1
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](50769540e7...604373da63)

Updates `github/codeql-action` from 3.26.6 to 3.26.12
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](4dd16135b6...c36620d31a)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: Azure/login
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: google-github-actions/auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 20:37:46 +00:00
Stefan Prodan 30c101fc7c
Merge pull request #793 from dipti-pai/git-oidc-integration-tests
Add new integration tests for Azure OIDC for git repositories
2024-09-14 01:36:14 +03:00
Dipti Pai 42a5c0ed73 Add new integration tests for Azure OIDC for git repositories
Signed-off-by: Dipti Pai <diptipai89@outlook.com>
Signed-off-by: Sunny <github@darkowlzz.space>
Co-authored-by: Dipti Pai <diptipai89@outlook.com>
Co-authored-by: Sunny <github@darkowlzz.space>
2024-09-13 13:01:07 -07:00
Stefan Prodan 7fe97890f0
Merge pull request #810 from fluxcd/up-int-deps
Update internal dependencies
2024-09-13 22:53:33 +03:00
Stefan Prodan f674386703
Update internal dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-09-13 22:34:02 +03:00
Stefan Prodan c8165afb55
Merge pull request #809 from fluxcd/k8s-1.31.1
Update dependencies
2024-09-13 22:21:54 +03:00
Stefan Prodan 18924bf8e4
Update controller-gen to v0.16.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-09-13 22:09:14 +03:00
Stefan Prodan 735a85bb64
Update dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-09-13 22:08:54 +03:00
Stefan Prodan 62475f18f6
Merge pull request #789 from dipti-pai/pkg-azure-git-wi-auth
Implement new packages auth, azure and git for passwordless authentication scenarios
2024-09-13 21:41:53 +03:00
Dipti Pai 1686996d3c Support Azure OIDC authentication
- Add packages auth, azure to fetch access token using azidentity DefaultAzureCredential API and default ARM scope

- Provide the capability to override the scope of the access token for Azure DevOps.

- Provide the capability to pass proxy settings to the client options if specified.

- Provide the option to specify a fake token credential for unit tests.

- Add ProviderOptions in git AuthOptions to configure the provider options from consumers.

- Use the credentials API to fetch Azure DevOps access token if the provider is Azure from gogit client.

- Add new unit tests for new functionality in azure, git and gogit client.

Signed-off-by: Dipti Pai <diptipai89@outlook.com>
2024-09-13 09:20:46 -07:00
Stefan Prodan a2a7a01ecd
Merge pull request #808 from matheuscscp/oci-auth-proxy
Add proxy support for oci/auth login
2024-09-10 18:30:55 +03:00
Matheus Pimenta 8b5c43a66c Add proxy support for oci/auth login
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2024-09-09 19:06:48 -03:00
Stefan Prodan d467d6e21b
Merge pull request #807 from fluxcd/dependabot/github_actions/ci-6f7028051e
build(deps): bump the ci group with 2 updates
2024-09-03 12:19:41 +03:00
dependabot[bot] a6b58a7a83
build(deps): bump the ci group with 2 updates
Bumps the ci group with 2 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `actions/upload-artifact` from 4.3.6 to 4.4.0
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](834a144ee9...50769540e7)

Updates `github/codeql-action` from 3.26.5 to 3.26.6
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](2c779ab0d0...4dd16135b6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-02 20:06:23 +00:00
Max Jonas Werner f0eb8aa7c6
Merge pull request #806 from fluxcd/dependabot/github_actions/ci-fc48fdf541
build(deps): bump the ci group with 2 updates
2024-08-27 08:40:48 +02:00
dependabot[bot] bd658a8044
build(deps): bump the ci group with 2 updates
Bumps the ci group with 2 updates: [google-github-actions/auth](https://github.com/google-github-actions/auth) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `google-github-actions/auth` from 2.1.4 to 2.1.5
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](f112390a2d...62cf5bd3e4)

Updates `github/codeql-action` from 3.26.3 to 3.26.5
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](883d8588e5...2c779ab0d0)

---
updated-dependencies:
- dependency-name: google-github-actions/auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-26 20:54:29 +00:00
Stefan Prodan e40e7ed2bc
Merge pull request #805 from fluxcd/oci-logr
Use `go-logr/logr` interface for OCI auth logging
2024-08-24 11:46:05 +03:00
Stefan Prodan 00a77aef41
Update oci dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-08-24 09:49:20 +03:00
Stefan Prodan f76f30d06c
Drop freeport dependency from pkg/oci tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-08-23 14:56:23 +03:00
Stefan Prodan ad24cb7aed
Use `go-logr/logr` interface for logging
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-08-23 10:27:37 +03:00
Max Jonas Werner 11195c91e5
Merge pull request #804 from fluxcd/dependabot/github_actions/ci-8cbcb71e32
build(deps): bump github/codeql-action from 3.26.0 to 3.26.3 in the ci group
2024-08-20 08:50:12 +02:00
dependabot[bot] 91db569eab
build(deps): bump github/codeql-action in the ci group
Bumps the ci group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 3.26.0 to 3.26.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](eb055d739a...883d8588e5)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-19 20:14:33 +00:00
Stefan Prodan 7b3f43cb99
Merge pull request #803 from fluxcd/controller-runtime-v0.19.0
Update `sigs.k8s.io/controller-runtime` to v0.19.0
2024-08-15 11:05:01 +03:00
Stefan Prodan da3ccfec88
Update `sigs.k8s.io/controller-runtime` to v0.19.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-08-15 10:51:59 +03:00
Stefan Prodan bd579fc61a
Merge pull request #802 from fluxcd/k8s-1.31-internal
Update internal packages
2024-08-14 20:41:43 +03:00
Stefan Prodan c06927b2c9
Update internal packages
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-08-14 20:28:15 +03:00
Stefan Prodan be8df7e8c7
Merge pull request #801 from fluxcd/k8s-1.31
Update dependencies to Kubernetes v1.31.0
2024-08-14 20:10:20 +03:00
Stefan Prodan 76035f8dfc
Update Helm to v3.15.4
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-08-14 18:55:29 +03:00
Stefan Prodan 3f5cf4c2cb
Build with Go 1.23
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-08-14 14:57:43 +03:00
Stefan Prodan 4b90241264
Update dependencies to Kubernetes v1.31.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-08-14 14:45:01 +03:00
Stefan Prodan 0e61a3b3f2
Merge pull request #799 from fluxcd/dependabot/github_actions/ci-9f4b007c5b
build(deps): bump the ci group with 4 updates
2024-08-13 00:44:33 +03:00
dependabot[bot] 6bf4badf0f
build(deps): bump the ci group with 4 updates
Bumps the ci group with 4 updates: [google-github-actions/auth](https://github.com/google-github-actions/auth), [google-github-actions/setup-gcloud](https://github.com/google-github-actions/setup-gcloud), [actions/upload-artifact](https://github.com/actions/upload-artifact) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `google-github-actions/auth` from 2.1.3 to 2.1.4
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](71fee32a0b...f112390a2d)

Updates `google-github-actions/setup-gcloud` from 2.1.0 to 2.1.1
- [Release notes](https://github.com/google-github-actions/setup-gcloud/releases)
- [Changelog](https://github.com/google-github-actions/setup-gcloud/blob/main/CHANGELOG.md)
- [Commits](98ddc00a17...f0990588f1)

Updates `actions/upload-artifact` from 4.3.5 to 4.3.6
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](89ef406dd8...834a144ee9)

Updates `github/codeql-action` from 3.25.15 to 3.26.0
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](afb54ba388...eb055d739a)

---
updated-dependencies:
- dependency-name: google-github-actions/auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: google-github-actions/setup-gcloud
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-12 20:21:16 +00:00
Stefan Prodan 968f1907a8
Merge pull request #795 from fluxcd/dependabot/github_actions/ci-8fa51b1870
build(deps): bump the ci group across 1 directory with 8 updates
2024-08-05 18:04:37 +03:00
dependabot[bot] bce8cab45b
build(deps): bump the ci group across 1 directory with 8 updates
Bumps the ci group with 8 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `4.1.6` | `4.1.7` |
| [actions/setup-go](https://github.com/actions/setup-go) | `5.0.1` | `5.0.2` |
| [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) | `3.0.0` | `3.2.0` |
| [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `3.3.0` | `3.6.1` |
| [docker/login-action](https://github.com/docker/login-action) | `3.2.0` | `3.3.0` |
| [ossf/scorecard-action](https://github.com/ossf/scorecard-action) | `2.3.3` | `2.4.0` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `4.3.4` | `4.3.5` |
| [github/codeql-action](https://github.com/github/codeql-action) | `3.25.12` | `3.25.15` |



Updates `actions/checkout` from 4.1.6 to 4.1.7
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.1.6...692973e3d937129bcbf40652eb9f2f61becf3332)

Updates `actions/setup-go` from 5.0.1 to 5.0.2
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v5.0.1...0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32)

Updates `docker/setup-qemu-action` from 3.0.0 to 3.2.0
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v3...49b3bc8e6bdd4a60e6116a5414239cba5943d3cf)

Updates `docker/setup-buildx-action` from 3.3.0 to 3.6.1
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v3.3.0...988b5a0280414f521da01fcc63a27aeeb4b104db)

Updates `docker/login-action` from 3.2.0 to 3.3.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](0d4c9c5ea7...9780b0c442)

Updates `ossf/scorecard-action` from 2.3.3 to 2.4.0
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](dc50aa9510...62b2cac7ed)

Updates `actions/upload-artifact` from 4.3.4 to 4.3.5
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](0b2256b8c0...89ef406dd8)

Updates `github/codeql-action` from 3.25.12 to 3.25.15
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](4fa2a79536...afb54ba388)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-05 14:46:35 +00:00
Sunny 7d033c142b
Merge pull request #798 from fluxcd/cleanup-aws-nuke
workflow: Set aws-nuke region for cleanup
2024-08-05 20:14:25 +05:30
Sunny e98ccfac72
workflow: Set aws-nuke region for cleanup
Set the aws-nuke target regions from the region variables in the
environment.

Signed-off-by: Sunny <github@darkowlzz.space>
2024-08-05 14:32:23 +00:00
Sunny 8d9a8a30fc
Merge pull request #797 from fluxcd/cleanup-provider-aws
workflow: use aws provider for cleanup
2024-08-05 19:39:51 +05:30
Sunny 5a3582c30b workflow: use aws provider for cleanup
Signed-off-by: Sunny <github@darkowlzz.space>
2024-08-05 13:57:47 +00:00
Sunny 81d7ac6cc3
Merge pull request #796 from fluxcd/cleanup-workflow-permission
workflows: add id-token permission for cleanup job
2024-08-05 19:24:13 +05:30
Sunny 12f2918674 workflows: add id-token permission for cleanup job
cleanup job for AWS uses OIDC federated credential, which requires
id-token.
Also, rename the role session name to be more accurate.

Signed-off-by: Sunny <github@darkowlzz.space>
2024-08-05 13:38:53 +00:00
Sunny 94e75b7854
Merge pull request #775 from fluxcd/int-aws-perms
Add workflow for OCI AWS tests & document the setup
2024-08-05 18:13:53 +05:30
Sunny a8faf1872a Add cleanup job for aws
Modify the workflow configurations accordingly to share accound ID and
region with the cleanup job.

Signed-off-by: Sunny <github@darkowlzz.space>
2024-08-02 18:05:10 +00:00
Sunny c3387211b7 Add workflow for OCI AWS test & document the setup
- Add a new workflow integration-aws for running the AWS integration
  tests for OCI.
- Add setup docs for configuring the AWS account and GitHub repository
  for running the tests.

Signed-off-by: Sunny <github@darkowlzz.space>
2024-08-02 18:20:37 +05:30
Stefan Prodan a703510d2c
Merge pull request #787 from fluxcd/dependabot/github_actions/ci-3045b5a003
build(deps): bump the ci group with 2 updates
2024-07-16 10:54:19 +03:00
dependabot[bot] 75ec0a05a0
build(deps): bump the ci group with 2 updates
Bumps the ci group with 2 updates: [actions/setup-go](https://github.com/actions/setup-go) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `actions/setup-go` from 5.0.1 to 5.0.2
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](cdcb360436...0a12ed9d6a)

Updates `github/codeql-action` from 3.25.11 to 3.25.12
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](b611370bb5...4fa2a79536)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-15 20:57:35 +00:00
Stefan Prodan e41e507b56
Merge pull request #786 from fluxcd/dependabot/github_actions/ci-37d1a723b0
build(deps): bump the ci group with 3 updates
2024-07-11 18:19:05 +03:00
dependabot[bot] b72aa22991
build(deps): bump the ci group with 3 updates
Bumps the ci group with 3 updates: [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action), [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) and [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `docker/setup-qemu-action` from 3.0.0 to 3.1.0
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](68827325e0...5927c834f5)

Updates `docker/setup-buildx-action` from 3.3.0 to 3.4.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](d70bba72b1...4fd812986e)

Updates `actions/upload-artifact` from 4.3.3 to 4.3.4
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](65462800fd...0b2256b8c0)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-08 20:20:11 +00:00
souleb c647aea830
Merge pull request #784 from fluxcd/cache-key-fix
Cache credentials tokens
2024-07-02 22:30:41 +02:00
Soule BA 8a3ba60bf0
Cache credentials tokens
If implemented, a specific function is used to compute the key for
caching credentials based on the provider way of requesting it.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-07-02 21:53:36 +02:00
Stefan Prodan c8409c0932
Merge pull request #785 from fluxcd/dependabot/github_actions/ci-6034f0241a
build(deps): bump github/codeql-action from 3.25.10 to 3.25.11 in the ci group
2024-07-02 09:50:48 +03:00
dependabot[bot] 6be12d485a
build(deps): bump github/codeql-action in the ci group
Bumps the ci group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 3.25.10 to 3.25.11
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](23acc5c183...b611370bb5)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-01 20:23:30 +00:00
Stefan Prodan e8251e12b5
Merge pull request #783 from Skarlso/add-option-to-skip-gzip
feat: add un-taring plain, unzipped tar files
2024-06-19 10:54:45 +03:00
Gergely Brautigam e6984b4206
feat: add un-taring plain, unzipped tar files
Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>
2024-06-19 08:59:32 +02:00
souleb 328e8e95db
Merge pull request #776 from fluxcd/cache-authn
[OCI] Cache Login credentials
2024-06-19 00:01:11 +02:00
Soule BA bb65fa7e32
Addapting tests
Switch return type from *time.Time to time.Time.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-06-18 16:11:12 +02:00
Soule BA b743354c43
cache authenticator retrieved when login to a provider
Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-06-18 10:31:37 +02:00
souleb e79914f961
Merge pull request #782 from fluxcd/dependabot/github_actions/ci-840fb89e3c
build(deps): bump the ci group with 2 updates
2024-06-18 08:42:05 +02:00
dependabot[bot] 5ea6862e19
build(deps): bump the ci group with 2 updates
Bumps the ci group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `actions/checkout` from 4.1.6 to 4.1.7
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](a5ac7e51b4...692973e3d9)

Updates `github/codeql-action` from 3.25.8 to 3.25.10
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](2e230e8fe0...23acc5c183)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 20:30:44 +00:00
souleb 61276f4653
Merge pull request #766 from fluxcd/enable-cachin-auth-tokens
Introduce in-memory caching package
2024-06-14 16:36:40 +02:00
Soule BA d838d8a21c
Add a store interface with default implementations
The store interface is a simplified version of client go store. If an
object can be cached there, it should be in our store implementations.

We also provide a default way to generate keys, but we allow users to
provide their own function. This should enable all needed levels of
isolation.

The provided implementations are an expiring cache and a LRU cache.

The cache is self-instrumented.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-06-14 16:16:58 +02:00
souleb d5e16a5f83
Merge pull request #780 from fluxcd/dependabot/github_actions/ci-4193280b19
build(deps): bump github/codeql-action from 3.25.7 to 3.25.8 in the ci group
2024-06-10 21:51:56 +01:00
dependabot[bot] 459382308a
build(deps): bump github/codeql-action in the ci group
Bumps the ci group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 3.25.7 to 3.25.8
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](f079b84933...2e230e8fe0)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 20:33:11 +00:00
souleb 1bfad58206
Merge pull request #779 from fluxcd/dependabot/github_actions/ci-af70b21c0f
build(deps): bump the ci group across 1 directory with 3 updates
2024-06-04 10:29:19 +02:00
dependabot[bot] d54c66943e
build(deps): bump the ci group across 1 directory with 3 updates
Bumps the ci group with 3 updates in the / directory: [Azure/login](https://github.com/azure/login), [docker/login-action](https://github.com/docker/login-action) and [github/codeql-action](https://github.com/github/codeql-action).


Updates `Azure/login` from 2.1.0 to 2.1.1
- [Release notes](https://github.com/azure/login/releases)
- [Commits](6b2456866f...6c251865b4)

Updates `docker/login-action` from 3.1.0 to 3.2.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](e92390c5fb...0d4c9c5ea7)

Updates `github/codeql-action` from 3.25.6 to 3.25.7
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](9fdb3e4972...f079b84933)

---
updated-dependencies:
- dependency-name: Azure/login
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-03 20:47:18 +00:00
souleb 140ac57483
Merge pull request #774 from fluxcd/dependabot/github_actions/ci-d10c88c1d9
build(deps): bump the ci group with 3 updates
2024-05-21 11:37:35 +02:00
dependabot[bot] 97c58865e5
---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: google-github-actions/auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-20 20:34:19 +00:00
Stefan Prodan 235bfbb67d
Merge pull request #772 from fluxcd/dependabot/github_actions/ci-b900de2ff3
build(deps): bump ossf/scorecard-action from 2.3.1 to 2.3.3 in the ci group
2024-05-13 23:57:26 +03:00
dependabot[bot] 0cea9ba324
build(deps): bump ossf/scorecard-action in the ci group
Bumps the ci group with 1 update: [ossf/scorecard-action](https://github.com/ossf/scorecard-action).


Updates `ossf/scorecard-action` from 2.3.1 to 2.3.3
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](0864cf1902...dc50aa9510)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-13 20:12:25 +00:00
Max Jonas Werner 96f2fb2b4e
Merge pull request #770 from fluxcd/dependabot/github_actions/ci-2057180a66
build(deps): bump the ci group with 2 updates
2024-05-07 09:04:40 +02:00
dependabot[bot] 4ed4d37fa1
build(deps): bump the ci group with 2 updates
Bumps the ci group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [actions/setup-go](https://github.com/actions/setup-go).


Updates `actions/checkout` from 4.1.4 to 4.1.5
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](0ad4b8fada...44c2b7a8a4)

Updates `actions/setup-go` from 5.0.0 to 5.0.1
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](0c52d547c9...cdcb360436)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-06 21:00:33 +00:00
Stefan Prodan adcfcbefcb
Merge pull request #769 from fluxcd/controller-runtime-v0.18.1
Update dependencies to controller-runtime v0.18.1
2024-05-02 10:58:13 +03:00
Stefan Prodan 0e74a82205
Update runtime pkg docs
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-02 09:46:56 +03:00
Stefan Prodan b329d92ba1
Update dependencies to controller-runtime v0.18.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-02 09:46:37 +03:00
Max Jonas Werner d0bf8ed836
Merge pull request #768 from fluxcd/dependabot/github_actions/ci-b93eff89fb
build(deps): bump actions/checkout from 4.1.3 to 4.1.4 in the ci group
2024-04-30 13:04:07 +02:00
dependabot[bot] 14f05d79ef
build(deps): bump actions/checkout from 4.1.3 to 4.1.4 in the ci group
Bumps the ci group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 4.1.3 to 4.1.4
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](1d96c772d1...0ad4b8fada)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-29 20:30:24 +00:00
Stefan Prodan 3790516760
Merge pull request #767 from fluxcd/up-internal-deps
Update internal dependencies
2024-04-26 11:13:22 +03:00
Stefan Prodan 37ea30cbc9
Update internal dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-26 10:57:05 +03:00
Stefan Prodan e32ccc2880
Merge pull request #763 from fluxcd/kubernetes-1.30
Update dependencies to Kubernetes 1.30 and adapt to breaking changes
2024-04-26 10:28:23 +03:00
Stefan Prodan 2b974af838
Update sigs.k8s.io/controller-tools to v0.15.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-26 09:59:41 +03:00
Stefan Prodan 52c1fc545f
Update sigs.k8s.io/controller-runtime to v0.18.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-26 09:40:04 +03:00
Stefan Prodan c906252d23
Update dependencies to Kubernetes 1.30
Pin controller-runtime to main branch due to
breaking change in Kubernetes 1.30 `client-go/tools/leaderelection`.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-25 01:11:24 +03:00
Stefan Prodan 92c13488b9
Merge pull request #764 from fluxcd/dependabot/github_actions/ci-e44cfae560
build(deps): bump the ci group with 3 updates
2024-04-23 10:19:22 +03:00
dependabot[bot] ccb916aaa9
build(deps): bump the ci group with 3 updates
Bumps the ci group with 3 updates: [actions/checkout](https://github.com/actions/checkout), [Azure/login](https://github.com/azure/login) and [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `actions/checkout` from 4.1.2 to 4.1.3
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](9bb56186c3...1d96c772d1)

Updates `Azure/login` from 2.0.0 to 2.1.0
- [Release notes](https://github.com/azure/login/releases)
- [Commits](8c334a195c...6b2456866f)

Updates `actions/upload-artifact` from 4.3.1 to 4.3.3
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](5d5d22a312...65462800fd)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: Azure/login
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-22 20:57:29 +00:00
Stefan Prodan 60815565aa
Merge pull request #761 from fluxcd/kustomize-name-prefix-suffix
kustomize: Add support for `namePrefix` and `nameSuffix`
2024-04-09 14:40:53 +03:00
Stefan Prodan abf5675f4b
kustomize: Add support for `namePrefix` and `nameSuffix`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-09 12:54:50 +03:00
Max Jonas Werner 98d2522af7
Merge pull request #760 from fluxcd/dependabot/github_actions/ci-8f082d4f6d
build(deps): bump docker/setup-buildx-action from 3.2.0 to 3.3.0 in the ci group
2024-04-09 08:15:45 +02:00
dependabot[bot] efcd824298
build(deps): bump docker/setup-buildx-action in the ci group
Bumps the ci group with 1 update: [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action).


Updates `docker/setup-buildx-action` from 3.2.0 to 3.3.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](2b51285047...d70bba72b1)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-08 20:18:14 +00:00
Stefan Prodan f89e3b79f4
Merge pull request #759 from fluxcd/kustomize-envsubst-strict
kustomize: Implement envsubst strict mode
2024-04-08 15:45:22 +03:00
Stefan Prodan d17ac2d1c4
kustomize: Implement envsubst strict mode
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-08 15:17:22 +03:00
Stefan Prodan e6464cb846
Merge pull request #758 from fluxcd/envsubst
Add envsubst package
2024-04-08 13:15:58 +03:00
Stefan Prodan c0615824c7
envsubst: Improve strict mode tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-08 12:04:14 +03:00
Stefan Prodan b3eaa12fba
envsubst: Add package doc
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-08 11:01:57 +03:00
Stefan Prodan c0b6634f14
envsubst: Add strict mode
Incorporate https://github.com/drone/envsubst/pull/34

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-08 11:00:21 +03:00
Stefan Prodan e28dea23a6
Add envsubst package
Forked from https://github.com/drone/envsubst

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-08 11:00:16 +03:00
Stefan Prodan d8ff5fa9aa
Merge pull request #757 from fluxcd/build-ks-no-resources
kustomize: Allow empty resources in `kustomization.yaml`
2024-04-08 10:53:06 +03:00
Stefan Prodan f5498f95df
kustomize: Fix const shadowing
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-07 11:01:07 +03:00
Stefan Prodan 7a73f41038
kustomize: Allow empty resources in kustomization.yaml
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-07 10:00:42 +03:00
Stefan Prodan cfa07c7328
Merge pull request #756 from fluxcd/kustomize-v5.4.0
Update dependencies to Kustomize v5.4.0
2024-04-05 10:01:52 +03:00
Stefan Prodan 8a7418fa4e
Update dependencies to Kustomize v5.4.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-04 20:38:30 +03:00
Stefan Prodan 159b281dfc
Merge pull request #755 from fluxcd/update-internal-deps-go1.22
Update internal dependencies
2024-04-02 13:32:33 +03:00
Stefan Prodan f4ae8e8e8a
Update internal dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-02 13:08:39 +03:00
Stefan Prodan 288cd7a81f
Merge pull request #752 from fluxcd/handle-in-cluster-annotation
Return a DiffTypeExclude when exclusion annotation is set in cluster
2024-04-02 12:40:45 +03:00
Soule BA 4971c8589f
Return a DiffTypeExclude when exclusion annotation is set in cluster
We want to enable this behaviour for use cases where different
controllers must coordinate in order to mutate a resource.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-04-02 11:19:36 +02:00
Stefan Prodan 46467e7ea1
Merge pull request #754 from fluxcd/update-docker
Update docker dependencies
2024-04-01 14:36:03 +03:00
Stefan Prodan 43f36aa752
Update docker dependencies
Fix CVE-2024-24557

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-01 14:08:26 +03:00
Stefan Prodan e350b5bdf6
Merge pull request #750 from fluxcd/update-deps-go-1.22
Update dependencies to Go 1.22 and Kubernetes 1.29.3
2024-04-01 09:07:48 +03:00
Stefan Prodan 3ad72d9ecf
Update dependencies to Go 1.22 and Kubernetes 1.29.3
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-03-31 22:13:58 +03:00
souleb 6ad47ef748
Merge pull request #751 from fluxcd/disable-bitbucket-server-tests
Disable bitbucket-server e2e
2024-03-28 07:44:13 +01:00
Soule BA 9ba119b6b8
Disable bitbucket-server e2e
We disable the bitbucket-server e2e tests until a new test environment
is available.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-03-28 00:18:33 +01:00
Stefan Prodan e8f9e40e22
Merge pull request #723 from gdasson/main
Adding common "reason" constants
2024-03-27 10:24:49 +02:00
Gaurav Dasson 5c27146df9 Adding common "reason" constants
Signed-off-by: Gaurav Dasson <gaurav.dasson@gmail.com>
2024-03-26 22:57:00 -05:00
Max Jonas Werner 77d72bcd91
Merge pull request #749 from fluxcd/dependabot/github_actions/ci-83d1e47aa6
build(deps): bump the ci group with 1 update
2024-03-26 11:15:05 +01:00
dependabot[bot] 163d93a760
build(deps): bump the ci group with 1 update
Bumps the ci group with 1 update: [actions/cache](https://github.com/actions/cache).


Updates `actions/cache` from 4.0.1 to 4.0.2
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](ab5e6d0c87...0c45773b62)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-26 08:52:37 +00:00
Stefan Prodan 9014952f17
Merge pull request #744 from kevinvalk/main
crdjsonschema action now creates a `all.json` schema to validate any Flux2 resource via a single schema
2024-03-26 10:18:36 +02:00
Kevin Valk 487dda0f29
feat(actions/crdjsonschema): creation of all.json schema to validate against any of Flux2 CRDTs
Signed-off-by: Kevin Valk <kevin@valk.email>
2024-03-25 19:48:12 +01:00
Stefan Prodan 3c0546eb5b
Merge pull request #747 from garyhodgson/issue-746_kubeconfig-proxy-url
runtine: Add `cluster.proxy-url` to kubeconfig allow fields
2024-03-25 16:26:14 +02:00
Gary Hodgson e60b22694a pkg issue 746 - kubeconfig cluster.proxy-url is being ignored by kube client
Signed-off-by: Gary Hodgson <contact@garyhodgson.com>
2024-03-25 14:34:28 +01:00
Stefan Prodan b59c644a87
Merge pull request #748 from fluxcd/pin-envtest
Pin envtest version
2024-03-25 14:42:00 +02:00
Max Jonas Werner f0f74efdcc
Pin envtest version
[This
commit](4c2442e4d7)
causes failures to install envtest, see
https://github.com/kubernetes-sigs/controller-runtime/issues/2720 for
details.

This commit pins envtest to the latest version that still works.

Signed-off-by: Max Jonas Werner <mail@makk.es>
2024-03-25 12:42:31 +01:00
Max Jonas Werner 965d8c8c73
Accept envtest version in envtest action
Users can now provide an envtest version to install. This may be
necessary in cases where the latest envtest version isn't compatible
with a certain Go version.

Signed-off-by: Max Jonas Werner <mail@makk.es>
2024-03-25 12:38:09 +01:00
Stefan Prodan 4cbe8b03fa
Merge pull request #745 from fluxcd/dependabot/github_actions/ci-85c1a2ff92
build(deps): bump the ci group with 5 updates
2024-03-25 10:52:35 +02:00
dependabot[bot] 324c130305
build(deps): bump the ci group with 5 updates
Bumps the ci group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `4.1.1` | `4.1.2` |
| [Azure/login](https://github.com/azure/login) | `1.6.1` | `2.0.0` |
| [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `3.0.0` | `3.2.0` |
| [actions/cache](https://github.com/actions/cache) | `4.0.0` | `4.0.1` |
| [docker/login-action](https://github.com/docker/login-action) | `3.0.0` | `3.1.0` |


Updates `actions/checkout` from 4.1.1 to 4.1.2
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](b4ffde65f4...9bb56186c3)

Updates `Azure/login` from 1.6.1 to 2.0.0
- [Release notes](https://github.com/azure/login/releases)
- [Commits](cb79c773a3...8c334a195c)

Updates `docker/setup-buildx-action` from 3.0.0 to 3.2.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](f95db51fdd...2b51285047)

Updates `actions/cache` from 4.0.0 to 4.0.1
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](13aacd865c...ab5e6d0c87)

Updates `docker/login-action` from 3.0.0 to 3.1.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](343f7c4344...e92390c5fb)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: Azure/login
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-18 20:58:15 +00:00
Sunny 0cf0546cb4
Merge pull request #737 from matheuscscp/download
Add new FetchWithContext() API to ArchiveFetcher and option for downloading without extracting
2024-03-04 16:57:54 +05:30
Matheus Pimenta abaaabe0fd Add new FetchWithContext() API to ArchiveFetcher and option for downloading without extracting
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2024-03-02 09:03:52 +00:00
Stefan Prodan bd512987f2
Merge pull request #740 from gmolau/main
Remove `genclient:Namespaced` tag
2024-02-29 13:49:43 +00:00
Georg Molau 795ce924c0 Remove `genclient:Namespaced` tag
This tag isn't used by controller-tools, only `nonNamespaced` is.

Context: https://cloud-native.slack.com/archives/CLAJ40HV3/p1708794732147909

Tested by running `make generate` and verifying that there is no diff.

Signed-off-by: Georg Molau <georg.molau@gmail.com>
2024-02-28 14:45:27 +01:00
Max Jonas Werner 1b6220820e
Merge pull request #739 from fluxcd/dependabot/github_actions/ci-7b07b3a124
build(deps): bump the ci group with 1 update
2024-02-27 09:18:21 +01:00
dependabot[bot] b3c04d1284
build(deps): bump the ci group with 1 update
Bumps the ci group with 1 update: [google-github-actions/auth](https://github.com/google-github-actions/auth).


Updates `google-github-actions/auth` from 2.1.1 to 2.1.2
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](a6e2e39c0a...55bd3a7c6e)

---
updated-dependencies:
- dependency-name: google-github-actions/auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-26 20:34:28 +00:00
Max Jonas Werner 739461c8ad
Merge pull request #735 from fluxcd/dependabot/github_actions/ci-8079e92a09
build(deps): bump the ci group with 1 update
2024-02-20 09:31:34 +01:00
dependabot[bot] ff8c479168
build(deps): bump the ci group with 1 update
Bumps the ci group with 1 update: [EndBug/label-sync](https://github.com/endbug/label-sync).


Updates `EndBug/label-sync` from 2.3.2 to 2.3.3
- [Release notes](https://github.com/endbug/label-sync/releases)
- [Commits](da00f2c11f...5207415819)

---
updated-dependencies:
- dependency-name: EndBug/label-sync
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-19 20:59:25 +00:00
Max Jonas Werner ce1f99f03d
Merge pull request #733 from fluxcd/dependabot/github_actions/ci-b6673dbec9
build(deps): bump the ci group with 1 update
2024-02-14 18:16:30 +01:00
dependabot[bot] a41579a002
build(deps): bump the ci group with 1 update
Bumps the ci group with 1 update: [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `actions/upload-artifact` from 4.3.0 to 4.3.1
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](26f96dfa69...5d5d22a312)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-12 20:48:13 +00:00
Stefan Prodan d15b989d11
Merge pull request #732 from fluxcd/dependabot/github_actions/ci-4de5eb711c
build(deps): bump the ci group with 1 update
2024-02-06 10:01:13 +02:00
dependabot[bot] 2f76485b8c
build(deps): bump the ci group with 1 update
Bumps the ci group with 1 update: [google-github-actions/auth](https://github.com/google-github-actions/auth).


Updates `google-github-actions/auth` from 2.1.0 to 2.1.1
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](5a50e58116...a6e2e39c0a)

---
updated-dependencies:
- dependency-name: google-github-actions/auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 20:39:49 +00:00
Stefan Prodan 2e7e8fed20
Merge pull request #730 from fluxcd/conditions-HasAnyReasons
runtime: Add `HasAnyReason` to conditions getter
2024-02-05 09:47:20 +02:00
Stefan Prodan 1ae7dafc5a
runtime: Add `HasAnyReason` to conditions getter
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-02-05 09:33:52 +02:00
Stefan Prodan db52a6747f
Merge pull request #729 from fluxcd/dependabot/github_actions/ci-727f6c18fd
build(deps): bump the ci group with 2 updates
2024-01-29 23:22:35 +02:00
dependabot[bot] ea2c0647e9
build(deps): bump the ci group with 2 updates
Bumps the ci group with 2 updates: [dorny/paths-filter](https://github.com/dorny/paths-filter) and [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `dorny/paths-filter` from 2 to 3
- [Release notes](https://github.com/dorny/paths-filter/releases)
- [Changelog](https://github.com/dorny/paths-filter/blob/master/CHANGELOG.md)
- [Commits](https://github.com/dorny/paths-filter/compare/v2...v3)

Updates `actions/upload-artifact` from 4.2.0 to 4.3.0
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](694cdabd8b...26f96dfa69)

---
updated-dependencies:
- dependency-name: dorny/paths-filter
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-29 20:29:55 +00:00
Stefan Prodan e5ca530f6c
Merge pull request #728 from fluxcd/internal-deps
Update internal dependencies
2024-01-29 11:19:17 +02:00
Stefan Prodan ac45fb6250
Update internal dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-01-29 11:04:52 +02:00
Stefan Prodan 31388ceb74
Merge pull request #727 from fluxcd/distribution-up
Update OCI distribution to v3.0.0-alpha.1
2024-01-26 17:14:53 +02:00
Stefan Prodan 328eb42302
Update OCI distribution to v3.0.0-alpha.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-01-26 16:59:56 +02:00
Sunny 7fabcd8e2b
Merge pull request #684 from somtochiama/pull-static-file-oci
[oci] Pull static layer
2024-01-26 16:51:03 +05:30
Somtochi Onyekwere a330445105 fix options
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2024-01-25 19:51:14 +01:00
Somtochi Onyekwere 255f8fc9a2 test for static archive
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2024-01-25 19:46:25 +01:00
Somtochi Onyekwere f155227712 refactor test
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2024-01-25 19:34:58 +01:00
Somtochi Onyekwere 86875142cf implement pull static artifact
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2024-01-25 12:19:10 +01:00
Stefan Prodan 4624208c62
Merge pull request #726 from fluxcd/deps-kube-v0.28.6
Update dependencies to Kubernetes v1.28.6
2024-01-24 13:34:06 +02:00
Stefan Prodan 30da897670
Update dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-01-24 00:20:25 +02:00
Stefan Prodan 63e3e9cce4
Merge pull request #725 from fluxcd/dependabot/github_actions/ci-f38fbd1956
build(deps): bump the ci group with 5 updates
2024-01-23 18:21:30 +02:00
dependabot[bot] 25550225a7
build(deps): bump the ci group with 5 updates
Bumps the ci group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [Azure/login](https://github.com/azure/login) | `1.6.0` | `1.6.1` |
| [actions/cache](https://github.com/actions/cache) | `3.3.3` | `4.0.0` |
| [google-github-actions/auth](https://github.com/google-github-actions/auth) | `2.0.1` | `2.1.0` |
| [google-github-actions/setup-gcloud](https://github.com/google-github-actions/setup-gcloud) | `2.0.1` | `2.1.0` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `4.1.0` | `4.2.0` |


Updates `Azure/login` from 1.6.0 to 1.6.1
- [Release notes](https://github.com/azure/login/releases)
- [Commits](e15b166166...cb79c773a3)

Updates `actions/cache` from 3.3.3 to 4.0.0
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](e12d46a63a...13aacd865c)

Updates `google-github-actions/auth` from 2.0.1 to 2.1.0
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](f6de81663f...5a50e58116)

Updates `google-github-actions/setup-gcloud` from 2.0.1 to 2.1.0
- [Release notes](https://github.com/google-github-actions/setup-gcloud/releases)
- [Changelog](https://github.com/google-github-actions/setup-gcloud/blob/main/CHANGELOG.md)
- [Commits](5a5f7b85fc...98ddc00a17)

Updates `actions/upload-artifact` from 4.1.0 to 4.2.0
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](1eb3cb2b3e...694cdabd8b)

---
updated-dependencies:
- dependency-name: Azure/login
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
- dependency-name: google-github-actions/auth
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: google-github-actions/setup-gcloud
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-23 15:48:47 +00:00
Stefan Prodan 16f5d1156e
Merge pull request #722 from fluxcd/ssa-filter-wait-errors
ssa: Improve wait error reporting
2024-01-23 17:40:42 +02:00
Stefan Prodan acf480777b
ssa: Improve wait error reporting
If fail fast is enable, include only the failed resources
in the returned error.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-01-20 10:02:15 +02:00
Stefan Prodan 404873e9c9
Merge pull request #721 from fluxcd/up-deps-cve-fix
Update dependencies with CVE fixes
2024-01-19 11:35:48 +02:00
Stefan Prodan fb02c984dd
Update dependencies with CVE fixes
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-01-19 11:16:54 +02:00
Stefan Prodan 87f5fa0273
Merge pull request #718 from fluxcd/restore-emptydir-build
kustomize: Restore empty dir build
2024-01-19 09:04:43 +02:00
Stefan Prodan e4ca429206
Replace go-multierror with Go std errors
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-01-18 18:08:40 +02:00
Stefan Prodan a542b49282
kustomize: Restore empty dir build
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-01-18 18:08:08 +02:00
Stefan Prodan c2c9efe8ba
Merge pull request #720 from fluxcd/fix-ssa-ns-error
ssa: Restore `namespace not specified` error handing
2024-01-18 16:56:16 +02:00
Stefan Prodan 26356305d9
ssa: Restore `namespace not specified` error handing
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-01-18 14:51:35 +02:00
Stefan Prodan 6f62989025
Merge pull request #719 from fluxcd/ssa-skip-clusterrole-normalization
ssa: Skip normalization of Roles and ClusterRoles
2024-01-18 12:29:45 +02:00
Stefan Prodan 2cd5930d9c
ssa: Skip normalization of Roles and ClusterRoles
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-01-18 11:41:14 +02:00
Stefan Prodan 58b2a7e8e0
Merge pull request #714 from fluxcd/dependabot/github_actions/ci-7664d44379
build(deps): bump the ci group with 4 updates
2024-01-16 11:04:31 +02:00
dependabot[bot] 5f217226f6
build(deps): bump the ci group with 4 updates
Bumps the ci group with 4 updates: [Azure/login](https://github.com/azure/login), [actions/cache](https://github.com/actions/cache), [google-github-actions/auth](https://github.com/google-github-actions/auth) and [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `Azure/login` from 1.5.1 to 1.6.0
- [Release notes](https://github.com/azure/login/releases)
- [Commits](de95379fe4...e15b166166)

Updates `actions/cache` from 3.3.2 to 3.3.3
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](704facf57e...e12d46a63a)

Updates `google-github-actions/auth` from 2.0.0 to 2.0.1
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](67e9c72af6...f6de81663f)

Updates `actions/upload-artifact` from 4.0.0 to 4.1.0
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](c7d193f32e...1eb3cb2b3e)

---
updated-dependencies:
- dependency-name: Azure/login
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: google-github-actions/auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-15 20:12:55 +00:00
Sunny 8197e2d2bd
Merge pull request #713 from fluxcd/enable-reaper-delete
integration-cleanup: Enable reaper delete
2024-01-10 18:50:32 +05:30
Sunny 1e9ea6f9f3
integration-cleanup: Enable reaper delete
The integration test resources cleanup program, reaper, used to be run
in dry-run mode before to only report on leftover resources that were
more than a day old. Recently, once in a few days, some GKE clusters
would provision in unusable state. In the GKE web console, the cluster
shows the following error:

```
All cluster resources were brought up, but: only 2 nodes out of 3 have
registered; cluster may be unhealthy.
```

And trying to connect to the cluster using cloudshell results in
connection error:

```
WARNING: cluster flux-test-casual-oryx is not RUNNING. The kubernetes
API may or may not be available. Check the cluster status for more
information.
```

The cluster is not usage.
When this happens, terraform waits for the cluster to be ready and
timeout. Due to the timeout, the cluster is not written to the terraform
state file and it can't be deleted by running terraform destroy.

The GKE and individual node logs and monitoring pages don't show any
other details about the issue,

In the past, these resources were manually deleted from the web console.
Since this failure can happen any time, enabling the reaper cleanup took
with retention period 1 hour would be helpful to ensure such unusable
cluster get deleted within a hour. Test clusters don't run for more than
20 minutes. Only the resources with the tag `ci=true` will get deleted.
Also, update the cron time for cleanup to run every hour.

Signed-off-by: Sunny <github@darkowlzz.space>
2024-01-10 17:24:34 +05:30
Stefan Prodan af287c011a
Merge pull request #711 from fluxcd/dependabot/github_actions/ci-0cd9d4ac0a
build(deps): bump the ci group with 1 update
2024-01-08 17:04:56 +02:00
dependabot[bot] 412da75d23
build(deps): bump the ci group with 1 update
Bumps the ci group with 1 update: [google-github-actions/setup-gcloud](https://github.com/google-github-actions/setup-gcloud).


Updates `google-github-actions/setup-gcloud` from 2.0.0 to 2.0.1
- [Release notes](https://github.com/google-github-actions/setup-gcloud/releases)
- [Changelog](https://github.com/google-github-actions/setup-gcloud/blob/main/CHANGELOG.md)
- [Commits](825196879a...5a5f7b85fc)

---
updated-dependencies:
- dependency-name: google-github-actions/setup-gcloud
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-08 14:48:41 +00:00
Sunny b60db8e44e
Merge pull request #712 from fluxcd/oci-int-destroy-only
oci/int: Add separate resource cleanup step
2024-01-08 20:15:45 +05:30
Sunny a79b4b97e6 oci/int: Add separate resource cleanup step
Introduce a destroy-only mode in the test runner to run terraform
destroy for the respective cloud provider configurations. This can be
used to destroy cloud resources without going through the whole
provision-test process.

Add a new step in github actions workflow to run the test binary in
destoy-only mode at the very end irrespective of the result of the
previous steps. This ensures that the infrastructure is always
destroyed, even if the CI job is cancelled.

This is added to solve a recent CI failure due to a failure in GCP which
resulted in the cluster provisioning to take more than 30 minutes,
which is the test timeout duration. After the timeout, the test binary
got terminated and couldn't perform graceful stop and cleanup. To work
around such scenarios, the cleanup can be run separately at the end with
its own timeout to not affect the test runtime.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2024-01-08 20:00:13 +05:30
Sunny 1876c5e80f
Merge pull request #710 from vishal-chdhry/fips-support-aws-auth
feat: add support for fips endpoints in aws auth parse registry
2023-12-20 18:56:04 +05:30
Vishal Choudhary cfcfe2fa59
feat: add support for fips endpoints in aws auth parse registry
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>

feat: update the regex to add fips non-capturing group

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>

feat: add support for fips endpoints in aws auth parse registry

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
2023-12-20 18:17:27 +05:30
Hidde Beydals d22f98a123
Merge pull request #709 from fluxcd/dependabot/github_actions/ci-ee46e5bd32
build(deps): bump the ci group with 1 update
2023-12-19 09:57:36 +01:00
dependabot[bot] 5023684202
build(deps): bump the ci group with 1 update
Bumps the ci group with 1 update: [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `actions/upload-artifact` from 3.1.3 to 4.0.0
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](a8a3f3ad30...c7d193f32e)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 20:29:59 +00:00
Hidde Beydals acee675cba
Merge pull request #708 from allenporter/flux-generator-remote
Fix a silently dropping Kustomization remote resources
2023-12-18 08:10:29 +01:00
Allen Porter 99853c569b Fix a silently dropping Kustomization remote resources
Signed-off-by: Allen Porter <allen.porter@gmail.com>
2023-12-17 02:56:11 +00:00
Stefan Prodan e4b557edc0
Merge pull request #705 from fluxcd/action-kustomize-5.3.0
Bump kustomize GH Action to 5.3.0
2023-12-15 13:34:59 +02:00
Stefan Prodan 87379ce910
Bump kustomize GH Action to 5.3.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-12-15 11:21:36 +02:00
Stefan Prodan 1169458de7
Merge pull request #707 from fluxcd/trim-condition-msg
runtime: Trim the condition message to the max accepted length
2023-12-13 15:04:16 +02:00
Stefan Prodan dcc7e93d33
runtime: Trim the condition message to the max accepted length
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-12-13 14:51:49 +02:00
Hidde Beydals b4466826d6
Merge pull request #706 from fluxcd/http-fetch-logger
http/fetch: allow configuring a logger on client
2023-12-13 11:43:32 +01:00
Hidde Beydals f78f2456e0
http/fetch: allow configuring a logger on client
This allows for the configuration of a logger on the retryable HTTP
client. While adding builtin support for providing a `logr.Logger`
instance, which will be wrapped in  a `retryablehttp.LeveledLogger`
to only log errors.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-12-13 11:30:09 +01:00
Stefan Prodan 0603b64045
Merge pull request #704 from fluxcd/dependabot/github_actions/ci-17e990830a
build(deps): bump the ci group with 4 updates
2023-12-11 21:51:27 +01:00
dependabot[bot] 8160394cfe
build(deps): bump the ci group with 4 updates
Bumps the ci group with 4 updates: [actions/setup-go](https://github.com/actions/setup-go), [Azure/login](https://github.com/azure/login), [google-github-actions/auth](https://github.com/google-github-actions/auth) and [google-github-actions/setup-gcloud](https://github.com/google-github-actions/setup-gcloud).


Updates `actions/setup-go` from 4.1.0 to 5.0.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](93397bea11...0c52d547c9)

Updates `Azure/login` from 1.5.0 to 1.5.1
- [Release notes](https://github.com/azure/login/releases)
- [Commits](4c88f01b0e...de95379fe4)

Updates `google-github-actions/auth` from 1.2.0 to 2.0.0
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](f105ef0cdb...67e9c72af6)

Updates `google-github-actions/setup-gcloud` from 1.1.1 to 2.0.0
- [Release notes](https://github.com/google-github-actions/setup-gcloud/releases)
- [Changelog](https://github.com/google-github-actions/setup-gcloud/blob/main/CHANGELOG.md)
- [Commits](e30db14379...825196879a)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
- dependency-name: Azure/login
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: google-github-actions/auth
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
- dependency-name: google-github-actions/setup-gcloud
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-11 20:38:07 +00:00
Hidde Beydals e73dd38824
Merge pull request #703 from fluxcd/git-update-deps
git/gogit: update go-git to v5.11.0
2023-12-11 13:46:53 +01:00
Hidde Beydals a096f678d9
git/gogit: update go-git to v5.11.0
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-12-11 13:32:15 +01:00
Hidde Beydals 42638a1828
Merge pull request #702 from fluxcd/oci-update-deps
oci: update dependencies
2023-12-11 13:31:50 +01:00
Hidde Beydals 30a1082492
oci: update other dependencies
- github.com/Azure/azure-sdk-for-go/sdk/azcore to v1.9.0
- github.com/Azure/azure-sdk-for-go/sdk/azidentity to v1.4.0
- github.com/go-git/go-git/v5 to v5.11.0
- github.com/google/go-containerregistry to v0.17.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-12-11 13:18:55 +01:00
Hidde Beydals 47993326d3
oci: update AWS related dependencies
- github.com/aws/aws-sdk-go-v2/config to v1.26.1
- github.com/aws/aws-sdk-go-v2/credentials to v1.16.12
- github.com/aws/aws-sdk-go-v2/internal/ini to v1.7.2
- github.com/aws/aws-sdk-go-v2/service/ecr to v1.24.5
- github.com/aws/aws-sdk-go-v2/service/sso to v1.18.5
- github.com/aws/aws-sdk-go-v2/service/ssooidc to v1.21.5
- github.com/aws/aws-sdk-go-v2/service/sts to v1.26.5

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-12-11 12:59:29 +01:00
Hidde Beydals 35ee14d1ba
Merge pull request #701 from fluxcd/runtime-update-deps
runtime: update dependencies
2023-12-11 12:56:25 +01:00
Hidde Beydals c746b91d0b
runtime/logger: properly encode "trace" log-level
This ensures that the loglevel for trace (and below), is logged as
"trace" instead of "level(-2)".

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-12-11 12:34:10 +01:00
Hidde Beydals d3aa542fbf
runtime: update dependencies
- go.uber.org/zap to v1.26.0
- k8s.io/klog/v2 to v2.110.1
- github.com/Azure/go-ansiterm to v0.0.0-20230124172434-306776ec8161
- github.com/fsnotify/fsnotify to v1.7.0
- github.com/go-logr/zapr to v1.3.0
- github.com/go-openapi/jsonpointer to v0.20.0
- github.com/go-openapi/swag to v0.22.4
- github.com/imdario/mergo to v0.3.16
- go.starlark.net to v0.0.0-20231121155337-90ade8b19d09
- golang.org/x/exp to v0.0.0-20231206192017-f3f8817b8deb
- gopkg.in/evanphx/json-patch.v5 to v5.7.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-12-11 12:16:44 +01:00
Stefan Prodan dd71ce1b5f
Merge pull request #700 from fluxcd/kustomize-5.3.0
Update Kustomize to v5.3.0
2023-12-11 09:42:21 +01:00
Stefan Prodan 53475f95ec
Update Kustomize to v5.3.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-12-11 10:29:54 +02:00
Stefan Prodan b963f73314
Merge pull request #699 from somtochiama/fix-azure
Update AWS dependencies
2023-12-11 09:20:19 +01:00
Somtochi Onyekwere 7b20166a9a Update AWS dependencies
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-12-10 06:56:19 +01:00
Hidde Beydals 6637febc31
Merge pull request #697 from fluxcd/ssa-break-cycle
ssa: avoid potential cyclic import
2023-12-01 11:58:49 +01:00
Hidde Beydals f3cc2d7092
ssa: avoid potential cyclic import
This moves things into separate packages to avoid a potential cyclic
import as soon as we would like to utilize `jsondiff` in `ssa` itself.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-12-01 11:45:08 +01:00
Stefan Prodan 1ad05599a9
Merge pull request #695 from fluxcd/bump-internal
Update internal dependencies
2023-11-29 21:36:41 +02:00
Stefan Prodan 39198df777
Update internal dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-29 21:23:56 +02:00
Stefan Prodan 91eda6e653
Merge pull request #694 from fluxcd/git-deps-up
Use `gomega` in sourceignore package
2023-11-28 17:06:20 +02:00
Stefan Prodan 2a6458411a
Use gomega in sourceignore
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-28 16:50:35 +02:00
Stefan Prodan 46577cdee2
Update `golang.org` dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-28 16:43:24 +02:00
Stefan Prodan e6b6af79c6
Merge pull request #685 from knutgoetz/chore/gogit/delete-gogiterror-function
Delete obsolete goGitError function
2023-11-28 11:54:14 +02:00
Knut Götz cbc217282a
Delete obsolete goGitError function
The function is no longer needed since go-git was updated to 5.10.0.
Now go-git returns an improved error message. See the following PR for
more details:
  - https://github.com/go-git/go-git/pull/866/files

Signed-off-by: Knut Götz <knutgoetz@gmail.com>
2023-11-28 11:12:25 +02:00
Stefan Prodan 02723c3a72
Merge pull request #693 from fluxcd/go-git-v5.10.1
Update go-git to v5.10.1
2023-11-28 10:07:51 +02:00
Stefan Prodan 3715de1f7c
Update go-git to v5.10.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-27 20:31:05 +02:00
Hidde Beydals ce912554b6
Merge pull request #692 from fluxcd/ssa-nits
ssa: prevent unnecessary `DeepCopy`
2023-11-27 14:12:30 +01:00
Hidde Beydals 8fc450539b
ssa: prevent unnecessary `DeepCopy`
When attempting to retrieve the object, setting the GVK on the
Unstructured is sufficient to be able to retrieve it from the cluster.

This avoids deep-copying the object in full and then `nil` writing it
again when it does not exist in the cluster. Which can potentially save
quite some duplicate data when e.g. dealing with Custom Resource
Definitions or other large object kinds.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-27 12:32:05 +01:00
Hidde Beydals cc076057cc
Merge pull request #691 from fluxcd/jsondiff-include-obj
ssa/jsondiff: cluster and desired object in Diff
2023-11-27 12:31:57 +01:00
Hidde Beydals c65e1a0ab0
ssa/jsondiff: cluster and desired object in Diff
By including the objects in full, it becomes possible to for example
apply the JSON Patch without having to retrieve the object again.

In addition, it becomes possible to e.g. render a diff including any
ignore rules (using dyff) by applying the JSON Patch to a copy of the
cluster object.

Note that when you want to use the JSON Patch result to perform an
actual patch operation, any Secret masking should be done while
displaying information and not using the available option. As otherwise
the patch would be issued with masked data (and potentially illegal
base64 payloads).

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-27 12:04:24 +01:00
Stefan Prodan 9f8701a7ae
Merge pull request #688 from fluxcd/dependabot/github_actions/ci-6276e8f844
build(deps): bump the ci group with 2 updates
2023-11-20 23:19:31 +02:00
dependabot[bot] eaab9ba09d
build(deps): bump the ci group with 2 updates
Bumps the ci group with 2 updates: [Azure/login](https://github.com/azure/login) and [google-github-actions/auth](https://github.com/google-github-actions/auth).


Updates `Azure/login` from 1.4.7 to 1.5.0
- [Release notes](https://github.com/azure/login/releases)
- [Commits](92a5484dfa...4c88f01b0e)

Updates `google-github-actions/auth` from 1.1.1 to 1.2.0
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](35b0e87d16...f105ef0cdb)

---
updated-dependencies:
- dependency-name: Azure/login
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: google-github-actions/auth
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-20 20:18:25 +00:00
Stefan Prodan 3dc541cc45
Merge pull request #687 from fluxcd/update-internal
Update internal dependencies
2023-11-20 14:13:17 +02:00
Stefan Prodan 1477c6d6ef
Update internal dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-20 14:01:18 +02:00
Stefan Prodan cc785fa0aa
Merge pull request #686 from fluxcd/k8s-1.28
Update to Kubernetes v2.28 and Kustomize v5.2
2023-11-20 13:47:21 +02:00
Stefan Prodan 1d7d31b812
all: Group `github.com/fluxcd/cli-utils` imports
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-20 13:21:34 +02:00
Stefan Prodan 09ba5d81ef
runtime: Add `pprof.GetHandlers` to help setup the metrics server
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-20 13:07:57 +02:00
Stefan Prodan 768085de41
runtime: Update `sigs.k8s.io/controller-runtime` to v0.16.3
Switch from `sigs.k8s.io/cli-utils` to `github.com/fluxcd/cli-utils`
to unblock Kubernetes updates.
Remove `pprof.SetupHandlers` due to breaking changes in controller-runtime.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-20 11:35:56 +02:00
Stefan Prodan 2e007cbb21
ssa: Update Kubernetes to v1.28.4
Switch from `sigs.k8s.io/cli-utils` to `github.com/fluxcd/cli-utils`
to unblock Kubernetes and Kustomize updates.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-20 11:34:06 +02:00
Stefan Prodan e7686cf5a0
kustomize: Update Kustomize to v5.2.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-20 11:32:06 +02:00
Stefan Prodan 3be575d438
oci: Update `sigs.k8s.io/controller-runtime` to v0.16.3
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-20 11:28:41 +02:00
Stefan Prodan 7f72436b22
helmtestserver: Update Helm to v3.13.2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-20 11:25:32 +02:00
Stefan Prodan fe543f5f6a
git: Update `golang.org/x/crypto` to v0.15.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-20 11:24:47 +02:00
Stefan Prodan 129adfded5
apis: Update Kubernetes to v1.28
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-11-20 11:20:46 +02:00
Sunny 5387cf37fc
Merge pull request #665 from somtochiama/test-workload-id
Add integration tests for Workload Identity
2023-11-15 17:21:56 +05:30
Somtochi Onyekwere 72807998d5 Add integration tests for Workload Identity
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-11-15 12:35:20 +01:00
Sanskar Jaiswal 2a5dc7e6a3
Merge pull request #671 from fluxcd/http-err
runtime/controller: add error type for insecure HTTP connections
2023-11-13 21:28:39 -06:00
Sanskar Jaiswal 9ab80b9e84
runtime/controller: add tests for connection options
Add tests for `ConnectionOptions` testing its flag binding and
environment compatibility checking.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-11-14 06:21:40 +05:30
Sanskar Jaiswal b353bf3638
runtime/controller: add error type for insecure HTTP connections
Add error type `ErrInsecureHTTPBlocked` to `runtime/controller` which
signals that use of insecure plain HTTP connections was requested but
such behavior is blocked.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-11-14 06:21:40 +05:30
Stefan Prodan 658f55ae79
Merge pull request #675 from somtochiama/push-single-file-oci
[oci] Extend oci.Push to create layer with static uncompressed contents
2023-11-07 08:35:11 +02:00
Somtochi Onyekwere 66f1c268a4 Push static layer
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-11-07 00:07:15 +01:00
Hidde Beydals 0d58ef473b
Merge pull request #683 from fluxcd/update-deps
Update dependencies
2023-11-06 12:09:29 +01:00
Hidde Beydals 5505645ada
Update `sigs.k8s.io/controller-runtime` to v0.15.3
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-06 11:53:58 +01:00
Hidde Beydals 2d41523d93
Update `k8s.io/*` to `v0.27.7`
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-06 11:27:49 +01:00
Hidde Beydals 4c3b551c94
Update `github.com/cyphar/filepath-securejoin`
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-06 11:25:18 +01:00
Hidde Beydals 830e2387a8
Update `github.com/docker/docker` across packages
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-06 11:24:48 +01:00
Hidde Beydals 7c5474c3cc
Update `golang.org/x/net` across packages
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-06 09:48:10 +01:00
Hidde Beydals 0b57897863
Merge pull request #681 from fluxcd/tweak-file-perms
*: change default permissions
2023-11-06 09:38:27 +01:00
Hidde Beydals 7dac171f5c
*: change default permissions
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-06 09:11:32 +01:00
Stefan Prodan 9c506d65ec
Merge pull request #682 from fluxcd/oci-int-stop-exit-code
oci/tests/int: Set exit code 1 on tf destroy fail
2023-11-03 23:53:20 +02:00
Sunny d29d25feb6
oci/tests/int: Set exit code 1 on tf destroy fail
Explicitly set the test program exit code to 1 when terraform destroy
fails to delete the infrastructure.

This was observed when GKE clusters failed to delete due to delete
protection enabled by default in the latest version of terraform
provider google.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-11-03 23:57:14 +05:30
Sunny c787787803
Merge pull request #680 from fluxcd/oci-int-delete-propagation
oci/tests/int: Set delete propagation policy
2023-10-31 16:36:11 +05:30
Sunny 72fbc60921
oci/tests: Set delete propagation policy
The test testImageRepositoryListTags creates a Job that performs
registry login and listing of tags. The Job is deleted at the end of the
test. But the associated Pods are left behind in completed state.
Pass a delete propagation policy to ensure the completed pods are
cleaned up.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-10-30 17:14:46 +05:30
Hidde Beydals ee4c4a0647
Merge pull request #676 from fluxcd/jsondiff-imprv
ssa/jsondiff: improve exclusion, and add graceful error behavior
2023-10-26 16:00:34 +02:00
Hidde Beydals 999391c1de
ssa/jsondiff: add graceful list option
This allows `UnstructuredList` to continue the diff operation when an
error occurs for a single resource. Which may be desirable behavior
when you want to act on any detected divergence, even if a portion of
the operation failed.

The parsing of an `IgnoreRule` itself _does_ continue to immediately
return an error, as otherwise the produced diff could be inaccurate
(instead of being unable to provide one).

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-26 14:49:28 +02:00
Hidde Beydals 709cb06091
ssa/jsondiff: add context to regex parsing errs
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-26 14:48:15 +02:00
Hidde Beydals 036df2d0eb
ssa/jsondiff: improve ignore and exclude behavior
This allows the exclusion selector for metadata to be provided when
diffing a single resource. While also recognizing an "empty" JSON
pointer path as an exclusion of a resource as a whole.

In addition, `IgnorePathSelector` has been renamed to `IgnoreRule`
with the goal to be easier to comprehend.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-26 14:48:14 +02:00
Max Jonas Werner 824f4c6779
Merge pull request #677 from fluxcd/dependabot/go_modules/helmtestserver/google.golang.org/grpc-1.56.3
build(deps): bump google.golang.org/grpc from 1.53.0 to 1.56.3 in /helmtestserver
2023-10-26 10:05:49 +02:00
dependabot[bot] 8760e92baa
build(deps): bump google.golang.org/grpc in /helmtestserver
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.53.0 to 1.56.3.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.53.0...v1.56.3)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-26 07:12:43 +00:00
Max Jonas Werner 4b21b741d4
Merge pull request #678 from fluxcd/upgrade-go-git
Upgrade go-git to 5.10.0
2023-10-26 09:10:46 +02:00
Max Jonas Werner fdd5321781
Upgrade go-git to 5.10.0
This will fix https://github.com/fluxcd/source-controller/issues/1239

Signed-off-by: Max Jonas Werner <mail@makk.es>
2023-10-26 07:51:35 +02:00
Hidde Beydals 64d359c22d
Merge pull request #674 from fluxcd/jsondiff-imprv
ssa/jsondiff: add helpers to `DiffSet`
2023-10-24 10:57:02 +02:00
Hidde Beydals 9750ec3f7c
ssa/jsondiff: add helpers to `DiffSet`
To allow consumers to quickly check if a `DiffSet` contains a certain
type, or any changes in general.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-24 10:36:33 +02:00
Stefan Prodan 3676ebdfde
Merge pull request #673 from fluxcd/dependabot/github_actions/ci-d9ade8d586
build(deps): bump the ci group with 2 updates
2023-10-24 00:06:08 +03:00
dependabot[bot] 486c824889
build(deps): bump the ci group with 2 updates
Bumps the ci group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [ossf/scorecard-action](https://github.com/ossf/scorecard-action).


Updates `actions/checkout` from 4.1.0 to 4.1.1
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8ade135a41...b4ffde65f4)

Updates `ossf/scorecard-action` from 2.3.0 to 2.3.1
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](483ef80eb9...0864cf1902)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-23 20:37:30 +00:00
Hidde Beydals 3e343b9755
Merge pull request #657 from fluxcd/ssa-jsondiff
ssa: introduce `jsondiff` package
2023-10-20 16:37:45 +02:00
Hidde Beydals f8bc121efa
ssa/jsondiff: `Change*` -> `Diff*`
To avoid a naming collision with `ssa` itself.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-19 16:30:51 +02:00
Hidde Beydals 92953af241
ssa/jsondiff: add more tests around selectors
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-19 16:30:38 +02:00
Hidde Beydals 46ceeb16e0
ssa/jsondiff: make rationalize a configurable opt
This allows for the enabling the rationalization of operations, which
may not be desirable behavior by default for all consumers.

For more information about the logic behind rationalization, refer to:
https://github.com/wI2L/jsondiff#operations-rationalization

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-19 15:36:20 +02:00
Hidde Beydals b7a62de113
ssa/jsondiff: use dry-run normalizer and error
This ensures the same patches are applied to the resource as is being
done by the `ResourceManager`, while also adopting the same type of
error to better reason about the cause of a dry-run apply failure.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-19 15:36:19 +02:00
Hidde Beydals 9b143fd57d
ssa: introduce `jsondiff` package
This package enhances drift detection and divergence reporting by
returning a JSON Patch (RFC 6902) in a single run, effectively
highlighting any discrepancies found.

It offers a distinct advantage over `ResourceManager#Diff()`, which
uses private logic for diff detection, resulting in potentially
different divergences being presented to users at a later stage
compared to those detected by the method.

Furthermore, `jsondiff` provides support for ignoring specific parts
of resources using JSON Pointer paths, and includes a Kustomize-like
"target" selector to apply ignore rules to one or multiple resources.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-19 15:31:48 +02:00
Stefan Prodan a694b868d8
Merge pull request #670 from fluxcd/force-delete-propagation
ssa: Set force delete propagation to cleanup jobs
2023-10-18 09:38:05 +03:00
Stefan Prodan f8e86c8840
ssa: Set force delete propagation to cleanup jobs
Set the delete propagation to background to cleanup the pods for recreated Job

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-10-18 01:13:24 +03:00
Sunny f42b2442d5
Merge pull request #669 from fluxcd/clone-shallowclone
git/gogit: Use shallowclone in cloneRefName tests
2023-10-17 20:30:32 +05:30
Sunny 606dd68754 git/gogit: Use shallowclone in cloneRefName tests
For consistency across the various clone methods that support cloning,
add shallow clone option in cloneRefName test.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-10-17 19:36:49 +05:30
Sanskar Jaiswal 68646dd78d
Merge pull request #668 from fluxcd/update-git
git/{gogit,e2e}: update internal deps
2023-10-17 19:08:59 +05:30
Sanskar Jaiswal eb1276b10b
git/{gogit,e2e}: update internal deps
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-10-17 18:41:32 +05:30
Sanskar Jaiswal 388dd6604d
Merge pull request #667 from fluxcd/update-git-deps
git/{gogit,e2e}: Update dependencies
2023-10-17 18:29:35 +05:30
Sanskar Jaiswal 2fed1faa21
git/e2e: update dependencies
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-10-17 17:50:19 +05:30
Sanskar Jaiswal 6ad87980e1
git/gogit: update dependencies
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-10-17 17:50:12 +05:30
Sanskar Jaiswal 3b08f087ee
git: update dependencies
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-10-17 17:50:01 +05:30
Sanskar Jaiswal d2d97d596f
Merge pull request #666 from fluxcd/optimize-refname
git/gogit: use existing methods to clone branch/tag via refname
2023-10-17 17:41:52 +05:30
Sanskar Jaiswal d6f0e933da
git/gogit: use existing methods to clone branch/tag via refname
Use `cloneBranch()` and `cloneTag()` when cloning a repo via a refname
if the refname points to a branch/tag. This enables shallow cloning
repositories via refnames as `cloneCommit()` doesn't support shallow
cloning.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-10-17 13:58:56 +05:30
Hidde Beydals 4292046920
Merge pull request #663 from fluxcd/tidy-nits
Address various nits throughout packages
2023-10-16 11:57:37 +02:00
Hidde Beydals e56a100162
helmtestserver: check err before `Close()` defer
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-13 13:34:31 +02:00
Hidde Beydals b6fd7cc5da
tar: remove unused `allowSymlink`
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-13 13:34:31 +02:00
Hidde Beydals 8b924c346c
tar: check err before continuing walk
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-13 11:49:58 +02:00
Hidde Beydals 3dbdf8e3cd
ssa: remove unnecessary blank assignment
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-13 11:48:46 +02:00
Hidde Beydals c4364ceb53
ssa: address `wait.PollImmediate` deprecation
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-13 11:46:02 +02:00
Hidde Beydals 9cc949d4e9
ssa: remove unused code
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-10 16:58:14 +02:00
Hidde Beydals 0a88d06ef3
ssa: use simple string conversion
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-10 16:56:12 +02:00
Hidde Beydals 3525dd9f9e
oci: do not use deprecated `ioutil`
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-10 16:50:57 +02:00
Hidde Beydals 66ba2bd527
oci: prevent unnecessary `fmt.Sprintf` wrapping
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-10 16:49:37 +02:00
Hidde Beydals 52f8838929
http/fetch: ensure proper naming of err type
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-10 16:48:14 +02:00
Hidde Beydals a5e9353b96
oci: remove unused `sync.Mutex`
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-10 16:47:23 +02:00
Hidde Beydals e40b4942dc
helmtestserver: move to ProtonMail openpgp
As the version from /x/crypto has been deprecated.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-10 16:10:43 +02:00
Hidde Beydals 6fcd67cad0
git: simplify if statement
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-10 16:06:56 +02:00
Hidde Beydals 2eb3470eea
gittestserver: remove redundant return
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-10 16:05:51 +02:00
Hidde Beydals 6e9a409657
git: set file permissions to `0o600`
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-10 15:53:49 +02:00
Hidde Beydals 91179f6200
git: deal with `io/ioutil` deprecation
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-10 12:55:29 +02:00
Hidde Beydals bdecd03bbf
git/gogit: test or ignore returned errs
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-10 12:43:54 +02:00
Hidde Beydals 807a69505f
Merge pull request #662 from fluxcd/dependabot/github_actions/ci-2f3aab97f7
build(deps): bump the ci group with 1 update
2023-10-09 22:55:29 +02:00
dependabot[bot] b3172c374c
build(deps): bump the ci group with 1 update
Bumps the ci group with 1 update: [ossf/scorecard-action](https://github.com/ossf/scorecard-action).

- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](08b4669551...483ef80eb9)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-09 20:31:47 +00:00
Hidde Beydals 18dd8fd7a2
Merge pull request #658 from fluxcd/ssa-normalize 2023-10-07 10:45:37 +02:00
Hidde Beydals dd98209a95
ssa: make dry-run error typed
This enriches the options a consumer has to debug the error, as it now
provides access to the Unstructured which produced the error. While
also allowing the upcoming `jsondiff` sub-package to reuse and emit
the error.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-07 09:41:33 +02:00
Hidde Beydals e1cb374995
ssa: deprecate `SetNativeKindsDefaults`
In favor of the newly added `NormalizeUnstructuredList`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-07 09:41:33 +02:00
Hidde Beydals 3773fe1818
ssa: add post-dry-run normalize function
To facilitate fixing issues to Kubernetes resources as returned by a
server-side dry-run apply.

The behavior of the function itself equals to the previous behavior
of `fixHorizontalPodAutoscaler`. However, this is now exposed to allow
other consumers (e.g. the to be introduced `jsondiff` sub-library) to
make use of the same patches without further code duplication.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-07 09:41:32 +02:00
Hidde Beydals fc3c0302ad
ssa: improve and extend Unstructured normalization
This allows for a single Unstructured object to be normalized, as was
already possible for a slice of objects using `SetNativeKindsDefaults`.

In addition, the further logic around normalization has be rewritten
to improve maintainability and address certain edge-case issues. More
specifically:

- Any default Kubernetes resource is normalized by converting it to a
  typed resource, and back to an Unstructured.
- Protocol default fixes have been added for Job and CronJob
  resources, which can hypothetically include port definitions.
- Instead of removing the `creationTimestamp` field, it is written to
  `nil`, to equal the default set for Unstructured objects returned
  by the converter.
- Test coverage has been added.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-07 09:41:32 +02:00
Hidde Beydals 2fa04c5abc
Merge pull request #661 from fluxcd/ssa-data-masking
ssa: improve data masking
2023-10-06 16:59:52 +02:00
Hidde Beydals 19c86d5e20
ssa: improve data masking
Instead of masking the data with `****` or `*****`, provide an easier
to distinguish `*** (before)` and `*** (after)` for values which have
changed. Matching the output of `kubectl diff`.

In addition, make the function public as it can be of use outside of the
`Diff` of the resource manager, and allow passing only one instance of
an object (for scenarios where a resource is either created or deleted).

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-06 16:30:06 +02:00
Stefan Prodan bf2de60d08
Merge pull request #660 from fluxcd/fix-cel-immutable
ssa: Extend CEL immutable error detection
2023-10-06 13:16:42 +03:00
Stefan Prodan 8b6f39b09b
Extend CEL immutable error detection
Add match variant to capture GCP immutable field behaviour.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-10-06 12:41:11 +03:00
Stefan Prodan 6dc2f174f4
Merge pull request #656 from fluxcd/update-tar-deps
Decommission untar package
2023-09-29 13:13:41 +03:00
Stefan Prodan ec9b48a580
Update internal dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-09-29 12:49:33 +03:00
Stefan Prodan 5275de819f
Decommission untar package
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-09-29 12:49:07 +03:00
Stefan Prodan 57d95882a6
Merge pull request #655 from fluxcd/oci-skip-symlinks
Skip symlinks during OCI layer decompression
2023-09-29 12:39:19 +03:00
Stefan Prodan c62dc82988
Skip symlinks during OCI layer decompression
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-09-29 12:02:03 +03:00
Stefan Prodan 4f69e7842c
Merge pull request #653 from errordeveloper/pull-any-artifact
oci/client: pull any artifact
2023-09-27 11:11:37 +03:00
Ilya Dmitrichenko 887bad406c
oci/clinet: ensure `Pull` sets `URL` field in metadata it returns
Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
2023-09-26 21:42:52 +01:00
Ilya Dmitrichenko 3b8d6349ae
oci/client: drop custom platfrom from default client options
In OCI terms having platform `flux/flux/v2` implies that the image
is runnable on some OS called "flux" on architecture called "flux".
In reality there is no such platform and there is no good reason
for Flux to pretend. OCI 1.1 (albeit still and RC at the moment),
doesn't mandate artifact to define a platform at all.

When client is constructed with a platform selector, many functions
will apply the selector, which is often undesirable.

The `flux/flux/v2` platform was only defined in client options, so
it wasn't set on any images and is safe to drop; source-controller
doesn't use `DefaultOptions`, so there is no concern.

Another inconvenient behaviour of GGCR is that some functions will pick
just the very first element that matches the platform and ignore any
additional elements, e.g. elements with same platform, but different
media type. That behaviour prevents searching for artefacts by media
type.

Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
2023-09-26 21:42:52 +01:00
Ilya Dmitrichenko 02027229fd
oci/client: relax annotation parser
This is in order to allow `flux pull artifact` to retrieve any kind
of OCI artifact, e.g. a Helm chart for debugging.

Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
2023-09-26 21:42:51 +01:00
Max Jonas Werner 56bc0ab893
Merge pull request #654 from fluxcd/dependabot/github_actions/ci-663ed1f0b6
build(deps): bump the ci group with 1 update
2023-09-26 16:22:57 +02:00
dependabot[bot] 10fa7dfc24
build(deps): bump the ci group with 1 update
Bumps the ci group with 1 update: [actions/checkout](https://github.com/actions/checkout).

- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](3df4ab11eb...8ade135a41)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-25 20:36:09 +00:00
Stefan Prodan 83f76d664c
Merge pull request #652 from fluxcd/dependabot/github_actions/ci-d24d09982f
build(deps): bump the ci group with 3 updates
2023-09-19 08:50:21 +03:00
dependabot[bot] 5c0b256a49
build(deps): bump the ci group with 3 updates
Bumps the ci group with 3 updates: [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action), [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) and [docker/login-action](https://github.com/docker/login-action).


Updates `docker/setup-qemu-action` from 2.2.0 to 3.0.0
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](2b82ce82d5...68827325e0)

Updates `docker/setup-buildx-action` from 2.10.0 to 3.0.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](885d1462b8...f95db51fdd)

Updates `docker/login-action` from 2.2.0 to 3.0.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](465a07811f...343f7c4344)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-18 20:42:49 +00:00
Max Jonas Werner 909b315f90
Merge pull request #651 from fluxcd/git-upgrade-deps
git: upgrade dependencies
2023-09-13 17:38:44 +02:00
Max Jonas Werner 3249e6ddff
git: upgrade dependencies
Signed-off-by: Max Jonas Werner <mail@makk.es>
2023-09-13 17:13:32 +02:00
Paulo Gomes 6eae7b41eb
Merge pull request #650 from pjbgf/upstream-billy
git/gogit: Replaces `fs` with upstream `osfs.BoundOS`
2023-09-13 10:47:40 +01:00
Paulo Gomes e8ee260bb1
git/gogit: Replaces fs with upstream osfs.BoundOS
Deprecates the fs implementation in favour of the upstream osfs.BoundOS.
Both implementations are largely the same, but the upstream had to be
slightly modified API in order to keep backwards compatibility to the rest
of its users.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
2023-09-12 23:34:16 +01:00
Max Jonas Werner 01981ea25a
Merge pull request #649 from fluxcd/dependabot/github_actions/ci-915f3d3f9a
build(deps): bump the ci group with 2 updates
2023-09-12 09:45:12 +02:00
dependabot[bot] c6bb1faa57
build(deps): bump the ci group with 2 updates
Bumps the ci group with 2 updates: [actions/cache](https://github.com/actions/cache) and [actions/upload-artifact](https://github.com/actions/upload-artifact).


Updates `actions/cache` from 3.3.1 to 3.3.2
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](88522ab9f3...704facf57e)

Updates `actions/upload-artifact` from 3.1.2 to 3.1.3
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](0b7f8abb15...a8a3f3ad30)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-11 21:02:19 +00:00
Stefan Prodan eedb1a0890
Merge pull request #646 from fluxcd/oci-cr-logger
oci: Use controller-runtime pkg/log specifically
2023-09-07 11:06:45 +03:00
Sunny e6669d82c8
oci/auth: Add test to check for non-test flags
Add a black box test to import the auth package as a consumer of the
package and make sure that no flags are injected. Being in a test, it
ignores all the default test flags with "test." prefix.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-09-06 21:31:36 +05:30
Sunny f01d884875
oci: Use controller-runtime pkg/log explicitly
This helps avoid importing the controller-runtime pkg/client/config
package which has a flag initialization for "kubeconfig". This results
in all the users of the oci package to also have the flag initialized in
their applications.
The usage of controller-runtime in oci package is just for logging.
Importing the pkg/log package specifically helps avoid importing the
client config which sets the flag.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-09-06 19:49:46 +05:30
Max Jonas Werner 488252ef92
Merge pull request #643 from fluxcd/dependabot/github_actions/ci-81eb07bab1
build(deps): bump the ci group with 3 updates
2023-09-05 13:46:15 +02:00
dependabot[bot] aad4f01156
build(deps): bump the ci group with 3 updates
Bumps the ci group with 3 updates: [actions/checkout](https://github.com/actions/checkout), [actions/setup-go](https://github.com/actions/setup-go) and [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action).


Updates `actions/checkout` from 3.6.0 to 4.0.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](f43a0e5ff2...3df4ab11eb)

Updates `actions/setup-go` from 4.0.1 to 4.1.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](fac708d667...93397bea11)

Updates `docker/setup-buildx-action` from 2.9.1 to 2.10.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](4c0219f9ac...885d1462b8)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-05 11:25:25 +00:00
Max Jonas Werner 1d44f9fefa
Merge pull request #644 from fluxcd/fix-e2e-dependabot
Skip git e2e tests for dependabot PRs
2023-09-05 13:22:30 +02:00
Max Jonas Werner 0cdb7cb10c
Skip git e2e tests for dependabot PRs
The bot doesn't have access to the secrets needed to perform these
tests.

Signed-off-by: Max Jonas Werner <mail@makk.es>
2023-09-05 11:26:04 +02:00
Stefan Prodan b4f3acd4b6
Merge pull request #640 from fluxcd/dependabot-group
ci: Group dependabot updates
2023-08-29 11:38:34 +03:00
Stefan Prodan a812aef4be
ci: Group dependabot updates
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-29 10:54:43 +03:00
Stefan Prodan 4032134563
Merge pull request #638 from fluxcd/dependabot/github_actions/actions/checkout-3.6.0
build(deps): bump actions/checkout from 3.5.3 to 3.6.0
2023-08-29 10:39:52 +03:00
dependabot[bot] b6c773d309
build(deps): bump actions/checkout from 3.5.3 to 3.6.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.3 to 3.6.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](c85c95e3d7...f43a0e5ff2)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-28 20:45:22 +00:00
Stefan Prodan e984fc64e5
Merge pull request #636 from fluxcd/up-deps
Update dependencies
2023-08-22 13:25:09 +03:00
Stefan Prodan 73563c0250
Update helm to v3.12.3
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-22 13:01:24 +03:00
Stefan Prodan b7df2c9be1
Update oci auth dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-22 13:01:05 +03:00
Stefan Prodan 09eedc13ee
Merge pull request #634 from somtochiama/remove-secret-err
Remove special error handling for secrets
2023-08-22 12:33:57 +03:00
Somtochi Onyekwere 3a2be110f4 remove error handling for secrets
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-08-22 10:06:00 +01:00
Sanskar Jaiswal a4b7a305e4
Merge pull request #635 from fluxcd/update-gogit-deps
git/{gogit,e2e}: update internal dependencies
2023-08-22 12:55:40 +05:30
Sanskar Jaiswal d58e122f27
git/{gogit,e2e}: update internal deps
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-22 12:24:58 +05:30
Sanskar Jaiswal 840e788c44
Merge pull request #633 from fluxcd/update-crypto
{gittestserver,ssh}: update golang.org/x/crypto
2023-08-22 11:44:27 +05:30
Sanskar Jaiswal d5408b0050
{gittestserver,ssh}: update golang.org/x/crypto
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-21 22:50:27 +05:30
Sanskar Jaiswal 04a0963f3a
Merge pull request #597 from fluxcd/tag-verification
git: Add support for adding tag info to commit
2023-08-21 22:37:54 +05:30
Sanskar Jaiswal 0f40956399
git: add support for lightweight tags
Add support for lightweight tags by checking the presence of a tag
reference and a tag object. Modify the cloning logic to always attach a
tag object to a commit object if checking out via a tag.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-21 21:34:07 +05:30
Sanskar Jaiswal 320d78fd4b
git/gogit: add tag info to commit if refname points to an annotated tag
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-21 21:34:07 +05:30
Sanskar Jaiswal 5658f3b6fe
git/gogit: add tag info to commit when checking out via semver
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-21 21:34:07 +05:30
Sanskar Jaiswal 75c942d032
git/gogit: add tag info to commit when checking out via tag
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-21 21:34:07 +05:30
Sanskar Jaiswal fba7100129
git: add support for linking a parent tag to a commit
Add a new struct `AnnotatedTag` that represents a Git annotated tag and
add it as a new field `Commit.ReferencingTag`, allowing for a commit to
contain information about its referencing tag. Add support for verifying
referecning tag as well.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-21 21:34:06 +05:30
Stefan Prodan 540f61e650
Merge pull request #631 from mihaiandreiratoiu/feature/gov-arm
oci/auth: Add support for Azure China and US Gov regions
2023-08-21 17:39:24 +03:00
mihaiandreiratoiu 174a5e95e0 Ops: Update azure cloud token auth
Signed-off-by: mihaiandreiratoiu <mihai.ratoiu@uipath.com>
2023-08-21 11:37:51 +03:00
Sunny 5eb935aef8
Merge pull request #632 from fluxcd/disable-azure-ci-jobs
Disable azure CI jobs
2023-08-18 18:08:15 +05:30
Sunny 133080092e
Disable azure CI jobs
No azure subscription to run the tests.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-08-18 17:37:13 +05:30
Sanskar Jaiswal 66fe41a412
Merge pull request #630 from fluxcd/git-ca-key
git: add support for key `ca.crt` to specify CA data
2023-08-17 19:36:15 +05:30
Sanskar Jaiswal 12b79e9629
git: add support for key `ca.crt` to specify CA data
Add support for key `ca.crt` in `NewAuthOptions()` to read CA
certificate data. It takes precedence over `caFile`.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-17 12:40:02 +05:30
Sanskar Jaiswal 1a428ac7cb
Merge pull request #629 from fluxcd/push-options
git: add support for push options
2023-08-16 17:54:46 +05:30
Sanskar Jaiswal 0518e8498c
git: add support for push options
Add `PushConfig.Options` to allow specifying the push options to use
when performing a push operation. For details about push options, please
see: https://git-scm.com/docs/git-push#Documentation/git-push.txt---push-optionltoptiongt

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-16 16:53:08 +05:30
Stefan Prodan 3fbf0d1184
Merge pull request #614 from chlunde/parallel-apply
ssa manager: Add concurrency to diff step in ApplyAll
2023-08-15 11:30:44 +03:00
Hidde Beydals 9ded60ab38
ssa: use `PollUntilContextCancel` in `ApplyAll`
While also allowing further configuration of the interval within
`ApplyOptions`, which is propagated during waiting in `ApplyAllStaged`
as well.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-14 16:54:42 +02:00
Carl Henrik Lunde 7bbf2fb6f6 ssa: Add integration test for immutable object with slow finalizer
Signed-off-by: Carl Henrik Lunde <chlunde@ifi.uio.no>
2023-08-14 16:21:50 +02:00
Carl Henrik Lunde a77f673e81 ssa manager: Poll with backoff to confirm deletion
Signed-off-by: Carl Henrik Lunde <chlunde@ifi.uio.no>
2023-08-14 16:21:50 +02:00
Carl Henrik Lunde 1d4b2d3b00 ssa manager: Add concurrency to diff step in ApplyAll
ApplyAll consists of two steps:

* dry run apply and collect skipped/created/configured/unchanged
  objects. This step also deletes immutable objects needing changes
  when force apply is enabled

* apply changes

This change adds concurrency to the first step, to improve performance
when there are many objects in a single kustomization.

The ordering is preserved.

Concurrency must be added to each controller by using
ResourceManager.SetConcurrency()

Signed-off-by: Carl Henrik Lunde <chlunde@ifi.uio.no>
2023-08-14 16:21:48 +02:00
Sunny bff596a805
Merge pull request #612 from fluxcd/stale-metrics
runtime/metrics: Delete metrics on object delete
2023-08-11 19:10:27 +05:30
Sunny 60a95d8147
runtime/metrics: Delete metrics on object delete
Delete the object metrics when the object is deleted. This ensures
that stale metrics about a deleted object is no longer exported.

As a result, the `ConditionDelete` is no longer needed. Another reason
to not have `ConditionDelete` is that a condition can only be one of
True, False or Unknown.

This introduces new delete methods in the low level metrics Recorder. In
the high level controller metrics, a list of owned finalizers is
introduced which is used to determine if an object is being deleted.
The existing Record*() methods are updated to check if the given object
is deleted, and call record or delete based on that. The user of this
API has to pass in the finalizer they write on object they maintain to
the metrics helper and record the metrics at the very end of the
reconciliation so that the final object state can be used to determine
if the metrics can be deleted safely.

To allow creating multiple instances of metrics helper, the metrics
collector registration is now done using a new function in metrics
package called MustMakeRecorder() which returns a metrics.Recorder.
metrics.Recorder can be used to create multiple metrics helpers with
different attributes if required, sharing the same underlying metrics
recorder.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-08-11 18:34:27 +05:30
Stefan Prodan ff3e247215
Merge pull request #626 from fluxcd/controller-runtime-v0.15.1
Update `sigs.k8s.io/controller-runtime` to v0.15.1
2023-08-08 16:06:06 +03:00
Stefan Prodan dd781e9ee8
Update sigs.k8s.io/controller-runtime v0.15.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-08 15:14:16 +03:00
Stefan Prodan 765ac9954a
Merge pull request #625 from fluxcd/ssa-IfNotPresent
ssa: Add `IfNotPresent` apply strategy
2023-08-08 15:10:33 +03:00
Stefan Prodan 1a0f6132ad
ssa: Add IfNotPresent apply strategy
Add `IfNotPresentSelector` to the apply options, the resources that match this selector will be applied on the cluster only if they don't exist.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-08-08 14:33:38 +03:00
Hidde Beydals f70c450e98
Merge pull request #624 from fluxcd/interval-jitter-default 2023-08-07 18:45:34 +02:00
Hidde Beydals b73ba32788
runtime/jitter: change default to +/-5%
This is a more friendly default for higher interval values (e.g. `1h`),
which would otherwise result in a 12-minute time-window.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-07 18:21:46 +02:00
Hidde Beydals 67b24c4fc5
Merge pull request #623 from fluxcd/update-gogit-deps
git/gogit: update dependencies
2023-08-07 12:14:14 +02:00
Hidde Beydals 0ce2ce3e40
git/internal/e2e: update dependencies
- github.com/fluxcd/pkg/git to v0.12.4
- github.com/fluxcd/pkg/gittestserver to v0.8.5
- github.com/fluxcd/pkg/ssh to v0.8.1

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-07 11:49:54 +02:00
Hidde Beydals 2eca17bb2b
git/gogit: update dependencies
- github.com/fluxcd/pkg/git to v0.12.4
- github.com/fluxcd/pkg/gittestserver to v0.8.5
- github.com/fluxcd/pkg/ssh to v0.8.1
- golang.org/x/crypto to v0.12.0
- golang.org/x/sys to v0.11.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-07 11:49:54 +02:00
Hidde Beydals 2861cb4787
Merge pull request #622 from fluxcd/update-oci-deps
oci: update dependendencies
2023-08-07 11:46:37 +02:00
Hidde Beydals c2dca7890e
oci/tests/integration: update dependencies
- sigs.k8s.io/controller-runtime to v0.15.1

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-07 11:21:51 +02:00
Hidde Beydals d20107f727
oci: update dependendencies
- github.com/fluxcd/pkg/sourceignore to v0.3.5
- sigs.k8s.io/controller-runtime to v0.15.1

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-07 11:03:02 +02:00
Hidde Beydals 68b676d024
Merge pull request #621 from fluxcd/update-runtime-deps
runtime: update dependencies
2023-08-04 18:30:32 +02:00
Hidde Beydals 8026a271ee
runtime: update dependencies
- github.com/fluxcd/pkg/apis/event to v0.5.2
- github.com/fluxcd/pkg/apis/meta to v1.1.2

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-04 17:59:30 +02:00
Hidde Beydals e8edd754de
Merge pull request #620 from fluxcd/update-deps
helmtestserver: update dependencies
2023-08-04 17:51:57 +02:00
Hidde Beydals 5e21e50841
helmtestserver: update dependencies
- github.com/docker/docker to v23.0.3 to mitigate warning on
  CVE-2023-28840, CVE-2023-28841 and CVE-2023-28842

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-04 17:25:13 +02:00
Hidde Beydals a7213f01da
Merge pull request #619 from fluxcd/enable-codeql-quality
ci: enable security-and-quality CodeQL query
2023-08-04 15:26:51 +02:00
Hidde Beydals 79175a1060
ci: enable security-and-quality CodeQL query
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-04 14:48:39 +02:00
Hidde Beydals bfb6c676e3
Merge pull request #617 from fluxcd/fix-git-flake
git/internal/e2e: address flake for clone tests
2023-08-04 12:29:28 +02:00
Hidde Beydals 0ac59bc890
git/internal/e2e: address flake for clone tests
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-04 11:56:48 +02:00
Hidde Beydals 79df79e0d0
Merge pull request #618 from fluxcd/remove-dep-rand-seed
*: remove deprecated `rand.Seed` calls
2023-08-04 11:19:10 +02:00
Hidde Beydals d9989875db
*: remove deprecated `rand.Seed` calls
Ref: https://go.dev/doc/go1.20#math/rand

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-04 10:48:26 +02:00
Hidde Beydals f775906949
Merge pull request #616 from fluxcd/update-deps
Update dependencies
2023-08-03 17:18:56 +02:00
Hidde Beydals 0568372f9a
ssa: update dependencies
- github.com/onsi/gomega to v1.27.10
- k8s.io/api to v0.27.4
- k8s.io/apimachinery to v0.27.4
- k8s.io/client-go to v0.27.4
- sigs.k8s.io/cli-utils to v0.35.0
- sigs.k8s.io/structured-merge-diff/v4 to v4.3.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:55 +02:00
Hidde Beydals 48874555f4
runtime: update dependencies
- github.com/onsi/gomega to v1.27.10
- go.uber.org/zap to v1.25.0
- golang.org/x/net to v0.13.0
- k8s.io/api to v0.27.4
- k8s.io/apimachinery to v0.27.4
- k8s.io/client-go to v0.27.4
- k8s.io/component-base to v0.27.4
- sigs.k8s.io/cli-utils to v0.35.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:55 +02:00
Hidde Beydals aefe10711b
git/internal/e2e: update dependencies
- github.com/fluxcd/go-git-providers to v0.18.0
- github.com/fluxcd/pkg/git/gogit to v0.12.1
- github.com/go-git/go-git/v5 to v5.8.1
- github.com/onsi/gomega to v1.27.10

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:55 +02:00
Hidde Beydals abcb730a27
git/gogit: update dependencies
- github.com/elazarl/goproxy to v0.0.0-20230731152917-f99041a5c027
- github.com/go-git/go-git/v5 to v5.8.1
- github.com/onsi/gomega to v1.27.10
- golang.org/x/crypto to v0.11.0
- golang.org/x/sys to v0.10.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:54 +02:00
Hidde Beydals 467c492ba1
git: update dependencies
- github.com/ProtonMail/go-crypto to v0.0.0-20230717121422-5aa5874ade95
- github.com/onsi/gomega to v1.27.10

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:54 +02:00
Hidde Beydals c1847e2385
oci/tests/integration: update dependencies
- github.com/fluxcd/pkg/oci to v0.30.0
- github.com/fluxcd/test-infra/tftestenv to v0.0.0-20230720084205-d40ee5473f22
- github.com/google/go-containerregistry to v0.16.1
- github.com/hashicorp/terraform-json to v0.17.1
- github.com/onsi/gomega to v1.27.10
- k8s.io/api to v0.27.4
- k8s.io/apimachinery to v0.27.4

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:54 +02:00
Hidde Beydals ebbebcecc1
gittestserver: update dependencies
- github.com/go-git/go-git/v5 to v5.8.1
- golang.org/x/crypto to v0.11.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:53 +02:00
Hidde Beydals 7a9a9e619e
http/fetch: update dependencies
- github.com/onsi/gomega to v1.27.10
- github.com/opencontainers/go-digest/blake3 to v0.0.0-20230801144141-122dc6384261

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:53 +02:00
Hidde Beydals 24bdf47dc5
oci: update dependencies
- github.com/Azure/azure-sdk-for-go/sdk/azcore to v1.7.0
- github.com/aws/aws-sdk-go-v2 to v1.20.0
- github.com/aws/aws-sdk-go-v2/config to v1.18.32
- github.com/aws/aws-sdk-go-v2/credentials to v1.13.31
- github.com/aws/aws-sdk-go-v2/service/ecr to v1.19.1
- github.com/distribution/distribution/v3 to v3.0.0-20230802173126-807a836852c0
- github.com/google/go-containerregistry to v0.16.1
- github.com/onsi/gomega to v1.27.10

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:53 +02:00
Hidde Beydals b060f36e08
ssh: update dependencies
- github.com/onsi/gomega to v1.27.10
- golang.org/x/crypto to v0.11.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:52 +02:00
Hidde Beydals 44c386ccd5
helmtestserver: update dependencies
- golang.org/x/crypto to v0.11.0
- helm.sh/helm/v3 to v3.12.2

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:52 +02:00
Hidde Beydals b8fb0f89c5
kustomize: update dependencies
- github.com/go-git/go-git/v5 to v5.8.1
- github.com/onsi/gomega to v1.27.10
- k8s.io/api to v0.27.4
- k8s.io/apiextensions-apiserver to v0.27.4
- k8s.io/apimachinery to v0.27.4
- k8s.io/client-go to v0.27.4

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:52 +02:00
Hidde Beydals 0b0196070d
sourceignore: update dependencies
- github.com/go-git/go-git/v5 to v5.8.1

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:51 +02:00
Hidde Beydals 8d9d348f45
apis/meta: update Kubernetes dependencies
- k8s.io/apimachinery to v0.27.4

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:51 +02:00
Hidde Beydals d1fa2f612f
apis/kustomize: update Kubernetes dependencies
- k8s.io/apiextensions-apiserver to v0.27.4

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:51 +02:00
Hidde Beydals fe263bdca7
apis/event: update Kubernetes dependencies
- k8s.io/api to v0.27.4
- k8s.io/apimachinery to v0.27.4

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-03 16:42:50 +02:00
Sanskar Jaiswal 6d61e1bd64
Merge pull request #615 from fluxcd/push-proxy
git/gogit: add proxy support for pushing to remote
2023-08-03 20:01:37 +05:30
Sanskar Jaiswal 926f56f12d
git/e2e: run initial push operations inside `Eventually()`
GitHub sometimes fails to push things using SSH due to weird and
mysterious deploy key errors, like
"unknown error: ERROR: Unknown public SSH key".

As a workaround, the intial push operation for each test case is
retried on failure for 20 seconds.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-03 19:39:53 +05:30
Sanskar Jaiswal 11525516bd
git/e2e: disable CGO while running e2e tests
Disable CGO for Git e2e tests as it was originially required because of
our libgit2 client. Since we no longer maintain a libgit2 client, there
is no need to run the tests with CGO enabled.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-03 18:52:31 +05:30
Sanskar Jaiswal 8b52742dbc
git/gogit: add proxy support for pushing to remote
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-08-02 22:41:39 +05:30
Hidde Beydals 33880dafe5
Merge pull request #613 from fluxcd/jitter
runtime: add `jitter` utils and options
2023-08-02 12:05:12 +02:00
Hidde Beydals 747915912e
runtime/jitter: improve setting defaults
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-02 10:57:11 +02:00
Hidde Beydals 9081beec95
runtime/jitter: naming improvements and other nits
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-02 10:52:54 +02:00
Hidde Beydals 521d8000dc
runtime/jitter: allow override of defaults
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-01 16:05:03 +02:00
Hidde Beydals 6268121abb
runtime: add `jitter` utils and options
This adds a `jitter` package to runtime to allow the configuration of a
random +/-% jitter to the interval at which resources are requeued.

Applying jitter to the interval duration can be useful to mitigate
spikes in memory and CPU usage caused by many resources being
configured with the same interval.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-01 16:00:23 +02:00
Stefan Prodan e34893accb
Merge pull request #610 from fluxcd/cel-immutablility
ssa: Detect immutable errors from CEL and custom webhooks
2023-07-31 15:52:00 +03:00
Stefan Prodan 03c49d6e03
ssa: Detect immutable errors from CEL and custom webhooks
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-31 15:35:23 +03:00
Stefan Prodan 4104c211db
Merge pull request #609 from somtochiama/ssa-fail-fast
Add failfast option to ssa.Wait
2023-07-31 15:05:12 +03:00
Somtochi Onyekwere 30fd85d970 add failfast option
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-07-31 12:15:50 +01:00
Sunny 2a323d771e
Merge pull request #607 from fluxcd/oci-test-ci-setup-docs
oci/tests/int: IAM setup automation docs & exit code propagation
2023-07-21 20:58:17 +05:30
Sunny 524494de4c oci/tests/int: always propagate exit code
Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-07-21 20:14:12 +05:30
Sunny 2c3fbeade7 oci/tests/int: IAM setup automation docs
Add terraform config in the docs for creating IAM permissions and
populating github actions secrets and variables required by the
integration tests.

Also, update the ACR configuration to enable admin user. This is
required for service principal created using terraform. Service
principal created by azure portal don't need this.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-07-21 20:14:08 +05:30
Stefan Prodan 1df1ec5351
Merge pull request #608 from fluxcd/dependabot/github_actions/docker/setup-buildx-action-2.9.1
build(deps): bump docker/setup-buildx-action from 2.8.0 to 2.9.1
2023-07-18 11:43:01 +03:00
dependabot[bot] 8bbdd0d32b
build(deps): bump docker/setup-buildx-action from 2.8.0 to 2.9.1
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.8.0 to 2.9.1.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](16c0bc4a6e...4c0219f9ac)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-17 20:33:35 +00:00
Sunny 5b608cb95e
Merge pull request #605 from somtochiama/aws-cross-region
[oci] Test login for aws repository in a different region
2023-07-12 16:02:52 +05:30
Somtochi Onyekwere d21152a667 add repository in a different region for ecr integration tests
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-07-12 10:42:17 +01:00
Stefan Prodan b51c004752
Merge pull request #604 from errordeveloper/add-oci-client-list-option
oci: Improve handling of cosgin artifacts
2023-07-11 14:06:53 +03:00
Ilya Dmitrichenko c16573fe39
oci: Improve handling of cosgin artifacts
Cosign uses "special" tags that have the following naming format:

<digestAgorithm>-<digestHex>.<artifactType(.att, .sbom, .sig)>

These are used to attach attestations, SBOMs and signatures to a
subject image reference by the first portion of the tag.

Until now Flux would ignore `.sig` tags, as its primary goal is to
filter through app image versions. This change extends the list of
omitted cosing artifacts to cover `.att` and `.sbom`.

In some cases it's desirable to observe cosgin artifacts, e.g. in
order to determine wheather an image had been signed or not.
Hence this change introduces a new field in `ListOptions`.

Co-authored-by: Sunny <darkowlzz@protonmail.com>
Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
2023-07-11 11:12:39 +01:00
Stefan Prodan bbbf40feb2
Merge pull request #601 from fluxcd/ssa-test-duplicate-ports
ssa: Add test for duplicate ports different proto
2023-07-06 16:12:40 +03:00
Stefan Prodan 2d6c4d92a4
Add test for duplicate ports different proto
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-07-06 15:55:39 +03:00
Stefan Prodan a108391304
Merge pull request #600 from somtochiama/aws-cross-region
Use registry region to get token for AWS
2023-07-06 13:25:55 +03:00
Somtochi Onyekwere cf94db44ce test aws cross-region
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-07-06 00:25:39 +01:00
Stefan Prodan d280cccd8d
Merge pull request #599 from fluxcd/dependabot/github_actions/docker/setup-buildx-action-2.8.0
build(deps): bump docker/setup-buildx-action from 2.7.0 to 2.8.0
2023-06-30 18:12:56 +03:00
dependabot[bot] 66ad0f0a04
build(deps): bump docker/setup-buildx-action from 2.7.0 to 2.8.0
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.7.0 to 2.8.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](ecf95283f0...16c0bc4a6e)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-30 14:47:26 +00:00
Stefan Prodan 7c20eff73a
Merge pull request #598 from fluxcd/sync-labels
Declaratively define (and sync) labels
2023-06-30 17:47:02 +03:00
Stefan Prodan c75f14d2ab
Declaratively define (and sync) labels
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-06-30 17:30:44 +03:00
Sanskar Jaiswal ea9224f0d7
Merge pull request #594 from fluxcd/http-env-var
runtime/client: add util func to check conn options compatibility with env
2023-06-30 16:45:38 +05:30
Sanskar Jaiswal 49eea19b4b
runtime/client: add util func to check conn options compatibility with env
Add `CheckEnvironmentCompatibility()` to check whether the configured
connection options are compatible with the environment, by checking env
vars like `HTTP_PROXY` and `HTTPS_PROXY`.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-06-29 19:31:26 +05:30
Stefan Prodan c4f37dcecc
Merge pull request #596 from fluxcd/dependabot/github_actions/ossf/scorecard-action-2.2.0
build(deps): bump ossf/scorecard-action from 2.1.3 to 2.2.0
2023-06-28 15:26:02 +03:00
dependabot[bot] b1a72db702
build(deps): bump ossf/scorecard-action from 2.1.3 to 2.2.0
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.1.3 to 2.2.0.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](80e868c13c...08b4669551)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-28 08:59:14 +00:00
Stefan Prodan 938e3221a4
Merge pull request #595 from fluxcd/go.mod-1.20
Align `go.mod` version with Kubernetes (Go 1.20)
2023-06-27 08:33:17 +03:00
Stefan Prodan 111ee3b79d
Align go.mod version with Kubernetes
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-06-26 19:50:03 +03:00
Stefan Prodan 4443dd8490
Merge pull request #593 from fluxcd/update-internal-deps
Update internal dependencies
2023-06-22 14:51:27 +03:00
Stefan Prodan de4bc151e6
Update internal dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-06-22 14:17:42 +03:00
Stefan Prodan 70a6fe1b7b
Merge pull request #592 from fluxcd/kube-0.27.3
Update dependencies
2023-06-22 13:59:13 +03:00
Stefan Prodan 8f494ab75b
Update dependencies
- k8s.io/* v0.27.3
- golang.org/x/crypto v0.10.0
- github.com/onsi/gomega v1.27.8
- github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1
- github.com/aws/aws-sdk-go-v2 v1.18.1
- github.com/hashicorp/go-retryablehttp v0.7.4
- github.com/prometheus/client_golang v1.15.1

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-06-22 13:21:41 +03:00
Stefan Prodan 094a2b61f0
Merge pull request #580 from somtochiama/immutable-err
ssa apply: check for NotFound errors on Delete
2023-06-22 13:21:16 +03:00
Somtochi Onyekwere a6b0b6d4d7 ssa apply: continue for NotFoundErrors
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-06-22 10:54:13 +01:00
Stefan Prodan e0d91c37e1
Merge pull request #591 from fluxcd/oci-created-ts
oci: Allow consumers to set the OCI artifact created date
2023-06-22 12:35:58 +03:00
Stefan Prodan 898bc960e9
oci: Allow consumers to set the OCI artifact created date
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-06-22 11:43:05 +03:00
Sanskar Jaiswal a3e50ffbcd
Merge pull request #590 from fluxcd/allow-http
runtime/controller: Add generic flag for allowing insecure HTTP connections
2023-06-20 18:26:55 +05:30
Sanskar Jaiswal cf3fad2a44
runtime/controller: add generic flag for allowing insecure HTTP connections
Add a generic flag `--insecure-allow-http` to allow users to enable the
use of plain HTTP connections.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-06-20 17:32:08 +05:30
Stefan Prodan 33fce20fff
Merge pull request #583 from fluxcd/dependabot/github_actions/actions/checkout-3.5.3
build(deps): bump actions/checkout from 3.5.2 to 3.5.3
2023-06-19 16:20:42 +03:00
dependabot[bot] 3e2248fe5c
build(deps): bump actions/checkout from 3.5.2 to 3.5.3
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.2 to 3.5.3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8e5e7e5ab8...c85c95e3d7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-19 11:37:18 +00:00
Sanskar Jaiswal b9091ddc7b
Merge pull request #589 from fluxcd/push-write-access-error
git/gogit: Translate misleading go-git write access error of Gitlab
2023-06-16 13:08:18 +05:30
Sanskar Jaiswal 56d4254571
git/gogit: translate misleading go-git write access error of Gitlab
go-git returns an unhelpful error message `unknown error: remote:` when
trying to push to a GitLab repository using a deploy key that does not
have push access. Translate the error message to something more helpful
and informative.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-06-16 00:41:40 +05:30
Max Jonas Werner a04ccbfc5b
Merge pull request #581 from fluxcd/bump-docker-distribution
Bump transitive github.com/docker/distribution
2023-06-15 11:20:52 +02:00
Max Jonas Werner 2651ee850c
Bump transitive github.com/docker/distribution
The new version fixes CVE-2023-2253. See
https://github.com/distribution/distribution/releases/tag/v2.8.2

Signed-off-by: Max Jonas Werner <mail@makk.es>
2023-06-15 10:48:20 +02:00
Max Jonas Werner 14687bd6a2
Merge pull request #587 from fluxcd/dependabot/github_actions/docker/setup-buildx-action-2.7.0
build(deps): bump docker/setup-buildx-action from 2.5.0 to 2.7.0
2023-06-13 16:51:00 +02:00
dependabot[bot] 2691424e9a
build(deps): bump docker/setup-buildx-action from 2.5.0 to 2.7.0
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.5.0 to 2.7.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](4b4e9c3e2d...ecf95283f0)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-13 14:33:09 +00:00
Max Jonas Werner cc7a4c58eb
Merge pull request #586 from fluxcd/dependabot/github_actions/docker/login-action-2.2.0
build(deps): bump docker/login-action from 2.1.0 to 2.2.0
2023-06-13 16:32:29 +02:00
dependabot[bot] efcbd15843
build(deps): bump docker/login-action from 2.1.0 to 2.2.0
Bumps [docker/login-action](https://github.com/docker/login-action) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](f4ef78c080...465a07811f)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-13 13:59:39 +00:00
Max Jonas Werner 92f488690e
Merge pull request #582 from fluxcd/dependabot/github_actions/github/codeql-action-2.13.4
build(deps): bump github/codeql-action from 2.3.6 to 2.13.4
2023-06-13 15:58:38 +02:00
dependabot[bot] 3ea90109e0
build(deps): bump github/codeql-action from 2.3.6 to 2.13.4
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.6 to 2.13.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](83f0fe6c49...cdcdbb5797)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-13 13:40:14 +00:00
Max Jonas Werner 8e4d541faf
Merge pull request #585 from fluxcd/dependabot/github_actions/docker/setup-qemu-action-2.2.0
build(deps): bump docker/setup-qemu-action from 2.1.0 to 2.2.0
2023-06-13 15:39:34 +02:00
dependabot[bot] 53e2605481
build(deps): bump docker/setup-qemu-action from 2.1.0 to 2.2.0
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](e81a89b173...2b82ce82d5)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-12 21:01:51 +00:00
Sunny 9cf7fbea8e
Merge pull request #578 from fluxcd/update-test-infra
oci/tests/int: Update tftestenv to the latest
2023-06-08 16:09:27 +05:30
Sunny 3916c2ef77
oci/tests/int: Update tftestenv to the latest
It fixes the unset logger related logs with the new controller-runtime.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-06-08 15:51:27 +05:30
Max Jonas Werner ea76e2c245
Merge pull request #579 from fluxcd/dependabot/github_actions/github/codeql-action-2.3.6
build(deps): bump github/codeql-action from 2.3.5 to 2.3.6
2023-06-06 09:39:45 +02:00
dependabot[bot] 14416f95e6
build(deps): bump github/codeql-action from 2.3.5 to 2.3.6
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.5 to 2.3.6.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](0225834cc5...83f0fe6c49)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-05 21:01:49 +00:00
Sunny 3f0e8881dd
Merge pull request #577 from somtochiama/update-module
[oci] Pass array of principal id to acr module in integration tests
2023-05-31 21:43:18 +05:30
Somtochi Onyekwere a346bb2af0 pass array of principal id to acr module
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-05-31 16:46:01 +01:00
Sanskar Jaiswal fe2cbaa665
Merge pull request #576 from fluxcd/multi-ack
git/gogit: add multi_ack/multi_ack_detailed as a supported capability
2023-05-31 18:50:37 +05:30
Sanskar Jaiswal 973caffb88
git/gogit: add multi_ack/multi_ack_detailed as a supported capability
Remove `multi_ack` and `multi_ack_detailed` from
`transport.UnsupportedCapabilities` as they're required to work Git v2
servers such as Azure Devops.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-31 16:27:12 +05:30
Sanskar Jaiswal c0c812b4db
Merge pull request #575 from fluxcd/gogit-proxy
git/gogit: Add support for per client proxying
2023-05-30 18:55:52 +05:30
Sanskar Jaiswal 12339fbae0
git/e2e: update deps
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-30 14:02:08 +05:30
Sanskar Jaiswal 62f49c9220
git/gogit: update gittestserver to v0.8.4
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-30 13:33:21 +05:30
Sanskar Jaiswal dfddf14939
git/gogit: add support for per client proxying
Add `WithProxy()`, a `ClientOption` which configures the proxy settings
for a `gogit.Client`. All remote operations performed by the client use
the configured proxy.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-30 13:33:21 +05:30
Max Jonas Werner a86b62f05f
Merge pull request #574 from fluxcd/dependabot/github_actions/github/codeql-action-2.3.5
build(deps): bump github/codeql-action from 2.3.3 to 2.3.5
2023-05-30 09:27:30 +02:00
dependabot[bot] cf722772e8
build(deps): bump github/codeql-action from 2.3.3 to 2.3.5
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.3 to 2.3.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](29b1f65c5e...0225834cc5)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-29 21:01:18 +00:00
Hidde Beydals bbe5187253
Merge pull request #573 from fluxcd/kus-update-ignore
kustomize: update sourceignore to v0.3.4
2023-05-26 15:44:01 +02:00
Hidde Beydals bd2be2a52c
kustomize: update sourceignore to v0.3.4
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-26 15:21:03 +02:00
Stefan Prodan 06656b6681
Merge pull request #563 from somtochiama/oci-timeout
[oci] Add function for configuring transport with retry backoff
2023-05-26 11:09:04 +03:00
Somtochi Onyekwere 5ee0c00933 Add function for configuring transport with retry backoff
This pr also splits LoginWithCredentials into a sub-function
GetAuthFromCredentials that returns the Authenticator. This
function can be used to get the authenticator for constructing
the retry transport.

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-05-26 08:35:30 +01:00
Sunny 748d18125a
Merge pull request #572 from fluxcd/generic-oicd-auth
Use registry host to get ACR access token and add new OIDCLogin function
2023-05-26 01:40:55 +05:30
Somtochi Onyekwere 1c2956bb08 Update oci integration tests to test OIDCLogin
It also updates the Makefile to build the testapp for linux/amd64
by default. This can be changed by setting GOARCH and GOOS variables.

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-05-25 15:10:34 +01:00
Somtochi Onyekwere 48ad0ebbf3 Implement new OIDC Login method and update old Login method to ignore ref argument
The Login function in oci/auth no longer uses the name.Reference argument and instead
gets the registry host from the image argument and passes that to the Login method of
the different region. This is to allow login to consumers of this function that don't
have a repository name and just a registry host.

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-05-25 15:10:20 +01:00
Somtochi Onyekwere 1af760de33 Use instance region for aws region instead of parsing region from ecr registry url.
This commits removes the code that parses the region from the ecr registry and uses it to set the config.
By default, LoadDefaultConfig will get the region of the instance from the metadata service which is the
correct region that should be used when requesting for a token.

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-05-25 14:21:38 +01:00
Sanskar Jaiswal c33a483aad
Merge pull request #571 from fluxcd/hostkey-callback
git/gogit: set `HostKeyCallback` for parent `PublicKeys` object
2023-05-25 14:55:10 +05:30
Sanskar Jaiswal 1e5b91f73d
git/gogit: set `HostKeyCallback` for parent `PublicKeys` object
Set `HostKeyCallback` for the parent `PublicKeys` object to avoid
setting the callback to one that uses the system's known_hosts.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-25 14:27:59 +05:30
Stefan Prodan 01a38c6a7e
Merge pull request #570 from fluxcd/validate-actions
Add GH Actions for Flux manifests validation
2023-05-24 17:38:52 +03:00
Stefan Prodan 6c0b4426ba
Stricter checksum finder
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-24 17:19:43 +03:00
Stefan Prodan f91f2339a5
Add checksum verification for yq
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-24 17:09:52 +03:00
Stefan Prodan a97ea808ec
Bump kustomize action to v5.0.3
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-24 16:50:43 +03:00
Stefan Prodan fbb30d1b4b
Add yq action
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-24 16:48:41 +03:00
Stefan Prodan fe8eed236d
Add kubeconform action
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-24 16:07:04 +03:00
Sanskar Jaiswal ca008e3816
Merge pull request #569 from fluxcd/bump-git
git/{gogit,e2e}: bump pkg/git to v0.12.2
2023-05-24 17:25:58 +05:30
Sanskar Jaiswal 9ce355d4db
git/{gogit,e2e}: bump pkg/git to v0.12.2
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-24 17:05:26 +05:30
Sanskar Jaiswal a69eec4195
Merge pull request #568 from fluxcd/refname-annotated-tags
git/gogit: Add support for using annotated tags with `RefName`
2023-05-24 16:56:35 +05:30
Sanskar Jaiswal 5b59b17753
git/gogit: add support for using annotated tags with `RefName`
Add support for using annotated tags with `CheckoutStrategy.Refname`.
Earlier, users were forced to specify the tag dereference suffix for the
clone operation to be successful, as the resolved ref pointed to a tag
object and not its child commit object.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-24 16:37:08 +05:30
Sanskar Jaiswal 062b08f7a2
Merge pull request #562 from fluxcd/gogit-upstream
git: Switch from `fluxcd/go-git` to `go-git/go-git`
2023-05-24 13:55:06 +05:30
Sanskar Jaiswal 57d151cc82
switch from `fluxcd/go-git` to `go-git/go-git`
Move from github.com/fluxcd/go-git/v5 to github.com/go-git/go-git/v5.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-24 13:11:28 +05:30
Stefan Prodan be2ab91e05
Merge pull request #567 from fluxcd/controller-runtime-v0.15.0
Update controller-runtime from beta to v0.15.0
2023-05-23 17:59:00 +03:00
Stefan Prodan 2437a9f36b
Update cloudflare/circl to v1.3.3
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-23 17:35:55 +03:00
Stefan Prodan fd419dea40
Update controller-runtime from beta to v0.15.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-23 17:23:44 +03:00
Stefan Prodan 7c23713877
Merge pull request #566 from fluxcd/testenv-max
runtime: Add `WithMaxConcurrentReconciles` to testenv
2023-05-23 15:45:37 +03:00
Stefan Prodan 6bda1a3ad4
runtime: Add `WithMaxConcurrentReconciles` to testenv
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-05-23 15:15:46 +03:00
Stefan Prodan c157419e07
Merge pull request #565 from fluxcd/bump-apis
Update internal dependencies
2023-05-22 21:01:55 +03:00
Sanskar Jaiswal 0501eb8b2a
Update internal dependencies
* apis/event => v0.5.0
* apis/kustomize => v1.1.0
* apis/meta => v1.1.0
* git => v0.12.1
* gittestserver => v0.8.3
* ssh => v0.7.4
* version => v0.2.2

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-22 23:03:37 +05:30
Hidde Beydals 80ab4c37a7
Merge pull request #564 from fluxcd/update-deps
Update dependencies across packages
2023-05-22 16:21:02 +02:00
Hidde Beydals 4759e6d73c
runtime: update dependencies
- github.com/onsi/gomega to v1.27.7
- github.com/stretchr/testify to v1.8.3
- k8s.io/klog/v2 to v2.100.1

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-22 15:35:46 +02:00
Hidde Beydals 403e3b1852
version: update dependencies
- github.com/Masterminds/semver/v3 to v3.2.1

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-22 15:33:50 +02:00
Hidde Beydals 7ff515189e
ssh: update dependencies
- github.com/onsi/gomega to v1.27.7
- golang.org/x/crypto to v0.9.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-22 15:32:16 +02:00
Hidde Beydals 1e5fbd8a90
ssa: update dependencies
- github.com/onsi/gomega to v1.27.7

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-22 15:31:37 +02:00
Hidde Beydals 1dd8df2f8a
oci/tests/integration: update dependencies
- github.com/fluxcd/pkg/oci to v0.24.0
- github.com/fluxcd/test-infra/tftestenv to v0.0.0-20230515143943-6c7866f3cd1a
- github.com/google/go-containerregistry to v0.15.2
- github.com/onsi/gomega to v1.27.7

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-22 15:30:38 +02:00
Hidde Beydals 31f7fe355c
oci: update dependencies
- github.com/Azure/azure-sdk-for-go/sdk/azcore to v1.6.0
- github.com/Azure/azure-sdk-for-go/sdk/azidentity to v1.3.0
- github.com/Masterminds/semver/v3 to v3.2.1
- github.com/aws/aws-sdk-go-v2 to v1.18.0
- github.com/aws/aws-sdk-go-v2/config to v1.18.25
- github.com/aws/aws-sdk-go-v2/credentials to v1.13.24
- github.com/aws/aws-sdk-go-v2/service/ecr to v1.18.11
- github.com/distribution/distribution/v3 to v3.0.0-20230519140516-983358f8e250
- github.com/google/go-containerregistry to v0.15.2
- github.com/onsi/gomega to v1.27.7
- github.com/sirupsen/logrus to v1.9.2

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-22 15:24:39 +02:00
Hidde Beydals f94edcc8a9
kustomize: update dependencies
- github.com/onsi/gomega to v1.27.7
- github.com/otiai10/copy to v1.11.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-22 15:22:40 +02:00
Hidde Beydals 51f7565443
http/fetch: update dependencies
- github.com/onsi/gomega to v1.27.7
- github.com/opencontainers/go-digest/blake3 to v0.0.0-20230329235805-65fac7b55eb7

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-22 15:21:05 +02:00
Hidde Beydals 90957c71fa
helmtestserver: update dependencies
- golang.org/x/crypto to v0.9.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-22 15:20:17 +02:00
Hidde Beydals e91b66e822
gittestserver: update dependencies
- golang.org/x/crypto to v0.9.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-22 15:18:17 +02:00
Hidde Beydals 4fe5cdd24d
git/internal/e2e: update dependencies
- github.com/fluxcd/go-git-providers to v0.15.3
- github.com/fluxcd/pkg/git/gogit to v0.9.0
- github.com/fluxcd/pkg/gittestserver to v0.8.2
- github.com/go-logr/logr to v1.2.4
- github.com/onsi/gomega to v1.27.7

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-22 15:17:26 +02:00
Hidde Beydals 02307fecaa
git/gogit: update dependencies
- github.com/fluxcd/pkg/gittestserver to v0.8.2
- github.com/onsi/gomega to v1.27.7

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-22 15:10:36 +02:00
Hidde Beydals 4bb5be6e72
git: update dependencies
- github.com/ProtonMail/go-crypto to v0.0.0-20230518184743-7afd39499903
- github.com/onsi/gomega to v1.27.7

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-22 15:08:34 +02:00
Hidde Beydals a23fdabd20
Merge pull request #534 from fluxcd/k8s-1.27
Update Kubernetes to 1.27.2 and Kustomize to 5.0.3
2023-05-22 14:50:51 +02:00
Sanskar Jaiswal 38d0a59b9c
runtime: add util func for creating rest mapper
Add a new util func `NewDynamicRESTMapper(restConfig *rest.Config)` in
`runtime/client` for creating new RESTMapper objects.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-22 18:00:12 +05:30
Sanskar Jaiswal 2abb3415c2
update k8s to 1.27.2 and kustomize to 5.0.3
* k8s.io/api => v0.27.2
* k8s.io/apimachinery => v0.27.2
* k8s.io/apiextensions-apiserver => v0.27.2
* k8s.io/client-go => v0.27.2
* k8s.io/component-base => v0.27.2
* sigs.k8s.io/controller-runtime => v0.15.0-beta.0
* sigs.k8s.io/kustomize/api => v0.13.4
* sigs.k8s.io/kustomize/kyaml => v0.14.2
* helm.sh/helm/v3 => v3.12.0
* github.com/onsi/gomega => v1.27.6
* github.com/go-logr/logr => v1.2.4
* github.com/prometheus/client_golang =>  v1.15.1

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-22 18:00:12 +05:30
Sunny 3413cbeeb2
Merge pull request #561 from fluxcd/oci-repo-root-login-int
oci/tests: Add test for repo root login
2023-05-22 17:27:04 +05:30
Sunny 4df95a615e
oci/tests: Add test for repo root login
This adds a new test to verify that login works if the URL and name
reference are constructed correctly.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-05-17 03:48:16 +05:30
Stefan Prodan f4cf2dc1a8
Merge pull request #557 from fluxcd/dependabot/github_actions/google-github-actions/setup-gcloud-1.1.1
build(deps): bump google-github-actions/setup-gcloud from 1.1.0 to 1.1.1
2023-05-16 10:16:35 +03:00
dependabot[bot] bc399dfda5
build(deps): bump google-github-actions/setup-gcloud from 1.1.0 to 1.1.1
Bumps [google-github-actions/setup-gcloud](https://github.com/google-github-actions/setup-gcloud) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/google-github-actions/setup-gcloud/releases)
- [Changelog](https://github.com/google-github-actions/setup-gcloud/blob/main/CHANGELOG.md)
- [Commits](62d4898025...e30db14379)

---
updated-dependencies:
- dependency-name: google-github-actions/setup-gcloud
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-16 06:48:05 +00:00
Stefan Prodan c0a5d27328
Merge pull request #558 from fluxcd/dependabot/github_actions/google-github-actions/auth-1.1.1
build(deps): bump google-github-actions/auth from 1.1.0 to 1.1.1
2023-05-16 09:47:22 +03:00
dependabot[bot] 516054c89c
build(deps): bump google-github-actions/auth from 1.1.0 to 1.1.1
Bumps [google-github-actions/auth](https://github.com/google-github-actions/auth) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](e8df18b60c...35b0e87d16)

---
updated-dependencies:
- dependency-name: google-github-actions/auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-16 05:48:03 +00:00
Stefan Prodan d3d95081f1
Merge pull request #559 from fluxcd/dependabot/github_actions/actions/setup-go-4.0.1
build(deps): bump actions/setup-go from 4.0.0 to 4.0.1
2023-05-16 08:47:26 +03:00
dependabot[bot] ae6225ab54
build(deps): bump actions/setup-go from 4.0.0 to 4.0.1
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](4d34df0c23...fac708d667)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-15 21:02:51 +00:00
Sunny 90b7cffa89
Merge pull request #556 from fluxcd/enable-cloud-int-test-cron
Enable daily cron for cloud integration test workflow
2023-05-15 20:47:01 +05:30
Sunny 33cb376411
Enable cloud integration test workflow cron
Enable cron for the cloud integration tests for azure and gcp.

Runs 12 hours after the daily cleanup job.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-05-15 20:25:47 +05:30
Sunny 8ab8bb67a3
Merge pull request #555 from fluxcd/workflow-cleanup-azure
Add integration test cleanup job for azure
2023-05-15 20:25:02 +05:30
Sunny 61f0315873
Add integration test cleanup job for azure
Appends the existing integration-cleanup workflow with a new job for
azure.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-05-15 19:58:21 +05:30
Sanskar Jaiswal 0c8e547b85
Merge pull request #554 from fluxcd/gogit-update
git/{gogit,e2e}: update dependencies
2023-05-15 19:42:59 +05:30
Sanskar Jaiswal 18ab12b7ef
git/{gogit,e2e}: update dependencies
* github.com/Masterminds/semver/v3 => v3.2.1
* github.com/fluxcd/pkg/git => v0.12.0
* golang.org/x/crypto => v0.9.0
* golang.org/x/sys => v0.8.0

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-15 19:13:28 +05:30
Sanskar Jaiswal bf62fd3e2c
Merge pull request #550 from fluxcd/push-to-ref
git: add `PushConfig` to specify push config and add support for refspecs
2023-05-15 18:25:02 +05:30
Sanskar Jaiswal adda1601f2
git: add PushConfig.Force for force pushing
Add `PushConfig.Force` for force pushing and remove
`gogit.Client.forcePush` in favor of the former.

Remove some stale test cases from `TestSwitchBranch` related to force
push since we don't check if force pushing is enabled while switching
branches anymore. Ref: https://github.com/fluxcd/pkg/pull/433

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-15 18:01:08 +05:30
Sanskar Jaiswal 39b978a1cf
gogit: rename CloneOptions to CloneConfig for consistency
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-15 18:01:08 +05:30
Sanskar Jaiswal 88da1a6b1b
git: add support for specifying refspecs for a push
Add `PushConfig` for configuring a push operation. Users can use
`PushConfig.Refspecs` to specify the refspecs when using `Push()`.

Furthermore, fix a bug related to `Push()` where all refs were pushed to
origin, since we did not specify a refspec and the default refspec used
by gogit is `refs/heads/*:/refs/heads/*`.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-05-15 18:01:07 +05:30
Sunny e0c94dbf51
Merge pull request #553 from fluxcd/int-cleanup-gcp
Add integration test resource cleanup workflow for GCP
2023-05-15 17:10:47 +05:30
Sunny c87edab3ae
Add integration test resource cleanup workflow
Run test-infra/tools/reaper and gcrgc for cleaning up the cloud
resources created by the integration tests. The workflow is run once
every day automatically.

The reaper is run in dry-run mode for now to observe what it lists for
some time. The retention-period is set to one day. It'll list resources
that are older than a day.

gcrgc is not in dry-run mode and will delete all the GCR repositories.
This is needed as GCR repositories created in the tests are not tracked
by terraform and are left behind. These have to be deleted regularly.
Repositories have to be explicitly excluded if needed in the future.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-05-12 05:13:40 +05:30
Sunny c5096c25f3
Merge pull request #552 from fluxcd/oci-test-buildx
oci/test: update docker build command to buildx
2023-05-12 00:27:48 +05:30
Sunny 10130119d6
oci/test: update docker build command for buildx
Update docker build to command to use buildx. Build fails with unknown
flag without it in the docker in CI.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-05-11 23:49:40 +05:30
Sunny b21e2691b6
Merge pull request #551 from fluxcd/cloud-e2e-workflow-secret
workflows: Update GCP & AZ secret names
2023-05-11 23:42:50 +05:30
Sunny 7f01962a30
workflows: Update GCP & AZ secret names
Update the GCP and Azure secret names to be specific to the test they
are for. This will help identify and manage the secrets and the
permissions needed for particular tests separately.

Also, update the resource tags to have the name of the repository where
they originate from. This will help identify which resources were
created from which repository.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-05-11 21:05:56 +05:30
Stefan Prodan 6c409baab9
Merge pull request #533 from somtochiama/oci-push
oci/client: Configureable retry backoff
2023-05-11 17:46:17 +03:00
Somtochi Onyekwere 91d118e56e add timeout to oci push
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-05-11 11:56:30 +01:00
Hidde Beydals 10217ff462
Merge pull request #549 from fluxcd/un-stefan-fy-errs
ssa: remove `, error:` from wrapped error strings
2023-05-10 16:20:37 +02:00
Hidde Beydals c0f39fc299
ssa: remove `, error:` from wrapped error strings
Also infamously known as "un-stefan-fying".

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-10 15:32:21 +02:00
Hidde Beydals d25c2af31d
Merge pull request #548 from fluxcd/fetch-improve-err
http/fetch: improve error messages
2023-05-10 15:18:30 +02:00
Hidde Beydals 7916c227f7
http/fetch: improve error messages
- Return a more specific error for an empty digest, instead of a parsing
  error.
- Include the digest in the error message when parsing fails.
- Tidy the format of some other errors.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-10 14:49:39 +02:00
Sunny 2d0a389509
Merge pull request #543 from fluxcd/oci-int-workflows
Add workflows for running oci integration tests on azure & gcp
2023-05-09 23:34:02 +05:30
Sunny 2fff1b66fc
Add workflows for oci intn tests on azure & gcp
Adds two separate workflows for running azure and gcp integration tests
separately. Only OCI tests are run at present.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-05-09 17:00:22 +05:30
Stefan Prodan 88f7afd17d
Merge pull request #547 from fluxcd/dependabot/github_actions/github/codeql-action-2.3.3
build(deps): bump github/codeql-action from 2.3.2 to 2.3.3
2023-05-09 11:40:05 +03:00
dependabot[bot] 02fc4e5859
build(deps): bump github/codeql-action from 2.3.2 to 2.3.3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.2 to 2.3.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](f3feb00acb...29b1f65c5e)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-08 21:02:12 +00:00
Sunny 54313924ce
Merge pull request #535 from fluxcd/tags-cleanup
oci/tests: Add resource tags, docs and gracefully stop environment
2023-05-04 22:20:43 +05:30
Sunny 5ce64db5c5
oci/tests: Add instructions for cleaning up GCR
Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-05-04 21:45:42 +05:30
Sunny bd0a398854
oci/tests: Add permission requirements for azure
Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-05-04 21:45:40 +05:30
Sunny 04106b8b6d
Provide instructions for using GCP service account
Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-05-04 21:45:38 +05:30
Sunny c6a9faeaf4
Update terraform config to use tags
Update the terraform configurations for all the cloud providers to use
tags. The tags are provided with input variables "tags" which is common
across the cloud providers.

In case of AWS, due to a bug in the aws terraform provider when using
tags with dynamic names, replace the usage of random_pet for random name
generation with a statically set input variable "rand". This is randomly
generated outside of terraform runtime using $RANDOM. The upstream issue
is linked with details in .env.sample file and
fluxcd/test-infra/utils/tags module.

Also update the requirements docs for AWS and GCP with some more
details.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-05-04 21:45:32 +05:30
Sunny a3c0c9fba9
oci/tests: Ensure infra env is stopped at the end
Update tftestenv with signal handling for graceful terraform shutdown.

Move the environment stop into a defer block to ensure that the
environment is always stopped at the end if -retain is not configured.
This will make sure that the environment is deleted in case any program
crashed, especially in CI environments.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-05-04 21:45:06 +05:30
Hidde Beydals db02d36ca6
Merge pull request #544 from matheuscscp/config-checksum
Add metadata key for holding an arbitrary identification token
2023-05-04 14:53:21 +02:00
Matheus Pimenta a0e131d76e Add metadata key for holding an arbitrary identification token
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2023-05-04 13:11:26 +01:00
Hidde Beydals 931997dc1f
Merge pull request #545 from fluxcd/dependabot/github_actions/github/codeql-action-2.3.2
build(deps): bump github/codeql-action from 2.3.0 to 2.3.2
2023-05-02 08:53:08 +02:00
dependabot[bot] ded8d7d13b
build(deps): bump github/codeql-action from 2.3.0 to 2.3.2
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.3.0 to 2.3.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](b2c19fb9a2...f3feb00acb)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-01 21:06:03 +00:00
Max Jonas Werner 2e870a1a4b
Merge pull request #541 from fluxcd/dependabot/github_actions/github/codeql-action-2.3.0
build(deps): bump github/codeql-action from 2.2.12 to 2.3.0
2023-04-25 09:27:06 +02:00
dependabot[bot] a1ba99c969
build(deps): bump github/codeql-action from 2.2.12 to 2.3.0
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.12 to 2.3.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](7df0ce3489...b2c19fb9a2)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-24 21:03:10 +00:00
Stefan Prodan 7fa160a2a2
Merge pull request #537 from fluxcd/dependabot/github_actions/actions/checkout-3.5.2
build(deps): bump actions/checkout from 3.5.0 to 3.5.2
2023-04-22 14:37:54 +02:00
dependabot[bot] a4ec1ad0fd
build(deps): bump actions/checkout from 3.5.0 to 3.5.2
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.0 to 3.5.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8f4b7f8486...8e5e7e5ab8)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-17 22:22:01 +00:00
Hidde Beydals a39c961042
Merge pull request #536 from fluxcd/dependabot/github_actions/github/codeql-action-2.2.12 2023-04-18 00:21:23 +02:00
dependabot[bot] 15d13e7faf
build(deps): bump github/codeql-action from 2.2.11 to 2.2.12
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.11 to 2.2.12.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](d186a2a36c...7df0ce3489)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-17 21:01:51 +00:00
Stefan Prodan 3a4ad50c09
Merge pull request #524 from fluxcd/dependabot/github_actions/actions/checkout-3.5.0
build(deps): bump actions/checkout from 3.4.0 to 3.5.0
2023-04-12 15:18:00 +03:00
dependabot[bot] 3ad1196561
build(deps): bump actions/checkout from 3.4.0 to 3.5.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](24cb908017...8f4b7f8486)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-11 05:54:06 +00:00
Stefan Prodan fca001617d
Merge pull request #532 from fluxcd/dependabot/github_actions/github/codeql-action-2.2.11
build(deps): bump github/codeql-action from 2.2.9 to 2.2.11
2023-04-11 08:53:28 +03:00
dependabot[bot] 34f97605ad
build(deps): bump github/codeql-action from 2.2.9 to 2.2.11
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.9 to 2.2.11.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](04df1262e6...d186a2a36c)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-10 21:03:43 +00:00
Stefan Prodan cf6b9467de
Merge pull request #531 from fluxcd/oci-opts
oci: Add `GetOptions` to client
2023-04-10 14:26:05 +03:00
Stefan Prodan bd52a59c3d
oci: Add GetOptions to client
Allow consumers to inspect the crane options used by the OCI client.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-04-09 19:59:20 +03:00
Stefan Prodan 4629f2d021
Merge pull request #530 from souleb/fix-kustomize-filter
Fix kustomize filterSlice function
2023-04-06 11:15:25 +03:00
Soule BA fbba1182e5
fix edge case where slice has 1 elem
Signed-off-by: Soule BA <bah.soule@gmail.com>
2023-04-06 09:47:57 +02:00
Stefan Prodan c5999661ed
Merge pull request #529 from fluxcd/dependabot/github_actions/ossf/scorecard-action-2.1.3
build(deps): bump ossf/scorecard-action from 2.1.2 to 2.1.3
2023-04-04 11:18:57 +03:00
dependabot[bot] 48bdfe7530
build(deps): bump ossf/scorecard-action from 2.1.2 to 2.1.3
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.1.2 to 2.1.3.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](e38b1902ae...80e868c13c)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-03 21:13:02 +00:00
souleb 5382a4b12e
Merge pull request #528 from souleb/sourceignore-support
Add support for .sourceignore and ignore string
2023-03-31 12:38:17 +02:00
Soule BA ef0f9554ec
Add support for .sourceignore and ignore string
If implemented the generator will be able to take into account a
`.sourceignore` in the base directory  and a provided `ignore` string
while generating/updating the kustomization file before build.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2023-03-31 11:58:27 +02:00
Hidde Beydals 6bf578d953
Merge pull request #526 from fluxcd/leader-election-id
runtime/leaderelection: add `GenerateID` and update dependencies
2023-03-29 12:35:41 +02:00
Hidde Beydals f88324f7c1
runtime: update dependencies
- github.com/onsi/gomega v1.27.5
- k8s.io/client-go v0.26.3
- k8s.io/component-base v0.26.3
- sigs.k8s.io/controller-runtime v0.14.6

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-29 11:46:18 +02:00
Hidde Beydals 398d063aa6
runtime/leaderelection: add `GenerateID`
This commit allows for the generation of a unique leader election ID
based on a base string and a set of arbitrary strings which are used
to generate a (short) SHA-256 sum to suffix with.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-29 11:46:17 +02:00
Stefan Prodan e222346d28
Merge pull request #525 from fluxcd/watch-label-selector
runtime: Add controller sharding capability based on label selector
2023-03-28 20:54:07 +03:00
Stefan Prodan 909e778e76
runtime: Add reconciler sharding capability based on label selector
Add `--watch-label-selector` flag to runtime. When specified the reconcilers will only watch for changes of those resources with matching labels. This enables horizontal scaling of Flux controller, where each controller can be deployed multiple times with a unique label selector which is used as the sharding key.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-03-28 20:28:13 +03:00
Hidde Beydals afcda20bf7
Merge pull request #523 from fluxcd/dependabot/github_actions/github/codeql-action-2.2.9
build(deps): bump github/codeql-action from 2.2.7 to 2.2.9
2023-03-28 09:19:20 +02:00
dependabot[bot] 181a7ac78a
build(deps): bump github/codeql-action from 2.2.7 to 2.2.9
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.7 to 2.2.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](168b99b3c2...04df1262e6)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-27 21:05:06 +00:00
Hidde Beydals 58580cb23e
Merge pull request #516 from fluxcd/update-actions
actions: update versions and ease maintenance burden
2023-03-27 17:15:17 +02:00
Hidde Beydals 847b2c031d
actions: `trap` fixup SC2064
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-27 16:53:02 +02:00
Hidde Beydals eb7bcf6430
actions: use `tr` for lowercase transformation
As Bash v4.0.0 is not available on macOS, but `tr` is available across
all runners.

In addition, solve some other issues around exec permissions and PATH
discovery.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-27 16:53:02 +02:00
Hidde Beydals feff8763dc
build: run actions on different runner versions
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-27 16:53:02 +02:00
Hidde Beydals 9feab97029
actions: update sops action
- Allow automatic resolvance of "latest" SOPS version.
- Support all runner types (Linux, macOS, Windows).
- Put binary into `$RUNNER_TOOL_CACHE`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-27 16:53:02 +02:00
Hidde Beydals 12d1867feb
actions: update kustomize action
- Remove the requirement of specifying an arch. This is now detected
  automatically based on the `RUNNER_ARCH` environment variable.
- Allow automatic resolvance of "latest" Kustomize version. Default is
  however still set to `v4.x.x` as this serves our primary needs.
- Support all runner types (Linux, macOS, Windows).
- Verify checksum of downloaded tarball.
- Put binary into `$RUNNER_TOOL_CACHE`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-27 16:53:01 +02:00
Hidde Beydals 0acac639f2
actions: update kubectl action
- Remove the requirement of specifying an arch. This is now detected
  automatically based on the `RUNNER_ARCH` environment variable.
- Allow automatic resolvance of "latest" Kubernetes version.
- Support all runner types (Linux, macOS, Windows).
- Verify checksum of downloaded binary.
- Put binary into `$RUNNER_TOOL_CACHE`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-27 16:53:01 +02:00
Hidde Beydals 06ea94ef34
actions: delete kubebuilder action
As it is no longer in use by any of Flux.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-27 16:53:01 +02:00
Hidde Beydals 310f26121b
actions: update helm action
- Use Helm installer script to automatically detect latest version, OS
  and arch.
- Download binary to `$RUNNER_TOOL_CACHE`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-27 16:53:01 +02:00
Hidde Beydals f6207f4a2a
actions: make envtest action composite
This drops the `Dockerfile` approach in favor of a composite GitHub
Action.

The `setup-envtest` is installed into the `$RUNNER_TOOL_CACHE`, using
the latest commit made to the `kubernetes-sigs/controller-runtime`
sub-directory which hosts the tool.

In addition, the envtest assets themselves are downloaded to a separate
`$RUNNER_TOOL_CACHE` directory. Allowing them to have a lifecycle
separate from the `setup-envtest` tool itself.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-27 16:53:01 +02:00
Hidde Beydals 18dda8f3db
actions: update crdjsonschema action
- Change image to much lighter Alpine version.
- Update `mogensen/kubernetes-split-yaml` to `v0.4.0`, and make it
  configurable using a build argument to ease maintenance. Sadly,
  GitHub Actions itself does not allow piping inputs to build args.

  Transforming this into a composite action at a later point is
  probably best, as Python comes pre-cached on GitHub runners in the
  `$RUNNER_TOOL_CACHE` directory.
- Rewrite the `entrypoint.sh` script to work in Alpine, be stricter
  in terms of working directory and arguments provided to binaries
  being called.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-27 16:53:01 +02:00
Stefan Prodan e175cf4f69
Merge pull request #522 from fluxcd/apis-v1.0.0
Update internal packages
2023-03-27 17:32:07 +03:00
Stefan Prodan 5f6e2f6aa2
Update internal packages
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-03-27 15:20:00 +03:00
Stefan Prodan eca885f49a
Merge pull request #521 from fluxcd/k8s-v0.26.3
Update Kubernetes packages to v0.26.3
2023-03-27 15:10:30 +03:00
Stefan Prodan 07451f6639
Update Kubernetes packages to v0.26.3
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-03-27 14:39:52 +03:00
Stefan Prodan e7086b2bc2
Merge pull request #517 from fluxcd/kustomize-fix-selector
apis: Kustomize target selector must be a pointer
2023-03-27 14:33:48 +03:00
Stefan Prodan 5ea22edd55
apis: Kustomize target selector must be a pointer
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-03-27 14:08:54 +03:00
Hidde Beydals c01256c2c1
Merge pull request #520 from fluxcd/runtime-test-flakiness
runtime/patch: increase (extended) timeout tests
2023-03-27 13:03:43 +02:00
Hidde Beydals ffa404e88c
runtime/patch: increase (extended) timeout tests
Once in awhile the tests appear to fail on this because it appears to
take a little longer than the current configurations. Slightly increase
both, to hopefully deal with it for good.

- https://github.com/fluxcd/pkg/actions/runs/4530985720/jobs/7980583099
- https://github.com/fluxcd/pkg/actions/runs/4500139007/jobs/7918873957
- https://github.com/fluxcd/pkg/actions/runs/4500711383/jobs/7920192543

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-27 12:35:06 +02:00
Hidde Beydals 31975dc53f
Merge pull request #518 from fluxcd/http-fetch-digest
http/fetch: support digest in archive fetcher
2023-03-27 12:20:54 +02:00
Hidde Beydals ad1bda05b9
http/fetch: support digest in archive fetcher
This allows verification against a known digest with a defined
algorithm, instead of an assumption on SHA-256. The change is backwards
compatible, and a `checksum` without a `:` will be assumed to be a
SHA-256 hash.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-27 11:41:40 +02:00
Hidde Beydals c7d085624b
Merge pull request #514 from fluxcd/update-workflows
Update workflows
2023-03-22 12:18:00 +01:00
Hidde Beydals 15ff8cacd8
build: enable Dependabot for GitHub Actions
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-22 11:51:33 +01:00
Hidde Beydals 8a7f34fcd4
build: update scan workflow
- Update actions to their latest versions.
- Use SHA to (potentially) allow enabling Dependabot.
- Remove obsolete `cache: true` setting which is the default for
  `actions/setup-go` since `>=v4.0.0`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-22 11:51:33 +01:00
Hidde Beydals 9a35b7f0ff
build: update ossf workflow
- Update actions to their latest versions.
- Use SHA to (potentially) allow enabling Dependabot.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-22 11:51:33 +01:00
Hidde Beydals cfbda55b55
build: update e2e workflow
- Update actions to their latest versions.
- Use SHA to (potentially) allow enabling Dependabot.
- Remove obsolete `cache: true` setting which is the default for
  `actions/setup-go` since `>=v4.0.0`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-22 11:51:33 +01:00
Hidde Beydals d56afe34df
build: update cifuzz workflow
- Update actions to their latest versions.
- Use SHA to (potentially) allow enabling Dependabot.
- Move caching responsibility to `actions/setup-go` (supported since
  >=v3).

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-22 11:51:33 +01:00
Hidde Beydals 5da2fa75ce
build: update build workflow
- Update actions to their latest versions.
- Use SHA to (potentially) allow enabling Dependabot.
- Remove obsolete `cache: true` setting which is the default for
  `actions/setup-go` since `>=v4.0.0`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-22 11:51:33 +01:00
Hidde Beydals fd0f6050fe
build: update actions workflow
- Update actions to their latest versions.
- Disable caching as this is enabled by default in `actions/setup-go`
  since `>=v4.0.0`.
- Update Go version to `1.20.x`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-22 11:51:27 +01:00
Hidde Beydals a8a70f3b4c
Merge pull request #515 from fluxcd/oci-update-protobuf
oci: update google.golang.org/protobuf to v1.29.1
2023-03-22 11:50:16 +01:00
Hidde Beydals 7552df3fcd
oci: update google.golang.org/protobuf to v1.29.1
https://pkg.go.dev/vuln/GO-2023-1631

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-22 11:21:09 +01:00
Hidde Beydals b3e1ed209a
Merge pull request #450 from weisdd/feat/azure-oci-workload-identity
feat(oci): Add support for Azure Workload Identity
2023-03-22 11:17:16 +01:00
Hidde Beydals a8d276c558
oci: further update dependencies
- github.com/aws/aws-sdk-go-v2 to v1.17.7
- github.com/aws/aws-sdk-go-v2/config to v1.18.19
- github.com/aws/aws-sdk-go-v2/credentials to v1.13.18
- github.com/aws/aws-sdk-go-v2/service/ecr to v1.18.7
- github.com/google/go-containerregistry to v0.14.0
- github.com/onsi/gomega to v1.27.4

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-22 10:28:42 +01:00
Igor Beliakov 21a9c62011 feat(oci): bump azidentity to v1.3.0-beta.4
To add support for Workload Identities.

Signed-off-by: Igor Beliakov <demtis.register@gmail.com>
2023-03-22 10:24:36 +01:00
Stefan Prodan eb40b22d79
Merge pull request #513 from fluxcd/set-common-metadata
ssa: Set common labels and annotations
2023-03-21 18:58:13 +02:00
Stefan Prodan 1ac829d11e
ssa: Set common labels and annotations
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-03-21 18:38:46 +02:00
Stefan Prodan 5da79e1701
Merge pull request #164 from dieend/histogram-metrics
Change the metric bucket into a more useful range.
2023-03-21 13:38:57 +02:00
Adinata Thayib d19ab656b9 update to use 30 mins instead of 60 mins
Signed-off-by: Adinata Thayib <mail.dieend@gmail.com>
2023-03-20 16:43:44 -07:00
Adinata Thayib a0c247c5bb Change the metric bucket into a more useful range.
Signed-off-by: Adinata Thayib <mail.dieend@gmail.com>
2023-03-20 16:43:26 -07:00
Sunny 9011841683
Merge pull request #512 from fluxcd/ignore-pattern-domain-side-effect
sourceignore: make a copy of domain for pattern
2023-03-16 17:28:27 +05:30
Sunny 1cf9c3b5eb sourceignore: make a copy of domain for pattern
LoadIgnorePatterns() modified the domain string slice after creating
ignore pattern, due to which the domain of certain patterns created
below the first directory level with multiple directories at the same
level resulted in the patterns to have the domain of the last directory
in the same directory level.

This is fixed by making a copy of the domain before creating a pattern.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-03-15 17:47:26 +05:30
Sunny 6805701899
Merge pull request #511 from fluxcd/result-finalize-ready-check
runtime/reconcile: Fix Ready check in Finalizer
2023-03-14 21:33:09 +05:30
Sunny 1e919d484d runtime/reconcile: Fix Ready check in Finalizer
Fix the Ready condition check in the ResultFinalizer.
`IsReady()` takes into account the Reconciling and Stalling conditons
too. Use `IsTrue()` to precisely check if Ready=True.

This ensure that Ready=True is toggled when there's a reconciliation
error in presence or other negative conditions.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-03-14 19:42:08 +05:30
Hidde Beydals e1f2cfca1b
Merge pull request #508 from fluxcd/runtime-setlogger
runtime/logger: add `SetLogger` helper
2023-03-07 16:13:50 +01:00
Hidde Beydals 23a1ea8d63
runtime/logger: add `SetLogger` helper
This adds a new helper which simultaneously configures
controller-runtime and klog to make use of the same logger instance.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 15:46:28 +01:00
Hidde Beydals ab91ddc7d6
Merge pull request #510 from fluxcd/misc-update-deps
misc: update dependencies
2023-03-07 15:46:21 +01:00
Hidde Beydals 1bc0669ea2
runtime: update dependencies
- github.com/fluxcd/pkg/apis/event to v0.4.1
- github.com/fluxcd/pkg/apis/meta to v0.19.1

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 15:22:27 +01:00
Hidde Beydals 066aef0b3a
kustomize: update dependencies
- github.com/fluxcd/pkg/apis/kustomize to v0.8.1

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 15:22:27 +01:00
Hidde Beydals 9c780974be
oci/tests: update dependencies
- github.com/fluxcd/pkg/oci to v0.21.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 15:22:27 +01:00
Hidde Beydals 71e9346425
oci: update dependencies
- github.com/Azure/azure-sdk-for-go/sdk/azcore to v1.4.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 15:22:27 +01:00
Hidde Beydals de270b092b
helmtestserver: update dependencies
- golang.org/x/crypto to v0.7.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 15:22:27 +01:00
Hidde Beydals 1872c9b1e6
Merge pull request #509 from fluxcd/git-update-deps
git: update dependencies
2023-03-07 14:38:47 +01:00
Hidde Beydals c128e33fdb
git/internal: update dependencies
- github.com/fluxcd/pkg/git/gogit to v0.8.1
- github.com/fluxcd/pkg/ssh to v0.7.3

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 14:15:51 +01:00
Hidde Beydals 71d54b208f
git/gogit: update dependencies
- github.com/fluxcd/pkg/ssh to v0.7.3
- golang.org/x/crypto to v0.7.0
- golang.org/x/sys to v0.6.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 14:15:26 +01:00
Hidde Beydals 740a5f1ece
gittestserver: update dependencies
- golang.org/x/crypto to v0.7.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 14:15:26 +01:00
Hidde Beydals 4d6969c7ee
ssh: update dependencies
- golang.org/x/crypto to v0.7.0

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 14:15:10 +01:00
Stefan Prodan f96f94a030
Merge pull request #502 from somtochiama/fix-misleading-immutable
[pkg/ssa] Do not force apply if resource doesn't exist on the cluster
2023-03-06 18:28:49 +02:00
Somtochi Onyekwere 987037af83 Do not force apply if resource doesn't exist on the cluster
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-03-06 17:05:02 +01:00
Stefan Prodan 24cffe9be9
Merge pull request #507 from fluxcd/oci-custom-annotations
oci: Allow setting custom annotations on artifacts
2023-03-03 10:21:28 +02:00
Stefan Prodan ea19dfc967
oci: Allow setting custom annotations on artifacts
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-03-03 09:34:03 +02:00
Hidde Beydals 99aeccc404
Merge pull request #506 from fluxcd/update-git-gogit
git/gogit: pin to pkg/git v0.11.0
2023-03-02 15:12:41 +01:00
Hidde Beydals 1215b082db
git/internal/e2e: pin to pkg/git v0.11.0
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 14:39:28 +01:00
Hidde Beydals ec058eecd3
git/gogit: pin to pkg/git v0.11.0
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 14:32:32 +01:00
Hidde Beydals 57a7e18d8c
Merge pull request #505 from fluxcd/git-update-deps
git: update dependencies
2023-03-02 14:06:52 +01:00
Hidde Beydals a5896a646e
git/internal/e2e: update dependencies
- github.com/fluxcd/pkg/git/gogit to v0.7.1
- github.com/onsi/gomega to v1.27.2
- Unpin github.com/emicklei/go-restful as it is no longer an active
  dependency.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 13:30:00 +01:00
Hidde Beydals 00f64653d7
git/gogit: update dependencies
- github.com/onsi/gomega to v1.27.2

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 13:30:00 +01:00
Hidde Beydals acf35bd746
git: update dependencies
- github.com/ProtonMail/go-crypto to v0.0.0-20230217124315-7d5c6f04bbb8
- github.com/onsi/gomega to v1.27.2

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 13:30:00 +01:00
Hidde Beydals eda77cf48a
ssh: update dependencies
- github.com/onsi/gomega to v1.27.2

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 13:30:00 +01:00
Hidde Beydals 41b3167e55
Merge pull request #504 from fluxcd/misc-update-deps
misc: update dependencies
2023-03-02 13:29:32 +01:00
Hidde Beydals 9a579c957f
ssa: update dependencies
- k8s.io/api to v0.26.2
- k8s.io/apimachinery to v0.26.2
- sigs.k8s.io/controller-runtime to v0.14.5

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 13:04:28 +01:00
Hidde Beydals 5185f6416f
http/fetch: update dependencies
- github.com/hashicorp/go-retryablehttp to v0.7.2
- github.com/onsi/gomega to v1.27.2

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 12:50:15 +01:00
Hidde Beydals 3caadb06a1
oci/tests: update dependencies
- github.com/fluxcd/pkg/oci to v0.20.0
- github.com/fluxcd/test-infra/tftestenv to v0.0.0-20230214200258-f19d6aa97a3f
- github.com/hashicorp/terraform-json to v0.15.0
- github.com/onsi/gomega to v1.27.2
- k8s.io/api to v0.26.2
- k8s.io/apimachinery to v0.26.2
- sigs.k8s.io/controller-runtime to v0.14.5

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 12:50:15 +01:00
Hidde Beydals 6f300e898a
oci: update dependencies
- github.com/aws/aws-sdk-go-v2 to v1.17.5
- github.com/aws/aws-sdk-go-v2/config to v1.18.15
- github.com/aws/aws-sdk-go-v2/credentials to v1.13.15
- github.com/aws/aws-sdk-go-v2/service/ecr to v1.18.5
- github.com/distribution/distribution/v3 to v3.0.0-20230223072852-e5d5810851d1
- github.com/onsi/gomega to v1.27.2
- sigs.k8s.io/controller-runtime to v0.14.5

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 12:50:15 +01:00
Hidde Beydals 527a9936d1
Merge pull request #503 from fluxcd/kustomize-update-deps
kustomize: update dependencies
2023-03-02 12:48:58 +01:00
Hidde Beydals da62a135cd
kustomize: update dependencies
- github.com/onsi/gomega to v1.27.2
- k8s.io/api to v0.26.2
- k8s.io/apiextensions-apiserver to v0.26.2
- k8s.io/apimachinery to v0.26.2
- sigs.k8s.io/controller-runtime to v0.14.5
- Pin kustomize to v4.5.7 to prevent if from accidentally updating
  until issues around v5 release are solved

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 12:21:37 +01:00
Hidde Beydals 2be8ae8ab2
apis/kustomize: update dependencies
- k8s.io/apiextensions-apiserver to v0.26.2

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 12:18:13 +01:00
Hidde Beydals 16b3fde5bf
Merge pull request #501 from fluxcd/runtime-update-deps
Update API and runtime dependencies
2023-03-02 12:17:17 +01:00
Hidde Beydals 94961cb94f
runtime: update dependencies
- github.com/onsi/gomega to v1.27.2
- github.com/stretchr/testify to v1.8.2
- k8s.io/api to v0.26.2
- k8s.io/apimachinery to v0.26.2
- k8s.io/client-go to v0.26.2
- k8s.io/component-base to v0.26.2
- k8s.io/klog/v2 to v2.90.1
- sigs.k8s.io/controller-runtime to v0.14.5

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 11:37:39 +01:00
Hidde Beydals 469beee137
apis/meta: update dependencies
- k8s.io/apimachinery to v0.26.2

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 11:37:39 +01:00
Hidde Beydals 14a5ae3365
apis/event: update dependencies
- k8s.io/api to v0.26.2
- k8s.io/apimachinery to v0.26.2

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 11:07:51 +01:00
Hidde Beydals 5584292632
Merge pull request #500 from fluxcd/events-log-level
runtime/events: change log level to trace
2023-03-02 10:34:51 +01:00
Hidde Beydals a78c79f2e2
runtime/events: change log level to trace
This commit changes the log level of the event recorder to `trace`,
reduing the noise one may receive while running a controller with log
level set to `debug` (to get a more extensive insight into what a
controller reports, but not as in-depth as `trace`).

This seems a more appropriate level, given the controller often emits a
variation of the information pushed in an event by itself on log level
`info`, and the knowledge about emitted events likely only has value
when deeply looking into the behavior of the application.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 10:16:37 +01:00
Hidde Beydals ee9a6094ee
Merge pull request #499 from fluxcd/build-go-1.20
build: update to Go 1.20
2023-03-01 17:16:15 +01:00
Hidde Beydals 09aa1dbba5 build: update to Go 1.20
Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-03-01 16:44:28 +01:00
Sanskar Jaiswal a05a666184
Merge pull request #497 from aryan9600/show-full-ref
git: add support for showing full references
2023-02-23 12:37:27 +05:30
Sanskar Jaiswal 1c20d8ee78 git: add support for showing full references
Add a new method `AbsoluteReference()` to show the full reference along
with the hash of a commit object. Refactor logic related to
`LastObservedCommit` in order for it to work with full references when
required.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-02-22 18:25:42 +05:30
Hidde Beydals e8417a23c0
Merge pull request #498 from fluxcd/ssa-skip-diff
ssa: report Skipped for diff exclusion
2023-02-21 16:39:46 +01:00
Hidde Beydals 44b2a42eca ssa: report Skipped for diff exclusion
Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-21 15:29:12 +01:00
Hidde Beydals 3e3846103a
Merge pull request #496 from fluxcd/update-codeowners
chore: update CODEOWNERS
2023-02-21 13:33:57 +01:00
Hidde Beydals 991894894d chore: update CODEOWNERS
Ownership has been defined based on commit count and track record of
(deeply) working with the specific libraries and/or the things it
integrates with.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-21 13:18:21 +01:00
Stefan Prodan f2c16a93ab
Merge pull request #490 from fluxcd/oci-globals
oci: Allow consumers to change the media types
2023-02-21 13:48:31 +02:00
Stefan Prodan 1a2564ef6e
oci: Allow consumers to change the media types
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-02-21 13:27:00 +02:00
Stefan Prodan 5b42f5f58e
Merge pull request #495 from fluxcd/ssa-skipped-action
Add `skipped` action to report ignored resources
2023-02-21 13:19:51 +02:00
Stefan Prodan 51ed871538
Add skipped action to report ignored resources
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-02-21 12:58:55 +02:00
Hidde Beydals 8ae07f47bb
Merge pull request #494 from fluxcd/all-target-change
Change `all` target to run only `tidy|generate|fmt|vet`
2023-02-21 11:55:06 +01:00
Hidde Beydals 05ba005f37 Change `all` to run only `tidy|generate|fmt|vet`
This is much cheaper than running all `test-%` variants, which can now
be triggered using `make test`.

It wil also help speeding up the extremely slow CodeQL workflow, which
at present runs the whole test suite without it being strictly required.
Due to the behavior of the Autobuild step described in
https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages#go

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-21 11:33:14 +01:00
Hidde Beydals 8eb7446dc7
Merge pull request #491 from fluxcd/ssa-action-type
ssa: make `Action` true to type
2023-02-21 11:28:01 +01:00
Hidde Beydals fd2c21bde1 sourceignore: update golang.org/x/net to v0.7.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-21 11:03:38 +01:00
Hidde Beydals 8dde0c129e ssa: make `Action` true to type
This makes the Action type a first-class citizen, over casting it to
a string. Resolving a whole lot of annoyances while working with the
change set when determining if something equals to (the string
representation of).

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-21 11:01:22 +01:00
Hidde Beydals 39de864a5c
Merge pull request #493 from fluxcd/xnet-update
chore: update golang.org/x/net across all libs
2023-02-21 11:01:06 +01:00
Hidde Beydals 45ca6c890b Add `tidy`, `fmt` and `vet` targets to `Makefile`
Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-21 10:13:22 +01:00
Hidde Beydals ba03289e4d chore: update golang.org/x/net across all libs
Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-21 10:13:22 +01:00
Stefan Prodan a0d6fd16b3
Merge pull request #492 from fluxcd/libgit2-decommission
git: Decommission libgit2 implementation
2023-02-21 11:10:12 +02:00
Stefan Prodan 4babd6af4a
git: Decommission libgit2 implementation
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-02-21 10:35:26 +02:00
Hidde Beydals 4897199eff
Merge pull request #479 from fluxcd/set-output-deprecation
build: convert ::set-output to $GITHUB_OUTPUT
2023-02-17 15:11:56 +01:00
Hidde Beydals 66e2edaf2d build: convert ::set-output to $GITHUB_OUTPUT
Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-17 14:27:53 +01:00
Stefan Prodan f40fab5a8c
Merge pull request #477 from fluxcd/dependabot/go_modules/helmtestserver/github.com/containerd/containerd-1.6.18
build(deps): bump github.com/containerd/containerd from 1.6.15 to 1.6.18 in /helmtestserver
2023-02-16 17:09:55 +02:00
dependabot[bot] 159be8f27e
build(deps): bump github.com/containerd/containerd in /helmtestserver
Bumps [github.com/containerd/containerd](https://github.com/containerd/containerd) from 1.6.15 to 1.6.18.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.6.15...v1.6.18)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-16 14:25:22 +00:00
Hidde Beydals 46a75e091e
Merge pull request #466 from fluxcd/ssa-fix-json-list
ssa: Use List v1 as JSON output
2023-02-16 12:00:45 +01:00
Stefan Prodan 9bad83ef87 ssa: Use List v1 as JSON output
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-02-16 11:48:18 +01:00
Hidde Beydals b2d4cf1dad
Merge pull request #452 from fluxcd/oci-azure-test-docs
oci/tests: Add details about using Azure Service Principal for authentication
2023-02-16 11:47:08 +01:00
Sunny ff8be4ec94 oci/tests: Add details about Azure CLI login
Add details about using Service Principal for azure tests.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-02-16 11:05:37 +01:00
Hidde Beydals fc87396f4e
Merge pull request #472 from fluxcd/sourceignore-update-deps
sourceignore/oci: update dependencies
2023-02-16 10:19:41 +01:00
Hidde Beydals a658dacfbc oci: update dependencies
- github.com/aws/aws-sdk-go-v2/config to v1.18.13
- github.com/aws/aws-sdk-go-v2/credentials to v1.13.13
- github.com/aws/aws-sdk-go-v2/service/ecr to v1.18.3
- github.com/distribution/distribution/v3 to v3.0.0-20230214150026-36d8c594d7aa
- github.com/fluxcd/pkg/sourceignore to v0.3.1

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-16 09:55:48 +01:00
Hidde Beydals 8d4759b856 sourceignore: update dependencies
- github.com/fluxcd/go-git/v5 to v5.0.0-20221219190809-2e5c9d01cfc4

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-16 09:23:56 +01:00
Hidde Beydals 9a517c826f
Merge pull request #471 from fluxcd/runtime-update-deps
runtime: update dependencies
2023-02-16 09:22:09 +01:00
Hidde Beydals ab8e44f99c runtime: update dependencies
- github.com/fluxcd/pkg/apis/event to v0.4.0
- sigs.k8s.io/controller-runtime to v0.14.4

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-15 23:49:49 +01:00
Hidde Beydals 602b51b39b
Merge pull request #474 from fluxcd/ssh-update-deps
ssh: update dependencies
2023-02-15 23:47:24 +01:00
Hidde Beydals 96dc63b965 git/e2e: update dependencies
- github.com/fluxcd/go-git-providers to v0.14.0
- github.com/fluxcd/pkg/git/gogit to v0.7.0
- github.com/fluxcd/pkg/git/libgit2 to v0.6.0
- github.com/fluxcd/pkg/gittestserver to v0.8.1
- github.com/fluxcd/pkg/ssh to v0.7.1

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-15 22:50:28 +01:00
Hidde Beydals 369fd2a59a libgit2: update dependencies
- github.com/fluxcd/pkg/git/gogit to v0.7.0
- github.com/fluxcd/pkg/gittestserver to v0.8.1
- github.com/fluxcd/pkg/ssh to v0.7.1
- github.com/fluxcd/pkg/version to v0.2.1
- github.com/onsi/gomega to v1.26.0

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-15 22:50:28 +01:00
Hidde Beydals e397cbb9f3 gogit: update dependencies
- github.com/fluxcd/pkg/gittestserver to v0.8.1
- github.com/fluxcd/pkg/version to v0.2.1
- github.com/fluxcd/pkg/ssh to v0.7.1
- github.com/onsi/gomega to v1.26.0

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-15 22:50:28 +01:00
Hidde Beydals c5036e6689 ssh: update dependencies
- github.com/onsi/gomega to v1.26.0
- golang.org/x/crypto to v0.6.0

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-15 22:50:28 +01:00
Hidde Beydals 9001818c65
Merge pull request #473 from fluxcd/ssa-update-deps
ssa: update dependencies
2023-02-15 22:49:50 +01:00
Hidde Beydals cf1edadd95 ssa: update dependencies
- sigs.k8s.io/controller-runtime to v0.14.4

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-15 22:34:22 +01:00
Hidde Beydals e5fe7f7d28
Merge pull request #470 from fluxcd/kustomize-update-deps
kustomize: update dependencies
2023-02-15 22:32:33 +01:00
Hidde Beydals d1afe0033d kustomize: update dependencies
- sigs.k8s.io/controller-runtime to v0.14.4

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-15 22:21:54 +01:00
Hidde Beydals 51df014544
Merge pull request #469 from fluxcd/helmtestserver-update-deps
helmtestserver: update dependencies
2023-02-15 22:19:49 +01:00
Hidde Beydals 37ab1041de helmtestserver: update dependencies
- golang.org/x/crypto to v0.6.0
- Unpin github.com/containerd/containerd to allow update to v1.6.15

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-15 21:54:54 +01:00
Hidde Beydals 2b825bf7b2
Merge pull request #475 from fluxcd/version-update-deps
version: update dependencies
2023-02-15 21:54:33 +01:00
Hidde Beydals 627ceadfaf version: update dependencies
- github.com/Masterminds/semver/v3 to v3.2.0

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-15 21:31:57 +01:00
Hidde Beydals 23c2b8da88
Merge pull request #468 from fluxcd/gittestserver-update-deps
gittestserver: update dependencies
2023-02-15 21:30:25 +01:00
Hidde Beydals f23c628657 gittestserver: update dependencies
- github.com/fluxcd/go-git/v5 to v5.0.0-20221219190809-2e5c9d01cfc4
- github.com/go-git/go-billy/v5 to v5.4.1
- golang.org/x/crypto to v0.6.0

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-15 19:11:47 +01:00
Hidde Beydals 3946786119
Merge pull request #467 from fluxcd/git-dep-update
git: update dependencies sub-packages
2023-02-15 17:56:35 +01:00
Hidde Beydals 8e2a32171b git/e2e: update dependencies
- github.com/fluxcd/pkg/git to v0.10.0
- github.com/fluxcd/pkg/git/gogit to v0.6.0
- github.com/fluxcd/pkg/git/libgit2 to v0.5.0

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-15 17:26:06 +01:00
Hidde Beydals 87a630d023 libgit2: update github.com/fluxcd/pkg/git to v0.10.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-15 17:10:30 +01:00
Hidde Beydals b85eea8237 gogit: update github.com/fluxcd/pkg/git to v0.10.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-15 15:58:42 +01:00
Hidde Beydals e8e803e2fe
Merge pull request #465 from aryan9600/clone-refname
add support for checking out git repo to a ref
2023-02-15 15:51:59 +01:00
Sanskar Jaiswal ca1dce0513 add support for checking out git repo to a ref via gogit
Add a new checkout strategy that enables checking out to a Git
reference: https://git-scm.com/book/en/v2/Git-Internals-Git-References.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-02-15 17:38:20 +05:30
Stefan Prodan 2bb3aa89bb
Merge pull request #461 from giantswarm/bump-default-client-burst-to-300
Increase default burst to 300 to conform `client-go`
2023-02-14 16:57:40 +02:00
Laszlo Uveges 4d5a7eb30d Increase default burst to 300 to conform client-go
See: https://github.com/kubernetes/kubernetes/pull/109141

Signed-off-by: Laszlo Uveges <laszlo@giantswarm.io>
2023-02-14 13:37:47 +01:00
Stefan Prodan db1f3af7f1
Merge pull request #460 from fluxcd/oci-media-type
oci: Introduce Flux media types
2023-02-13 14:47:17 +02:00
Stefan Prodan 2dda8d717b
oci: Add media type test
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-02-13 13:39:13 +02:00
Stefan Prodan e1d86c3bc3
oci: Set created annotation time to UTC
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-02-13 13:11:17 +02:00
Stefan Prodan 13010c913c
oci: Introduce Flux media types
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-02-13 13:11:17 +02:00
Hidde Beydals 6c2b10bc5d
Merge pull request #464 from fluxcd/update-git-lib-deps
Update Git library dependencies
2023-02-10 19:36:28 +01:00
Hidde Beydals 228c90b33e libgit2: just use github.com/google/uuid
This is being used by the previous package being used, and further
detaches us from Kubernetes dependencies. Which are kind of weird to
depend on for a Git library...

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-10 18:45:01 +01:00
Hidde Beydals 0adb24c908 git/e2e: update dependencies
Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-10 18:40:00 +01:00
Hidde Beydals d04cee3f80 libgit2: update dependencies
Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-10 18:40:00 +01:00
Hidde Beydals 775694bad1 gogit: update dependencies
Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-10 18:39:09 +01:00
Hidde Beydals 598e74ef01 git: update dependencies
Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-10 18:38:28 +01:00
Hidde Beydals c28ef00d44
Merge pull request #463 from fluxcd/go-git-bc-tag
go-git: transform revision for last observed tag
2023-02-10 16:59:46 +01:00
Hidde Beydals da9a7b707b go-git: transform revision for last observed tag
This ensures this strategy is backwards compatible as well, as I
accidentally forgot to do this for go-git in #404.

This lacks tests (as does the libgit2 implementation), and it would
probably be good to make them less dynamic as a follow up, as that's
how this slipped through the cracks.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-10 15:32:05 +01:00
Hidde Beydals 0009fda236
Merge pull request #404 from fluxcd/commit-string-fmt
git: change Commit#String format
2023-02-10 13:52:42 +01:00
Hidde Beydals db0daab1f8 git: make LastObservedCommit backwards compatible
This ensures the Git implementations transform any LastObservedCommit
value into the new format before comparing it to what they constructed
from the remote state.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-10 12:28:20 +01:00
Hidde Beydals 3fb1b65b2b git: tidy code around digests
Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-10 12:28:20 +01:00
Hidde Beydals b097686689 git: align tests and code with commit fmt change
Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-10 12:28:20 +01:00
Hidde Beydals 24a228cadb git: change Commit#String format
This changes the string format of `Commit` to use an `@` separator
instead of `/`, and drops the usage of "HEAD" as a virtual named
reference for commits without a named pointer (e.g. a Git branch and/or
tag). Matching the (revision) format proposed in RFC-0005.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-10 12:28:20 +01:00
Hidde Beydals da2a476d1a
Merge pull request #462 from fluxcd/event-digest-key
apis/event: add MetaDigestKey
2023-02-10 11:43:37 +01:00
Hidde Beydals 7053ad7c71 apis/event: add MetaDigestKey
This to support RFC-0005 in eventing.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-10 11:15:17 +01:00
Stefan Prodan e1160e92ac
Merge pull request #459 from fluxcd/dependabot/go_modules/helmtestserver/helm.sh/helm/v3-3.11.1
build(deps): bump helm.sh/helm/v3 from 3.11.0 to 3.11.1 in /helmtestserver
2023-02-09 12:37:48 +02:00
dependabot[bot] 8dddd93014
build(deps): bump helm.sh/helm/v3 in /helmtestserver
Bumps [helm.sh/helm/v3](https://github.com/helm/helm) from 3.11.0 to 3.11.1.
- [Release notes](https://github.com/helm/helm/releases)
- [Commits](https://github.com/helm/helm/compare/v3.11.0...v3.11.1)

---
updated-dependencies:
- dependency-name: helm.sh/helm/v3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-08 22:40:28 +00:00
Sunny 119e06afbe
Merge pull request #458 from fluxcd/checker-with-t
runtime/conditions: Add HasAny() for conditions and WithT for checker
2023-02-07 20:03:41 +05:30
Sunny 4a3f0dd7ec runtime/conditions: Add HasAny()
HasAny() helps check if an object contains any of the given list of
conditons.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-02-07 18:29:21 +05:30
Sunny 65475ce44a runtime/condns/check: Add *gomega.WithT in check
Use *gomega.WithT in condition checker to be able to assert and fail
like a proper go test and as a test helper instead of abrupt exit.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-02-07 18:29:14 +05:30
Stefan Prodan 2d2a14d6a4
Merge pull request #457 from fluxcd/controller-runtime/v0.14.1
Update internal dependencies
2023-01-27 11:53:07 +02:00
Stefan Prodan 4438aced04
Update internal dependencies
- Update and adapt fluxcd/pkg/runtime to controller-runtime v0.14.1
- Bump internal packages to latest

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-01-27 11:07:56 +02:00
Stefan Prodan 0cd2cf5dfa
Merge pull request #456 from fluxcd/fix-ignore
ssa: Ignore objects even if they exist in cluster
2023-01-26 17:45:35 +02:00
Stefan Prodan 3fcf57c9aa
ssa: Ignore objects even if they exist in cluster
If an object was created but then marked as ignored in source, we should skip applying it
even if the in-cluster object has no ignore annotation.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-01-26 16:39:51 +02:00
Stefan Prodan 524af9ea5c
Merge pull request #455 from fluxcd/kube-1.26
Update dependencies
2023-01-26 16:24:22 +02:00
Stefan Prodan 6eb33cbae9
Update dependencies
- k8s.io/* v0.26.1
- sigs.k8s.io/controller-runtime v0.14.1
- helm.sh/helm/v3 v3.11.0
- github.com/Azure/azure-sdk-for-go/sdk/azcore v1.3.0
- github.com/aws/aws-sdk-go-v2 v1.17.3
- github.com/google/go-containerregistry v0.13.0

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-01-26 15:51:17 +02:00
Stefan Prodan a61dfad113
Merge pull request #453 from fluxcd/ssa-force-selector
ssa: Add force apply selector options
2023-01-26 10:34:40 +02:00
Stefan Prodan 59e5383f02
Add force apply selector options
Add `ForceSelector` to `ApplyOptions` to recreate immutable objects with matching labels or annotations.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-01-25 14:03:11 +02:00
Stefan Prodan d1b8dfca79
Merge pull request #449 from somtochiama/v2-autoscaling
ssa: apply hpa drift detection fix to autoscaling/v2
2023-01-25 14:02:48 +02:00
Somtochi Onyekwere 60dda9ebae Fix hpa on apiVersion: autoscaling/v2
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2023-01-25 12:21:46 +01:00
Sunny d0e7e5c6ac
Merge pull request #451 from fluxcd/update-git-deps
Update pkg/git dependency to v0.8.0
2023-01-20 21:00:51 +05:30
Sunny e97d4358da Update pkg/git dependency to v0.8.0
Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-01-20 20:08:22 +05:30
Sunny 7ef01b0736
Merge pull request #442 from blurpy/feature/git_bearer_token
Support specifying bearerToken for git http token authentication
2023-01-20 19:44:34 +05:30
Christian Ihle 659695fabb Add back support for passphrase protected ssh keys
Signed-off-by: Christian Ihle <blurpy@gmail.com>
2023-01-20 13:56:00 +01:00
Christian Ihle 767e771669 Validate that basic auth and bearer token cannot be set at the same time
Signed-off-by: Christian Ihle <blurpy@gmail.com>
2023-01-20 12:48:07 +01:00
Christian Ihle cbf091cd4e Add test to verify that username from Secret is preferred
Signed-off-by: Christian Ihle <blurpy@gmail.com>
2023-01-20 12:16:09 +01:00
Christian Ihle b6c68885e0 Refactor of NewAuthOptions to only fill the auth options that are relevant
Signed-off-by: Christian Ihle <blurpy@gmail.com>
2023-01-20 10:40:31 +01:00
Christian Ihle fef9d6a24e Add more test scenarios for NewAuthOptions
Signed-off-by: Christian Ihle <blurpy@gmail.com>
2023-01-20 10:15:44 +01:00
Christian Ihle 9b9b723460 Validate that bearer token is not used over http
Signed-off-by: Christian Ihle <blurpy@gmail.com>
2023-01-20 07:49:32 +01:00
Christian Ihle 04d0d4878d Add some quick tests of basic auth in client.validateUrl()
Signed-off-by: Christian Ihle <blurpy@gmail.com>
2023-01-20 07:49:32 +01:00
Christian Ihle a451505248 Support specifying bearerToken for git http token authentication.
As an alternative to username and password with http basic authentication.

Signed-off-by: Christian Ihle <blurpy@gmail.com>
2023-01-20 07:49:32 +01:00
Sanskar Jaiswal bfb6385d48
Merge pull request #448 from fluxcd/e2e-ux
git/e2e: improve UX and add README
2023-01-18 20:34:52 +05:30
Sanskar Jaiswal 44a5f999d0 git/e2e: Replace GO_TEST_ARGS with GO_TEST_PREFIX in run.sh
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-01-18 19:38:53 +05:30
Sanskar Jaiswal 6214fd9e2e git/e2e: add README
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-01-18 19:38:53 +05:30
Sunny 2b9553c975 gitlab git e2e test improvements
- cleanup gitlab container even on test failure
- rename input argument variable to GO_TEST_ARGS as it's go test
  arguments
- simplify the gitlab test matcher which also allows running specific
  subtests for gitlab tests now
- provide option to persist the gitlab container and reuse in subsequent
  test execution
- generate random gitlab PAT per test execution, allowing subsequent
  test execution to not conflict
- no sleep when gitlab is found to be healthy
- support for specifying registry proxy for the gitlab container image
- rename gitlab container to be unique to flux tests
- retry grabbing root password by restarting gitlab

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-01-18 19:38:53 +05:30
Sanskar Jaiswal 41f8b170f8 git/e2e: improve UX and allow for more user inputs
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-01-18 19:38:53 +05:30
Stefan Prodan fcfb9b2730
Merge pull request #440 from mclarke47/export-patch-methods
feat: export ssa patching methods
2023-01-18 10:10:11 +02:00
Matthew Clarke bf7d62a5f2
Merge branch 'main' into export-patch-methods 2023-01-17 14:16:52 -05:00
Sunny 946d9acf6e
Merge pull request #441 from laozc/scheme
Set scheme when getting client from kubeconfig
2023-01-10 22:05:22 +05:30
Zhongcheng Lao f58ab9e6c0 Address PR comments
Signed-off-by: Zhongcheng Lao <Zhongcheng.Lao@microsoft.com>
2023-01-10 21:30:46 +05:30
Zhongcheng Lao 3026c1b634 Allow to pass scheme when getting kubeclient
Signed-off-by: Zhongcheng Lao <Zhongcheng.Lao@microsoft.com>
2023-01-10 21:30:46 +05:30
Sunny 25ef4743b8
Merge pull request #443 from fluxcd/default-rate-limiter
Expose the default rate limiter
2023-01-10 21:10:40 +05:30
Sunny a9070dbcc3 Expose the default rate limiter
The default configurations for rate limiter is exposed only to flag set.
This change adds a new function GetDefaultRateLimiter() to provide
access to the same rate limiter configuration without flags. This is
useful for setting the default rate limiter for reconcilers in test
suites.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-01-10 20:40:46 +05:30
Sunny 75f797c84b
Merge pull request #444 from fluxcd/kustomization-yaml-panic-recovery
kustomize: Handle malformed YAML in manifest scan
2023-01-10 20:38:15 +05:30
Matthew Clarke 43e1205dce
Merge branch 'main' into export-patch-methods 2023-01-10 09:47:56 -05:00
Sunny 00a9a2db7f kustomize: Handle malformed YAML in manifest scan
While scanning YAML manifests for generating kustomization, certain
invalid YAML files can cause panic. Add panic recovery while scanning
manifests.

Extracts the manifest scan code into a separate function and adds
white-box tests for it for different scenarios.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-01-10 14:59:32 +05:30
Sunny ad2ee3c415
Merge pull request #422 from fluxcd/intermediate-conditions-summary
Progressive status helper and in-progress status checker
2023-01-09 20:35:00 +05:30
Sunny 7962d2a157 conditions/check: Add InProgressChecker
InProgressChecker is a variant of the status conditions checker with a
different set of checks that are applicable to the objects in the middle
of on-going reconciliation, with intermediate conditions.

Delete invalid check FAIL0010.
Add FAIL0011 for mid-reconciliation scenario.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-01-09 19:48:13 +05:30
Sunny 4b7fec5f6a runtime/reconcile: Add progressive status
Add a progressive status helper for setting the Reconciling and Ready
conditions in the middle of reconciliation with consideration for
drift detection.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-01-09 19:48:08 +05:30
Sanskar Jaiswal d4e691cc31
Merge pull request #447 from aryan9600/revert-auto-stage
git/gogit: stop auto-staging files from WithFiles
2023-01-09 14:25:48 +05:30
Sanskar Jaiswal 061a859266 git/gogit: stop auto-staging files from WithFiles
Revert commit 80ff3d5d82 due to https://github.com/fluxcd/flux2/issues/3467

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-01-09 13:24:53 +05:30
Matthew Clarke 5805f40e73 feat: export ssa patching methods
Signed-off-by: Matthew Clarke <mclarke@spotify.com>
2022-12-28 10:29:25 -05:00
Paulo Gomes 90080a776e
Merge pull request #433 from fluxcd/single-branch
gogit: Add WithSingleBranch
2022-12-16 09:23:41 +00:00
Paulo Gomes 3d0a4a3419
gogit: Add WithSingleBranch
At present go-git does not support the MULTI_ACK capability, which
means that follow-up fetches on a given remote will fail.

To support Image Automation Controller use cases, the SwitchBranch
was initially short-circuited to avoid additional fetches. However,
this has the side effect of the controller pushing the same change
to the target repository multiple times. (fluxcd/flux2#3384)

In order to avoid this, a new WithSingleBranch option was created
to enable the download of all references at the initial clone.
From now on SwitchBranch has the single responsibility of switching
branches, and no longer pulling references.

The package git/gogit's primary goal is to support Flux use cases,
currently there is no need to expand the current API to expose ways
for users to refresh repository references outside the initial clone.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-12-16 08:15:22 +00:00
Stefan Prodan 01e30ef62d
Merge pull request #435 from fluxcd/dependabot/go_modules/helmtestserver/helm.sh/helm/v3-3.10.3
build(deps): bump helm.sh/helm/v3 from 3.10.2 to 3.10.3 in /helmtestserver
2022-12-15 14:11:01 +02:00
dependabot[bot] 3158f4e0af
build(deps): bump helm.sh/helm/v3 in /helmtestserver
Bumps [helm.sh/helm/v3](https://github.com/helm/helm) from 3.10.2 to 3.10.3.
- [Release notes](https://github.com/helm/helm/releases)
- [Commits](https://github.com/helm/helm/compare/v3.10.2...v3.10.3)

---
updated-dependencies:
- dependency-name: helm.sh/helm/v3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-15 11:40:29 +00:00
Stefan Prodan 51b87259ed
Merge pull request #438 from fluxcd/pin-envtest
Pin envtest to Kubernetes v1.25
2022-12-15 13:37:00 +02:00
Stefan Prodan dfd41997a9
Pin envtest to Kubernetes v1.25
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-12-15 13:06:51 +02:00
Stefan Prodan f9340b5a46
Merge pull request #436 from pjbgf/improv-fuzz
fuzz: Use build script from upstream
2022-12-15 11:26:02 +02:00
Paulo Gomes 68ea01011e
fuzz: Use build script from upstream
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-12-14 22:21:00 +00:00
Sunny 171df06d84
Merge pull request #434 from fluxcd/fix-oci-repo-root-login
oci/auth: Fix ImageRegistryProvider for repo root
2022-12-15 01:32:05 +05:30
Sunny cb4fdc70d5 oci/auth: Fix ImageRegistryProvider for repo root
When a repository root is provided, ImageRegistryProvider() fails to
identify the registry host. The provided name.Reference for repository
root is a Tag reference.
name.ParseReference(), assumes that that given string is the name and
registry host being empty defaults to index.docker.io.

ImageRegistryProvider() now takes the full address, in addition to the
name.Reference and uses the full address for analysis if there's no "/"
in the address, which indicates that it's a repository root.

This fixes login with repository root for all the providers, not just
AWS.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-12-14 22:24:07 +05:30
Stefan Prodan 6eb290f3f8
Merge pull request #431 from souleb/fix-generate-kustomization
Make sure to take into consideration all the accepted kustomization file extensions.
2022-12-14 15:44:07 +02:00
Soule BA 386f2a14b0
Make sure to take into consideration all the accepted kustomization file
extensions.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2022-12-14 13:56:19 +01:00
Sunny 2978355b08
Merge pull request #432 from fluxcd/oci-auth-aws-fix
oci/auth: Fix aws login with aws-sdk-go-v2
2022-12-14 17:01:25 +05:30
Sunny 0e7a168e75 oci/auth: Fix aws login with aws-sdk-go-v2
As per aws-sdk-go-v2 docs, new config for creating a session should use
config.LoadDefaultConfig() and account ID is not needed for ECR
authorization token.

In order to maintain the auth API which is shared with other provider,
return an empty client for NewClient(). The login implementation loads
the default config if the client config is nil. A test can stub the
client config before calling login.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-12-14 16:23:45 +05:30
Paulo Gomes 0b80dfbb42
Merge pull request #430 from aryan9600/osfs
git/gogit: fix chroot filesystem and add submodule test
2022-12-12 11:02:44 +00:00
Sanskar Jaiswal bf8628cc5e git/gogit: add test for cloning repos with submodules
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-12-12 15:51:31 +05:30
Sanskar Jaiswal 551ca85681 git/fs: use securejoin to join paths while chrooting
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-12-12 15:51:28 +05:30
Stefan Prodan e7417c93f5
Merge pull request #418 from somtochiama/buildabs-path
Build archive properly in oci.Build
2022-12-09 12:42:55 +02:00
Somtochi Onyekwere 4801d49add Put file at root dir when a single file is passed in oci.Build
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-12-08 21:43:38 +01:00
Paulo Gomes b941b34109
Merge pull request #428 from aryan9600/fix-gogit-mod
git/{libgit2,e2e}: bump git/gogit to v0.3.1
2022-12-08 14:20:15 +00:00
Sanskar Jaiswal 02bd4bd7c3 git/{libgit2,e2e}: bump git/gogit to v0.3.1
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-12-08 19:15:24 +05:30
Paulo Gomes 23f1ade0c0
Merge pull request #427 from aryan9600/fix-gogit-mod
git/gogit: bump to gittestserver v0.8.0
2022-12-08 12:51:01 +00:00
Sanskar Jaiswal 57c705b28d git/gogit: bump to gittestserver v0.8.0
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-12-08 17:25:26 +05:30
Paulo Gomes 71c5265bb9
Merge pull request #426 from fluxcd/bb-onprem-e2e
git/e2e: fix bitbucket server url parsing and project key
2022-12-08 11:48:38 +00:00
Sanskar Jaiswal dc639894a8 git/e2e: fix bitbucket server url parsing and project key
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-12-08 16:59:14 +05:30
Paulo Gomes 5bf958f36c
Merge pull request #424 from fluxcd/test-gitlab-ce
git: Bump to latest fluxcd/go-git
2022-12-08 10:02:16 +00:00
Paulo Gomes f51bdb9fdf
libgit2: Adhoc fix for darwin
When running in MacOS, the util.Walk func may incorrectly
say that the current dir is not inside the workdir set in
the fs. To workaround the issue we check for the error and
ensure that the path is the same as the
workdir set.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-12-07 14:54:50 +00:00
Paulo Gomes ebfa51a7c9
git/e2e: Ensure changes are staged
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-12-07 14:34:26 +00:00
Paulo Gomes 80ff3d5d82
gogit: Auto-stage files from WithFiles
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-12-07 14:34:25 +00:00
Paulo Gomes 49c90f601a
build: Bump fluxcd/go-git
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-12-06 15:19:26 +00:00
Paulo Gomes 51f482bd11
git/libgit2: Ensure only Flux fs is used
The upstream fs implementation has a few issues.
Due to this, use Flux internal version instead.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-12-06 15:19:25 +00:00
Paulo Gomes e90858972b
git/e2e: Ensure repos are initialised in new dir
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-12-06 15:19:24 +00:00
Paulo Gomes a85e4cfe80
git/fs: Fix wd detected as outside wd
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-12-06 13:19:37 +00:00
Paulo Gomes e1f19a1e6b
Merge pull request #423 from aryan9600/bb-onprem-e2e
git: add e2e tests for Bitbucket Server
2022-12-06 12:38:53 +00:00
Sanskar Jaiswal e5dff06303 git: add e2e tests for Bitbucket Server
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-12-05 22:35:38 +05:30
Paulo Gomes 28e89e47ba
Merge pull request #421 from aryan9600/default-kh
git/gogit: fallback to machine known_hosts
2022-12-05 13:59:55 +00:00
Sanskar Jaiswal 5447c4759b git/gogit: add option to fallback to machine known_hosts
Add a new ClientOption `WithFallbackToDefaultKnownHosts()` which falls
back to the default known_hosts of the machine when constructing an auth
method if the identity and known_hosts are missing in the provided in
auth options.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-12-05 12:23:44 +05:30
Paulo Gomes fa4f4c7b34
Merge pull request #412 from klausenbusk/components
Add support for Kustomize components
2022-12-02 10:28:57 +00:00
Kristian Klausen 42a26235f0 Add support for Kustomize components
Ref: fluxcd/kustomize-controller#753

Signed-off-by: Kristian Klausen <kristian@klausen.dk>
2022-12-02 10:28:19 +01:00
Paulo Gomes 0e7b8ce6f3
Merge pull request #420 from aryan9600/gg-proxy
git/gogit: add proxy tests
2022-12-02 09:11:50 +00:00
Sanskar Jaiswal 587f9881f2 git/gogit: update to gogit with sha1 collision detection
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-12-02 14:05:05 +05:30
Sanskar Jaiswal 806c0b6927 git/gogit: add socks5 proxy tests
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-12-01 20:44:38 +05:30
Sanskar Jaiswal c6ed805299 git/gogit: add http proxy tests
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-12-01 20:44:35 +05:30
Paulo Gomes fbb8b9f29f
Merge pull request #419 from aryan9600/osfs
git/gogit: modify chroot to return a new os filesystem
2022-11-28 15:33:52 +00:00
Sanskar Jaiswal f73a879f8e git/gogit: modify chroot to return a new os filesystem
Modify `Chroot()` into returning a new OS filesystem. The filesystem
returned is not actually chrooted, but only enforces all files to be
under the root working directory. This is required to avoid breaking
cloning repos with submodules.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-11-28 20:28:35 +05:30
Paulo Gomes 8b61e848f6
Merge pull request #337 from aryan9600/proxy
git/libgit2: add support for ssh proxy and tests
2022-11-25 09:54:55 +00:00
Sanskar Jaiswal 0479928031 git/libgit2: add tests for ssh/socks proxy
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-11-23 20:13:47 +05:30
Sanskar Jaiswal b86d71a63b git/libgit2: add tests for http(s) proxy
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-11-23 20:13:47 +05:30
Sanskar Jaiswal 97d12892b4 git/libgit2: add ClientOption to specify proxy
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-11-23 20:13:47 +05:30
Sanskar Jaiswal a61bb3e601 git/libgit2: modify ssh transport to accept custom proxy urls
Extend the libgit2 ssh transport to support custom proxies in addition
to reading env vars

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-11-23 20:13:47 +05:30
Paulo Gomes 5807592e70
Merge pull request #416 from pjbgf/fix-broken-fuzz
build: Improve fuzz tests' reliability
2022-11-23 12:29:51 +00:00
Paulo Gomes 4386e9204b
build: Improve fuzz tests' reliability
Establish conventions which aligns with what is supported upstream
today, whilst expanding on documentation to ensure other contributors
have pointers on how to debug/check for issues going forwards.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-23 12:01:23 +00:00
Paulo Gomes b11a081a1a
Merge pull request #415 from pjbgf/fix-broken-fuzz
build: Fix fuzz tests
2022-11-23 10:31:24 +00:00
Paulo Gomes ab2b4eba15
build: Fix fuzz tests
Temporarily ignores recorder_fuzzer_test.go.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-23 09:30:16 +00:00
Stefan Prodan 7881b111d7
Merge pull request #414 from fluxcd/fix-crd-gen
Fix openapi2jsonschema action
2022-11-22 19:08:38 +02:00
Stefan Prodan 17454395c6
Fix openapi2jsonschema action
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-11-22 18:53:23 +02:00
Paulo Gomes 8fd85287c2
Merge pull request #413 from pjbgf/bump-aws-sdk
oci: Bump github.com/aws/aws-sdk-go to v2
2022-11-22 16:48:53 +00:00
Paulo Gomes 750df674c5
Bump github.com/aws/aws-sdk-go to v2
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-18 14:18:50 +00:00
Paulo Gomes a44e208e30
Merge pull request #411 from pjbgf/revert-combine-schemas
Revert "Merge pull request #189 from chanwit/combine_all_schemas"
2022-11-17 15:31:51 +00:00
Paulo Gomes ab72b80e7a
Revert "Merge pull request #189 from chanwit/combine_all_schemas"
This reverts commit 24666ee778, reversing
changes made to 1d572db560.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
2022-11-17 14:15:34 +00:00
Paulo Gomes 16ed2d843b
Merge pull request #410 from aryan9600/fix-e2e
ci: fix git e2e tests workflow
2022-11-16 14:23:28 +00:00
Sanskar Jaiswal 9f02fe7433 ci: fix git e2e tests workflow
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-11-16 19:16:37 +05:30
Paulo Gomes 70f372a2a4
Merge pull request #409 from aryan9600/bump-git-v0.7.0
bump pkg/git to v0.7.0
2022-11-16 11:34:01 +00:00
Sanskar Jaiswal eff6bdc690 bump pkg/git to v0.7.0
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-11-16 15:42:04 +05:30
Stefan Prodan 30dc34c8d2
Merge pull request #392 from souleb/main
Clean-up Kustomize module and enable dry-run for varsub
2022-11-16 12:08:57 +02:00
Soule BA 0180cac2f8
Enable dry-run mode for varsub
If implemented, consumers can implement offline behavior while using
this pkg.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2022-11-16 10:10:33 +01:00
Soule BA 6ae69c29b6
Update genarator and varsub
- use same envsubst version than kustomize-controller
- use securefs

This in order to make sure this lib can be used by both flux cli and
kustomize-controller.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2022-11-16 10:07:03 +01:00
Paulo Gomes f70757d507
Merge pull request #408 from fluxcd/fix-e2e
build: Fix e2e tests broken after #402
2022-11-15 19:03:18 +00:00
Paulo Gomes 5723219108
build: Fix e2e tests broken after #402
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-15 17:41:44 +00:00
Paulo Gomes 286ec55e21
Merge pull request #402 from pjbgf/git-repository
Create `git/repository` and Consolidate use of `ClientOption`
2022-11-15 16:33:54 +00:00
Paulo Gomes 13379749d7
git: Move repository options to git/repository
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-15 15:16:28 +00:00
Paulo Gomes 6db7f53798
git: Move pkg/gitutil into pkg/git
The gitutil package sole purpose was to provide better error handling
for both go-git and libgit2 implementations. By moving this package
into the respective git implementations, they become self-contained.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-15 15:16:27 +00:00
Paulo Gomes dccd499d62
git: Consolidate the use of ClientOption
The use of options were a mix of value and funcs, which in some cases
was confusing:

NewClient(os.TempDir(), nil,
	WithDiskStorage,
	WithForcePush(),
	WithInsecureCredentialsOverHTTP)

With the changes, all options are exposed as funcs instead:

NewClient(os.TempDir(), nil,
	WithDiskStorage(),
	WithForcePush(),
	WithInsecureCredentialsOverHTTP())

The above changes aligns with the standards used in source controller
internal/reconcile/summarize.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-15 15:04:34 +00:00
Paulo Gomes 4d71f21e2e
git: Rename git.RepositoryClient to repository.Client
Left over changes from the initial PR, which aims at
making the pkg/git packages more Go idiomatic.

xref:
https://github.com/fluxcd/pkg/pull/300#discussion_r932037900

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-15 15:04:33 +00:00
Stefan Prodan aec27af6e0
Merge pull request #407 from fluxcd/update-internal-pkgs
Update internal dependencies
2022-11-15 16:55:08 +02:00
Stefan Prodan 842913223e
Update internal dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-11-15 16:11:38 +02:00
Stefan Prodan 7741c5ff7c
Merge pull request #403 from pjbgf/update-deps
build: Update dependencies
2022-11-15 15:32:12 +02:00
Paulo Gomes b01b5e8656
build: Update dependencies
- k8s.io/* 0.25.4
- github.com/AdaLogics/go-fuzz-headers 0.0.0-20221103172237-443f56ff4ba8
- github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
- github.com/aws/aws-sdk-go 1.44.137
- github.com/Azure/azure-sdk-for-go/sdk/azcore 1.2.0
- github.com/Azure/azure-sdk-for-go/sdk/azidentity 1.2.0
- github.com/BurntSushi/toml v1.2.1
- github.com/cloudflare/circl v1.3.0
- github.com/containerd/containerd v1.6.10
- github.com/distribution/distribution/v3 3.0.0-20221111170714-3b8fbf975279
- github.com/docker/cli v20.10.21+incompatible
- github.com/docker/docker-credential-helpers v0.7.0
- github.com/docker/docker v20.10.21+incompatible
- github.com/docker/go-units v0.5.0
- github.com/emicklei/go-restful/v3 v3.10.0
- github.com/evanphx/json-patch v5.6.0+incompatible
- github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f
- github.com/fluxcd/pkg/testserver 0.4.0
- github.com/fluxcd/pkg/testserver v0.4.0
- github.com/go-errors/errors v1.4.2
- github.com/go-gorp/gorp/v3 v3.1.0
- github.com/google/btree v1.1.2
- github.com/google/gnostic v0. v0.6.9
- github.com/google/go-cmp v0.5.9
- github.com/google/go-containerregistry 0.12.1
- github.com/google/uuid v1.3.0
- github.com/go-openapi/jsonreference v0.20.0
- github.com/go-openapi/swag v0.22.3
- github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79
- github.com/hashicorp/errwrap v1.1.0
- github.com/hashicorp/go-cleanhttp v0.5.2
- github.com/huandu/xstrings v1.3.3
- github.com/imdario/mergo v0.3.13
- github.com/inconshreveable/mousetrap v1.0.1
- github.com/klauspost/compress v1.15.12
- github.com/lib/pq v1.10.7
- github.com/mailru/easyjson v0.7.7
- github.com/mattn/go-colorable v0.1.13
- github.com/mattn/go-isatty v0.0.16
- github.com/mattn/go-runewidth v0.0.14
- github.com/matttproud/golang_protobuf_extensions v1.0.4
- github.com/mitchellh/go-wordwrap v1.0.1
- github.com/moby/term v0.0.0-20221105221325-4eb28fa6025c
- github.com/onsi/gomega 1.24.1
- github.com/opencontainers/image-spec v1.1.0-rc2
- github.com/prometheus/client_golang 1.14.0
- github.com/prometheus/client_golang v1.14.0
- github.com/prometheus/client_model v0.3.0
- github.com/prometheus/common v0.37.0
- github.com/prometheus/procfs v0.8.0
- github.com/ProtonMail/go-crypto 0.0.0-20221026131551-cf6655e29de4
- github.com/PuerkitoBio/purell v1.2.0
- github.com/rivo/uniseg v0.4.2
- github.com/rubenv/sql-migrate v1.2.0
- github.com/russross/blackfriday v1.6.0
- github.com/shopspring/decimal v1.3.1
- github.com/sirupsen/logrus v1.9.0
- github.com/spf13/cast v1.5.0
- github.com/spf13/cobra v1.6.1
- github.com/stretchr/testify 1.8.1
- github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb
- go.etcd.io/etcd/api/v3 v3.5.5
- golang.org/x/crypto v0.2.0
- golang.org/x/net v0.2.0
- golang.org/x/oauth2 v0.2.0
- golang.org/x/sync v0.1.0
- golang.org/x/sys v0.2.0
- golang.org/x/term v0.2.0
- golang.org/x/text v0.4.0
- golang.org/x/time v0.2.0
- google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1
- google.golang.org/grpc v1.50.1
- google.golang.org/protobuf v1.28.1
- go.starlark.net v0.0.0-20221028183056-acb66ad56dd2
- helm.sh/helm/v3 v3.10.2
- k8s.io/klog/v2 v2.80.1
- k8s.io/kubectl v0.25.4
- k8s.io/kube-openapi v0.0.0-20221110221610-a28e98eb7c70
- k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2
- oras.land/oras-go v1.2.1
- sigs.k8s.io/cli-utils 0.34.0
- sigs.k8s.io/controller-runtime 0.13.1

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-15 12:46:55 +00:00
Stefan Prodan 01e9693e3d
Merge pull request #406 from fluxcd/add-common-reasons
apis/meta: Add common failure reasons
2022-11-15 13:56:09 +02:00
Stefan Prodan b2956038d1
Add common failure reasons
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-11-15 13:15:31 +02:00
Stefan Prodan 1e14426b56
Merge pull request #405 from fluxcd/fix-scorecard
Bump scorecard action to v2.0.6
2022-11-15 12:42:54 +02:00
Stefan Prodan e0401e033c
Bump scorecard action to v2.0.6
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-11-15 10:39:55 +02:00
Paulo Gomes c6f9759287
Merge pull request #401 from fluxcd/refactor-e2e
build: Refactor e2e tests and update GitHub actions
2022-11-11 12:04:14 +00:00
Paulo Gomes bce5f8848e
build: Update GH actions
Node.js 12 actions are deprecated so moving the actions to the
latest version to remove warnings whilst running CI builds.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-11 10:13:07 +00:00
Paulo Gomes d551249add
build: Refactor e2e tests
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-11 10:13:06 +00:00
Paulo Gomes 900d7998ad
Merge pull request #399 from pjbgf/git-add-tests
build: Fix gitkit and gitlab tests
2022-11-11 08:05:47 +00:00
Paulo Gomes 78bc65cc68
build: Fix gitkit and gitlab tests
The two sets of tests affected are only executed at main branch
and were sending credentials over HTTP, which has been blocked
by #396. The changes use WithInsecureCredentialsOverHTTP to enable
such behaviour.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-10 17:15:13 +00:00
Paulo Gomes 2dfd75cd91
Merge pull request #396 from pjbgf/git-add-tests
git: Add new WithInsecureCredentialsOverHTTP
2022-11-10 16:44:09 +00:00
Paulo Gomes b451b61ab4
git: Add new WithInsecureCredentialsOverHTTP
Blocks the transmission of credentials over HTTP by default
but add a new WithInsecureCredentialsOverHTTP which enables
it.

Passing credentials in plain-text over HTTP is not
recommended for production environments.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-10 13:28:09 +00:00
Paulo Gomes 23cf50f6c9
Merge pull request #391 from pjbgf/bump-gogit
gogit: Replace `go-git/go-git` with `fluxcd/go-git`
2022-11-08 15:19:48 +00:00
Paulo Gomes f83a6203a4
gogit: Change test expectation for new gogit/fs
The new gogit fs will enforce file writes are created in dirs descending
from the current working dir. The previous behaviour was to return the
error: 'chroot boundary crossed'.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-08 14:30:32 +00:00
Paulo Gomes 5f35e85a91
gogit: Replace go-git/go-git with fluxcd/go-git
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-08 14:30:31 +00:00
Paulo Gomes d55f10ffb4
Merge pull request #393 from aryan9600/empty-repos
git: add support for cloning empty repos
2022-11-08 14:27:40 +00:00
Sanskar Jaiswal c6c2d6de26 git: add support for cloning empty repos
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-11-08 19:32:38 +05:30
Stefan Prodan ac62657d8b
Merge pull request #395 from fluxcd/udate-runtime-events
Migrate runtime to Event API v1beta1
2022-11-08 15:16:23 +02:00
Stefan Prodan 23a088198d
Migrate runtime to Event API v1beta1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-11-08 14:43:36 +02:00
Stefan Prodan 5b80083a70
Merge pull request #390 from fluxcd/apis-event
Introduce the Event v1beta1 API schema
2022-11-08 14:24:07 +02:00
Stefan Prodan 25b2594f2f
Add constants that define the Event metadata conventions
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-11-08 13:59:46 +02:00
Stefan Prodan cf7c9a74ae
Introduce the Event v1beta1 API schema
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-11-08 13:59:42 +02:00
Stefan Prodan a0c91ac376
Merge pull request #394 from aryan9600/gogit-callback
git/gogit: configure hostkey callback only when known_hosts is provided
2022-11-08 12:12:11 +02:00
Sanskar Jaiswal 003506d1fa git/gogit: configure hostkey callback only when known_hosts is provided
Some applications like CLIs might prefer to use the known_hosts of the
machine which then leads to an empty known_hosts value being used in
`git.AuthOptions` resulting in an invalid callback.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-11-08 14:46:59 +05:30
Paulo Gomes 2ee90dd5b2
Merge pull request #389 from pjbgf/optimise-forcepush
gogit: Optimise force push
2022-11-02 12:39:58 +00:00
Paulo Gomes cb0fa7fac6
gogit: Optimise force push
When force push is enabled, we always override the push branch
therefore references for the target branch are redundant.

By short-circuting the process, we avoid a fetch operation
against the server, which in this case has no impact on the
end result.

For servers that require multi_ack, this operation was leading
to a silenced error.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-02 10:26:08 +00:00
Paulo Gomes 6919983b21
Merge pull request #388 from pjbgf/force-push
gogit: Add WithForcePush
2022-10-29 08:13:38 +01:00
Paulo Gomes d2ab01acb1
gogit: Add WithForcePush
Force push enables use cases in image automation controller
in which a branch has changed in-between a Clone and the
push operation. An example would be long-lived push branches
that become stale from the default or clone branch.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-10-28 14:27:45 +01:00
Paulo Gomes 7f35f613c6
Merge pull request #387 from pjbgf/gogit-create-dir
gogit: create parent dirs for fs.Symlink()
2022-10-26 17:35:10 +01:00
Paulo Gomes dbef6805e9
gogit: create parent dirs for fs.Symlink()
Go-git expects that the dir containing the target symlink exists,
which is the same behaviour observed for regular files. Regular
files and dir are managed by fs.OpenFile(), which is call by both
fs.Open() and fs.Create().

With the this change, fs.Symlink() aligns with the behaviour elsewhere
within go-git.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-10-26 16:13:15 +01:00
Paulo Gomes 11a3405b25
Merge pull request #386 from pjbgf/gogit-fs
gogit: Implement osfs to better support git clones
2022-10-26 12:12:16 +01:00
Paulo Gomes a1f911ee53
gogit: Implement osfs to better support git clones
The upstream implementation has some limitations which causes Git worktrees
to be dirty soon after a clone, as they change the contents of symlinks and
does not honour filemodes. Here's a list of behaviour changes:
- Chroot is not supported and paths are not changed from the underlying OS fs.
- Relative paths are forced to descend from the working dir.
- Symlinks don't have its targets modified, and therefore can point to locations
outside the working dir or to non-existent paths.
- OpenFile honours the FileMode passed as argument.
- ReadLink and Lstat does not follow symlinks as most other funcs do.
However, it ensures that:
a) The filename is located within the current dir.
b) The dir in which filename is based, is located within the current dir.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-10-26 11:04:32 +01:00
Paulo Gomes 3adaefc650
Merge pull request #376 from pjbgf/libgit2-1.5.0
build: Bump golang-with-libgit2 to v0.4.0
2022-10-26 08:56:58 +01:00
Paulo Gomes 0bfef632ad
build: Bump golang-with-libgit2 to v0.4.0
The new version uses libgit2 1.5.0 and requires git2go/v34.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-10-26 08:28:55 +01:00
Stefan Prodan d0873772e5
Merge pull request #384 from developer-guy/feature/diff
oci: Use upstream layer digest for artifact diff
2022-10-26 09:33:32 +03:00
Batuhan Apaydın 405d43dbf3
feature: use layer digest
Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
Co-authored-by: Furkan Türkal <furkan.turkal@trendyol.com>
Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
2022-10-22 12:12:46 +03:00
Stefan Prodan d4a148f509
Merge pull request #382 from developer-guy/feature/diff
oci/client: add diff capability
2022-10-20 11:27:05 +03:00
Batuhan Apaydın 0cb6bcf965
feat: diff capability added to client
Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
2022-10-19 23:04:42 +03:00
Paulo Gomes e179603d8b
Merge pull request #383 from pjbgf/v2
git: Bump go-git to enable `multi_ack`
2022-10-19 11:13:33 +01:00
Paulo Gomes f8fc1fcc72
git: Bump go-git to enable multi_ack
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-10-19 10:34:54 +01:00
Stefan Prodan 70dc6be4c2
Merge pull request #381 from fluxcd/bump-tar
Update tar pkg for `http/fetch` and `oci/client`
2022-10-18 18:13:28 +03:00
Stefan Prodan 563f87b445
Update tar pkg for http/fetch
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-10-18 17:40:00 +03:00
Paulo Gomes fe2ef0aa85
Merge pull request #378 from pjbgf/streamfetch
http/fetch: Optimise memory consumption
2022-10-18 15:12:51 +01:00
Paulo Gomes 678f92d3a1
http/fetch: Optimise memory consumption
The previous `http/fetch` logic would load into memory the tar file,
causing large files to increase the likelihood of concurrent
reconciliations to cause OOM.

The Fetch func downloads a file, and then hashs it content and if the
checksum matches, it then goes ahead and extract its contents. The
`resp.Body` is not a `io.SeekReader`, which means that to avoid loading
the full size of the file into memory, we need to save it into a temporary
file, and then load the file to the subsequent operations. With this approach
the memory consumption per operation was reduced from 23mb to 2.1mb:
```
Benchmark_Fetch-16      5  227630480 ns/op  23003358 B/op  19511 allocs/op
Benchmark_FetchNew-16   5  227570375 ns/op   2106795 B/op  19504 allocs/op
```
The tar size use was 7mb.

Expanding on preventing programming, the download process and subsequent
operations are short-circuited after a Max Download Size is reached. With
a max limit set to 100 bytes, the error message yielded is:

`artifact is 7879239 bytes greater than the max download size of 100 bytes`

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-10-18 13:53:55 +01:00
Stefan Prodan b37a57c5f1
Merge pull request #379 from fluxcd/serialpatcher
runtime/patch: Add SerialPatcher
2022-10-14 19:19:03 +03:00
Sunny 701acc8538 runtime/patch: Add SerialPatcher
SerialPatcher is a wrapper around the patch helper to help perform
consecutive patching of object in a transparent manner without the need
to keep track of the object state after patching.

The SerialPatcher persists the a before state of the object and a
kubernetes client. The patch operations configurations aren't persisted
and are accepted as argument to SerialPatcher.Patch(). This makes the
patcher reusable in different scenarios during its lifetime.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-10-14 20:38:16 +05:30
Paulo Gomes 3868547250
Merge pull request #377 from pjbgf/no-untar
tar: Optimise memory usage
2022-10-14 11:57:40 +01:00
Paulo Gomes 81b9a5cdfd
untar: Decomission package
Redirect use to call tar.Untar instead.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-10-14 08:55:24 +01:00
Paulo Gomes 30674300a3
tar: Optimise memory usage
The previous untar logic would take into memory each tar file entry,
causing large files to increase the likelihood of concurrent
reconciliations to cause OOM.

This change forces the untar process to use a buffer when processing
tar file entries, causing the memory profile per operation to be
reduced. On benchmarks below, the memory consumption per operation
was reduced from 10mb to 0.24mb:

Benchmark_Untar-16        6  188662186 ns/op  10962682 B/op  19836 allocs/op
Benchmark_Untar_Limit-16  8  131385484 ns/op   1964667 B/op  19274 allocs/op

The biggest file within the tar file was 95mb in size.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-10-14 08:44:53 +01:00
Stefan Prodan 4078e4f12a
Merge pull request #367 from fluxcd/oci-autologin-flag-log
oci/auth: Remove log message about autologin flag
2022-10-11 15:34:21 +03:00
Sunny ba6c11fdd8 oci/auth: Remove log message about autologin flag
OCI autologin/contextual login in source-controller has per object cloud
provider option in the spec. image-reflector v1beta2 API (upcoming) also
configures it per object in the spec. The autologin flag log can be
removed now.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-10-11 17:36:25 +05:30
Stefan Prodan d29f3fb578
Merge pull request #329 from fluxcd/reconcile-result
runtime: Add reconcile result finalizer
2022-10-11 15:02:27 +03:00
Sunny 17cb83d295 runtime/reconcile: Add SuccessType for reconcilers
SuccessType defines the reconciliation result success types.
It is used to distinguish between Stalled and success for reconcilers
that don't requeue on success.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-10-10 23:36:12 +05:30
Sunny 86a91b82d6 Add runtime/reconcile package
runtime/reconcile package provides helpers for controller
reconciliation.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-10-10 23:36:08 +05:30
Sunny f11f646fb1 Add runtime/object pkg for runtime.Object helpers
runtime/object package provides helpers for querying and mutating the
attributes of a runtime.Object without knowing their static types
using unstructured objects.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-10-10 23:19:27 +05:30
Sunny d7f0b99239 runtime: Update Fake CRD with interval & rec req
Add spec.interval and status.lastHandledReconcileAt in the Fake CRD for
testing object helper that return interval and last reconcile at values.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-10-10 23:19:27 +05:30
Stefan Prodan 7d22930e32
Merge pull request #374 from fluxcd/conditions-check
runtime/conditions/check: Add kstatus check pkg
2022-10-10 17:48:55 +03:00
Sunny 0d79864da5 runtime/conditions/check: Add kstatus check pkg
runtime/conditions/check helps check status conditions compatibility
with kstatus.
Copied from https://github.com/darkowlzz/controller-check.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-10-10 19:41:00 +05:30
Stefan Prodan d56b66ca92
Merge pull request #375 from fluxcd/http-fetch
Add package for fetching archives over HTTP
2022-10-10 15:14:03 +03:00
Stefan Prodan 808032ef3c
Add ArtifactFromDir to the test server
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-10-10 14:45:14 +03:00
Stefan Prodan d147ae21c1
Add package for fetching archives over HTTP
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-10-10 14:23:53 +03:00
Stefan Prodan 60dfe8426f
Merge pull request #373 from developer-guy/feature/3176
feat: accept files in oci build
2022-10-10 12:23:51 +03:00
Batuhan Apaydın 943902cfa4
feat: accept files in oci build
Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
2022-10-09 12:42:11 +03:00
Stefan Prodan a7d54fb412
Merge pull request #372 from fluxcd/runtime-meta-up
Bump apis/meta in runtime
2022-10-07 17:07:44 +03:00
Stefan Prodan 316aaa9c47
Bump apis/meta in runtime
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-10-07 16:24:06 +03:00
Stefan Prodan ccc3bab767
Merge pull request #370 from fluxcd/runtime-impersonator
Add Kubernetes account impersonation helpers
2022-10-07 16:22:07 +03:00
Stefan Prodan feb2b96e4e
Add Kubernetes account impersonation helpers
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-10-07 15:53:48 +03:00
Paulo Gomes 9bff531d46
Merge pull request #369 from aryan9600/ssh-trace
git/libgit2: log context closed message as info instead of err
2022-10-07 09:17:49 +01:00
Sanskar Jaiswal 03761c8411 git/libgit2: log discarded errors at trace info level
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-10-07 10:47:09 +05:30
Sunny 640a3abb1f
Merge pull request #362 from bnsfrt/fix-ecr-oci-registry
Add regex to support ECR as OCI Helm registry
2022-09-29 19:42:00 +05:30
Ben f7c66eb06a Refactors aws.ParseImage to ParseRegistry
This change replaces ParseImage with ParseRegistry to allow URLs that
point to the root of an AWS account's ECR registry, instead of
forcing all repositories to contain a "/" character.
This enables support for using ECR repositories at root level to be used
as OCI Helm Repository.

Signed-off-by: Ben <benjamin.seifert@niche.com>
2022-09-29 19:14:23 +05:30
Sunny be0e81edba
Merge pull request #365 from fluxcd/disable-cosign-verification
disable cosign verification in CI
2022-09-29 19:13:54 +05:30
Sunny b99f2ef9b0 bump libgit2 image to v0.3.0
Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-09-29 18:46:33 +05:30
Sunny 215e8cfbaf disable cosign verification of libgit2-only in CI
Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-09-29 18:46:09 +05:30
Paulo Gomes 62bda1ad42
Merge pull request #364 from pjbgf/replace-git2go
build: Replace git2go with fluxcd fork
2022-09-27 17:04:28 +01:00
Paulo Gomes 1d5a7b25a5
build: Replace git2go with fluxcd fork
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-09-27 16:14:44 +01:00
Stefan Prodan 82919e6986
Merge pull request #359 from aryan9600/git-tests
Add e2e tests for GitLab
2022-09-26 20:45:08 +03:00
Sanskar Jaiswal 235c736aa6 ci: add gitlab to git e2e tests
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-09-26 20:31:37 +05:30
Sanskar Jaiswal c0940d655e git/e2e: add e2e tests for gitlab.com
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-09-26 20:31:37 +05:30
Stefan Prodan daa2fc29a8
Merge pull request #361 from fluxcd/go-1.19
Update Go and internal packages
2022-09-26 17:48:17 +03:00
Stefan Prodan 352f3a2fd4
Update Go and internal packages
- update CI to use Go 1.19
- bump internal packages

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-09-26 16:55:27 +03:00
Stefan Prodan 262bb5c488
Merge pull request #360 from fluxcd/controller-runtime-v0.13.0
Update dependencies
2022-09-26 16:07:10 +03:00
Stefan Prodan b75bed4cfd
Update dependencies
- k8s.io/* v0.25.2
- helm v3.10.0
- controller-runtime v0.13.0
- cli-utils v0.33.0

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-09-26 15:40:25 +03:00
Stefan Prodan 1c0a874da2
Merge pull request #358 from aryan9600/git-tests
ci: add e2e workflow to path filtering and workflow_dispatch trigger
2022-09-21 17:53:33 +03:00
Sanskar Jaiswal 01cdfb9385 ci: add e2e workflow to path filtering and workflow_dispatch trigger
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-09-21 19:58:41 +05:30
Stefan Prodan 8734c5d876
Merge pull request #357 from aryan9600/git-tests
ci: fix e2e conditonal logic
2022-09-21 15:06:35 +03:00
Sanskar Jaiswal cad3cc3d48 ci: fix e2e conditonal logic
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-09-21 17:11:52 +05:30
Stefan Prodan 7cc271c2dc
Merge pull request #354 from aryan9600/git-tests
Add e2e tests for GitHub
2022-09-21 13:56:52 +03:00
Sanskar Jaiswal 39041875e8 ci: refactor e2e tests into matrix
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-09-19 20:35:08 +05:30
Sanskar Jaiswal 2e365e6dde ci: add github support to git e2e tests
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-09-16 18:03:11 +05:30
Sanskar Jaiswal f014c9a2e5 git/e2e: add e2e tests for github.com
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-09-16 18:03:11 +05:30
Stefan Prodan 26163f61dc
Merge pull request #355 from aryan9600/cosign-experimental
fix libgit2 build by enabling COSIGN_EXPERIMENTAL
2022-09-16 15:32:40 +03:00
Sanskar Jaiswal 6edc9af130 fix libgit2 build by enabling COSIGN_EXPERIMENTAL
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-09-16 17:08:57 +05:30
Stefan Prodan dbad05cf95
Merge pull request #352 from ManoManoTech/oci-local-opts
Add login capabilities to the OCI client
2022-09-09 16:30:03 +03:00
Adrien Fillon cd0522db8a
Add LoginWithProvider method to OCI client
Signed-off-by: Adrien Fillon <adrien.fillon@manomano.com>
2022-09-09 14:27:36 +02:00
Adrien Fillon b2dc7ac691
Add login capabilities to the OCI client
This can be re-used by flux to auto-login during
artifacts operations as showcased in https://github.com/fluxcd/flux2/pull/3079

Signed-off-by: Adrien Fillon <adrien.fillon@manomano.com>
2022-09-09 11:36:18 +02:00
Stefan Prodan 884d4b9354
Merge pull request #353 from pjbgf/fix-fuzz-replace
fuzz: Fix build
2022-09-09 08:42:07 +03:00
Paulo Gomes 2ed866ce82
fuzz: Fix build
An helper func calling t.Errorf is being replaced by
upstream with testingtypes.Errorf, which breaks the
build. For the time being the helper func is being
deleted.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-09-08 18:19:18 +01:00
Paulo Gomes e786e92727
Merge pull request #351 from aryan9600/improve-libgit2
git/libgit2: use uuid for transport options usage
2022-09-08 15:57:55 +01:00
Sanskar Jaiswal 538bbcd1fc git/libgit2: use uuid for transport options usage
Use UUID for transport options URL, decreasing the chance of a clash and
hence use of the wrong transport options for a Git operation.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-09-08 18:42:25 +05:30
Paulo Gomes 008618904d
Merge pull request #349 from pjbgf/go-fuzz
fuzz: Refactor Fuzzers based on Go native fuzzing
2022-09-06 08:49:03 +01:00
Paulo Gomes 8b7bf6ed2c
fuzz: Refactor Fuzzers based on Go native fuzzing
Due to the structure of fluxcd/pkg, its oss_fuzz_build.sh file deviates
slightly from the same file in other repositories. It goes through all
the Go packages and ensure they have the required fuzz dependencies,
needed for oss-fuzz.

The generated fuzzers will be prefixed with fuzz_ plus the Go module
name, for improved discoverability within oss-fuzz.

This project does not contain a make target for Go native fuzzing,
as not all tests play nicely with that ecosystem. Once Fuzz_Eventf is
refactored this can be reviewed.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-09-06 07:34:13 +01:00
Stefan Prodan ba1e2451e7
Merge pull request #348 from pjbgf/fuzz-update
fuzz: Fuzz optimisations
2022-09-03 09:10:28 +03:00
Paulo Gomes 8ea8c95fa8
fuzz: Fix cache path
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-09-03 03:56:36 +01:00
Paulo Gomes 6ea20246cd
fuzz: Reuse go cache from host
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-09-02 17:49:51 +01:00
Paulo Gomes 83fe9febe2
fuzz: Ensure latest base images are used
Latest base image should contain Go 1.18, removing
the need of updating that ourselves, apart from
benefiting from latest changes upstream.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-09-02 17:49:50 +01:00
Stefan Prodan 009acdfea9
Merge pull request #347 from fluxcd/ssa-class-types
ssa: Apply Kubernetes class types first
2022-09-02 15:54:41 +03:00
Stefan Prodan 80afb6ab3d
Apply Kubernetes class types first
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-09-02 15:36:48 +03:00
Paulo Gomes 4d204a4a6f
Merge pull request #346 from aryan9600/bump-git-v0.6.1
bump deps in git sub packages
2022-09-02 11:18:57 +01:00
Sanskar Jaiswal ba13863d87 bump deps in git sub packages
1. Bump pkg/git to v0.6.1 in pkg/git/gogit, pkg/git/libgit2 &
pkg/git/internal/e2e
2. Bump pkg/gittestserver to v0.7.0 in pkg/git/gogit, pkg/git/libgit2
& pkg/git/internal/e2e

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-09-02 15:02:08 +05:30
Paulo Gomes 74e7fc4108
Merge pull request #345 from aryan9600/cleanup-git
git: tidy the `RepositoryWriter` interface
2022-09-02 08:57:08 +01:00
Sanskar Jaiswal 2ab7f6b69f git: integrate `WriteFile()` into `Commit()` and add `CommitOptions`
Introduce `CommitOptions` which encapsulates commit configurations such
as an OpenPGP signer and a map of files to be included as a part of the
commit. Introduce `CommitOpton` as a setter for `CommitOptions`.

Remove `WriteFile()` from `RepositoryWriter`. Modify `Commit()` to
accept `CommitOption` as a variadic parameter and integrate the
functionality of `WriteFile()` into `Commit()`.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-09-02 13:08:58 +05:30
Sanskar Jaiswal d06c4652d3 git: introduce `CloneOptions` replacing `CheckoutOptions` with a better API
`CheckoutOptions` is renamed aptly to `CloneOptions` since it configures
cloning behvaior.
A new API `CheckoutStrategy` is introduced and embedded into `CloneOptions`
to better differentiate between options related to cloning and checking
out.
`LastRevision` is renamed to `LastObservedCommit` to make its intended value is
more obvious, and its usage is made clearer with the help of additional docs.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-09-02 13:08:54 +05:30
Paulo Gomes 10b923813d
Merge pull request #343 from aryan9600/billy-util
git/libgit2: use go-billy/util.Walk to traverse files when committing
2022-08-31 22:20:32 +01:00
Sanskar Jaiswal 6e7d61e2ab git/libgit2: use go-billy/util.Walk to traverse files when committing
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-09-01 00:19:46 +05:30
Paulo Gomes 5c03f12747
Merge pull request #344 from aryan9600/go-cache
ci: use inbuilt cache feature of setup-go
2022-08-31 14:49:36 +01:00
Sanskar Jaiswal e4445060c5 ci: use inbuilt cache feature of setup-go
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-31 18:24:35 +05:30
Paulo Gomes faf9a964d3
Merge pull request #342 from aryan9600/modify-options
git: fallback to 'git' for username only for ssh
2022-08-31 12:32:00 +01:00
Sanskar Jaiswal 538b829ee2 git: fallback to 'git' for username only for ssh
Fallback to 'git' for username only when cloning Git repos through SSH,
since using 'git' as the username when cloning Git repos through HTTP(S)
might lead to 401s.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-31 16:21:51 +05:30
Paulo Gomes 077770cc27
Merge pull request #221 from pjbgf/untar
Add tar.WithMaxUntarSize
2022-08-31 10:44:53 +01:00
Paulo Gomes d569f31f01
tar: Point untar fuzz tests to new tar pkg
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-08-31 08:42:54 +01:00
Paulo Gomes 65612a962a
tar: Add new tar package
- Add new tar package to make Untar more extensible/testable.
- Set default maxUntarSize to 100Mb.
- Tests core scenarios around tar.Untar usage.
- Set current working dir default base for relative paths.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-08-31 08:42:53 +01:00
Stefan Prodan c5e54ac8ef
Merge pull request #341 from somtochiama/update-runtime
Update controller-runtime to 1.12.3
2022-08-31 09:44:21 +03:00
Somtochi Onyekwere d213b758e0 Update controller-runtime to 1.12.3
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-31 03:50:47 +01:00
Stefan Prodan 5b0ad92e9b
Merge pull request #339 from dholbach/update-flux-docs-structure
update to new doc links structure
2022-08-30 17:00:48 +03:00
Daniel Holbach f6a05a68ee update to new doc links structure
Signed-off-by: Daniel Holbach <daniel@weave.works>
2022-08-30 15:07:06 +02:00
Paulo Gomes 571b7a3fdb
Merge pull request #338 from aryan9600/bump-git-v0.6.0
Bump `pkg/git` to v0.6.0
2022-08-30 13:49:57 +01:00
Sanskar Jaiswal 144b783484 git/internal/e2e: bump pkg/git to v0.6.0
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-30 17:14:44 +05:30
Sanskar Jaiswal a6e6da81a9 git/libgit2: bump pkg/git to v0.6.0
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-30 16:56:03 +05:30
Sanskar Jaiswal 076b26ffa2 git/gogit: bump pkg/git to v0.6.0
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-30 16:55:53 +05:30
Paulo Gomes 38b2cb21a1
Merge pull request #336 from pjbgf/fix-fuzz
fuzz: Ensure Go 1.18 for fuzz image
2022-08-26 08:03:01 +01:00
Paulo Gomes f14d8cb4d4
fuzz: Ensure Go 1.18 for fuzz image
- Upgrade fuzz container to Go 1.18.
- Upgrade worker to Go 1.18.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-08-25 21:46:29 +01:00
Stefan Prodan 92b068824e
Merge pull request #326 from aryan9600/remove-runtime
git/libgit2: remove dep to pkg/runtime
2022-08-25 17:54:35 +03:00
Sanskar Jaiswal dfed4fbd86 git/libgit2: remove dep to pkg/runtime
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-25 19:56:55 +05:30
Stefan Prodan d65cef8fa8
Merge pull request #327 from fluxcd/internal-deps-up
Update internal dependencies
2022-08-25 17:19:54 +03:00
Stefan Prodan 13f4fb1e0d
Update internal dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-08-25 16:56:58 +03:00
Stefan Prodan 353ad509c7
Merge pull request #325 from fluxcd/go-1.18-mod
Update Go to v1.18 in go.mod
2022-08-25 16:18:24 +03:00
Stefan Prodan cddc690248
Update Go to v1.18 in go.mod
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-08-25 15:45:19 +03:00
Stefan Prodan 6c44a11afa
Merge pull request #324 from fluxcd/kube-0.25.0
Update Kubernetes packages to v1.25.0
2022-08-25 15:41:46 +03:00
Stefan Prodan c0a1eba228
Update Kubernetes packages to v1.25.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-08-25 15:15:08 +03:00
Stefan Prodan 107f0afa63
Merge pull request #318 from aryan9600/split-git
pkg/git: split into pkg/git/gogit and pkg/git/libgit2
2022-08-25 13:20:53 +03:00
Sanskar Jaiswal 8a3d5fc192 pkg/git: split into pkg/git/gogit and pkg/git/libgit2
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-24 23:04:30 +05:30
Stefan Prodan 58fb44c9f3
Merge pull request #321 from somtochiama/delete-oci
[pkg/oci]: Add Delete function
2022-08-24 20:18:38 +03:00
Somtochi Onyekwere 0285f5df7b add delete function to oci
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-24 17:36:18 +01:00
Stefan Prodan a5d0b859cb
Merge pull request #322 from somtochiama/cleanup-dir
[pkg/oci] Remove test symlink dir
2022-08-24 19:17:13 +03:00
Somtochi Onyekwere 2b3ef622e0 remove symlink dir
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-24 16:45:36 +01:00
Sunny 8d88cfe707
Merge pull request #300 from aryan9600/git-libgit2
git: Add a new `RepositoryClient` using libgit2
2022-08-18 01:56:05 +05:30
Sanskar Jaiswal b6f8510ffa clean path while initializing gogit and libgit2 clients
Use filepath-securejoin to ensure relative paths are safe to use.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-17 19:50:01 +00:00
Sanskar Jaiswal 067b92d01b fix potential race condition in libgit2 ssh transport
Ensure that `sshSmartSubtransport.Close()` is called only when it hasn't
been called already internally by libgit2, using `closedSessions`.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-17 19:50:01 +00:00
Sanskar Jaiswal fe9bc0f0da use go-billy for repo filesystem in libigt2
Modify libgit2 implementation to use go-billy for repo filesystem to
ensure consistency across git implementations.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-17 19:50:01 +00:00
Sanskar Jaiswal cf3bdd7216 run e2e tests and modify Makefiles
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-17 19:50:01 +00:00
Sanskar Jaiswal 152883af3b add full support for RepositoryClient for libgit2
Implement all methods of RepositoryClient for libgit2 and add related
tests

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-17 19:50:01 +00:00
Sanskar Jaiswal 606a00c4f8 add tests to verify support for various ssh settings
Add tests for libgit2 to verify support for various ssh settings like
key exchange algos, host key algos, etc.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-17 19:50:01 +00:00
Sanskar Jaiswal 2a30cb1765 add support for cloning using libgit2
Add support for cloning Git repositories using libgit2 via various
options like branch, tag, etc. Add tests for the same.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-17 19:50:01 +00:00
Sanskar Jaiswal b6076f7088 add tests for libgit2 transports and callbacks
Add tests for managed transport and callbacks for libgit2, by using a
sub Makefile in order to reduce the impact of downloading pre-requisites
like musl, golang-with-libgit2, etc on other packages part of this
monorepo and updating the Makefile to use the sub Makefile
intelligently.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-17 19:50:01 +00:00
Sanskar Jaiswal e85db051a7 git: add new package for libgit2
Add a new package libgit2 to be used as a git implementation. Provide
custom smart transports avoiding the need for underlying transports
provided by libgit2/git2go, along with a way to register transport level
operations in order to bypass the inbuilt callback mechanism.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-08-17 19:50:01 +00:00
Stefan Prodan b3a659df47
Merge pull request #317 from somtochiama/sourceignore
[pkg/oci] Export fields in ListOptions
2022-08-17 18:37:19 +03:00
Somtochi Onyekwere ede70c3581 Export fields in ListOptions
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-17 16:12:36 +01:00
Stefan Prodan 63d691cb1f
Merge pull request #316 from somtochiama/sourceignore
[pkg/oci]: Add options to filter tags by semver and regex
2022-08-17 18:01:35 +03:00
Somtochi Onyekwere 5c5f691c1b Add options to filter tags by semver and regex
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-17 14:48:33 +01:00
Stefan Prodan 17398b55c1
Merge pull request #314 from somtochiama/sourceignore
Check for `.` path before using domain
2022-08-17 13:28:14 +03:00
Somtochi Onyekwere fb3355b1d3 check for . path
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-17 11:09:49 +01:00
Stefan Prodan 4d3acc8b60
Merge pull request #313 from fluxcd/oci-ignore
Update sourceignore version for OCI
2022-08-16 14:45:44 +03:00
Stefan Prodan 82fe1eddd3
Update sourceignore version for OCI
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-08-16 14:20:36 +03:00
Stefan Prodan 4cc38cba24
Merge pull request #312 from somtochiama/sourceignore
Add `sourceignore` pkg to `pkg/oci`
2022-08-16 13:53:01 +03:00
Somtochi Onyekwere e36c9174da increase timeout for failing patch
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-15 16:41:54 +01:00
Somtochi Onyekwere 9de29920a3 run tidy
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-15 15:41:56 +01:00
Somtochi Onyekwere 4e42496cf0 Move sourceignore its own dir
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-15 14:17:33 +01:00
Somtochi Onyekwere d26e2ae84e remove log
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-15 13:50:54 +01:00
Somtochi Onyekwere 71cbd21037 Move sourceignore package and add ignore functionality to oci build/push
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-15 13:41:59 +01:00
Paulo Gomes d6fc959f43
Merge pull request #310 from pjbgf/fix-action
oci: Fix GitHub Action - nested symbolic links
2022-08-08 11:48:47 +01:00
Paulo Gomes bb353d419c
oci: Fix GitHub Action - nested symbolic links
The nested symlinks have to be created on demand to
bypass a limitation on GitHub actions, which errors
with:
Too many levels of symbolic links.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-08-08 11:29:58 +01:00
Paulo Gomes 7f5a5df295
Merge pull request #309 from pjbgf/fix-action
oci: Fix broken action
2022-08-08 10:43:49 +01:00
Paulo Gomes c2597a0ad9
oci: Fix broken action
The broken symlinks used for tests broke the use of
fluxcd/pkg as a GitHub action, as pointed out in:
https://github.com/fluxcd/flux2/pull/2964\#discussion_r939991220

This creates and removes such symlinks on demand
to ensure the tests are still catered for, without
impacting the GitHub actions.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-08-08 10:18:57 +01:00
Stefan Prodan 5b162412f4
Merge pull request #307 from fluxcd/oci-meta-created
Add `org.opencontainers.image.created` to OCI meta
2022-08-08 12:13:27 +03:00
Stefan Prodan 770524e589
Add "org.opencontainers.image.created" to OCI meta
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-08-08 11:41:31 +03:00
Stefan Prodan ec406cf693
Update controller-gen to v0.9.2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-08-08 11:37:11 +03:00
Stefan Prodan 785f99a4d3
Merge pull request #308 from fluxcd/oci-build-fs-rename
oci/client: Add internal/fs package for os.Rename
2022-08-06 13:17:01 +03:00
Sunny ceef6bf347
oci/client: Remove taskkill git from test code
This test code seems to have been copied from the helm project. In this
specific context of oci, we don't do anything related to git. Hence it
can be removed.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-08-05 20:25:20 +05:30
Sunny b6b53ee9d1
oci/client: Add internal/fs package for os.Rename
os.Rename() fails with LinkError when the source and destination are in
different directories.
internal/fs is copied from source-controller internal/fs. It has an
implementation of Rename with fallback to handle this failure.

This also fixes the build tests failure on some platforms.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-08-05 19:49:20 +05:30
Sunny 680663a877
Merge pull request #306 from fluxcd/oci-go-1.18-azsdk-v1
oci: Use go 1.18 and azure sdk v1
2022-08-03 01:19:33 +05:30
Sunny f523e13ed1
actions/envtest & build workflow: Use go 1.18
Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-08-02 21:25:33 +05:30
Sunny d248216a86
oci: Use go 1.18 and azure sdk v1
Update oci package to use go 1.18, and azcore and azidentity to v1.1.0.
Updated the integration tests accordingly.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-08-02 21:00:52 +05:30
Stefan Prodan 18036e5a8a
Merge pull request #305 from fluxcd/oci-client
Add OCI client
2022-08-02 14:01:12 +03:00
Stefan Prodan 00d031e6a0
Add OCI client struct
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-08-02 11:31:49 +03:00
Stefan Prodan 5184dcd86d
Add OCI client
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-08-02 10:25:26 +03:00
Sunny 76ec44d97d
Merge pull request #304 from fluxcd/oci-deps-downgrade
oci: downgrade dependencies
2022-08-01 19:41:29 +05:30
Sunny 4da085abee
oci: downgrade dependencies
Downgrade the controller-runtime and associated dependencies to use
the same as in the other flux projects.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-08-01 19:03:39 +05:30
Sunny a9f522466f
Merge pull request #301 from fluxcd/registry-pkg
Add oci package
2022-08-01 17:35:34 +05:30
Sunny 353b4e4c2e
oci: Add integration tests
Adds OCI integration tests against various cloud providers. These tests
are not run in CI yet. They will be modified to run in CI in the future.
For now, they can be easily run in development machine with appropriate
cloud provider account configurations.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-08-01 16:39:47 +05:30
Sunny abe5a54e79
Re-org: rename registry to oci package
Rename registry to oci package and move the login related code in auth
subpackage.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-08-01 16:39:43 +05:30
Sunny 685286f4bf
Add registry package
registry package contains helpers to log into various cloud registry
providers using native login mechanisms.

It is copied as it is from image-reflector-controller.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-08-01 16:36:29 +05:30
Stefan Prodan 1a52b793ec
Merge pull request #303 from fluxcd/kustomize/v4.5.6
Update kustomize to v4.5.6
2022-08-01 12:56:47 +03:00
Stefan Prodan d18fb89746
Update kustomize to v4.5.6
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-08-01 12:42:36 +03:00
Paulo Gomes 9437d14135
Merge pull request #284 from aryan9600/gittestserver-windows
Use HTTP server to initialize repos on Windows
2022-07-29 11:56:23 +01:00
Sanskar Jaiswal 2382438d93 use filepath-securejoin to initialize repos
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-07-29 15:20:31 +05:30
Sanskar Jaiswal 679274ab33 use HTTP server to init repos on Windows
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-07-29 15:06:59 +05:30
Paulo Gomes 0789a0377a
Merge pull request #298 from aryan9600/git-e2e
git: add E2E tests for GitLab and a separate CI workflow for E2E tests
2022-07-26 11:07:39 +01:00
Sanskar Jaiswal 9823541b4b ci: add workflow for e2e tests
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-07-26 15:07:48 +05:30
Sanskar Jaiswal ef39d3150f git: add gitlab e2e tests
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-07-26 15:07:48 +05:30
Sanskar Jaiswal 9a05222806 git: refactor e2e test and add utils
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-07-26 15:07:48 +05:30
Paulo Gomes c5caba1dd5
Merge pull request #299 from pjbgf/readonly
gittestserver: Add ReadOnly mode
2022-07-25 18:21:46 +01:00
Paulo Gomes d77cce3ac7
gittestserver: Add ReadOnly mode
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-07-22 14:10:37 +01:00
Paulo Gomes ab802f21fd
Merge pull request #291 from aryan9600/pkg-git
Consolidate scattered Git packages into `pkg/git`
2022-07-18 13:14:04 +01:00
Sanskar Jaiswal fb15ebb012 refactor file and api names to be more apt
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-07-18 16:53:10 +05:30
Sanskar Jaiswal 08f667422d allow client to be configured with storer and worktree fs
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-07-18 16:53:10 +05:30
Sanskar Jaiswal 7ed50c74e7 update GitClient to be a diamond interface
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-07-18 16:53:10 +05:30
Sanskar Jaiswal 1f88376245 add e2e tests for gitkit
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-07-18 16:53:10 +05:30
Sanskar Jaiswal 73f807539a refactor auth options and fix comments; tests
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-07-18 16:53:10 +05:30
Sanskar Jaiswal 21846e203c git: add tests for gogit
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-07-18 16:53:10 +05:30
Sanskar Jaiswal 449c3ca4b0 git: add support for gogit
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-07-18 16:53:10 +05:30
Sanskar Jaiswal 1e8d9ba559 add new package: git
Adds a new package named `git`, which defines a common API for all git
clients, along with various utilities and helper methods.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-07-18 16:53:10 +05:30
Hidde Beydals 5326197d14
Merge pull request #297 from somtochiama/mac-tests
kustomize: Fix failing tests on MacOS
2022-07-14 12:14:26 +02:00
Somtochi Onyekwere fe2d6226b8 Resolve symlink for tmp dir
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-07-06 11:09:49 +01:00
Paulo Gomes 7dbfa9c50b
Merge pull request #295 from pjbgf/update-deps
Update `gopkg.in/yaml.v3` to version 3.0.1
2022-07-01 12:19:04 +01:00
Paulo Gomes 8b9b2ac68e
Update dependencies
- gopkg.in/yaml.v3 to version 3.0.1.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-07-01 12:03:19 +01:00
Stefan Prodan 76f30cf3b1
Merge pull request #292 from aryan9600/http-transport
add new pkg `transport` for http transports
2022-06-21 12:57:17 +03:00
Sanskar Jaiswal 6b991a1d0e add new pkg `transport` for http transports
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-06-21 14:57:22 +05:30
Hidde Beydals 7cac70af3e
Merge pull request #290 from SomtochiAma/utils-masktoken 2022-06-14 18:46:51 +02:00
Somtochi Onyekwere 9832df6ea8 Return error if regex doesn't compile
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-06-14 17:01:56 +01:00
Paulo Gomes 2ea0c4ff31
Merge pull request #289 from SomtochiAma/utils-masktoken
Add pkg for masking token
2022-06-14 13:49:22 +01:00
Somtochi Onyekwere f4a7c12a22 Add license header
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-06-14 12:57:50 +01:00
Somtochi Onyekwere 9c5c7d42ab correct expected string in test
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-06-14 10:39:56 +01:00
Somtochi Onyekwere d2c27f869b Add function to mask a token from string
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-06-14 10:39:56 +01:00
Stefan Prodan 3357f39663
Merge pull request #288 from fluxcd/bump-apis
Update runtime to latest apis
2022-06-08 11:46:07 +03:00
Stefan Prodan 1aacb6f1a5
Update runtime to latest apis
Bump apis/meta and apis/kustomize

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-06-08 11:17:37 +03:00
Paulo Gomes 1230ea2dd5
Merge pull request #287 from fluxcd/CVE-2022-31030
Update dependencies
2022-06-08 09:04:24 +01:00
Stefan Prodan f92c07bd41
Update dependencies
- containerd v1.6.6 (fix CVE-2022-31030)
- k8s.io/* 0.24.1
- cli-utils v0.31.2
- kustomize v4.5.5

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-06-08 10:37:08 +03:00
Stefan Prodan 0d8cee8038
Merge pull request #286 from aryan9600/ssh-debug
Update `KnownKey.Matches` to initialize it's own hasher
2022-06-08 10:26:55 +03:00
Sanskar Jaiswal 64591ea5f2 update KnownKey.Matches to initialize it's own hasher
Previously, KnownKey.Matches() accepted a SHA256 hasher as an argument,
which could lead to unintended bugs when calling it in a loop. This
eliminates that, by initializing a new hasher itself instead of relying
on the caller for the same.
Enables us to fix a regression in the source-controller: https://github.com/fluxcd/image-automation-controller/issues/378

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-06-08 12:02:48 +05:30
Stefan Prodan 2149190ef7
Merge pull request #285 from pjbgf/set-ssh-defaults
ssh: Enforce ClientConfig default values
2022-05-27 14:21:12 +03:00
Paulo Gomes 0899ddb18e
ssh: Enforce ClientConfig default values
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-05-27 12:02:40 +01:00
Paulo Gomes 1947c753e8
Merge pull request #283 from pjbgf/update-meta
Update internal dependencies
2022-05-26 13:22:55 +01:00
Paulo Gomes 27fa84373d
Update internal dependencies
Bump apis in runtime and kustomize packages.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-05-26 13:10:20 +01:00
Paulo Gomes 3d631dfcb2
Merge pull request #282 from aryan9600/known-key
Add tests for `ParseKnownHosts` and `KnownKey.Matches`
2022-05-26 13:10:02 +01:00
Sanskar Jaiswal d65cdf0342 add tests for ParseKnownHosts and KnownKey.Matches
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-05-26 17:23:03 +05:30
Stefan Prodan 9b9adf5b51
Merge pull request #281 from fluxcd/ossf-scorecards
Add OSSF Scorecards action
2022-05-26 13:56:39 +03:00
Stefan Prodan 7345a9780c
Add permissions to GH actions
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-05-26 13:36:12 +03:00
Stefan Prodan 3ff82650ff
Add OSSF Scorecards action
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-05-26 13:21:50 +03:00
Stefan Prodan 9fcd73b7f7
Merge pull request #280 from fluxcd/CVE-2022-28948
kustomize: Update go-yaml to v3.0.0
2022-05-26 13:13:02 +03:00
Stefan Prodan 9680cef48c
kustomize: Update go-yaml to v3.0.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-05-26 12:43:54 +03:00
Stefan Prodan 5a95439cb0
Merge pull request #279 from fluxcd/go-yaml-v3.0.0
Update go-yaml to v3.0.0
2022-05-26 12:40:18 +03:00
Stefan Prodan b8501db9a9
Update go-yaml to v3.0.0
Fix CVE-2022-28948

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-05-26 12:22:21 +03:00
Stefan Prodan 97da96c3c4
Merge pull request #278 from fluxcd/helm-v3.9.0
Update helm to v3.9.0
2022-05-25 10:38:07 +03:00
Stefan Prodan 34d688b2e7
Update helm to v3.9.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-05-25 10:14:05 +03:00
Paulo Gomes eaf00b7b04
Merge pull request #277 from aryan9600/known-key
Add helpers to parse knownhosts and match against them
2022-05-24 14:48:22 +01:00
Sanskar Jaiswal 40719a352c Add helpers to parse knownhosts and match against them
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-05-24 18:41:24 +05:30
Paulo Gomes b09460e9dd
Merge pull request #274 from pjbgf/ssh-hash-known-hosts
ssh: add support for hashing hostnames in known_hosts
2022-05-16 16:02:49 +01:00
Paulo Gomes 8d72f0992d
ssh: add support for hashing hostnames in known_hosts
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-05-13 17:09:38 +01:00
Stefan Prodan 412e8abfcd
Merge pull request #273 from fluxcd/sync-deps
Update internal dependencies
2022-05-11 17:42:13 +03:00
Stefan Prodan 9f0a4450d9
Update internal dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-05-11 17:20:16 +03:00
Stefan Prodan 8c47448d92
Merge pull request #272 from fluxcd/kube-1.24
Update dependencies
2022-05-11 17:10:03 +03:00
Stefan Prodan 0c4b609ff0
Update Go to v1.18 in CI
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-05-11 16:51:06 +03:00
Stefan Prodan 549f3cf213
Update Kubernetes packages to v1.24.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-05-11 16:49:04 +03:00
Stefan Prodan ed96ab713a
Merge pull request #270 from aryan9600/server-side-throttling
runtime: Use server-side throttling when available
2022-05-11 15:04:09 +03:00
Sanskar Jaiswal 5909ab579d remove fatal log and continue upon error
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-05-11 16:42:32 +05:30
Sanskar Jaiswal 3ab4e3346c use server side throttling if enabled
Checks if the PriorityAndFairness flow control filter is enabled to
disable client side throttling, leveraging server side throttling
instead, since client-go respects the `Retry-After` response header set
by the APF filter

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-05-11 16:42:32 +05:30
Paulo Gomes 6ccf9140d3
Merge pull request #271 from pjbgf/features
runtime: Add Feature Gates
2022-05-11 12:02:56 +01:00
Paulo Gomes 27d1faba10
runtime: Add Features Gates
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-05-11 10:00:53 +01:00
Paulo Gomes d891f47a41
Merge pull request #268 from pjbgf/kex-amends
ssh: Update PreferredKexAlgos based on golang.org/x/crypto/ssh
2022-05-06 15:21:50 +01:00
Paulo Gomes e67355f34a
ssh: update dependencies
- golang.org/x/crypto to v0.0.0-20220427172511-eb4f295cb31f

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-05-06 10:53:41 +01:00
Paulo Gomes 9dafb00972
ssh: update PreferredKexAlgos based on golang.org/x/crypto/ssh
Aligns preferred algorithms with upstream golang.org/x/crypto/ssh,
resulting in adding support to two new kex algorithms on PreferredKexAlgos:
- curve25519-sha256
- diffie-hellman-group14-sha256

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-05-06 10:33:36 +01:00
Paulo Gomes 65678976fe
ssh: remove sha1 kex algorithms not in use
The previous implementation did not include these algorithms as
part of the preferred. Given that recommendations is for
both items not to be used due to security concerns, they
may as well be removed from here.

xref: https://tools.ietf.org/id/draft-ietf-curdle-ssh-kex-sha2-09.html
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-05-06 10:30:25 +01:00
Paulo Gomes 36fd9ba1ae
Merge pull request #266 from pjbgf/ssh-test
Add WithSSHConfig and PublicKeyLookupFunc
2022-05-06 09:01:13 +01:00
Paulo Gomes f61f0c7d7b
Add WithSSHConfig and PublicKeyLookupFunc
This replaces the original gitkit fork with github.com/fluxcd/gitkit.
Having the capability of setting ssh.ServerConfig amongst other things,
enables the use of unit tests to reproduce scenarios that otherwise can
only be experienced in E2E tests.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-05-05 18:32:01 +01:00
Paulo Gomes 4ecf27f4c0
Merge pull request #267 from pjbgf/ssh-host-n-key
ssh: Add GenerateKeyPair and support for setting HostKeyAlgos on ScanHostKey
2022-05-05 15:17:49 +01:00
Paulo Gomes 0f8f17ee05
ssh: Add support for setting HostKeyAlgos for ScanHostKey
This enables testing to guarantee we are dealing with the specific
HostKey algorithm we intent to, instead of potential defaults (i.e. RSA).

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-05-05 14:25:39 +01:00
Paulo Gomes 4f6f288de6
ssh: Add GenerateKeyPair
For unit tests that need to generate different
types of keypairs, having a type based generator
makes the code implementation much simpler and
avoid code duplication.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-05-05 11:57:51 +01:00
Stefan Prodan a0d5d51561
Merge pull request #265 from fluxcd/up-runtime-meta
Remove cyclic dependency to kustomize-controller API
2022-04-26 14:22:44 +03:00
Stefan Prodan afc5fa3702
Remove cyclic dependency to kustomize-controller API
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-04-26 13:46:52 +03:00
Stefan Prodan 178bb79c95
Bump apis/meta in runtime
- Update `github.com/fluxcd/pkg/apis/meta` to v0.13.0

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-04-26 13:31:22 +03:00
Hidde Beydals 42a63df53f
Merge pull request #264 from fluxcd/kus-fs-allow-prefix 2022-04-20 17:06:24 +02:00
Hidde Beydals a2505ae518 kustomize/filesys: config of allowed prefixes
This introduction is required for the build of Kustomizations which
refer to remote bases, as the internal load process creates new
temporary directories to fetch these into.

By ensuring the `root` of the FS does not start with an allowed prefix,
it is not possible for a FS to reach into another FS if the program
which creates them uses a static list.

This solution is not optimal, and is a signal we need to fork Kustomize
(and advocate upstream), to simply allow a more diverse configuration
of loader restrictions. Making this FS implementation obsolete.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-20 16:30:19 +02:00
Hidde Beydals 9f5245b095
Merge pull request #257 from nstogner/add-secret-key-reference 2022-04-15 22:56:13 +02:00
Nick Stogner df88b80c83 Add SecretKeyReference
Signed-off-by: Nick Stogner <nicholas.stogner@gmail.com>
2022-04-15 14:04:44 -04:00
Hidde Beydals c380964707
Merge pull request #262 from fluxcd/kustomize-filesys 2022-04-15 15:19:25 +02:00
Hidde Beydals 0ec014baf4 kustomize: introduce secure FS implementation
This implementation functions as a drop-in replacement for Kustomize's
own `fsOnDisk`, and asserts any path it handles to be inside root.

In essence, the whole file system is now restricted like
loader.RestrictionRootOnly would, but while allowing root to differ
from the top Kustomization directory.

The main reason to put the constraint in the file system implementation
is because the current Krusty API does not allow to configure a custom
load restrictor, but does allow injecting a custom FS.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-15 14:58:06 +02:00
Stefan Prodan 745f2246be
Merge pull request #261 from fluxcd/update-runtime-meta
Bump apis/meta in runtime
2022-04-14 13:55:59 +03:00
Stefan Prodan f9b5e700cf
Bump apis/meta in runtime
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-04-14 11:29:30 +03:00
Stefan Prodan c326dda635
Merge pull request #260 from fluxcd/helm-v3.8.2
Update Helm packages to v3.8.2
2022-04-14 10:48:04 +03:00
Stefan Prodan c40e67e0b7
Update Helm packages to v3.8.2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-04-14 10:30:09 +03:00
Hidde Beydals 828cfd1f37
Merge pull request #259 from fluxcd/k8s.io/api-v0.23.5 2022-04-13 17:40:19 +02:00
Stefan Prodan aba780f07d
Update kustomize to v4.5.4
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-04-13 16:39:22 +03:00
Stefan Prodan 82d0fdc2b7
Update Kubernetes packages
- k8s.io/* v0.23.5
- sigs.k8s.io/cli-utils v0.29.4
- sigs.k8s.io/controller-runtime v0.11.2

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-04-13 16:35:42 +03:00
Stefan Prodan 1cfbbfa677
Merge pull request #258 from pjbgf/add-retry-flags
runtime/controller: fix RateLimiterOptions.BindFlags
2022-04-13 15:26:58 +03:00
Paulo Gomes 16210f4b23
runtime/controller: fix RateLimiterOptions.BindFlags
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-04-13 11:51:11 +01:00
Stefan Prodan 4046043b79
Merge pull request #256 from pjbgf/add-retry-flags
runtime/controller: add flags to configure exponential back-off retry
2022-04-12 10:24:28 +03:00
Paulo Gomes ac05f3e625
runtime/controller: add flags to configure exponential back-off retry
Add two new flags to enable users to configure exponential
back-off for Flux objects. The default values are now
set to 750ms for minimum retry time, and 15min for max.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-04-11 16:36:21 +01:00
Stefan Prodan b9afff4d0b
Merge pull request #255 from souleb/fix-grouprversion-group
[Kustomize] Retrieve the right key to validate if substitution is disabled
2022-04-01 11:22:58 +03:00
Soule BA 0e9f256708
Make sure we retrieve the right key for substitution validation
Using kustomizev1.GroupVersion.Group this will get the key to validate
if any label or annotation have been set to disable substitution.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2022-04-01 10:09:56 +02:00
Hidde Beydals 357066be0e
Merge pull request #254 from fluxcd/fix-lexicographicless 2022-03-29 22:15:09 +02:00
Sunny bb1f335fba
runtime/conditions: Fix lexicographicLess() comp
When the observed generations don't match, don't consider the condition
types, compare based on the observed generation value only.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-03-30 01:26:34 +05:30
Hidde Beydals 391f780ca8
Merge pull request #253 from fluxcd/conditions-set-observedgen 2022-03-29 18:30:18 +02:00
Hidde Beydals f8ccf2493a runtime/conditions: sort cond incl observed gen
This ensures a Condition of Type=B with ObservedGeneration=2 is sorted
before Type=A with ObservedGeneration=1, displaying the most up-to-date
information first.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-03-29 17:46:41 +02:00
Sunny 0f5e761d1a runtime/conditions: Update observed gen on Set()
conditions Set() should update the observed generation of the condition
to the latest object version to reflect the observation on the latest
generation of the object.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-03-29 17:44:19 +02:00
Hidde Beydals 87d4c63c21
Merge pull request #251 from pjbgf/create-kubeconfig 2022-03-29 17:38:16 +02:00
Paulo Gomes 2d3a3c9432
Add kubeconfig into 'runtime/client'
Adds kubeconfig sanitisation for kubeconfig values, making it easier to enforce what features to enable/disable.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-03-29 15:57:54 +01:00
Sunny 0c7b2ecc56
Merge pull request #252 from ilanpillemer/align-deps-for-fuzzing
align fuzzing deps
2022-03-28 14:49:59 +05:30
Ilan df056fd581 align fuzzing deps as per task 1 flux2 issue 2552
Signed-off-by: Ilan <ilan.pillemer@gmail.com>
2022-03-28 08:48:56 +01:00
Stefan Prodan 372d2e087e
Merge pull request #250 from pjbgf/enable-test-race
build: enable '-race' for 'go test'
2022-03-21 11:03:32 +02:00
Paulo Gomes 49ca364bf7
Fix race condition on gittestserver
Prevent multiple ssh server initialisations with a mutex.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-03-21 07:12:32 +00:00
Paulo Gomes 386f3bde2a
build: enable '-race' for 'go test'
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-03-20 12:09:20 +00:00
Hidde Beydals e526462295
Merge pull request #249 from fluxcd/update-deps 2022-03-16 11:01:56 +01:00
Hidde Beydals 09e5986367 ssh: update dependencies
- golang.org/x/crypto to v0.0.0-20220315160706-3147a52a75dd

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-03-16 10:54:46 +01:00
Hidde Beydals 9316ea1821 ssa: update dependencies
- github.com/google/go-cmp to v0.5.7
- k8s.io/api to v0.23.4
- k8s.io/apimachinery to v0.23.4
- sigs.k8s.io/cli-utils to v0.29.3

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-03-16 10:53:41 +01:00
Hidde Beydals 641d0d8008 kustomize: update dependencies
- github.com/onsi/gomega to v1.18.1
- k8s.io/api to v0.23.4
- k8s.io/apiextensions-apiserver to v0.23.4
- k8s.io/apimachinery to v0.23.4
- sigs.k8s.io/controller-runtime to v0.11.1
- sigs.k8s.io/kustomize/api to v0.11.2
- sigs.k8s.io/kustomize/kyaml to v0.13.3

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-03-16 10:52:24 +01:00
Hidde Beydals 628a87b30d helmtestserver: update dependencies
- golang.org/x/crypto to v0.0.0-20220315160706-3147a52a75dd
- helm.sh/helm/v3 to v3.8.1

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-03-16 10:48:56 +01:00
Hidde Beydals 3cf673cd43 apis/meta: update dependencies
- k8s.io/apiextensions-apiserver to v0.23.4

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-03-16 10:47:32 +01:00
Hidde Beydals b1b3ec5a00 apis/kustomize: update dependencies
- k8s.io/apiextensions-apiserver to v0.23.4

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-03-16 10:45:36 +01:00
Sunny c08f59a8dc
Merge pull request #248 from aryan9600/helm-sign
Update `helmtestserver` to optionally sign packaged charts
2022-03-04 21:32:47 +05:30
Sanskar Jaiswal 39c7d4698c Update helmtestserver to sign charts using openpgp
Add functionality to sign packaged charts using an openpgp keyring. Add
tests related to helmtestserver. This helps test consumers to in chart
verification using a provenance file.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-03-04 21:13:23 +05:30
Stefan Prodan ce2b6bc425
Merge pull request #247 from fluxcd/skip-managed-fields-cleanup
ssa: Allow objects to be excluded from metadata cleanup
2022-03-04 12:20:08 +02:00
Stefan Prodan 8d011dc3d3
ssa: Update cli-utils to v0.29.2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-03-04 12:00:07 +02:00
Stefan Prodan 5a0d9233d0
ssa: Allow objects to be excluded from metadata cleanup
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-03-03 13:32:41 +02:00
Stefan Prodan f69b2f10b9
Merge pull request #246 from fluxcd/runc-v1.1.0
Update dependencies
2022-03-03 12:45:02 +02:00
Stefan Prodan ee27683fab
Update containerd to v1.6.1
Fix for https://github.com/containerd/containerd/security/advisories/GHSA-crp2-qrr5-8pq7

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-03-03 12:18:58 +02:00
Stefan Prodan dcdd2bbf78
Update runc to v1.1.0
Fix for https://github.com/advisories/GHSA-fgv8-vj5c-2ppq

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-03-03 12:15:32 +02:00
Sunny f1f84569d7
Merge pull request #244 from pjbgf/patch-250222
Update github.com/sosedoff/gitkit to v0.3.0 (CVE fix)
2022-02-25 16:11:38 +05:30
Paulo Gomes fafceb6111
Update github.com/sosedoff/gitkit to v0.3.0 (CVE fix)
Fixes https://snyk.io/vuln/SNYK-GOLANG-GITHUBCOMSATORIGOUUID-72488 in the indirect dependency github.com/satori/go.uuid.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-02-25 09:33:19 +00:00
Hidde Beydals 230d9ecb0f
Merge pull request #242 from fluxcd/increase-qps-burst 2022-02-21 12:48:34 +01:00
Stefan Prodan 8f157dc240
runtime: Increase client QPS and Burst to 50/100
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-02-21 13:39:18 +02:00
Hidde Beydals 3c08fcac7f
Merge pull request #241 from fluxcd/patch-tounstructured 2022-02-21 12:17:40 +01:00
Sunny 5e55b75896
runtime/patch: Make ToUnstructured() public
ToUnstructured() is useful for others controllers, especially for use
in tests.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-02-21 16:24:19 +05:30
Hidde Beydals ccbc687aa7
Merge pull request #240 from fluxcd/runtime-apis-meta-update 2022-02-18 14:48:22 +01:00
Hidde Beydals 9c6ae693e3 chore: update apis/meta to v0.12.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-02-18 14:40:10 +01:00
Stefan Prodan aa13413586
Merge pull request #238 from pjbgf/patch-180222
Update dependencies
2022-02-18 13:32:55 +02:00
Paulo Gomes 96cf31abea
Update github.com/prometheus/client_golang to v1.12.1 (CVE fix)
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-02-18 11:17:13 +00:00
Hidde Beydals 75906578b9
Merge pull request #239 from fluxcd/runtime-patch-fieldowner 2022-02-18 12:04:16 +01:00
Hidde Beydals e9a4022210 runtime/patch: add FieldOwner K8s client option
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-02-18 10:48:57 +01:00
Stefan Prodan 5f45ff67c9
Merge pull request #235 from souleb/fix-stringdata-diff
ssa: Fix Secrets diff by converting StringData to Data
2022-02-18 11:45:13 +02:00
Soule BA 94fc3ea0f9
convert StringData to data
If applied, will make sure that stringData is converted to Data before
applying.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2022-02-18 09:43:19 +01:00
Stefan Prodan af165a9c97
Merge pull request #237 from fluxcd/update-deps
all: Update Kubernetes dependencies
2022-02-17 13:25:29 +02:00
Stefan Prodan 7b6ce7d0fc
all: Update Kubernetes dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-02-17 10:57:29 +02:00
Stefan Prodan 91e4177abe
Merge pull request #236 from fluxcd/cli-utils-v0.28.0
ssa: Update Kubernetes dependencies
2022-02-17 10:44:59 +02:00
Stefan Prodan 0112c0da52
ssa: Update Kubernetes dependencies
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-02-17 10:26:02 +02:00
Stefan Prodan 04e7376032
Merge pull request #234 from fluxcd/ssa-fix-crd-wait
ssa: Preserve the status field on CRDs
2022-02-07 10:36:18 +02:00
Stefan Prodan 8fe6a0679e
ssa: Preserve the status field on CRDs
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-02-07 10:13:21 +02:00
Stefan Prodan fd8b32b4a3
Merge pull request #233 from SomtochiAma/ssa-bug
ssa: Transfer the ownership of managed fields from others managers
2022-02-07 10:12:31 +02:00
Somtochi Onyekwere 2bb8525daa Refactor code for merge into a different function
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-02-03 14:49:17 +01:00
Somtochi Onyekwere ea51d2c09b Merge managedfields when cleaning up metadata
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-02-03 14:33:20 +01:00
Stefan Prodan b4a14854c7
Merge pull request #232 from SomtochiAma/new-manger
ssa: Add tests for metadata drift detection
2022-01-26 14:08:04 +02:00
Somtochi Onyekwere 6a5711b946 Add test for hasDrifted method
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-01-26 12:37:53 +01:00
Stefan Prodan 7f5bc7ebc2
Merge pull request #230 from fluxcd/acl-no-cross-namespace-refs
runtime: Add flag to disable cross-namespace refs
2022-01-25 17:25:33 +02:00
Stefan Prodan 44169dffbb
runtime: Add flag to disable cross-namespace refs
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-25 14:20:48 +02:00
Sunny 61ba31f6ae
Merge pull request #222 from fluxcd/runtime-events-fixes
runtime/events: Handle empty webhook address and log event in debug mode
2022-01-24 21:36:41 +05:30
Sunny a48ae4c42a
runtime/events: log events if debug is enabled
When debug logging is enabled, the events are also logged in addition
to recording the events in k8s and posting to external event endpoint.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-01-24 21:12:19 +05:30
Sunny 1345e117e3
runtime/events: Handle no webhook
When the provided webhook address is empty, skip posting event to
external webhook endpoint.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-01-24 21:11:54 +05:30
Stefan Prodan 126e85924c
Merge pull request #229 from fluxcd/ssa-refactor
ssa: Refactor server-side apply helpers
2022-01-21 16:17:25 +02:00
Stefan Prodan d664bb4427
ssa: Refactor server-side apply helpers
- use DeepEqual to detect drift in metadata maps
- fix typo in FieldManager API
- remove ReadKubernetesObjects function (validation should happen before SSA)

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-21 16:00:15 +02:00
Stefan Prodan dfff829322
Merge pull request #228 from fluxcd/ssa-read-and-validate
ssa: Add read function that validates resources
2022-01-21 10:49:18 +02:00
Stefan Prodan 70f70252fe
ssa: Add read function that validates resources
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-20 18:16:11 +02:00
Stefan Prodan 65e0709eca
Merge pull request #227 from fluxcd/ssa-diff-exclude
ssa: Add exclusion list to diff options
2022-01-20 12:31:08 +02:00
Stefan Prodan a968113362
ssa: Add exclusion list to diff options
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-20 12:08:29 +02:00
Stefan Prodan 6083da5de1
Merge pull request #223 from SomtochiAma/new-manger
Replaces kubectl field managers with the resource manager owner in ssa apply
2022-01-20 12:08:10 +02:00
Somtochi Onyekwere d5ab2c568c replace manager in ssa apply
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-01-20 09:40:21 +01:00
Stefan Prodan 9fa16a9968
Merge pull request #226 from fluxcd/delete-action-sbom
Remove SBOM action
2022-01-20 09:49:43 +02:00
Stefan Prodan 23b00fd3e9
Remove SBOM action
There is an official action for generating SBOM `anchore/sbom-action/download-syft`.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-20 09:42:34 +02:00
Stefan Prodan 87a0941d23
Merge pull request #225 from souleb/action-sops
Add a github action for sops
2022-01-19 19:09:10 +02:00
Soule BA 8c36cc8543
Add a github action for sops
If implemented, this code will enable flux packages to use this action to run sops
commands.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2022-01-19 16:21:03 +01:00
Stefan Prodan 637ff545a9
Merge pull request #224 from souleb/kustomize-export-action-type
Export the Action type in pkg/kustomize
2022-01-19 16:03:36 +02:00
Soule BA b478a2aaed
Export the Action type
If implemented this will permit consuming the Action type from other
packages.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2022-01-19 12:52:55 +01:00
Stefan Prodan 11014c18f6
Merge pull request #203 from souleb/kustomization-module
Kustomize module for generation and var substitution
2022-01-18 18:19:09 +02:00
Soule BA 9c489959c5
Kustomization module for generation and var substitution
This module declare methods used in both kustomization-controller

and the flux cli

Signed-off-by: Soule BA <bah.soule@gmail.com>
2022-01-18 08:47:07 +01:00
Stefan Prodan f4d04dc877
Merge pull request #219 from fluxcd/sbom-action
Add action to generate SBOM for container images
2022-01-14 16:33:36 +02:00
Stefan Prodan e868ed154b
Make SBOM generation optional
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-14 16:23:38 +02:00
Stefan Prodan d633d351db
Merge pull request #220 from pjbgf/sbom-action
Add checksum verification for syft installer script
2022-01-14 15:49:00 +02:00
Paulo Gomes 114fcb695f
Add checksum verification for syft installer script
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-01-14 13:39:43 +00:00
Stefan Prodan dda4a0152f
Add action to generate SBOM for container images
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-14 11:52:02 +02:00
Stefan Prodan 3ccbcf87cb
Merge pull request #217 from fluxcd/ssa-exclude-status-subresource
Exclude the status subresouce from the applied resource
2022-01-13 18:48:27 +02:00
Stefan Prodan d8a9a2b3dc
Exclude the status subresouce from the applied resource
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-13 18:33:31 +02:00
Stefan Prodan 1c5bb5968f
Merge pull request #218 from pjbgf/fix-fuzzers
Fix fuzzer build and improve fuzz tests on pull requests
2022-01-13 18:03:48 +02:00
Paulo Gomes 5f948ef331
Replace cifuzz with custom smoke test
The official git actions goes through all fluxcd repos, which in
time will be extremely long and painful to run on each PR.
This smoke test will ensure the fuzzer correctness until a new
action is in place to run the process as advised by oss-fuzz.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-01-13 15:53:33 +00:00
Paulo Gomes bb24137b0b
Fix fuzz issue at oss-fuzz
More information: https://github.com/google/oss-fuzz/runs/4804502678?check_suite_focus=true

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-01-13 15:52:34 +00:00
Stefan Prodan e693be5bc5
Merge pull request #209 from fluxcd/override-kubectl-managed-fields
Take ownership of kubectl managed fields
2022-01-13 15:53:13 +02:00
Stefan Prodan 22005faeba
Update sigs.k8s.io/cli-utils to v0.27.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-13 13:48:09 +02:00
Stefan Prodan 66a8285955
Exclude subresources from cleanup
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-13 13:48:04 +02:00
Stefan Prodan feec6d204c
Add labels cleanup to apply options
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-13 13:48:04 +02:00
Stefan Prodan 3488232cc7
Add metadata cleanup to apply options
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-13 13:48:04 +02:00
Stefan Prodan eba79fc1bc
Remove last-applied-configuration annotation
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-13 13:48:04 +02:00
Stefan Prodan 55545a7ee6
Remove before-first-apply manager
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-13 13:48:04 +02:00
Stefan Prodan e5ba139d62
Take ownership of kubectl managed fields
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-13 13:48:03 +02:00
Stefan Prodan eda0924890
Merge pull request #216 from fluxcd/remove-git-pkg
Remove the deprecated git pkg from main
2022-01-13 13:44:09 +02:00
Stefan Prodan 91da8c91b1
Remove the deprecated git pkg from main
The fluxcd/pkg/git package has been deprecated in Apr 2021, it's time to delete it from here as it's unmaintained.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-13 13:28:49 +02:00
Stefan Prodan 39c645c067
Merge pull request #215 from aryan9600/aryan9600/setup-testenv
Fix makefile envtest and controller-gen usage
2022-01-13 13:10:25 +02:00
Sanskar Jaiswal be4220123d fix makefile envtest and controller-gen usage
Refactor logic to install helper tools into one function in the
Makefile. Add support for envtest to help install tools like kubectl,
etcd which helps users run tests more conveniently.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2022-01-13 16:07:10 +05:30
Stefan Prodan cc5bf6ab65
Merge pull request #212 from pjbgf/fuzz
Refactor Fuzz implementation
2022-01-12 12:01:58 +02:00
Paulo Gomes ab49d7b6f9
Refactor fuzzing
Structure the fuzz implementation to be closer to what go native will support.
Add Makefile target to enable smoketesting fuzzers.
Add github workflow to test and upload crash results.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-01-11 18:55:57 +00:00
AdamKorcz 283b5db589
Fuzzing: Initial commit
Signed-off-by: AdamKorcz <adam@adalogics.com>
2022-01-10 18:48:44 +00:00
Hidde Beydals 58cd020c72
Merge pull request #213 from fluxcd/x-crypto-patch 2022-01-10 19:00:53 +01:00
Hidde Beydals 58c5863475 Update golang.org/x/crypto to latest main
This includes the full commit tree to solve both CVE-2020-29652 and
CVE-2021-43565:
8b5274cf68...5770296d90

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-01-10 18:51:28 +01:00
Stefan Prodan 22c9f20138
Merge pull request #211 from fluxcd/containerd-v1.5.9
Update containerd v1.5.9 to fix CVE-2021-43816
2022-01-10 14:59:02 +02:00
Stefan Prodan 2866c32aff
Update containerd v1.5.9 to fix CVE-2021-43816
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-10 13:28:26 +02:00
Hidde Beydals b6e122bd65
Merge pull request #210 from fluxcd/ssh-fix-CVE-2020-29652 2022-01-10 11:21:06 +01:00
Stefan Prodan d8adb6eb62
Update golang.org/x/crypto to fix CVE-2020-29652
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-10 11:52:04 +02:00
Stefan Prodan 60ca1f824e
Merge pull request #208 from souleb/preserve-changes-when-secret-masking
Preserve value difference when masking secret data
2022-01-06 13:59:17 +02:00
Soule BA 5e71323019
Preserve value difference when masking secret data
This enable for an existing secret object and its updated version to preserve
changes when masking sensitive values

Signed-off-by: Soule BA <bah.soule@gmail.com>
2022-01-06 12:17:25 +01:00
Stefan Prodan 1609286293
Merge pull request #207 from fluxcd/ssa-hpa-diff
Workaround for HPA dry-run metrics duplication
2022-01-06 10:40:47 +02:00
Stefan Prodan 658c8131a0
Workaround for HPA dry-run metrics duplication
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-06 10:22:50 +02:00
Stefan Prodan 2eecb2f6b8
Merge pull request #205 from souleb/ssa-Export-IsImmutableError
Export IsImmutableError, and some clean-up
2022-01-03 13:24:57 +02:00
Soule BA c811c4c54e
Export IsImmutableError, and some clean-up
We want to rely on this function behavior in flux-cli

Signed-off-by: Soule BA <bah.soule@gmail.com>
2021-12-22 11:05:49 +01:00
Stefan Prodan cd50d1697c
Merge pull request #202 from fluxcd/prep-runtime-rc6
Prepare runtime v0.13.0-rc.6
2021-12-15 19:01:14 +02:00
Stefan Prodan f7d1ada0cd
Prepare runtime v0.13.0-rc.6
Update apis packages to match Go 1.17 and controller-runtime 0.11.0

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-12-15 18:53:02 +02:00
Stefan Prodan b8b6b18bc9
Merge pull request #199 from fluxcd/apiskustomize/apiextensions-apiserver-0.23
[apis/kustomize] Update apiextensions-apiserver to v0.23.0
2021-12-15 18:46:59 +02:00
Aurel Canciu 96d9e35337
[apis/kustomize] Update apiextensions-apiserver to v0.23.0
Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
2021-12-15 17:39:31 +01:00
Stefan Prodan 059c15c37d
Merge pull request #198 from fluxcd/apismeta/apimachinery-0.23
[apis/meta] Update apimachinery to v0.23.0
2021-12-15 18:35:30 +02:00
Aurel Canciu 9e8fddb8e3
[apis/meta] Update apimachinery to v0.23.0
Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
2021-12-15 17:17:33 +01:00
Stefan Prodan 60d797aff6
Merge pull request #201 from fluxcd/controller-gen-0.7.0
Bump controller-gen to v0.7.0
2021-12-15 18:16:13 +02:00
Aurel Canciu eef6dea6db
Bump controller-gen to v0.7.0
Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
2021-12-15 17:07:02 +01:00
Stefan Prodan 6f6b292bbe
Merge pull request #177 from fluxcd/run-tests-container
Run build in container
2021-12-15 17:17:47 +02:00
Aurel Canciu 8ca5ca821e
Run build in container
Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
2021-12-15 16:10:39 +01:00
Stefan Prodan a443f3bd37
Merge pull request #175 from fluxcd/go-v1.17
Update Go to v1.17 and controller-runtime to v0.11.0
2021-12-15 16:59:19 +02:00
Aurel Canciu 43c22626f0
Update controller-runtime to v0.11.0 / helm v3.7.2
Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
2021-12-15 15:35:48 +01:00
Aurel Canciu 1a81f054eb
Update Go to v1.17
Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
2021-12-14 22:43:57 +01:00
Stefan Prodan 097e698370
Merge pull request #195 from fluxcd/ssa-fix-order-override
ssa: Fix apply order override
2021-12-09 21:49:23 +02:00
Stefan Prodan 5d039348ec
ssa: Fix apply order override
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-12-09 20:58:37 +02:00
Stefan Prodan f14717aab2
Merge pull request #194 from fluxcd/ssa-kind-order
ssa: Allow consumers to override the apply order
2021-12-09 11:01:09 +02:00
Stefan Prodan ddd42d55ef
ssa: Allow consumers to override the apply order
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-12-08 18:41:12 +02:00
Stefan Prodan 8cab72ed20
Merge pull request #193 from fluxcd/ssa-diff
ssa: Remove YAML diff
2021-12-06 18:33:38 +02:00
Stefan Prodan a559fa5692
ssa: Remove YAML diff
Remove the YAML diff composed with go-cmp. The ssa.Diff now returns the live object and the merged one (resulted from apply dry-run). Consumers can take the two objects and perform the YAML diff with 3rd party tools like Linux diff.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-12-06 18:20:39 +02:00
Stefan Prodan 283cbad8bc
Merge pull request #192 from fluxcd/ssa-force-fix
ssa: Force apply on invalid and conflict errors
2021-12-04 11:18:05 +02:00
Stefan Prodan 0c386be5f1
Force apply for invalid and conflict errors
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-12-03 17:27:50 +02:00
Hidde Beydals c38e659c02
Merge pull request #191 from fluxcd/update-deps 2021-11-24 19:02:55 +01:00
Hidde Beydals e3bd920023 Force github.com/opencontainers/image-spec v1.0.2
To work around another CVE-2021-41190 related warning.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-11-24 18:29:21 +01:00
Hidde Beydals af1080e802 Force github.com/containerd/containerd to v1.5.8
Resolves warning for CVE-2021-41190 related issue.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-11-24 18:19:28 +01:00
Hidde Beydals e289c2706d
Merge pull request #190 from fluxcd/crdjsonschema-patch 2021-11-24 11:17:57 +01:00
Hidde Beydals e94c9d80b0 Use `objectmeta-meta-v1.json` from root
As this is where the `Dockerfile` copies the file to, which differs
(apparently) from the path the Python script is executed in.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-11-24 11:09:36 +01:00
Stefan Prodan 24666ee778
Merge pull request #189 from chanwit/combine_all_schemas
Generate a combined json schemas with oneOf operator
2021-11-22 11:09:06 +02:00
Chanwit Kaewkasi 77dfca7aa9 generate a combined json schemas for crdjsonschema action
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
2021-11-19 22:57:15 +07:00
Max Jonas Werner 1d572db560
Merge pull request #188 from fluxcd/kustomize-debuggability
feat: make it easier to debug kustomize action failures
2021-11-16 17:08:54 +01:00
Max Jonas Werner 0192233be8
feat: make it easier to debug kustomize action failures
When curl fails there has been no way to understand why because of the
'silent' flag. Removing the silent flag and just disabling the
progress meter makes it easier to reason about failures when
downloading kustomize.

Signed-off-by: Max Jonas Werner <mail@makk.es>
2021-11-16 14:04:26 +01:00
Stefan Prodan bf5b01ea94
Merge pull request #180 from sbernheim/docs-kustomize-patches-no-file-support
Remove file support from Kustomize Patch type docs
2021-11-13 08:48:08 +02:00
sbernheim 441c4e65d2
tabs over spaces
Signed-off-by: sbernheim <1707604+sbernheim@users.noreply.github.com>
2021-11-13 00:35:26 -05:00
sbernheim 38913287ea
Remove file support from Kustomize Patch type docs
The Kustomize Patch API type only supports inlined patch
definitions and does not support reading patches from a
file. Updating the godoc comments for the type to remove
any mention of reading patch definitions from a file and
make it clear that only inline patches are supported.

Signed-off-by: sbernheim <1707604+sbernheim@users.noreply.github.com>
2021-11-13 00:24:44 -05:00
Stefan Prodan 823e780ea1
Merge pull request #187 from fluxcd/fix-ssa-delete-exclusions
ssa: Fix delete with exclusions
2021-11-08 14:39:04 +02:00
Stefan Prodan 7dda17b150
ssa: Fix delete with exclusions
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-08 14:20:47 +02:00
Stefan Prodan 231ff634e0
Merge pull request #186 from fluxcd/ssa-apply-exclusions
ssa: Add exclusions to apply options
2021-11-08 13:45:18 +02:00
Stefan Prodan 92368e55d5
ssa: Add exclusions to apply options
Skip applying changes to in-cluster objects when their metadata (labels and/or annotations) match the exclusions list.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-08 13:24:32 +02:00
Stefan Prodan 3ed468b07c
Merge pull request #185 from fluxcd/ssa-apply-opts
ssa: Introduce apply options
2021-11-08 12:46:05 +02:00
Stefan Prodan 33715b271d
ssa: Introduce apply options
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-08 12:27:22 +02:00
Stefan Prodan fb9b404983
Merge pull request #184 from fluxcd/ssa-wait-opts
ssa: Introduce wait options
2021-11-08 11:54:12 +02:00
Stefan Prodan 1dbf5e0589
ssa: Introduce wait options
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-08 11:37:59 +02:00
Stefan Prodan 40e3dee86b
Merge pull request #183 from fluxcd/ssa-delete-opts
ssa: Introduce delete options
2021-11-08 11:22:08 +02:00
Stefan Prodan 2ad99603ad
ssa: Introduce delete options
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-08 11:06:08 +02:00
Stefan Prodan 751923021d
Merge pull request #181 from fluxcd/delete-propagation-background
ssa: Set delete propagation policy to background
2021-11-08 09:38:45 +02:00
Stefan Prodan 6c28be47dc
ssa: Set delete propagation policy to background
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-07 12:34:40 +02:00
Sunny 3840ab1c71
Merge pull request #179 from darkowlzz/gitserver-middleware
gittestserver: Add http middleware support
2021-11-04 01:54:16 +05:30
Sunny 6ffa2dee6f acl_test.go: wait for manager to be elected
Observed a test flake with error:

```
the cache is not started, can not read objects
```

Like all the other tests, waiting for the manager to be elected may help
provide enough time for the cache to be ready.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-11-04 01:39:08 +05:30
Sunny d3a67d978d gittestserver: Add http middleware support
Add http middleware support to be able to change the behavior of the
server. Usage could be for returning certain response and error or
introducing some delay in the server, etc.
The middlewares can be chained together based on the needs.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-11-04 00:53:46 +05:30
Michael Bridgen 3ab7cce7f4
Merge pull request #178 from fluxcd/acl-return-value
Rationalise the return value of ACL checks
2021-11-02 14:59:11 +00:00
Michael Bridgen 19c6a30108 Remove redundant return value of HasAccessToRef
The bool return value for HasAccessToRef is the same as `err == nil`,
so redundant. However it's useful to distinguish between access being
denied, and actual errors. So: make a type for access denied errors,
and provide a predicate to make it easy to test for that case.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-11-02 14:40:10 +00:00
Sunny 80b204662b
Merge pull request #171 from darkowlzz/gittestserver-branch-tag
gittestserver: Fix InitRepo() with branch
2021-10-26 18:37:10 +05:30
Sunny cd1d638293 gittestserver: Fix InitRepo() with custom branch.
In the GitServer.InitRepo(), to create a custom branch when
initializing a repo, make a commit to the default branch, checkout
to the commit at the target branch and push the branches to remote.

Restructure the test to create space for more cases easily.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-10-26 17:52:49 +05:30
Hidde Beydals 5e99e1947c
Merge pull request #161 from darkowlzz/event-rec-to-k8s-upstream 2021-10-19 09:25:54 +02:00
Sunny e418a53b0f recorder: Add object info in the logger
Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-10-19 11:59:28 +05:30
Sunny a26ceb22f0 Remove controller.Events
Since events.Recorder implements the k8s EventRecorder interface, there
is no need of the controller.Events any more. The reconcilers can embed
the k8s EventRecorder and use a events.Recorder recorder.

Update the events.Recorder to embed a k8s event recorder to pass events
to k8s along with an external recorder.

The trace events are passed to k8s recorder as a normal event since it
only accepts normal and warning event types.

Update tests to use testenv with suite_test.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-10-19 00:38:55 +05:30
Sunny b732fd552d Update external event recorder to adhere to upstream k8s
Update external event recorder to be compatible with the upstream k8s
EventRecorder interface.
Since the EventRecorder interface methods don't return any error, add a
logger to the external event recorder to log any errors.

Add an event type constant for trace events.

Update `controller.Events.EventWithMetaf()` to send the available
metadata information to the kubernetes event recorder with
`AnnotatedEventf()`.

Update the tests to work with the function signature changes.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-10-19 00:38:55 +05:30
Stefan Prodan ecd2e4937a
Merge pull request #170 from fluxcd/ssa-wait
ssa: Implement WaitForSet
2021-10-18 16:48:54 +03:00
Stefan Prodan 131659fd5f
ssa: Implement WaitForSet
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-18 16:26:17 +03:00
Stefan Prodan 776c8ebffd
Merge pull request #169 from fluxcd/sigs.k8s.io/cli-utils-v0.26.0
Update sigs.k8s.io/cli-utils to v0.26.0
2021-10-15 15:50:00 +03:00
Stefan Prodan f541230f4c
Update sigs.k8s.io/cli-utils to v0.26.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-15 14:56:13 +03:00
Stefan Prodan 141b759413
Merge pull request #168 from fluxcd/helm.sh/helm/v3-v3.7.1
Update Helm packages to v3.7.1
2021-10-15 14:44:56 +03:00
Stefan Prodan 248d0800b1
Update Helm packages to v3.7.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-15 14:37:15 +03:00
Stefan Prodan ea562a0403
Merge pull request #167 from fluxcd/ssa-drift
ssa: Improve drift detection
2021-10-13 12:13:59 +03:00
Stefan Prodan bed0c2a86b
ssa: Improve drift detection
Remove server-side generated fields (metadata and status) before checking for semantic equality.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-13 11:40:00 +03:00
Stefan Prodan c09ec44b3c
Merge pull request #166 from fluxcd/ssa-defaults
ssa: Improve native kind matching
2021-10-12 11:49:16 +03:00
Stefan Prodan 70897b19c2
ssa: Improve native kind matching
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-12 11:39:15 +03:00
Stefan Prodan 5ebf4e1fa0
Merge pull request #165 from fluxcd/ssa-hpa
ssa: Set defaults for HPA v2beta1
2021-10-12 11:20:40 +03:00
Stefan Prodan 4e305f97e0
ssa: Set defaults for HPA v2beta1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-12 11:09:47 +03:00
Stefan Prodan 4fd74df812
Merge pull request #163 from fluxcd/ssa-binaryData
ssa: Add binaryData to ConfigMaps diff
2021-10-11 16:25:07 +03:00
Stefan Prodan b0f506989a
ssa: Add binaryData to ConfigMaps diff
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-11 16:13:04 +03:00
Stefan Prodan ed2d983bff
Merge pull request #162 from fluxcd/fix-secret-diff
ssa: Detect changes in Secrets and ConfigMaps
2021-10-11 16:01:43 +03:00
Stefan Prodan 067d6d4b95
ssa: Detect changes in Secrets and ConfigMaps
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-11 15:07:13 +03:00
Stefan Prodan 7cdf6696e3
Merge pull request #160 from fluxcd/ssa-fix
Fix SSA upstream bugs for Kubernetes < 1.22
2021-10-10 15:19:07 +03:00
Stefan Prodan 4b0783c316
Fix SSA upstream bugs for Kubernetes < 1.22
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-10 15:12:53 +03:00
Stefan Prodan 6c1a229889
Merge pull request #159 from darkowlzz/ct-marker-evaluation
runtime/events: fix Severity validation marker value
2021-10-10 09:55:38 +03:00
Sunny 5d975bbb52 runtime/events: fix Severity marker validation value
Also, run controller-gen schemapatch to evaluate all the kubebuilder
markers before generating code.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-10-10 02:08:59 +05:30
Stefan Prodan 36ddbce4cc
Merge pull request #158 from fluxcd/rbac-diff
ssa: Improve RBAC reconciliation
2021-10-08 10:22:12 +03:00
Stefan Prodan 9f21cd3b1e
Force apply immutable RBAC
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-07 23:40:40 +03:00
Stefan Prodan 963567270c
Add RBAC specs to diff filter
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-07 22:37:05 +03:00
Stefan Prodan 6a3ed50eec
Merge pull request #156 from darkowlzz/testenv-provision-user
testenv: Add AddUser() to provision new user
2021-10-07 12:41:22 +03:00
Sunny db45852179 testenv: Add AddUser() to provision new user
Add `Environment.AddUser()` to allow provisioning of new cluster user.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-10-07 14:35:39 +05:30
Stefan Prodan 1f33307f0a
Merge pull request #154 from fluxcd/update-helmtester
Update helm to v3.7.0
2021-10-05 14:41:09 +03:00
Stefan Prodan ceb8ae4bf2
Update helm to v3.7.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-05 14:17:42 +03:00
Stefan Prodan 0cb90ff15e
Merge pull request #153 from darkowlzz/gittestserver-init-repo
gittestserver: Add InitRepo() to initialize a repo
2021-10-05 14:07:34 +03:00
Sunny 01f335c51f gittestserver: Add InitRepo() to initialize a repo
GitServer.InitRepo() can be used to initialize a repo in the git server
with a given fixture. The repo is created internally using go-git over
the file protocol, irrespective of the git server.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-10-05 13:35:22 +05:30
Stefan Prodan 3d73953d57
Merge pull request #152 from fluxcd/ssa
Add server-side apply package
2021-10-04 14:12:14 +03:00
Stefan Prodan 00679b87eb
Add server-side apply package
Package ssa contains utilities for managing Kubernetes resources using sever-side apply.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-04 13:07:57 +03:00
Stefan Prodan 2e13fd058e
Update controller-runtime to v0.10.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-30 16:59:12 +03:00
Hidde Beydals ed06eb8178
Merge pull request #148 from darkowlzz/testenv-klog-init-flags 2021-09-23 17:53:34 +02:00
Sunny c5a17be357 testenv: Remove klog init flags
Removes klog.InitFlags() because the klog flags aren't parsed before
using klog. To avoid conflicting with other flags, it's better to not
populate the global flagset.
This results in default klogr to be set as the default
controller-runtime logger if not set in the test already. The logger
setup not being in init() allows users to set their own logger before
creating testenv Environment.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-09-23 16:46:28 +05:30
Hidde Beydals f2b114a3d1
Merge pull request #149 from darkowlzz/conditions-with-generations 2021-09-23 10:39:39 +02:00
Sunny a12df463fa runtime/conditions: Add merge option WithLatestGeneration
Adds merge option WithLatestGeneration() to consider the condition's
observed generation while merging. When withLatestGeneration is set,
the condition groups are created based on the generation of the
conditions. The condition groups with the latest generations are
grouped together and sorted based on their merge priority. The
condition groups with old generations don't contain the up-to-date
information and hence not considered.
The merge behavior remains the same when no generation is specified.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-09-22 00:38:33 +05:30
Stefan Prodan d726dea3fc
Merge pull request #147 from fluxcd/trace-events
Add trace event type
2021-08-26 15:12:54 +03:00
Stefan Prodan 487f832d3a
Add trace event type
Traces are persisted as Kubernetes events only, usually informing about actions taken during reconciliation that are irrelevant to the alerting system.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-26 10:42:54 +03:00
Stefan Prodan 6a82b831df
Merge pull request #146 from allenporter/ioutil
Remove use of deprecated io/ioutil package
2021-08-25 08:41:13 +03:00
Allen Porter eb4a586d44 Remove use of deprecated io/ioutil package
Remove deprecated calls and replace with suggestions from the deprecation notice.

Signed-off-by: Allen Porter <allen@thebends.org>
2021-08-24 14:06:17 -07:00
Stefan Prodan 580f74a06f
Merge pull request #145 from jpellizzari/jp-fix-kubebuilder-action
Fix kubebuilder download URL
2021-08-23 19:31:12 +03:00
Jordan Pellizzari d08be3c043 Fix kubebuilder download URL
Signed-off-by: Jordan Pellizzari <jordan@weave.works>
2021-08-23 09:23:23 -07:00
Michael Bridgen ed5665055b
Merge pull request #144 from fluxcd/progressing-in-patch
Account for reconciling condition in patch example
2021-08-17 11:17:34 +01:00
Michael Bridgen eecf278c43 Account for reconciling condition in patch example
At present the example of how to use patch.Helper unconditionally
clears the reconciling condition on a "clean" exit (no error or
explicit requeue). This is on the assumption that the condition is
used only within the Reconcile method to indicate that the resource is
being processed.

However, in general it's possible for Reconcile to exit cleanly
without the reconciliation having reached a ready state, but without
definitively failing either. For example, a Deployment would need to
visit Reconcile several times during a rolling upgrade before it has
rolled out a new pod spec.

On the expectation that people may borrow the example, I think it is
better to treat the Reconciling condition as an indication that there
is more work to be done.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-08-17 10:39:23 +01:00
Stefan Prodan ce2d6b7d7a
Merge pull request #143 from fluxcd/controller-runtime-v0.9.6
Update controller runtime to v0.9.6
2021-08-16 19:08:12 +03:00
Stefan Prodan 6f401b351c
Fix make test on macOS
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-16 18:40:28 +03:00
Stefan Prodan c76846137f
Update controller-runtime to v0.9.6
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-16 18:39:57 +03:00
Stefan Prodan 6caa94232d
Merge pull request #141 from fluxcd/runtime-acl
Add ACL authorization helper to runtime
2021-08-10 14:53:11 +03:00
Stefan Prodan 4ee2705f70
Add ACL authorization helper to runtime
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-10 14:00:58 +03:00
Stefan Prodan 328b23a5bf
Merge pull request #140 from fluxcd/acl-api
Add Access Control List API types and conditions
2021-08-09 16:25:08 +03:00
Stefan Prodan e1440cd39b
Add Access Control List API types and conditions
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-09 15:48:13 +03:00
Stefan Prodan 0a1a471c9d
Merge pull request #138 from darkowlzz/envtest-docker-action
actions/envtest: Update to docker container action
2021-08-01 18:30:15 +03:00
Sunny 26a3f13a67
actions/envtest: Update to docker container action
Update action/envtest to be a docker container action. This helps
install envtest binaries without Go installed on the host.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-08-01 20:40:44 +05:30
Stefan Prodan 259da2abae
Merge pull request #137 from fluxcd/code-scan
Enable code scanning
2021-07-30 13:14:26 +03:00
Stefan Prodan 00464db9ac
Enable code scanning
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-07-30 13:02:27 +03:00
Stefan Prodan 8493b46df1
Merge pull request #136 from fluxcd/helm-v3.6.3
Update helm pkg to v3.6.3
2021-07-30 12:54:39 +03:00
Stefan Prodan 06aed42653
Update helm pkg to v3.6.3
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-07-30 12:47:58 +03:00
Hidde Beydals f5d963e27b
Merge pull request #133 from fluxcd/runtime-conditions-kstatus
runtime/conditions: add kstatus condition helpers
2021-07-26 16:04:13 +02:00
Hidde Beydals 745e8739ff runtime/conditions: add kstatus condition helpers
This commit adds getter and setter helpers to `runtime/conditions` to
make it easier to mark resources with kstatus conditions, and observe
their state.

- The `MarkReconciling` and `MarkStalled` functions delete their
  counterpart condition type while marking the resource with the
  kstatus condition, making it easier to adhere to the kstatus
  standards.
- The `IsReady`, `IsStalled` and `IsReconciling` functions take the
  existence of their counterpart condition types into account, ensuring
  conclusive conditional checks.

`MarkReady` was not taken into consideration, it could technically be
added as syntax sugar, but this would first require a discussion about
a counterpart as you likely want to be able to mark something as "not
ready".

To determine a Ready condition at present, the advice is to compose one
using `SetSummary` based on the defined condition types from your own
API, for example:

```go
conditions.SetSummary(
	&obj,
	meta.ReadyCondition,
	conditions.WithConditions(
		foov1.FooCondition,
		foov1.BarCondition,
		foov1.BazCondition,
	),
)
```

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-26 13:07:05 +02:00
Hidde Beydals 51d3cb03fd
Merge pull request #132 from darkowlzz/testserver-tests 2021-07-26 10:37:46 +02:00
Sunny 9a42a81e59
testserver: Add tests for ArtifactServer
Adds tests to verify that the artifact server serves the artifacts.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-07-26 06:05:11 +05:30
Sunny 445030189e
testserver: Add tests for http and https servers
Adds tests to verify that the http and https testservers run with the
provided configurations. Also checks if the middlewares execute properly
in both the server setup.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-07-26 02:10:39 +05:30
Sunny 0bf975fabe
gittestserver: Add tests for http and https server
Adds tests to verify that the http and https gittestservers run with the
provided configurations.
This also configures authentication in the https server, similar to the
http server.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-07-25 20:04:58 +05:30
Sunny 061ee3a67a
Add testdata/certs for TLS based testserver tests
The testdata/certs is based on the testdata used in the
source-controller repo under controllers/testdata/certs/.
Since this will be shared between different kinds of testservers, the
testdata exists at the root of the repo, outside of the individual
packages.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-07-25 20:03:37 +05:30
Hidde Beydals 516d6a267f
Merge pull request #130 from darkowlzz/predicates-tests 2021-07-23 15:11:20 +02:00
Sunny 1b935e188d
runtime/predicates: Add unit tests
Adds unit tests for ReconcileRequestedPredicate.Update.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-07-23 01:51:11 +05:30
Hidde Beydals 4f241578e5
Merge pull request #129 from darkowlzz/makefile-setup-envtest
Add setup-envtest in Makefile
2021-07-22 22:18:03 +02:00
Sunny d028e0c438
Add setup-envtest in Makefile
This adds setup-envtest in the Makefile to make it easier to run
envtests without the need to download the kubebuilder binaries
separately.
The default value of KUBEBUILDER_ASSETS can be overridden by the value
set in CI, actions/envtest github action.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-07-23 01:40:27 +05:30
Hidde Beydals 5e8f061ff7
Merge pull request #131 from darkowlzz/gittestserver-test-cleanup
gittestserver: Cleanup the test git repo dir
2021-07-22 22:01:17 +02:00
Sunny e8bed86c1e
gittestserver: Cleanup the test git repo dir
Cleanup the temporary directories created by the gittestserver tests.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-07-23 00:32:24 +05:30
Michael Bridgen d76c0f4b88
Merge pull request #128 from fluxcd/gittestserver-options
Add GitServer method for installing an update hook
2021-07-13 15:51:56 +01:00
Michael Bridgen 0f910975bc Add GitServer method for installing an update hook
For testing what a controller does when the git server balks at an
operation (e.g., pushing a branch), it's useful to be able to install
a service-side git hook in the test git server. This new method is for
installing an update hook (runs for each updated ref), which is the
one I needed; pre-receive (runs before accepting the push) and
post-receive (runs after accepting the push) are trivial adaptations,
should they be needed.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-07-13 15:24:00 +01:00
Hidde Beydals 7abcaccde9
Merge pull request #127 from fluxcd/runtime-patch-envtest 2021-07-13 10:49:14 +02:00
Hidde Beydals 2d7898f656 runtime: update apis/meta dependency to v0.11.0 RC
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-13 10:38:09 +02:00
Hidde Beydals 3cace7a518 build: move actions tests to separate workflow
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-13 10:33:48 +02:00
Hidde Beydals 461936b207 actions/envtest: set KUBEBUILDER_ASSETS
For end-consomer convenience, overwriting the variable is possible by
overwriting the variable again using `env`:

```yaml
- name: "Example"
  env:
    KUBEBUILDER_ASSETS: /path/overwrite
  run: ...
```

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-13 10:33:48 +02:00
Hidde Beydals 70500430f0 runtime/patch: add integration test using testenv
This was recorded in 723c6bd1e2 as a TODO
because the `testenv` package was not yet available.

The integration tests make use of a `Fake` Kubernetes resource object
that for the time being has been made public from a `testdata` package
in `conditions`. In a future iteration we may want to move it to
`pkg/apis` so that it is available for generic usage during e.g.
testing.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-13 10:33:48 +02:00
Hidde Beydals 6582b854c4
Merge pull request #126 from fluxcd/conditions-type-sort
Order ReconcilingCondition before ReadyCondition
2021-07-13 10:10:11 +02:00
Hidde Beydals fb15e51f02 Order ReconcilingCondition before ReadyCondition
This is more logical, as both `StalledCondition` and
`ReconcilingCondition` are abnormal-true types, and should thus only be
present on a resource when the condition is True.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 19:45:54 +02:00
Hidde Beydals 1e9d46445a
Merge pull request #125 from fluxcd/runtime-readme 2021-07-12 18:45:30 +02:00
Hidde Beydals 4599158c1d runtime: address review nits README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 18:36:55 +02:00
Hidde Beydals e22885e6f1 runtime: link to envtest doc in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 16:47:13 +02:00
Hidde Beydals 883e09f52d runtime: list controller-runtime as "standard"
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 16:22:09 +02:00
Hidde Beydals 5577a1bb13 runtime: document predicates in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 15:52:03 +02:00
Hidde Beydals fbaeedab43 runtime: document errors in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 15:44:18 +02:00
Hidde Beydals f7a1d07175 runtime: note about conditions and meta API pkg
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 15:26:51 +02:00
Hidde Beydals b6d8262744 runtime: document dependency ordering in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 15:15:07 +02:00
Hidde Beydals 6ee5af32e0 runtime: change "usage" order in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 14:58:35 +02:00
Hidde Beydals 063c42dea6 runtime: document recording metrics in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 14:56:21 +02:00
Hidde Beydals 46ccb1185e runtime: document forward events in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 14:17:34 +02:00
Hidde Beydals e4fb0a9a45 runtime: document controller helpers in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 13:46:24 +02:00
Hidde Beydals 666b976895 runtime: document safe patching in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 12:58:24 +02:00
Hidde Beydals 8628d6a17a runtime: document testing in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 12:58:14 +02:00
Hidde Beydals 411b581a31 runtime: document debugging in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 11:37:37 +02:00
Hidde Beydals 00396211bf runtime/pprof: expose Endpoints
This makes them part of the public API (and thereby makes them
documented) and allows overwrites in case this is ever required.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 11:29:52 +02:00
Hidde Beydals 6cd2168597 runtime: document runtime config opts in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 11:29:45 +02:00
Hidde Beydals 4aa5821022 runtime: document conditions pacakge in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 11:28:18 +02:00
Hidde Beydals bf3b7618c4 runtime: document usage in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 11:20:39 +02:00
Hidde Beydals f6e27a9bda runtime: list supported standards in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 11:20:39 +02:00
Hidde Beydals 1f8510d83b runtime: outline package and goals in README
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-12 11:20:39 +02:00
Hidde Beydals 7a2365c02d
Merge pull request #102 from fluxcd/feature/certs
Add TLS package and helper methods to runtime
2021-07-09 11:21:52 +02:00
Philip Laine b65cb52904 Add TLS package and helper methods to runtime
Signed-off-by: Philip Laine <philip.laine@gmail.com>
Co-authored-by: Hidde Beydals <hello@hidde.co>
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-09 11:10:31 +02:00
Hidde Beydals b26176b242
Merge pull request #123 from fluxcd/event-without-meta
Make it easier to send events without metadata
2021-07-08 16:17:28 +02:00
Hidde Beydals ce1544906f Make it easier to send events without metadata
While validating the runtime package changes, it quickly become
cumbersome to pass `nil` for every event that didn't require any
metadata to be attached.

This commit solves this annoyance by renaming the existing methods to
`EventWithMeta` and `EventWithMetaf`, and reintroducing the `Event` and
`Eventf` methods with signatures that do not take any metadata string
map.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-08 16:04:10 +02:00
Hidde Beydals d07f5f4d6d
Merge pull request #122 from fluxcd/testenv-copy
runtime/testenv: give credit where due
2021-07-08 13:26:38 +02:00
Hidde Beydals 9411e86fa6
Merge pull request #121 from fluxcd/remove-deprecated-predicate
Remove deprecated `ReconcileAtAnnotation`
2021-07-08 12:48:13 +02:00
Hidde Beydals 0ff7e51e73 runtime/testenv: give credit where due
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-08 12:45:33 +02:00
Hidde Beydals 7863ff6fe0 Remove deprecated `ReconcileAtAnnotation`
This includes the removal of the predicate and changes to the
`ReconcileAnnotationValue` function.

In retrospect, it would have been better if we at the time had changed
the `LastHandledReconcileAt` field in the `ReconcileRequestStatus`
to something like `LastHandledReconcileRequest`. But I guess this has
now become "weirdness due to historical reasons".

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-08 12:33:24 +02:00
Hidde Beydals 11abd078e2
Merge pull request #101 from fluxcd/conditions-patch-helpers 2021-07-07 21:58:16 +02:00
Hidde Beydals b7eec6318b Fixup: indents in-comment code blocks and wordings
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 25fb8b6229 Document runtime patch package
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 06cface893 Document runtime predicates package
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 7ec4df68b9 Document runtime metrics package
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 65de24f500 Align Go modules with all recent changes
Including some `go <vet|fmt>` changes.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 7b2d1e9e22 Document and extend runtime pprof package
Extension includes the default configuration of mutex profiling, and
inclusion of additional endpoints.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals ac747c72dc Document runtime logger package
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals f248cff07b Document runtime events package
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 95d5db382d Document runtime transform package
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 4ee6f3bd5d Document runtime probes package
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 2d67687f0d Document runtime testenv package
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 0e9caec25c Document runtime leaderelection package
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 0db78f1277 Make runtime errors package errors more generic
Quite a lot of the errors in the package had close to the same meaning,
or could be used together with a context defining wrapping error. They
also assumed knowledge of component implementation details at times.

This commit de-duplicates the and removes the errors in these category,
and also properly documents them.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals bac7da8408 Make runtime dependency package to use meta API
This commit makes the runtime dependency package use the API structs
and interface from our own meta package, and aligns the way we make
assumptions about objects being being controller-runtime compatible
options with that of the other helper packages like `controller` and
`conditions`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 7c2b0b825c Document runtime controller package
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 702679afd6 Document runtime conditions package
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 94067b9f92 Document runtime client package
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals ab781734ed Document meta API package
This includes the renaming and introduction of a set of interfaces around
working with objects that follow GitOps Toolkit conventions.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 16fa76c66c Document Kustomize API package
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 4a7e889999 Further tidying of runtime and meta elements
- Simplification of `*Reason` constants in `meta` API package. They now
  no longer assume to be tied to a specific condition type, and can be
  used as "generic" reasons within the context of a type.

  This includes the removal of the `DependencyNotReady` reason. Instead,
  API objects should have a dedicated condition type that reflects the
  an observation of the state of the dependencies combined with one of
  the generic reasons, or a custom one.
- Change of `ObjectWithStatusConditions` interface to
  `ObjectWithConditions`, and introduction of
  `ObjectWithConditionsSetter`. This interface is further expanded by
  the `conditions` package to perform getter and setter operations on
  API type structures that adhere to the interface.
- Alignment of method names in the `Metrics` helper, and introduction
  of `RecordReconciling` and `RecordStalled` methods to provide
  shortcuts for the generic `meta` condition types.
- Replacement of the private interfaces in the `controller` helpers
  with well-known interfaces for the context they are used in, or are
  already expected to adhere to.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 4bae44778d Expand `SetAggregate` API and features
NB: needs more tests

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 84a9050c0d Allow subset message match in MatchConditions
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 723c6bd1e2 Add `patch` helper to `runtime`
This commit adds a `patch` helper to the `runtime` package, making it
easier to e.g. securely patch status conditions while taking condition
type ownership into account. This ensures that if properly setup, merge
conflicts can be solved by the controller without it accidentally
overwriting state.

The work has been derived from
d2faf48211/util/patch,
but adapted to work with our `conditions` package, and
`metav1.Condition` types.

End-to-end / Ginkgo tests have not been included, as there is no proper
framework for these types of tests yet.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 308c5d6291 Support summarizing to condition other than Ready
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals e1d94e5329 Always update ObservedGeneration on condition Set
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 45d6bb8ee9 Prio Stalled and Reconciling in lexico cond order
This commit ensures `Stalled`, `Ready` and `Reconciling` conditions
are always ordered first while setting and merging conditions.

This eases usage for end-users that are observing a resource via e.g.
`kubectl`, and provides better integration with `kstatus`:
https://github.com/kubernetes-sigs/cli-utils/blob/master/pkg/kstatus/README.md#conditions

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 1cf6ea6a4c Add support for negative polarity conditions
This commit adds support for negative polarity conditions, also
known as "normal-false" or "abnormal-true" types[1], during merge and
set operations.

The polarity is taken into account during sort operations, and results
in the following order:

- P0 - Status=True, NegativePolarity=True
- P1 - Status=False, NegativePolarity=False
- P2 - Condition=True, NegativePolarity=False
- P3 - Status=False, NegativePolarity=True
- P4 - Status=Unknown

This order ensures that condifitions of most importance to the user are
listed first.

[1]: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Hidde Beydals 6df6c0ed6e Add `conditions` helper to `runtime`
This commit adds a helper to work with the conditions of GitOps Toolkit
object kinds, including but not limited to aggregration,
summarization and mirroring of condition types.

The work has been derived from
7478817225/util/conditions
but adapted to work with the `metav1.Condition` and
`metav1.ConditionStatus` types.

More concretely, this includes the removal of "condition severity"
related functionalities, as this is not supported by the
`metav1.Condition` type.

The following work is still required before it can be considered ready
for consumption:

* Support for "negative polarity" or "normal-false" conditions; this is
  required to properly support the `Stalled` and `Reconciling`
  conditions of `meta` (and `kstatus`).
* Summarization to other target conditions than `Ready`; results in a
  more generic API.
* Support setting the `ObservedGeneration` in the status condition.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-07-07 21:46:29 +02:00
Stefan Prodan 70e2be0b11
Merge pull request #116 from fluxcd/meta-bump
Bump apis/meta in runtime
2021-06-25 17:58:42 +03:00
Stefan Prodan 420365034b
Bump apis/meta in runtime
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-06-25 17:49:08 +03:00
Stefan Prodan af0944d139
Merge pull request #115 from fluxcd/controller-runtime-v0.9.2
Update dependencies
2021-06-25 17:23:01 +03:00
Stefan Prodan b059caaee7
Update controller-runtime to v0.9.2
Update k8s.io/* to v0.21.2

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-06-25 17:05:22 +03:00
Stefan Prodan 5bbbfbc64d
Merge pull request #114 from fluxcd/composite-actions
Use composite GitHub actions
2021-06-25 14:23:13 +03:00
Stefan Prodan bd76fcbfbd
Use composite GitHub actions
Add support for AMD64 and ARM64 GitHub runners when installing kubectl, kustomize and helm CLIs

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-06-25 13:37:02 +03:00
Michael Bridgen 77c864db59
Merge pull request #113 from fluxcd/trace-log-level
Trace log level
2021-06-24 13:11:32 +01:00
Michael Bridgen 54475d1a11 Provide consts for logging levels
This is for convenience when doing, e.g.,

    log.V(something).Info(...)

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-06-24 11:16:27 +01:00
Michael Bridgen 9fb49ac503 Add a trace log level
Signed-off-by: Michael Bridgen <michael@weave.works>
2021-06-24 11:12:52 +01:00
Stefan Prodan 671d92954a
Merge pull request #111 from fluxcd/ci-envtest
Add controller runtime envtest GH action
2021-06-16 18:09:16 +03:00
Stefan Prodan e9a6584854
Add envtest GH action
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-06-16 17:41:37 +03:00
Stefan Prodan 09982be0c1
Setup envtest in CI
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-06-16 17:24:59 +03:00
Hidde Beydals ad6daa8dd6
Merge pull request #110 from fluxcd/runtime-testenv
runtime: add `testenv` integration test util
2021-06-16 16:15:34 +02:00
Hidde Beydals a8a8434ded runtime: add `testenv` integration test util
This adds a tiny wrapper around controller-runtime's `testenv` package
so that the configuration for integration tests becomes much easier.

The work is derived from
aa049f15e7/internal/envtest
but offers configuration options to setup Custom Resource Definitions
and the runtime scheme in a generic way.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-06-16 16:03:42 +02:00
Stefan Prodan b1176f6bbb
Merge pull request #109 from Kissy/main
Add generic patches in Kustomization
2021-06-11 12:44:14 +03:00
Guillaume Le Biller a1b524d113
Add generic patches in Kustomization
Will allow patching multiple resources instead of a single existing one as
StrategicMerge & JSON6902 are forced to target existing named resources.

Signed-off-by: Guillaume Le Biller <glebiller@Traveldoo.com>
2021-06-11 09:00:57 +02:00
Hidde Beydals 56c483495d
Merge pull request #106 from fluxcd/update-pkgs 2021-06-08 13:19:03 +02:00
Hidde Beydals 1c87a0ba97 Update Go version in GitHub action to v1.16.x
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-06-08 13:09:11 +02:00
Hidde Beydals f9bdd57a86 Update internal `fluxcd/pkg` deps to latest
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-06-08 13:07:35 +02:00
Hidde Beydals 4cf4c1c55b
Merge pull request #105 from fluxcd/update-deps
Update Go, K8s, controller-runtime and Helm deps
2021-06-08 12:54:18 +02:00
Hidde Beydals 674e064dd8 Update Go, K8s, controller-runtime and Helm deps
- Update `k8s.io/*` to `v0.21.1`
- Update `sigs.k8s.io/controller-runtime` to `v0.9.0`
- Update `helm.sh/helm/v3` to `v3.6.0`
- Update `sigs.k8s.io/controller-tools/cmd/controller-gen` to `v0.5.0`
- Update Go requirement to `v1.16.0`

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-06-08 12:08:36 +02:00
Hidde Beydals f0418f8c4b
Merge pull request #104 from fluxcd/k8s-update
Update K8s dependencies to v1.20.7
2021-06-04 13:09:25 +02:00
Hidde Beydals a45ad3087f Update K8s dependencies to v1.20.7
This ensures we are no longer affected by GO-2021-0053.

In an initial try an attempt was made to also deal with GO-2020-0018
by updating the `github.com/satori/go.uuid` dependency to
`v1.2.1-0.20181028125025-b2ce2384e17b`.

This is however at present not possible due to a change of the `NewV4`
method signature (single value return -> multiple-value), and the
impact of this should be low (if not non-existent) as the
`gittestserver` package is only used during tests.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-06-04 11:05:39 +02:00
Hidde Beydals df1bbeb4f5
Merge pull request #56 from fluxcd/controller-shell 2021-05-14 10:33:18 +02:00
Hidde Beydals 514528d6be Allow metadata to be forwarded with external event
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-05-14 10:25:04 +02:00
Hidde Beydals 0285f1eb6d Drop ObjectReference parameters and improve logger
This commit addresses the two rough edges mentioned by Michael.

> You have to supply an ObjectReference to both the metrics and the
> events methods.

As the helper methods are always called from within a reconciler, and
both events and metrics must only be recorderd for well known
resources, the methods of the helpers should only be called for objects
that do contain data about the kind and/or version.

This means that calling `reference.GetReference` within the helper
methods will generally not result in any errors, nor be a really
expensive calculation.

In cases where the GVK information for some reason is not available
on the object, `GetReference` will still be capable of falling back to
the manager's `runtime.Scheme` that is now injected to the helper.

Resulting in a - in my personal opinion - fair trade-off, and a much
more friendly API from the consumer's perspective.

> You have to pass logs in to the Events helper.

By relying on the context of the reconcile operation we get a logger
(with object metadata preconfigured) for free.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-05-14 10:25:04 +02:00
Hidde Beydals b3971e259f Add `RecordConditionMetric` method helper
To allow recording metrics for conditions other than just the readiness
status.

The `RecordReadinessMetric` method is kept in place for API consumption
convenience.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-05-14 10:25:04 +02:00
Hidde Beydals 6b73e40cf6 Add reason and map severity to K8s core event type
This commit adds support for providing a reason to the Event method,
and maps the severity of an event to a K8s core event type. This makes
the emitted events in-line with Kubernetes standards, and is beneficial
to the Flux UI: https://github.com/fluxcd/webui/pull/13

The reason to not fully depend on the K8s event type and drop the
severity is because there have been reports from users wanting to have
access to "debug" events, a type not known to Kubernetes.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-05-14 10:25:04 +02:00
Michael Bridgen 6abebaad34 Create Events helper struct
This adds the capability of sending events to Kubernetes and the
notification controller.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-05-14 10:25:04 +02:00
Michael Bridgen b36ece8a75 Create metrics helper struct
This adds a struct which can be embedded in a reconciler, which
contains the metrics recording logic.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-05-14 10:25:04 +02:00
Stefan Prodan f110e27c00
Merge pull request #100 from fluxcd/cleanup
Cleanup test files
2021-05-13 20:27:53 +03:00
Stefan Prodan 287a075be2
Cleanup test files
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-05-13 17:30:23 +03:00
Hidde Beydals 716a45d044
Merge pull request #99 from SomtochiAma/ssh-preferred-keys 2021-04-28 15:40:50 +02:00
Somtochi Onyekwere 85a5bcf8dc Adds better comments
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-04-28 14:22:33 +01:00
Somtochi Onyekwere 6b082c397e Adds better comments
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-04-28 13:45:07 +01:00
Somtochi Onyekwere ebfb4c7894 Add preferred key algorithms
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-04-28 12:38:04 +01:00
Stefan Prodan f0ec65b20a
Merge pull request #98 from fluxcd/runtime-v0.11.0
Update runtime to api/meta v0.9.0
2021-04-21 12:17:15 +03:00
Stefan Prodan b59871b156
Update runtime to api/meta v0.9.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-04-21 12:04:26 +03:00
Stefan Prodan e53ffab9fd
Merge pull request #97 from SomtochiAma/kstatus-conditions
Add stalled and reconciling condition
2021-04-21 12:00:27 +03:00
Somtochi Onyekwere 9314a4121b Add stalled and reconciling condition
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-04-20 21:18:40 +01:00
Stefan Prodan f05fecc693
Merge pull request #96 from fluxcd/rate-limited-events
Avoid retrying rate limited events
2021-04-19 14:33:58 +03:00
Stefan Prodan 1b0792bd34
Avoid retrying rate limited events
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-04-19 14:03:31 +03:00
Stefan Prodan 0867f3fab0
Merge pull request #86 from fluxcd/openapi2jsonschema
Add GH Action to generate OpenAPI JSON schema from Kubernetes CRD
2021-04-13 13:17:06 +03:00
Stefan Prodan 49e26aa2ee
Split multi-doc CRDs
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-04-13 11:53:23 +03:00
Stefan Prodan 3dbe1ee3f9
Add GH Action to generate OpenAPI JSON schema from Kubernetes CRD
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-04-13 10:21:29 +03:00
Stefan Prodan 196a3bafdb
Merge pull request #93 from fluxcd/fix-le
Set leader election Lease duration to 35s
2021-03-25 12:40:11 +02:00
Stefan Prodan 98bdf3b6e9
Set leader election Lease duration to 35s
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-03-25 12:31:52 +02:00
Stefan Prodan 1d56dd85a1
Merge pull request #92 from fluxcd/leaderelection-options
Add leader election config to runtime
2021-03-25 11:20:44 +02:00
Stefan Prodan c294d46d93
Add leader election config to runtime
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-03-25 11:16:20 +02:00
Stefan Prodan 8ef4a8f70f
Merge pull request #91 from SomtochiAma/record-deepcopy
Generate deepcopy method for event
2021-03-20 11:49:01 +02:00
Somtochi Onyekwere 9a29a951c9 Generate deepcopy method for event
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-03-20 10:37:35 +01:00
Stefan Prodan 276ad9374f
Merge pull request #90 from SomtochiAma/runtime-suspend
Uses suspendGuage in RecordSuspend
2021-03-17 10:46:50 +02:00
Somtochi Onyekwere 4efd97c713 Uses suspendGuage
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-03-17 03:30:21 +01:00
Stefan Prodan ec8435eac0
Merge pull request #89 from fluxcd/controller-runtime-v0.8.3
Update controller-runtime to v0.8.3
2021-03-09 14:50:39 +02:00
Stefan Prodan f879c7e93a
Update controller-runtime to v0.8.3
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-03-09 12:56:37 +02:00
Michael Bridgen 750af4f10b
Merge pull request #88 from fluxcd/git-err-msg
Transpose git error tidiers from image-automation
2021-03-02 15:38:37 +00:00
Michael Bridgen b359974a8c Transpose git error tidiers from image-automation
This adds the git error tidiers from

  https://github.com/fluxcd/image-automation-controller/pull/115

to fluxcd/pkg/gitutil, so they can be used elsewhere e.g., in
source-controller.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-03-02 13:58:32 +00:00
Stefan Prodan 7761407a8e
Merge pull request #87 from fluxcd/controller-runtime-v0.8.2
Update controller-runtime to v0.8.2
2021-02-19 13:20:07 +02:00
Stefan Prodan 641a6915ab
Update controller-runtime to v0.8.2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-02-19 13:05:00 +02:00
Hidde Beydals be0a96bbd6
Merge pull request #85 from arbourd/move-merge-maps
Move MergeMaps from helm-controller
2021-02-15 17:51:54 +01:00
Dylan Arbour 704d478258 Move MergeMaps from helm-controller
8492473195/internal/util/util.go (L29-L51)

Signed-off-by: Dylan Arbour <arbourd@users.noreply.github.com>
2021-02-15 11:07:31 -05:00
Michael Bridgen 572bd22a2a
Merge pull request #83 from fluxcd/git-auth
Add method to GitServer to switch auth on
2021-02-11 13:29:28 +00:00
Michael Bridgen fb91554ba9 Add method to GitServer to switch auth on
When testing using gittestserver, it's useful to be able to use
authentication. This is especially true when testing against libgit2,
because it expects to use authentication over SSH, and will balk if
it's not requested.

This commit adds a method to *GitServer for switching auth on. There's
no way to switch auth on for just SSH -- it will also be required for
HTTP. For that reason, a username and password are needed.

The credentials are included in the URL returned by
HTTPAddressWithCredentials(), so anything using that will
transparently work whether auth is on or not. If you need to test
authentication with HTTP, use `s.HTTPAddress()` and the credentials
you handed to `s.Auth()`.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-02-11 13:13:36 +00:00
Michael Bridgen 09262f96a9
Merge pull request #82 from fluxcd/test-ssh-gittestserver
Make SSH server usable for testing
2021-02-10 08:02:28 +00:00
Michael Bridgen 42adaa888d Separate ListenSSH from StartSSH
`StartSSH()` doesn't return until `StopSSH()` is called (or there's an
error). This makes it difficult to use in tests, since you will
usually want to know the address to use before proceeding with the
rest of the test, but the listener must be created before it can be
obtained.

This commit adds a `ListenSSH()`, which creates the SSH server and
listener on localhost, then returns. That means you can call
`ListenSSH()`, get the address, start a goroutine to run StartSSH(),
then complete the test (and `StopSSH()`).

The semantics of how to use SSH server is different now: instead of
StartSSH creating a new server (with a new listener), both ListenSSH()
and StartSSH() create a server _if it hasn't been created
already_. This is necessary because creating a new listener each time
invalidates any address obtained from `SSHAddress()` previously,
making the test control flow above impossible.

Another change, for testing convenience: `SSHAddress()` now returns a
URL you can use with git, like `HTTPAddress()` does.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-02-09 16:53:44 +00:00
Michael Bridgen b222d73e6e Ensure that StartSSH works
The underlying library, gitkit, expects to have a KeyDir supplied in
its *Config when running an SSH server. It's uncertain whether
StartSSH is used anywhere (and it wouldn't work, if it is); but for
the least disruption, I have added a func for supplying the KeyDir
value rather than changing the signature of any existing func.

Since StartSSH blocks when it succeeds, the test has to do a kludge
with a timer to be able to exit.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-02-08 18:04:19 +00:00
Hidde Beydals 7c4805e8a4
Merge pull request #81 from fluxcd/runtime-pprof 2021-02-07 11:42:04 +01:00
Hidde Beydals 6c2943b9ff Add helper for setting up pprof handlers
This follows the suggestion of controller-runtime to use the metrics
server for registering the handlers using `AddMetricsExtraHandler`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-02-07 11:25:45 +01:00
Hidde Beydals 5237a0affc
Merge pull request #80 from fluxcd/gitlab-use-path 2021-02-04 16:23:33 +01:00
Hidde Beydals d9ac5fab23 Split `getProjects` method into dedicated methods
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-02-04 16:12:01 +01:00
Hidde Beydals 2b42f3fb5a git: drop usage of Name for GitLab operations
During the development of the provider a mistake was made, and the
repository was created using the `Name` field instead of the `Path`.
The result of this is that GitLab will create a `Path` based on the
provided `Name`, with a random (number) suffix added, resulting in
all sorts of issues (and work around attempts) down the line.

By only working with `Path` fields, and assuming that the provided
repository name is a path, the look ups we make are now guaranteed
to always return the same group, subgroup or repository.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-02-04 15:47:29 +01:00
Hidde Beydals 50807dc3c0
Merge pull request #79 from fluxcd/git-update-deps
Update `git` dependencies
2021-02-04 15:23:28 +01:00
Hidde Beydals 0e910fd683 Update `git` dependencies
- google/go-github to v33.0.0
  Breaking changes have no impact on us:
  https://github.com/google/go-github/releases/tag/v33.0.0
- xanzy/go-gitlab to v0.43.0

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-02-04 14:20:11 +01:00
Hidde Beydals 3ae26dc645
Merge pull request #78 from fluxcd/meta-api-deepcopy 2021-02-04 09:20:41 +01:00
Hidde Beydals f622a2bcee Enable deepcopy gen for meta API
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-02-03 22:57:46 +01:00
Hidde Beydals a77cc488d4
Merge pull request #77 from fluxcd/kustomize-api
Introduce Kustomize API group
2021-02-03 19:36:25 +01:00
Hidde Beydals 0a3c4dde5c Add `make` target to generate deepcopy methods
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-02-03 18:19:42 +01:00
Hidde Beydals c9274a8cd2 Introduce Kustomize API group
This commit introduces a specific set of structures to work with
Kustomize patches without depending directly on the Kustomize API,
and provide simple validation for the JSON6902 operations.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-02-03 18:01:40 +01:00
Stefan Prodan 736039c5aa
Merge pull request #76 from defreng/bugfix/75-github-no-required-access-level
Drop required access level when listing groups using the GitLab API
2021-01-21 17:39:28 +02:00
Alexander Hungenberg f3b72d8fb7 dropping required access level when listing groups using the GitLab API
This will make it possible to use project-level access tokens

Resolves: #75
Signed-off-by: Alexander Hungenberg <alexander.hungenberg@roche.com>
2021-01-21 14:16:27 +01:00
Stefan Prodan 809a301695
Merge pull request #74 from fluxcd/runtime-client
Add Kubernetes client options (QPS and Burst) to runtime
2021-01-21 13:01:51 +02:00
Stefan Prodan 59e74c8939
Use pflag for logger options
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-21 12:50:32 +02:00
Stefan Prodan 05db12b44b
Add Kubernetes client options (QPS and Burst) to runtime
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-21 12:43:43 +02:00
Stefan Prodan c6968c351f
Merge pull request #73 from fluxcd/ref-types
Add object ref types
2021-01-21 12:06:53 +02:00
Stefan Prodan 05f52bf565
Add cross-namespace object ref types
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-21 11:49:26 +02:00
Stefan Prodan 9c9c40ec8d
Merge pull request #72 from SomtochiAma/find-gitlab-path
GitLab: Check both the name and the path when searching for groups
2021-01-19 13:22:53 +02:00
Somtochi Onyekwere 8367847e67 Check both name and path for gitlab group
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-01-18 14:44:36 +01:00
Stefan Prodan cc0947dbac
Merge pull request #71 from fluxcd/controller-runtime-v0.8.0
Update controller-runtime to v0.8.0
2021-01-16 14:06:16 +02:00
Stefan Prodan 860f52494b
Update controller-runtime to v0.8.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-15 17:52:49 +02:00
Stefan Prodan 0e35b40f60
Merge pull request #70 from fluxcd/k8s.io/api-v0.20.2
Update Kubernetes packages to v1.20.2
2021-01-15 17:35:34 +02:00
Stefan Prodan 06bc798eb8
Update Kubernetes packages to v1.20.2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-01-15 17:17:45 +02:00
Hidde Beydals 65dd04b7e2
Merge pull request #67 from SomtochiAma/correct-group-search 2021-01-14 18:12:44 +01:00
Somtochi Onyekwere 5bac694989 Deprecate GetRepositoryOwner function
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-01-14 14:51:17 +01:00
Somtochi Onyekwere 095cc0ee54 Ensure correct group is gotten from gitlab search
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-01-14 11:11:48 +01:00
Hidde Beydals 787b3658f0
Merge pull request #69 from fluxcd/rename-predicate 2021-01-14 10:51:27 +01:00
Hidde Beydals 78080d7cf5 Rename predicate to ReconcileRequestedPredicate
This changes the name of the predicate (that contained a typo) from
`ReconcilateAtChangedPredicate` to `ReconcileRequestedPredicate`,
which does _not_ contain a typo and is more in-line with the naming
of the `ReconcileRequestAnnotation`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-01-14 10:47:32 +01:00
Michael Bridgen d62a7924f7
Merge pull request #68 from fluxcd/unswap-reconcile-predicate
Fix false negatives from reconcile-at predicate
2021-01-13 19:44:49 +00:00
Michael Bridgen 09c034210c Fix false negatives from reconcile-at predicate
The logic of the (newly separated) ReconcileAtChanged predicate should
be:

    if new object has reconcileAt annotation
      if old obj has different or no annotation -> true
    else -> false

However the old and new object were swapped around, leading to

    if old object has reconcileAt annotation
    ...

which results in `false` when the annotation has just been applied,
when it should be `true`.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-01-13 18:57:52 +00:00
Stefan Prodan 01a61cb045
Merge pull request #66 from SomtochiAma/gitlab-path
Add GetRepositoryOwner function to Git provider
2021-01-11 16:58:56 +02:00
Somtochi Onyekwere 64749c100a add GetRepositoryOwner func
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-01-11 15:00:21 +01:00
Stefan Prodan 8317841059
Merge pull request #65 from SomtochiAma/gitlab-subgroups
Search subgroups in gitlab
2021-01-11 13:04:44 +02:00
Somtochi Onyekwere 69288e3244 search for subgroups in gitlab
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-01-11 11:58:07 +01:00
Hidde Beydals 29767bbc57
Merge pull request #64 from fluxcd/runtime-logger-json-def
Make "json" the listed log-encoding default
2020-12-18 09:30:19 +01:00
Hidde Beydals 553b5a3a8b Make "json" the listed log-encoding default
Signed-off-by: Hidde Beydals <hello@hidde.co>
2020-12-18 09:22:58 +01:00
Hidde Beydals 9e1fe564d7
Merge pull request #63 from fluxcd/runtime/controller-runtime-v0.7.0 2020-12-17 13:51:43 +01:00
Hidde Beydals 7bbb6fc8b5 Refactor logger configuration
This commit refactors the `runtime/logger` package so that consumers
can bind their flagset to the default flag configuration, making it
easier for all consumers to follow the same contract.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2020-12-17 13:44:32 +01:00
Hidde Beydals 1a6324556a Turn Change into ReconcilateAtChanged predicate
As predicates can be chained and used in conjunction with others,
it is more useful to do just one thing in the predicate: detecting
changes to the meta.ReconcileAtAnnotation.

The generation changes can still be detected by chaining the predicate
together with the predicate.GenerationChangedPredicate from
controller-runtime itself using predicate.Or.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2020-12-16 22:09:46 +01:00
Hidde Beydals b5deaf7c29 Upgrade controller-runtime to v0.7.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2020-12-16 22:09:43 +01:00
Stefan Prodan 7d41e2d1cc
Merge pull request #58 from sylr/suspend-metric
Add gotk_suspend_status metric
2020-12-11 17:53:31 +02:00
Sylvain Rabot 055a131850
Add gotk_suspend_status metric
Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
2020-12-11 16:46:05 +01:00
608 changed files with 82978 additions and 3440 deletions

17
.github/CODEOWNERS vendored
View File

@ -1,3 +1,14 @@
git/* @stefanprodan
ssh/* @hiddeco
testserver/* @hiddeco
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence.
* @fluxcd/core-maintainers
# The following have a bit more specific owners and require e.g.
# specific domain expertise.
/actions/ @stefanprodan
/apis/ @hiddeco @stefanprodan
/ssa/ @stefanprodan
/runtime/ @hiddeco @stefanprodan
/sourceignore/ @hiddeco
/kustomize/ @stefanprodan
/git/ @aryan9600 @hiddeco
/oci/ @stefanprodan

16
.github/dependabot.yaml vendored Normal file
View File

@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
labels: ["area/ci", "dependencies"]
groups:
# Group all updates together, so that they are all applied in a single PR.
# Grouped updates are currently in beta and is subject to change.
# xref: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#groups
ci:
patterns:
- "*"
schedule:
# By default, this will be on a monday.
interval: "weekly"

30
.github/labels.yaml vendored Normal file
View File

@ -0,0 +1,30 @@
# Configuration file to declaratively configure labels
# Ref: https://github.com/EndBug/label-sync#Config-files
- name: area/actions
description: GitHub Actions related issues and pull requests
color: '#00b140'
- name: area/git
description: Git and SSH related issues and pull requests
color: '#863faf'
- name: area/helm
description: Helm related issues and pull requests
color: '#1673b6'
- name: area/http
description: HTTP transport related issues and pull requests
color: '#006b75'
- name: area/oci
description: OCI related issues and pull requests
color: '#c739ff'
- name: area/kustomize
description: Kustomize related issues and pull requests
color: '#00e54d'
- name: area/runtime
description: Controller runtime related issues and pull requests
color: '#00e54d'
- name: area/server-side-apply
description: SSA related issues and pull requests
color: '#2819CB'
- name: area/testserver
description: Test server related issues and pull requests
color: '#006b75'

40
.github/workflows/actions.yaml vendored Normal file
View File

@ -0,0 +1,40 @@
name: actions
on:
pull_request:
push:
paths:
- 'actions/**'
branches:
- main
permissions: read-all
jobs:
actions:
strategy:
fail-fast: false
matrix:
version: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.version }}
name: actions on ${{ matrix.version }}
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup yq
uses: ./actions/yq
- name: Setup kubeconform
uses: ./actions/kubeconform
- name: Setup envtest
uses: ./actions/envtest
with:
version: c7e1dc9b5302d649d5531e19168dd7ea0013736d # remove this when https://github.com/kubernetes-sigs/controller-runtime/issues/2720 is fixed
- name: Setup helm
uses: ./actions/helm
- name: Setup kubectl
uses: ./actions/kubectl
- name: Setup kustomize
uses: ./actions/kustomize
- name: Setup sops
uses: ./actions/sops

View File

@ -6,33 +6,30 @@ on:
branches:
- main
permissions: read-all
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Restore Go cache
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: 1.15.x
go-version: 1.24.x
# https://github.com/actions/setup-go/blob/main/docs/adrs/0000-caching-dependencies.md#example-of-real-use-cases
cache-dependency-path: |
**/go.sum
**/go.mod
- name: Run tests
run: make all
env:
SKIP_COSIGN_VERIFICATION: true
run: make test
- name: Check if working tree is dirty
run: |
if [[ $(git diff --stat) != '' ]]; then
echo 'run make test and commit changes'
git --no-pager diff
echo 'run make all and commit changes'
exit 1
fi
- uses: ./actions/helm
- uses: ./actions/kubebuilder
- uses: ./actions/kubectl
- uses: ./actions/kustomize
- run: kubebuilder version

25
.github/workflows/cifuzz.yaml vendored Normal file
View File

@ -0,0 +1,25 @@
name: fuzz
on:
pull_request:
branches:
- main
permissions: read-all
jobs:
smoketest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: 1.24.x
# https://github.com/actions/setup-go/blob/main/docs/adrs/0000-caching-dependencies.md#example-of-real-use-cases
cache-dependency-path: |
**/go.sum
**/go.mod
- name: Smoke test Fuzzers
run: make fuzz-smoketest

89
.github/workflows/e2e.yaml vendored Normal file
View File

@ -0,0 +1,89 @@
name: e2e
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
contents: read
jobs:
git-test:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
provider:
- gitkit
- gitlab-ce
- gitlab
- github
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
# Since this is a monorepo, changes in other packages will also trigger these e2e tests
# meant only for the git package. This detects us whether the changed files are part of the
# git directory. Subsequent steps check if this is true, before executing, thus helping us
# run these tests only when there are changes to the git package.
- name: Check for changes to git/ or e2e workflow
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
e2e:
- '.github/workflows/e2e.yaml'
git:
- 'git/**'
- name: Setup Go
if: ${{ steps.filter.outputs.git == 'true' || steps.filter.outputs.e2e == 'true' || github.event_name == 'workflow_dispatch' }}
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: 1.24.x
# https://github.com/actions/setup-go/blob/main/docs/adrs/0000-caching-dependencies.md#example-of-real-use-cases
cache-dependency-path: |
**/go.sum
**/go.mod
- name: Run tests
if: ${{ steps.filter.outputs.git == 'true' || steps.filter.outputs.e2e == 'true' || github.event_name == 'workflow_dispatch' }}
run: |
run_e2e=true
# don't run e2e tests for PRs from forked repos for Github, GitLab and Bitbucket Server
if [[ ${{ github.event_name }} != "pull_request" ]] || \
[[ "${{ github.event.pull_request.head.repo.full_name }}" = ${{ github.repository }} ]]; then
if [[ ${{ matrix.provider }} = "github" ]]; then
export GO_TEST_PREFIX="TestGitHubE2E"
export GITHUB_USER="fluxcd-gitprovider-bot"
export GITHUB_ORG="fluxcd-testing"
export GITHUB_TOKEN="${{ secrets.GITPROVIDER_BOT_TOKEN }}"
export GHAPP_ID="${{ secrets.GHAPP_ID }}"
export GHAPP_INSTALL_ID="${{ secrets.GHAPP_INSTALL_ID }}"
export GHAPP_PRIVATE_KEY="${{ secrets.GHAPP_PRIVATE_KEY }}"
elif [[ ${{ matrix.provider }} = "gitlab" ]]; then
export GO_TEST_PREFIX="TestGitLabE2E"
export GITLAB_USER="fluxcd-gitprovider-bot"
export GITLAB_GROUP="fluxcd-testing"
export GITLAB_PAT="${{ secrets.GITLAB_BOT_TOKEN }}"
fi
else
run_e2e=false
fi
if [[ ${{ matrix.provider }} = "gitkit" ]]; then
export GO_TEST_PREFIX="TestGitKitE2E"
run_e2e=true
elif [[ ${{ matrix.provider }} = "gitlab-ce" ]]; then
export GO_TEST_PREFIX="TestGitLabCEE2E"
run_e2e=true
fi
if [ $run_e2e = true ]; then
cd git/internal/e2e && GO_TEST_PREFIX="${GO_TEST_PREFIX}" ./run.sh
else
echo "skipping tests for ${{ matrix.provider }}"
fi

69
.github/workflows/integration-aws.yaml vendored Normal file
View File

@ -0,0 +1,69 @@
name: integration-aws
on:
workflow_dispatch:
schedule:
- cron: "0 12 * * *"
# push:
# branches:
# - main
permissions:
contents: read
id-token: write # Required for obtaining AWS OIDC federated credential.
jobs:
oci-test:
runs-on: ubuntu-latest
strategy:
matrix:
auth-mode:
- node-identity
- workload-identity
fail-fast: false
defaults:
run:
working-directory: ./oci/tests/integration
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: 1.24.x
cache-dependency-path: oci/tests/integration/go.sum
- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.OCI_E2E_AWS_ASSUME_ROLE_NAME }}
role-session-name: OCI_GH_Actions
aws-region: us-east-1
- name: Setup QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Set dynamic variables in .env
run: |
cat > .env <<EOF
export TF_VAR_rand=${RANDOM}
export TF_VAR_tags='{"environment"="github", "ci"="true", "repo"="pkg", "createdat"="$(date -u +x%Y-%m-%d_%Hh%Mm%Ss)"}'
EOF
- name: Print .env for dynamic tag value reference
run: cat .env
- name: Build test app
run: make docker-build
- name: Run tests
run: . .env && make test-aws
env:
AWS_REGION: us-east-1
TF_VAR_cross_region: us-east-2
TF_VAR_enable_wi: ${{ (matrix.auth-mode == 'workload-identity' && 'true') || 'false' }}
- name: Ensure resource cleanup
if: ${{ always() }}
run: . .env && make destroy-aws
env:
AWS_REGION: us-east-1
TF_VAR_cross_region: us-east-2
TF_VAR_enable_wi: ${{ (matrix.auth-mode == 'workload-identity' && 'true') || 'false' }}

View File

@ -0,0 +1,91 @@
name: integration-azure
on:
workflow_dispatch:
schedule:
- cron: "0 12 * * *"
# push:
# branches:
# - main
permissions:
contents: read
jobs:
oci-test:
runs-on: ubuntu-latest
strategy:
matrix:
auth-mode:
- node-identity
- workload-identity
fail-fast: false
defaults:
run:
working-directory: ./oci/tests/integration
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: 1.24.x
cache-dependency-path: oci/tests/integration/go.sum
- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
- name: Authenticate to Azure
uses: Azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v1.4.6
with:
creds: '{"clientId":"${{ secrets.ARM_CLIENT_ID }}","clientSecret":"${{ secrets.ARM_CLIENT_SECRET }}","subscriptionId":"${{ secrets.ARM_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.ARM_TENANT_ID }}"}'
- name: Setup QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Set dynamic variables in .env
run: |
cat > .env <<EOF
export TF_VAR_tags='{"environment"="github", "ci"="true", "repo"="pkg", "createdat"="$(date -u +x%Y-%m-%d_%Hh%Mm%Ss)"}'
EOF
- name: Print .env for dynamic tag value reference
run: cat .env
- name: Build test app
run: make docker-build
- name: Prepare Git SSH secrets
run: |
mkdir -p azure
cat <<EOF > azure/identity
$GIT_SSH_IDENTITY
EOF
cat <<EOF > azure/identity.pub
$GIT_SSH_IDENTITY_PUB
EOF
cat <<EOF > azure/known_hosts
$GIT_SSH_KNOWN_HOSTS
EOF
env:
GIT_SSH_IDENTITY: ${{ secrets.GIT_SSH_IDENTITY }}
GIT_SSH_IDENTITY_PUB: ${{ secrets.GIT_SSH_IDENTITY_PUB }}
GIT_SSH_KNOWN_HOSTS: ${{ secrets.GIT_SSH_KNOWN_HOSTS }}
- name: Run tests
run: . .env && make test-azure
env:
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
TF_VAR_azuredevops_org: ${{ secrets.TF_VAR_azuredevops_org }}
TF_VAR_azuredevops_pat: ${{ secrets.TF_VAR_azuredevops_pat }}
TF_VAR_azure_location: ${{ vars.TF_VAR_azure_location }}
TF_VAR_enable_wi: ${{ (matrix.auth-mode == 'workload-identity') && 'true' || 'false' }}
- name: Ensure resource cleanup
if: ${{ always() }}
run: . .env && make destroy-azure
env:
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
TF_VAR_azuredevops_org: ${{ secrets.TF_VAR_azuredevops_org }}
TF_VAR_azuredevops_pat: ${{ secrets.TF_VAR_azuredevops_pat }}
TF_VAR_azure_location: ${{ vars.TF_VAR_azure_location }}
TF_VAR_enable_wi: ${{ (matrix.auth-mode == 'workload-identity') && 'true' || 'false' }}

View File

@ -0,0 +1,107 @@
name: integration-cleanup
on:
workflow_dispatch:
schedule:
- cron: "0 * * * *"
permissions:
id-token: write # Required for obtaining AWS OIDC federated credential.
env:
GCRGC_VERSION: 0.4.8
jobs:
gcp:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tools/reaper
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: fluxcd/test-infra
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: 1.24.x
cache-dependency-path: ./tools/reaper/go.sum
- name: Setup bin dir
run: mkdir -p ~/.local/bin
- name: Populate local env
# This is needed to be able to use the global env as local env in cache
# key.
run: echo "GCRGC_VERSION=${GCRGC_VERSION}" >> $GITHUB_ENV
- name: Cache gcrgc
id: cache-gcrgc
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: ~/.local/bin/gcrgc
key: gcrgc-${{ env.GCRGC_VERSION }}
- name: Install gcrgc
if: steps.cache-gcrgc.outputs.cache-hit != 'true'
run: |
cd $(mktemp -d)
wget https://github.com/graillus/gcrgc/releases/download/v${GCRGC_VERSION}/gcrgc_${GCRGC_VERSION}_linux_amd64.tar.gz -O - | tar xz
mv gcrgc ~/.local/bin/
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@b7593ed2efd1c1617e1b0254da33b86225adb2a5 # v2.1.12
with:
credentials_json: '${{ secrets.CLEANUP_E2E_GOOGLE_CREDENTIALS }}'
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@cb1e50a9932213ecece00a606661ae9ca44f3397 # v2.2.0
- name: Run gcrgc
# Cleanup all the GCR repositories in the project. They are not tracked
# by terraform used to provision test infra and are left behind.
run: gcrgc gcr.io/${{ vars.TF_VAR_gcp_project_id }} --retention-period 1h
- name: Run reaper
run: go run ./ -provider gcp -gcpproject ${{ vars.TF_VAR_gcp_project_id }} -retention-period 1h -tags 'ci=true' -delete
azure:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tools/reaper
if: true
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: fluxcd/test-infra
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: 1.24.x
cache-dependency-path: ./tools/reaper/go.sum
- name: Authenticate to Azure
uses: Azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v1.4.6
with:
creds: '{"clientId":"${{ secrets.ARM_CLIENT_ID }}","clientSecret":"${{ secrets.ARM_CLIENT_SECRET }}","subscriptionId":"${{ secrets.ARM_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.ARM_TENANT_ID }}"}'
- name: Run reaper
run: go run ./ -provider azure -retention-period 1h -tags 'ci=true' -delete
aws:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tools/reaper
if: true
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: fluxcd/test-infra
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: 1.24.x
cache-dependency-path: ./tools/reaper/go.sum
- name: Authenticate to AWS
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.CLEANUP_E2E_AWS_ASSUME_ROLE_NAME }}
role-session-name: cleanup_GH_Actions
aws-region: ${{ vars.AWS_REGION }}
- name: Run reaper
run: go run ./ -provider aws-nuke -awsregions '${{ vars.AWS_REGION }},${{ vars.OCI_E2E_TF_VAR_cross_region }}' -retention-period 1h -tags 'ci=true' -delete

83
.github/workflows/integration-gcp.yaml vendored Normal file
View File

@ -0,0 +1,83 @@
name: integration-gcp
on:
workflow_dispatch:
schedule:
- cron: "0 12 * * *"
# push:
# branches:
# - main
permissions:
contents: read
jobs:
oci-test:
runs-on: ubuntu-latest
strategy:
matrix:
auth-mode:
- node-identity
- workload-identity
fail-fast: false
defaults:
run:
working-directory: ./oci/tests/integration
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: 1.24.x
cache-dependency-path: oci/tests/integration/go.sum
- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@b7593ed2efd1c1617e1b0254da33b86225adb2a5 # v2.1.12
id: 'auth'
with:
credentials_json: '${{ secrets.OCI_E2E_GOOGLE_CREDENTIALS }}'
token_format: 'access_token'
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@cb1e50a9932213ecece00a606661ae9ca44f3397 # v2.2.0
- name: Setup QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Log into gcr.io
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with:
registry: gcr.io
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Log into us-central1-docker.pkg.dev
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with:
registry: us-central1-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Set dynamic variables in .env
run: |
cat > .env <<EOF
export TF_VAR_tags='{"environment"="github", "ci"="true", "repo"="pkg", "createdat"="$(date -u +x%Y-%m-%d_%Hh%Mm%Ss)"}'
EOF
- name: Print .env for dynamic tag value reference
run: cat .env
- name: Build test app
run: make docker-build
- name: Run tests
run: . .env && make test-gcp
env:
TF_VAR_gcp_project_id: ${{ vars.TF_VAR_gcp_project_id }}
TF_VAR_gcp_region: ${{ vars.TF_VAR_gcp_region }}
TF_VAR_gcp_zone: ${{ vars.TF_VAR_gcp_zone }}
TF_VAR_enable_wi: ${{ (matrix.auth-mode == 'workload-identity' && 'true') || 'false' }}
- name: Ensure resource cleanup
if: ${{ always() }}
run: . .env && make destroy-gcp
env:
TF_VAR_gcp_project_id: ${{ vars.TF_VAR_gcp_project_id }}
TF_VAR_gcp_region: ${{ vars.TF_VAR_gcp_region }}
TF_VAR_gcp_zone: ${{ vars.TF_VAR_gcp_zone }}
TF_VAR_enable_wi: ${{ (matrix.auth-mode == 'workload-identity' && 'true') || 'false' }}

55
.github/workflows/ossf.yaml vendored Normal file
View File

@ -0,0 +1,55 @@
name: ossf
on:
workflow_dispatch:
branch_protection_rule:
schedule:
# Weekly on Saturdays.
- cron: '30 1 * * 6'
push:
branches: [ main ]
permissions: read-all
jobs:
analysis:
name: Scorecards analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Used to receive a badge. (Upcoming feature)
id-token: write
actions: read
contents: read
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: "Run analysis"
uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
with:
results_file: results.sarif
results_format: sarif
repo_token: ${{ secrets.BOT_GITHUB_TOKEN }}
# Publish the results for public repositories to enable scorecard badges. For more details, see
# https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories, `publish_results` will automatically be set to `false`, regardless
# of the value entered here.
publish_results: true
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: SARIF file
path: results.sarif
retention-days: 5
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # v3.29.8
with:
sarif_file: results.sarif

24
.github/workflows/preview-release.yaml vendored Normal file
View File

@ -0,0 +1,24 @@
name: preview-release
on:
workflow_dispatch:
jobs:
preview-release:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
- run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- run: git config --global user.name "github-actions[bot]"
- run: make tools
- run: ./bin/flux-tools pkg prep --yes
- run: git add .
- run: git commit -m "Release preview" || true
- run: ./bin/flux-tools pkg release --preview

40
.github/workflows/scan.yaml vendored Normal file
View File

@ -0,0 +1,40 @@
name: scan
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '18 10 * * 3'
permissions:
security-events: write
actions: read
contents: read
jobs:
codeql:
name: CodeQL
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: 1.24.x
cache-dependency-path: |
**/go.sum
**/go.mod
- name: Initialize CodeQL
uses: github/codeql-action/init@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # v3.29.8
with:
languages: go
# xref: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# xref: https://codeql.github.com/codeql-query-help/go/
queries: security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # v3.29.8
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # v3.29.8

28
.github/workflows/sync-labels.yaml vendored Normal file
View File

@ -0,0 +1,28 @@
name: sync-labels
on:
workflow_dispatch:
push:
branches:
- main
paths:
- .github/labels.yaml
permissions:
contents: read
jobs:
labels:
name: Run sync
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2.3.3
with:
# Configuration file
config-file: |
https://raw.githubusercontent.com/fluxcd/community/main/.github/standard-labels.yaml
.github/labels.yaml
# Strictly declarative
delete-other-labels: true

4
.gitignore vendored
View File

@ -13,3 +13,7 @@
# Dependency directories (remove the comment below to include it)
# vendor/
build/
bin/
testbin/

130
Makefile
View File

@ -1,21 +1,64 @@
VER?=0.0.1
MODULES=$(shell find . -mindepth 2 -maxdepth 4 -type f -name 'go.mod' | cut -c 3- | sed 's|/[^/]*$$||' | sort -u | tr / :)
targets=$(addprefix test-, $(MODULES))
root_dir=$(shell git rev-parse --show-toplevel)
all:
$(MAKE) $(targets)
# Use $GOBIN from the environment if set, otherwise use ./bin
ifeq (,$(shell go env GOBIN))
GOBIN=$(root_dir)/bin
else
GOBIN=$(shell go env GOBIN)
endif
PKG?=$*
GO_TEST_ARGS ?= -race
# API generation utilities
CONTROLLER_GEN_VERSION ?= v0.16.1
# Architecture to use envtest with
ENVTEST_ARCH ?= amd64
# Kubernetes versions to use envtest with
ENVTEST_KUBERNETES_VERSION?=1.31
all: tidy generate fmt vet
tidy:
$(MAKE) $(addprefix tidy-, $(MODULES))
tidy-%:
cd $(subst :,/,$*); go mod tidy
cd $(subst :,/,$*); go mod tidy -compat=1.24
fmt:
$(MAKE) $(addprefix fmt-, $(MODULES))
fmt-%:
cd $(subst :,/,$*); go fmt ./...
vet-%:
cd $(subst :,/,$*); go vet ./...
vet:
$(MAKE) $(addprefix vet-, $(MODULES))
test-%: tidy-% fmt-% vet-%
cd $(subst :,/,$*); go test ./... -coverprofile cover.out
vet-%:
cd $(subst :,/,$*); go vet ./... ;\
# Run generate for all modules
generate:
$(MAKE) $(addprefix generate-, $(MODULES))
# Generate manifests e.g. CRD, RBAC etc.
generate-%: controller-gen
cd $(subst :,/,$*); CGO_ENABLED=0 $(CONTROLLER_GEN) schemapatch:manifests="./" paths="./..." ;\
CGO_ENABLED=0 $(CONTROLLER_GEN) object:headerFile="$(root_dir)/hack/boilerplate.go.txt" paths="./..." ;\
# Run tests for all modules
test:
$(MAKE) $(addprefix test-, $(MODULES))
# Run tests
KUBEBUILDER_ASSETS?="$(shell $(ENVTEST) --arch=$(ENVTEST_ARCH) use -i $(ENVTEST_KUBERNETES_VERSION) --bin-dir=$(ENVTEST_ASSETS_DIR) -p path)"
test-%: tidy-% generate-% fmt-% vet-% install-envtest
cd $(subst :,/,$*); KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS) go test ./... $(GO_TEST_ARGS) -coverprofile cover.out ;\
release-%:
$(eval REL_PATH=$(subst :,/,$*))
@ -24,3 +67,74 @@ release-%:
git pull
git tag "$(REL_PATH)/v$(VER)"
git push origin "$(REL_PATH)/v$(VER)"
# Find or download controller-gen
CONTROLLER_GEN = $(GOBIN)/controller-gen
.PHONY: controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_GEN_VERSION))
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
install-envtest: setup-envtest
mkdir -p ${ENVTEST_ASSETS_DIR}
$(ENVTEST) use $(ENVTEST_KUBERNETES_VERSION) --arch=$(ENVTEST_ARCH) --bin-dir=$(ENVTEST_ASSETS_DIR)
ENVTEST = $(GOBIN)/setup-envtest
.PHONY: envtest
setup-envtest: ## Download envtest-setup locally if necessary.
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
# go-install-tool will 'go install' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-install-tool
@[ -f $(1) ] || { \
set -e ;\
TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
go mod init tmp ;\
echo "Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
rm -rf $$TMP_DIR ;\
}
endef
# Build fuzzers used by oss-fuzz.
fuzz-build:
rm -rf $(shell pwd)/build/fuzz/
mkdir -p $(shell pwd)/build/fuzz/out/
docker build . --pull --tag local-fuzzing:latest -f tests/fuzz/Dockerfile.builder
docker run --rm \
-e FUZZING_LANGUAGE=go -e SANITIZER=address \
-e CIFUZZ_DEBUG='True' -e OSS_FUZZ_PROJECT_NAME=fluxcd \
-v "$(shell go env GOMODCACHE):/root/go/pkg/mod" \
-v "$(shell pwd)/build/fuzz/out":/out \
local-fuzzing:latest
# Run each fuzzer once to ensure they will work when executed by oss-fuzz.
fuzz-smoketest: fuzz-build
docker run --rm \
-v "$(shell pwd)/build/fuzz/out":/out \
-v "$(shell pwd)/tests/fuzz/oss_fuzz_run.sh":/runner.sh \
-e ENVTEST_BIN_VERSION=$(ENVTEST_KUBERNETES_VERSION) \
local-fuzzing:latest \
bash -c "/runner.sh"
# Prepare release for Go modules.
.PHONY: prep
prep: tools
@./bin/flux-tools pkg prep
# Release Go modules.
.PHONY: release
release: tools
@./bin/flux-tools pkg release
# Run vet for tools.
.PHONY: tools
tools:
@cd cmd; \
go mod tidy; \
go fmt ./internal/... ./cli/...; \
go vet ./internal/... ./cli/...; \
go build -o ../bin/flux-tools ./cli

View File

@ -3,4 +3,63 @@
[![godev](https://img.shields.io/static/v1?label=godev&message=reference&color=00add8)](https://pkg.go.dev/github.com/fluxcd/pkg)
[![build](https://github.com/fluxcd/pkg/workflows/build/badge.svg)](https://github.com/fluxcd/pkg/actions)
GitOps Toolkit common packages.
## GitOps Toolkit Go SDK
### APIs
- **[github.com/fluxcd/pkg/apis/acl](./apis/acl)** - API types for defining access control lists
- **[github.com/fluxcd/pkg/apis/event](./apis/event)** - API Schema definitions for Flux eventing
- **[github.com/fluxcd/pkg/apis/kustomize](./apis/kustomize)** - API types for Kustomize resources
- **[github.com/fluxcd/pkg/apis/meta](./apis/meta)** - Generic metadata APIs for Kubernetes resources
### Authentication & Security
- **[github.com/fluxcd/pkg/auth](./auth)** - OIDC-based authentication with cloud providers (AWS, Azure, GCP)
- **[github.com/fluxcd/pkg/masktoken](./masktoken)** - Token redaction utilities for secure logging
- **[github.com/fluxcd/pkg/ssh](./ssh)** - SSH host key scanning and management
### Controller Runtime
- **[github.com/fluxcd/pkg/runtime](./runtime)** - Controller Runtime SDK
- **[runtime/acl](./runtime/acl)** - Cross-namespace access control utilities
- **[runtime/cel](./runtime/cel)** - Common Expression Language (CEL) evaluation utilities
- **[runtime/client](./runtime/client)** - Kubernetes client runtime configuration options
- **[runtime/conditions](./runtime/conditions)** - Status conditions manipulation utilities
- **[runtime/controller](./runtime/controller)** - Controller embeddable structs for GitOps Toolkit conventions
- **[runtime/dependency](./runtime/dependency)** - Dependency sorting for Kubernetes resources
- **[runtime/errors](./runtime/errors)** - Generic controller and reconciler runtime errors
- **[runtime/events](./runtime/events)** - Kubernetes Events recording on external HTTP endpoints
- **[runtime/features](./runtime/features)** - Feature gate management
- **[runtime/jitter](./runtime/jitter)** - Jitter utilities for reconciliation intervals
- **[runtime/leaderelection](./runtime/leaderelection)** - Leader election runtime configuration
- **[runtime/logger](./runtime/logger)** - Logging runtime configuration options
- **[runtime/metrics](./runtime/metrics)** - Standard metrics recording for GitOps Toolkit components
- **[runtime/object](./runtime/object)** - Helpers for interacting with GitOps Toolkit objects
- **[runtime/patch](./runtime/patch)** - Patch utilities for conflict-free object patching
- **[runtime/pprof](./runtime/pprof)** - pprof endpoints registration helper
- **[runtime/predicates](./runtime/predicates)** - Controller-runtime predicates for event filtering
- **[runtime/probes](./runtime/probes)** - Health and readiness probes configuration
- **[runtime/reconcile](./runtime/reconcile)** - Reconciliation helpers and result finalization
- **[runtime/secrets](./runtime/secrets)** - Kubernetes secrets handling utilities (TLS, auth, tokens)
- **[runtime/statusreaders](./runtime/statusreaders)** - Status readers for Kubernetes resources
- **[runtime/testenv](./runtime/testenv)** - Setup helpers for local Kubernetes test environment
- **[runtime/transform](./runtime/transform)** - Type transformation utilities
- **[github.com/fluxcd/pkg/ssa](./ssa)** - Kubernetes resources management using server-side apply
### Source Management
- **[github.com/fluxcd/pkg/git](./git)** - Git repository operations, commit verification, and reference handling
- **[github.com/fluxcd/pkg/sourceignore](./sourceignore)** - Gitignore-like functionality for source filtering
### Package Management
- **[github.com/fluxcd/pkg/chartutil](./chartutil)** - Helm chart values management from Kubernetes resources
- **[github.com/fluxcd/pkg/kustomize](./kustomize)** - Generic helpers for Kustomize operations
- **[github.com/fluxcd/pkg/oci](./oci)** - OCI registry operations (push, pull, tag artifacts)
### Utilities
- **[github.com/fluxcd/pkg/cache](./cache)** - Generic cache implementations (expiring and LRU)
- **[github.com/fluxcd/pkg/envsubst](./envsubst)** - Variable expansion in strings using `${var}` syntax
- **[github.com/fluxcd/pkg/lockedfile](./lockedfile)** - Atomic file operations with locking
- **[github.com/fluxcd/pkg/tar](./tar)** - Secure tarball extraction utilities
- **[github.com/fluxcd/pkg/version](./version)** - Semantic version parsing and sorting
### HTTP & Transport
- **[github.com/fluxcd/pkg/http/fetch](./http/fetch)** - Archive fetcher for HTTP resources
- **[github.com/fluxcd/pkg/http/transport](./http/transport)** - HTTP transport utilities

View File

@ -0,0 +1,18 @@
FROM python:3-alpine
RUN pip install --no-cache-dir pyaml
ARG KUBERNETES_SPLIT_YAML_VERSION=0.4.0
RUN wget -q -O - \
https://github.com/mogensen/kubernetes-split-yaml/releases/download/v${KUBERNETES_SPLIT_YAML_VERSION}/kubernetes-split-yaml_${KUBERNETES_SPLIT_YAML_VERSION}_linux_amd64.tar.gz | \
tar xz kubernetes-split-yaml -C /usr/bin/ && \
chmod +x /usr/bin/kubernetes-split-yaml && \
kubernetes-split-yaml -h
COPY openapi2jsonschema.py /usr/bin/openapi2jsonschema
RUN chmod +x /usr/bin/openapi2jsonschema
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -0,0 +1,19 @@
name: crdjsonschema
description: Generate OpenAPI JSON schemas from Custom Resource Definitions
author: Flux project
branding:
icon: 'command'
color: 'blue'
inputs:
crd:
description: 'Local path or URL of the CRD YAML file'
required: true
output:
description: 'Path to a local dir where to write the JSON file'
required: true
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.crd }}
- ${{ inputs.output }}

View File

@ -0,0 +1,30 @@
#!/usr/bin/env sh
set -e
[ -z "$1" ] && echo "No CRD file specified" && exit 1
[ -z "$2" ] && echo "No output directory specified" && exit 1
CRD_PATH=${1}
if [ ! -f "$CRD_PATH" ]; then
echo "CRD file not found at ${CRD_PATH}"
exit 1
fi
OUTPUT_DIR=${2}
mkdir -p "$OUTPUT_DIR"
WORK_DIR=$(mktemp -dt crd-json-schemas-XXXXXX)
trap 'rm -rf $WORK_DIR' EXIT
SPLIT_DIR="$WORK_DIR/split"
mkdir -p "$SPLIT_DIR"
kubernetes-split-yaml --outdir "$SPLIT_DIR" "$CRD_PATH"
( cd "$WORK_DIR"
openapi2jsonschema "$SPLIT_DIR"/*
)
mv "$WORK_DIR"/*.json "$OUTPUT_DIR"
echo "OpenAPI JSON schemas saved to ${OUTPUT_DIR}"

View File

@ -0,0 +1,192 @@
#!/usr/bin/env python
# Copyright 2021 The Flux authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script generates OpenAPI v3 JSON schema from Kubernetes CRD YAML
# Derived from https://github.com/yannh/kubeconform
# Derived from https://github.com/instrumenta/openapi2jsonschema
import yaml
import json
import sys
import os
import urllib.request
from dataclasses import dataclass
from typing import Any
@dataclass
class Schema:
kind: str
group: str
version: str
definition: dict[Any, Any]
def additional_properties(data):
"This recreates the behaviour of kubectl at https://github.com/kubernetes/kubernetes/blob/225b9119d6a8f03fcbe3cc3d590c261965d928d0/pkg/kubectl/validation/schema.go#L312"
new = {}
try:
for k, v in data.items():
new_v = v
if isinstance(v, dict):
if "properties" in v:
if "additionalProperties" not in v:
v["additionalProperties"] = False
new_v = additional_properties(v)
else:
new_v = v
new[k] = new_v
return new
except AttributeError:
return data
def replace_int_or_string(data):
new = {}
try:
for k, v in data.items():
new_v = v
if isinstance(v, dict):
if "format" in v and v["format"] == "int-or-string":
new_v = {"oneOf": [{"type": "string"}, {"type": "integer"}]}
else:
new_v = replace_int_or_string(v)
elif isinstance(v, list):
new_v = list()
for x in v:
new_v.append(replace_int_or_string(x))
else:
new_v = v
new[k] = new_v
return new
except AttributeError:
return data
def allow_null_optional_fields(data, parent=None, grand_parent=None, key=None):
new = {}
try:
for k, v in data.items():
new_v = v
if isinstance(v, dict):
new_v = allow_null_optional_fields(v, data, parent, k)
elif isinstance(v, list):
new_v = list()
for x in v:
new_v.append(allow_null_optional_fields(x, v, parent, k))
elif isinstance(v, str):
is_non_null_type = k == "type" and v != "null"
has_required_fields = grand_parent and "required" in grand_parent
if is_non_null_type and not has_required_field:
new_v = [v, "null"]
new[k] = new_v
return new
except AttributeError:
return data
def append_no_duplicates(obj, key, value):
"""
Given a dictionary, lookup the given key, if it doesn't exist create a new array.
Then check if the given value already exists in the array, if it doesn't add it.
"""
if key not in obj:
obj[key] = []
if value not in obj[key]:
obj[key].append(value)
def write_schema_file(schema, filename):
schema = additional_properties(schema)
schema = replace_int_or_string(schema)
# Dealing with user input here..
filename = os.path.basename(filename)
f = open(filename, "w")
f.write(json.dumps(schema, indent=2))
f.close()
print("{filename}".format(filename=filename))
if len(sys.argv) == 0:
print("missing file")
exit(1)
schemas: list[Schema] = []
for crdFile in sys.argv[1:]:
if crdFile.startswith("http"):
f = urllib.request.urlopen(crdFile)
else:
f = open(crdFile)
with f:
for y in yaml.load_all(f, Loader=yaml.SafeLoader):
if "kind" not in y:
continue
if y["kind"] != "CustomResourceDefinition":
continue
if "spec" in y and "validation" in y["spec"] and "openAPIV3Schema" in y["spec"]["validation"]:
schemas.append(Schema(
kind=y["spec"]["names"]["kind"],
group=y["spec"]["group"],
version=y["spec"]["version"],
definition=y["spec"]["validation"]["openAPIV3Schema"]
))
elif "spec" in y and "versions" in y["spec"]:
for version in y["spec"]["versions"]:
if "schema" in version and "openAPIV3Schema" in version["schema"]:
schemas.append(Schema(
kind=y["spec"]["names"]["kind"],
group=y["spec"]["group"],
version=version["name"],
definition=version["schema"]["openAPIV3Schema"]
))
filename_format = os.getenv("FILENAME_FORMAT", "{kind}-{group}-{version}")
# Write down all separate schema files.
for schema in schemas:
filename = filename_format.format(
kind=schema.kind,
group=schema.group.split(".")[0],
version=schema.version,
).lower() + ".json"
write_schema_file(schema.definition, filename)
# Make a single definitions file that has the enum field set for kind and apiVersion so we can have automatic matching
# for JSON schema.
with open('_definitions.json', 'w') as definitions_file:
definitions: dict[str, dict[Any, Any]] = {}
# NOTE: No deep copy is needed as we already wrote the schema files, so let's modify the original structures.
for schema in schemas:
append_no_duplicates(schema.definition['properties']['apiVersion'], 'enum', f'{schema.group}/{schema.version}')
append_no_duplicates(schema.definition['properties']['kind'], 'enum', schema.kind)
definitions[f'{schema.group}.{schema.version}.{schema.kind}'] = schema.definition
definitions_file.write(json.dumps({"definitions": definitions}, indent=2))
# Finally we write a flux2 main schema file that can be used to automatically validate any Flux2 schema using oneOf
# semantics.
with open('all.json', 'w') as all_file:
refs = [{'$ref': f'_definitions.json#/definitions/{schema.group}.{schema.version}.{schema.kind}'} for schema in schemas]
all_file.write(json.dumps({ "oneOf": refs }, indent=2))
exit(0)

View File

@ -0,0 +1,81 @@
name: Setup envtest
description: A GitHub Action for installing setup-envtest and envtest binaries
author: Flux project
branding:
color: blue
icon: command
inputs:
k8s_version:
description: Strict SemVer or version range of the envtest Kubernetes binaries to install. Defaults to the latest release.
required: true
default: latest
envtest_version:
description: verion of envtest to install. Can be a tag or a commit SHA. Defaults to latest.
required: true
default: latest
runs:
using: composite
steps:
- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: 1.20.x
cache: false
- name: Use specified version to install
if: inputs.envtest_version != ''
shell: bash
run: |
echo "VERSION=${{ inputs.version }}" >> "$GITHUB_ENV"
- name: Determine version to install
if: inputs.envtest_version == ''
shell: bash
run: |
VERSION=$(curl -fsSL -H "Authorization: token ${{github.token}}" "https://api.github.com/repos/kubernetes-sigs/controller-runtime/commits?path=tools/setup-envtest&page=1&per_page=1" | grep sha | head -n1 | cut -d '"' -f 4)
if [[ -z "$VERSION" ]]; then
echo "Unable to determine latest setup-envtest version"
exit 1
fi
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
- name: Download the binary to the runner's cache dir
shell: bash
run: |
OS=$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')
ARCH=$(echo "${RUNNER_ARCH}" | tr '[:upper:]' '[:lower:]')
SETUPENVTEST_EXEC_FILE="setup-envtest"
if [[ "$OS" == "windows" ]]; then
SETUPENVTEST_EXEC_FILE="${SETUPENVTEST_EXEC_FILE}.exe"
fi
# Install the latest version of the setup-envtest tool.
SETUPENVTEST_TOOL_DIR="${RUNNER_TOOL_CACHE}/setup-envtest/${VERSION}/${OS}/${ARCH}"
if [[ ! -x "${SETUPENVTEST_TOOL_DIR}/${SETUPENVTEST_EXEC_FILE}" ]]; then
echo "Installing setup-envtest@$VERSION"
mkdir -p "$SETUPENVTEST_TOOL_DIR"
GOBIN="$SETUPENVTEST_TOOL_DIR" go install "sigs.k8s.io/controller-runtime/tools/setup-envtest@${VERSION}"
# Cleanup cache to avoid affecting other builds. Some go builds may get
# affected by this cache populated in the above operations.
go clean -cache
fi
# Add the setup-envtest tool dir to the path.
echo "Adding setup-envtest to path"
echo "$SETUPENVTEST_TOOL_DIR" >> "$GITHUB_PATH"
- name: Install the specified version of envtest
shell: bash
run: |
K8S_VERSION=${{ inputs.k8s_version }}
if [[ -z "$K8S_VERSION" ]]; then
K8S_VERSION="latest"
fi
# Install the assets for the specified version of Kubernetes.
ENVTEST_TOOL_DIR="${RUNNER_TOOL_CACHE}/envtest"
echo "Installing envtest assets for Kubernetes $K8S_VERSION"
setup-envtest use --bin-dir "$ENVTEST_TOOL_DIR" "$K8S_VERSION"
# Export the path to the KUBEBUILDER_ASSETS environment variable.
echo "Exporting KUBEBUILDER_ASSETS"
ENVTEST_ASSETS_PATH=$(setup-envtest use --bin-dir "$ENVTEST_TOOL_DIR" -i "$K8S_VERSION" -p path)
echo "KUBEBUILDER_ASSETS='$ENVTEST_ASSETS_PATH'" >> "$GITHUB_ENV"

View File

@ -1,6 +0,0 @@
FROM stefanprodan/alpine-base:latest
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,15 +1,65 @@
name: 'helm'
description: 'A GitHub Action to run Helm commands'
author: 'Hidde Beydals'
name: Setup Helm CLI
description: A GitHub Action for installing the Helm CLI
author: Flux project
branding:
icon: 'command'
color: 'blue'
color: blue
icon: command
inputs:
version:
description: 'strict semver'
description: Strict SemVer of the Helm CLI to install. Defaults to the latest release.
required: false
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.version }}
using: composite
steps:
- name: Download the binary to the runner's cache dir
shell: bash
run: |
VERSION=${{ inputs.version }}
if [[ -z "$VERSION" ]] || [[ "$VERSION" = "latest" ]]; then
VERSION=$(curl -fsSL -H "Authorization: token ${{github.token}}" https://api.github.com/repos/helm/helm/releases/latest | grep tag_name | cut -d '"' -f 4)
fi
if [[ -z "$VERSION" ]]; then
echo "Unable to determine Helm version"
exit 1
fi
if [[ ! $VERSION = v* ]]; then
VERSION="v${VERSION}"
fi
OS=$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')
ARCH=$(echo "${RUNNER_ARCH}" | tr '[:upper:]' '[:lower:]')
HELM_EXEC_FILE="helm"
if [[ "$OS" == "windows" ]]; then
HELM_EXEC_FILE="${HELM_EXEC_FILE}.exe"
fi
HELM_TOOL_DIR="${RUNNER_TOOL_CACHE}/helm/${VERSION}/${OS}/${ARCH}"
if [[ ! -x "${HELM_TOOL_DIR}/${HELM_EXEC_FILE}" ]]; then
# Download the installer.
HELM_INSTALLER_TMP="$(mktemp -t helm-installer-XXXXXX)"
curl -fsSL -o "$HELM_INSTALLER_TMP" https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod +x "$HELM_INSTALLER_TMP"
# Run the installer.
echo "Running Helm installer"
mkdir -p "$HELM_TOOL_DIR"
if [[ "$OS" = "macos" ]]; then
# Workaround for "helm not found. Is "<path>" on your $PATH?
export PATH="$HELM_TOOL_DIR:$PATH"
fi
USE_SUDO=false HELM_INSTALL_DIR="$HELM_TOOL_DIR" VERIFY_CHECKSUM=true VERIFY_SIGNATURES=false "$HELM_INSTALLER_TMP" --version "$VERSION"
# Clean up.
echo "Cleaning up"
rm -rf "$HELM_INSTALLER_TMP"
fi
# Add the Helm tool dir to the path.
echo "Adding Helm to path"
echo "$HELM_TOOL_DIR" >> "$GITHUB_PATH"
- name: Print installed Helm version
shell: bash
run: |
helm version

View File

@ -1,18 +0,0 @@
#!/bin/bash
set -eu
VERSION=${1:-3.3.4}
helm_url=https://get.helm.sh && \
curl -sL ${helm_url}/helm-v${VERSION}-linux-amd64.tar.gz | \
tar xz
mkdir -p $GITHUB_WORKSPACE/bin
cp ./linux-amd64/helm $GITHUB_WORKSPACE/bin
chmod +x $GITHUB_WORKSPACE/bin/helm
$GITHUB_WORKSPACE/bin/helm version
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin" >> $GITHUB_PATH

View File

@ -1,6 +0,0 @@
FROM stefanprodan/alpine-base:latest
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,15 +0,0 @@
name: 'kubebuilder'
description: 'A GitHub Action to run kubebuilder commands'
author: 'Stefan Prodan'
branding:
icon: 'command'
color: 'blue'
inputs:
version:
description: 'strict semver'
required: false
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.version }}

View File

@ -1,14 +0,0 @@
#!/bin/bash
set -eu
VERSION=${1:-2.3.1}
curl -sL https://go.kubebuilder.io/dl/${VERSION}/linux/amd64 | tar -xz -C /tmp/
mkdir -p $GITHUB_WORKSPACE/kubebuilder
mv /tmp/kubebuilder_${VERSION}_linux_amd64/* $GITHUB_WORKSPACE/kubebuilder/
ls -lh $GITHUB_WORKSPACE/kubebuilder/bin
echo "$GITHUB_WORKSPACE/kubebuilder/bin" >> $GITHUB_PATH
echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/kubebuilder/bin" >> $GITHUB_PATH

View File

@ -0,0 +1,88 @@
name: Setup kubeconform CLI
description: A GitHub Action for installing the kubeconform CLI
author: Flux project
branding:
color: blue
icon: command
inputs:
version:
description: Strict SemVer of the kubeconform CLI to install. Defaults to the latest release.
required: false
runs:
using: composite
steps:
- name: Download the binary to the runner's cache dir
shell: bash
run: |
VERSION=${{ inputs.version }}
if [[ -z "$VERSION" ]] || [[ "$VERSION" == "latest" ]]; then
VERSION=$(curl -fsSL -H "Authorization: token ${{github.token}}" https://api.github.com/repos/yannh/kubeconform/releases/latest | grep tag_name | cut -d '"' -f 4)
fi
if [[ -z "$VERSION" ]]; then
echo "Unable to determine kubeconform version"
exit 1
fi
if [[ ! $VERSION = v* ]]; then
VERSION="v${VERSION}"
fi
OS=$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')
if [[ "$OS" == "macos" ]]; then
OS="darwin"
fi
ARCH=$(echo "${RUNNER_ARCH}" | tr '[:upper:]' '[:lower:]')
if [[ "$ARCH" == "x64" ]]; then
ARCH="amd64"
fi
KUBECONFORM_EXEC_FILE="kubeconform"
if [[ "$OS" == "windows" ]]; then
KUBECONFORM_EXEC_FILE="${KUBECONFORM_EXEC_FILE}.exe"
fi
KUBECONFORM_TOOL_DIR="${RUNNER_TOOL_CACHE}/kubeconform/${VERSION}/${OS}/${ARCH}"
if [[ ! -x "$KUBECONFORM_TOOL_DIR/$KUBECONFORM_EXEC_FILE" ]]; then
DL_DIR="$(mktemp -dt kubeconform-XXXXXX)"
trap 'rm -rf $DL_DIR' EXIT
echo "Downloading kubeconform ${VERSION} for ${OS}/${ARCH}"
KUBECONFORM_TARGET_FILE="kubeconform-${OS}-${ARCH}.tar.gz"
if [[ "$OS" == "windows" ]]; then
KUBECONFORM_TARGET_FILE="kubeconform-${OS}-${ARCH}.zip"
fi
KUBECONFORM_CHECKSUMS_FILE="CHECKSUMS"
KUBECONFORM_DOWNLOAD_URL="https://github.com/yannh/kubeconform/releases/download/${VERSION}/"
curl -fsSL -o "$DL_DIR/$KUBECONFORM_TARGET_FILE" "$KUBECONFORM_DOWNLOAD_URL/$KUBECONFORM_TARGET_FILE"
curl -fsSL -o "$DL_DIR/$KUBECONFORM_CHECKSUMS_FILE" "$KUBECONFORM_DOWNLOAD_URL/$KUBECONFORM_CHECKSUMS_FILE"
echo "Verifying checksum"
sum=$(openssl sha1 -sha256 "$DL_DIR/$KUBECONFORM_TARGET_FILE" | awk '{print $2}')
expected_sum=$(grep " $KUBECONFORM_TARGET_FILE\$" "$DL_DIR/$KUBECONFORM_CHECKSUMS_FILE" | awk '{print $1}')
if [ "$sum" != "$expected_sum" ]; then
echo "SHA sum of ${KUBECONFORM_TARGET_FILE} does not match. Aborting."
exit 1
fi
echo "Installing kubeconform to ${KUBECONFORM_TOOL_DIR}"
mkdir -p "$KUBECONFORM_TOOL_DIR"
if [[ "$OS" == "windows" ]]; then
unzip "$DL_DIR/$KUBECONFORM_TARGET_FILE" "$KUBECONFORM_EXEC_FILE" -d "$KUBECONFORM_TOOL_DIR"
else
tar xzf "$DL_DIR/$KUBECONFORM_TARGET_FILE" -C "$KUBECONFORM_TOOL_DIR" $KUBECONFORM_EXEC_FILE
fi
chmod +x "$KUBECONFORM_TOOL_DIR/$KUBECONFORM_EXEC_FILE"
fi
echo "Adding kubeconform to path"
echo "$KUBECONFORM_TOOL_DIR" >> "$GITHUB_PATH"
- name: Print installed kubeconform version
shell: bash
run: |
kubeconform -v

View File

@ -1,6 +0,0 @@
FROM stefanprodan/alpine-base:latest
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,15 +1,79 @@
name: 'kubectl'
description: 'A GitHub Action to run kubectl commands'
author: 'Stefan Prodan'
name: Setup kubectl CLI
description: A GitHub Action for installing the kubectl CLI
author: Flux project
branding:
icon: 'command'
color: 'blue'
color: blue
icon: command
inputs:
version:
description: 'strict semver'
description: Strict SemVer of the kubectl CLI to install. Defaults to the latest release.
required: false
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.version }}
using: composite
steps:
- name: Download the binary to the runner's cache dir
shell: bash
run: |
VERSION=${{ inputs.version }}
if [[ -z "$VERSION" ]] || [[ "$VERSION" = "latest" ]]; then
VERSION=$(curl -fsSL -H "Authorization: token ${{github.token}}" https://api.github.com/repos/kubernetes/kubernetes/releases/latest | grep tag_name | cut -d '"' -f 4)
fi
if [[ -z "$VERSION" ]]; then
echo "Unable to determine Kubernetes version"
exit 1
fi
if [[ ! $VERSION = v* ]]; then
VERSION="v${VERSION}"
fi
OS=$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')
if [[ "$OS" == "macos" ]]; then
OS="darwin"
fi
ARCH=$(echo "${RUNNER_ARCH}" | tr '[:upper:]' '[:lower:]')
if [[ "$ARCH" == "x64" ]]; then
ARCH="amd64"
elif [[ "$ARCH" == "x86" ]]; then
ARCH="386"
fi
KUBECTL_EXEC_FILE="kubectl"
if [[ "$OS" == "windows" ]]; then
KUBECTL_EXEC_FILE="${KUBECTL_EXEC_FILE}.exe"
fi
KUBECTL_TOOL_DIR="${RUNNER_TOOL_CACHE}/kubectl/${VERSION}/${OS}/${ARCH}"
if [[ ! -x "$KUBECTL_TOOL_DIR/$KUBECTL_EXEC_FILE" ]]; then
DL_DIR="$(mktemp -dt kubectl-XXXXXX)"
trap 'rm -rf $DL_DIR' EXIT
echo "Downloading kubectl ${VERSION} for ${OS}/${ARCH}"
KUBECTL_DOWNLOAD_URL="https://dl.k8s.io/${VERSION}/bin/${OS}/${ARCH}/${KUBECTL_EXEC_FILE}"
KUBECTL_TARGET_FILE="$DL_DIR/$KUBECTL_EXEC_FILE"
KUBECTL_SHA256_FILE="$DL_DIR/$KUBECTL_EXEC_FILE.sha256"
curl -fsSL -o "$KUBECTL_TARGET_FILE" "$KUBECTL_DOWNLOAD_URL"
curl -fsSL -o "$KUBECTL_SHA256_FILE" "$KUBECTL_DOWNLOAD_URL.sha256"
echo "Verifying checksum"
sum=$(openssl sha1 -sha256 ${KUBECTL_TARGET_FILE} | awk '{print $2}')
expected_sum=$(cat ${KUBECTL_SHA256_FILE})
if [ "$sum" != "$expected_sum" ]; then
echo "SHA sum of ${KUBECTL_TARGET_FILE} does not match. Aborting."
exit 1
fi
echo "Installing kubectl to ${KUBECTL_TOOL_DIR}"
mkdir -p "$KUBECTL_TOOL_DIR"
mv "$KUBECTL_TARGET_FILE" "$KUBECTL_TOOL_DIR/$KUBECTL_EXEC_FILE"
chmod +x "$KUBECTL_TOOL_DIR/$KUBECTL_EXEC_FILE"
fi
echo "Adding kubectl to path"
echo "$KUBECTL_TOOL_DIR" >> "$GITHUB_PATH"
- name: Print installed kubectl version
shell: bash
run: |
kubectl version --client

View File

@ -1,16 +0,0 @@
#!/bin/bash
set -eu
VERSION=${1:-1.19.2}
curl -sL https://storage.googleapis.com/kubernetes-release/release/v${VERSION}/bin/linux/amd64/kubectl > kubectl
mkdir -p $GITHUB_WORKSPACE/bin
cp ./kubectl $GITHUB_WORKSPACE/bin
chmod +x $GITHUB_WORKSPACE/bin/kubectl
$GITHUB_WORKSPACE/bin/kubectl version --client
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin" >> $GITHUB_PATH

View File

@ -1,6 +0,0 @@
FROM stefanprodan/alpine-base:latest
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,15 +1,87 @@
name: 'kustomize'
description: 'A GitHub Action to run kustomize commands'
author: 'Stefan Prodan'
name: Setup kustomize CLI
description: A GitHub Action for installing the kustomize CLI
author: Flux project
branding:
icon: 'command'
color: 'blue'
color: blue
icon: command
inputs:
version:
description: 'strict semver'
description: "Strict SemVer of the kustomize CLI. Defaults to 5.3.0. Use 'latest' to get the latest release."
required: false
default: "5.3.0"
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.version }}
using: composite
steps:
- name: Download the binary to the runner's cache dir
shell: bash
run: |
VERSION=${{ inputs.version }}
if [[ -z "$VERSION" ]] || [[ "$VERSION" == "latest" ]]; then
VERSION=$(curl -fsSL -H "Authorization: token ${{github.token}}" https://api.github.com/repos/kubernetes-sigs/kustomize/releases/latest | grep tag_name | cut -d '"' -f 4)
fi
if [[ -z "$VERSION" ]]; then
echo "Unable to determine Kustomize version"
exit 1
fi
if [[ ! $VERSION = v* ]]; then
VERSION="v${VERSION}"
fi
OS=$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')
if [[ "$OS" == "macos" ]]; then
OS="darwin"
fi
ARCH=$(echo "${RUNNER_ARCH}" | tr '[:upper:]' '[:lower:]')
if [[ "$ARCH" == "x64" ]]; then
ARCH="amd64"
fi
KUSTOMIZE_EXEC_FILE="kustomize"
if [[ "$OS" == "windows" ]]; then
KUSTOMIZE_EXEC_FILE="${KUSTOMIZE_EXEC_FILE}.exe"
fi
KUSTOMIZE_TOOL_DIR="${RUNNER_TOOL_CACHE}/kustomize/${VERSION}/${OS}/${ARCH}"
if [[ ! -x "$KUSTOMIZE_TOOL_DIR/$KUSTOMIZE_EXEC_FILE" ]]; then
DL_DIR="$(mktemp -dt kustomize-XXXXXX)"
trap 'rm -rf $DL_DIR' EXIT
echo "Downloading kustomize ${VERSION} for ${OS}/${ARCH}"
KUSTOMIZE_TARGET_FILE="kustomize_${VERSION}_${OS}_${ARCH}.tar.gz"
if [[ "$OS" == "windows" ]]; then
KUSTOMIZE_TARGET_FILE="kustomize_${VERSION}_${OS}_${ARCH}.zip"
fi
KUSTOMIZE_CHECKSUMS_FILE="checksums.txt"
KUSTOMIZE_DOWNLOAD_URL="https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F${VERSION}/"
curl -fsSL -o "$DL_DIR/$KUSTOMIZE_TARGET_FILE" "$KUSTOMIZE_DOWNLOAD_URL/$KUSTOMIZE_TARGET_FILE"
curl -fsSL -o "$DL_DIR/$KUSTOMIZE_CHECKSUMS_FILE" "$KUSTOMIZE_DOWNLOAD_URL/$KUSTOMIZE_CHECKSUMS_FILE"
echo "Verifying checksum"
sum=$(openssl sha1 -sha256 "$DL_DIR/$KUSTOMIZE_TARGET_FILE" | awk '{print $2}')
expected_sum=$(grep " $KUSTOMIZE_TARGET_FILE\$" "$DL_DIR/$KUSTOMIZE_CHECKSUMS_FILE" | awk '{print $1}')
if [ "$sum" != "$expected_sum" ]; then
echo "SHA sum of ${KUSTOMIZE_TARGET_FILE} does not match. Aborting."
exit 1
fi
echo "Installing kustomize to ${KUSTOMIZE_TOOL_DIR}"
mkdir -p "$KUSTOMIZE_TOOL_DIR"
if [[ "$OS" == "windows" ]]; then
unzip "$DL_DIR/$KUSTOMIZE_TARGET_FILE" "$KUSTOMIZE_EXEC_FILE" -d "$KUSTOMIZE_TOOL_DIR"
else
tar xzf "$DL_DIR/$KUSTOMIZE_TARGET_FILE" -C "$KUSTOMIZE_TOOL_DIR" $KUSTOMIZE_EXEC_FILE
fi
chmod +x "$KUSTOMIZE_TOOL_DIR/$KUSTOMIZE_EXEC_FILE"
fi
echo "Adding kustomize to path"
echo "$KUSTOMIZE_TOOL_DIR" >> "$GITHUB_PATH"
- name: Print installed kustomize version
shell: bash
run: |
kustomize version

View File

@ -1,18 +0,0 @@
#!/bin/bash
set -eu
VERSION=${1:-3.8.2}
kustomize_url=https://github.com/kubernetes-sigs/kustomize/releases/download && \
curl -sL ${kustomize_url}/kustomize%2Fv${VERSION}/kustomize_v${VERSION}_linux_amd64.tar.gz | \
tar xz
mkdir -p $GITHUB_WORKSPACE/bin
cp ./kustomize $GITHUB_WORKSPACE/bin
chmod +x $GITHUB_WORKSPACE/bin/kustomize
$GITHUB_WORKSPACE/bin/kustomize version
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin" >> $GITHUB_PATH

71
actions/sops/action.yaml Normal file
View File

@ -0,0 +1,71 @@
name: Setup SOPS
description: A GitHub Action for installing the SOPS CLI
author: Flux project
branding:
color: blue
icon: command
inputs:
version:
description: Strict SemVer of the SOPS CLI to install. Defaults to the latest release.
required: false
runs:
using: composite
steps:
- name: Download the binary to the runner's cache dir
shell: bash
run: |
VERSION=${{ inputs.version }}
if [[ -z "$VERSION" ]] || [[ "$VERSION" == "latest" ]]; then
VERSION=$(curl -fsSL -H "Authorization: token ${{github.token}}" https://api.github.com/repos/getsops/sops/releases/latest | grep tag_name | cut -d '"' -f 4)
fi
if [[ -z "$VERSION" ]]; then
echo "Unable to determine SOPS version"
exit 1
fi
if [[ ! $VERSION = v* ]]; then
VERSION="v${VERSION}"
fi
OS=$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')
if [[ "$OS" == "macos" ]]; then
OS="darwin"
fi
ARCH=$(echo "${RUNNER_ARCH}" | tr '[:upper:]' '[:lower:]')
if [[ "$ARCH" == "x64" ]]; then
ARCH="amd64"
fi
SOPS_EXEC_FILE="sops"
if [[ "$OS" == "windows" ]]; then
SOPS_EXEC_FILE="${SOPS_EXEC_FILE}.exe"
fi
SOPS_TOOL_DIR="${RUNNER_TOOL_CACHE}/sops/${VERSION}/${OS}/${ARCH}"
if [[ ! -x "$SOPS_TOOL_DIR/$SOPS_EXEC_FILE" ]]; then
DL_DIR="$(mktemp -dt sops-XXXXXX)"
trap 'rm -rf $DL_DIR' EXIT
echo "Downloading sops ${VERSION} for ${OS}/${ARCH}"
SOPS_TARGET_FILE="sops-${VERSION}.${OS}.${ARCH}"
if [[ "$OS" == "windows" ]]; then
SOPS_TARGET_FILE="sops-${VERSION}.${ARCH}.exe"
fi
SOPS_DOWNLOAD_URL="https://github.com/getsops/sops/releases/download/${VERSION}/"
echo "Downloading sops from $SOPS_DOWNLOAD_URL/$SOPS_TARGET_FILE"
curl -fsSL -o "$DL_DIR/$SOPS_TARGET_FILE" "$SOPS_DOWNLOAD_URL/$SOPS_TARGET_FILE"
echo "Installing sops to ${SOPS_TOOL_DIR}"
mkdir -p "$SOPS_TOOL_DIR"
mv "$DL_DIR/$SOPS_TARGET_FILE" "$SOPS_TOOL_DIR/$SOPS_EXEC_FILE"
chmod +x "$SOPS_TOOL_DIR/$SOPS_EXEC_FILE"
fi
echo "Adding sops to path"
echo "$SOPS_TOOL_DIR" >> "$GITHUB_PATH"
- name: Print installed sops version
shell: bash
run: |
sops --version

84
actions/yq/action.yml Normal file
View File

@ -0,0 +1,84 @@
name: Setup yq CLI
description: A GitHub Action for installing the yq CLI
author: Flux project
branding:
color: blue
icon: command
inputs:
version:
description: Strict SemVer of the yq CLI to install. Defaults to the latest release.
required: false
runs:
using: composite
steps:
- name: Download the binary to the runner's cache dir
shell: bash
run: |
VERSION=${{ inputs.version }}
if [[ -z "$VERSION" ]] || [[ "$VERSION" == "latest" ]]; then
VERSION=$(curl -fsSL -H "Authorization: token ${{github.token}}" https://api.github.com/repos/mikefarah/yq/releases/latest | grep tag_name | cut -d '"' -f 4)
fi
if [[ -z "$VERSION" ]]; then
echo "Unable to determine yq version"
exit 1
fi
if [[ ! $VERSION = v* ]]; then
VERSION="v${VERSION}"
fi
OS=$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')
if [[ "$OS" == "macos" ]]; then
OS="darwin"
fi
ARCH=$(echo "${RUNNER_ARCH}" | tr '[:upper:]' '[:lower:]')
if [[ "$ARCH" == "x64" ]]; then
ARCH="amd64"
fi
YQ_EXEC_FILE="yq_${OS}_${ARCH}"
if [[ "$OS" == "windows" ]]; then
YQ_EXEC_FILE="${YQ_EXEC_FILE}.exe"
fi
YQ_TOOL_DIR="${RUNNER_TOOL_CACHE}/yq/${VERSION}/${OS}/${ARCH}"
if [[ ! -x "$YQ_TOOL_DIR/$YQ_EXEC_FILE" ]]; then
DL_DIR="$(mktemp -dt yq-XXXXXX)"
trap 'rm -rf $DL_DIR' EXIT
echo "Downloading yq ${VERSION} for ${OS}/${ARCH}"
YQ_TARGET_FILE="yq"
if [[ "$OS" == "windows" ]]; then
YQ_TARGET_FILE="yq.exe"
fi
YQ_CHECKSUMS_FILE="checksums"
YQ_DOWNLOAD_URL="https://github.com/mikefarah/yq/releases/download/${VERSION}/"
curl -fsSL -o "$DL_DIR/$YQ_TARGET_FILE" "$YQ_DOWNLOAD_URL/$YQ_EXEC_FILE"
curl -fsSL -o "$DL_DIR/$YQ_CHECKSUMS_FILE" "$YQ_DOWNLOAD_URL/$YQ_CHECKSUMS_FILE"
echo "Verifying checksum"
sum=$(openssl sha1 -sha256 "$DL_DIR/$YQ_TARGET_FILE" | awk '{print $2}')
expected_sum=$(grep "^$YQ_EXEC_FILE " "$DL_DIR/$YQ_CHECKSUMS_FILE" | awk '{print $19}')
if [ "$sum" != "$expected_sum" ]; then
echo "SHA sum of $DL_DIR/$YQ_TARGET_FILE and $YQ_EXEC_FILE does not match. Aborting."
exit 1
fi
echo "Installing yq to ${YQ_TOOL_DIR}"
mkdir -p "$YQ_TOOL_DIR"
cp "$DL_DIR/$YQ_TARGET_FILE" "$YQ_TOOL_DIR/$YQ_TARGET_FILE"
chmod +x "$YQ_TOOL_DIR/$YQ_TARGET_FILE"
fi
echo "Adding yq to path"
echo "$YQ_TOOL_DIR" >> "$GITHUB_PATH"
- name: Print installed yq version
shell: bash
run: |
yq --version

36
apis/acl/acl_types.go Normal file
View File

@ -0,0 +1,36 @@
/*
Copyright 2021 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package acl
// AccessFrom defines an ACL for allowing cross-namespace references to a source object
// based on the caller's namespace labels.
type AccessFrom struct {
// NamespaceSelectors is the list of namespace selectors to which this ACL applies.
// Items in this list are evaluated using a logical OR operation.
// +required
NamespaceSelectors []NamespaceSelector `json:"namespaceSelectors"`
}
// NamespaceSelector selects the namespaces to which this ACL applies.
// An empty map of MatchLabels matches all namespaces in a cluster.
type NamespaceSelector struct {
// MatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
// map is equivalent to an element of matchExpressions, whose key field is "key", the
// operator is "In", and the values array contains only "value". The requirements are ANDed.
// +optional
MatchLabels map[string]string `json:"matchLabels,omitempty"`
}

31
apis/acl/conditions.go Normal file
View File

@ -0,0 +1,31 @@
/*
Copyright 2021 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package acl
// These constants define the Condition types for when the GitOps Toolkit components perform ACL assertions.
const (
// AccessDeniedCondition indicates that access to a resource has been denied by an ACL assertion.
// The Condition adheres to an "abnormal-true" polarity pattern, and MUST only be present on the resource if the
// Condition is True.
AccessDeniedCondition string = "AccessDenied"
)
// These constants define the Condition reasons for when the GitOps Toolkit components perform ACL assertions.
const (
// AccessDeniedReason indicates that access to a resource has been denied by an ACL assertion.
AccessDeniedReason string = "AccessDenied"
)

19
apis/acl/doc.go Normal file
View File

@ -0,0 +1,19 @@
/*
Copyright 2021 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package acl contains the API types for defining access control lists for use by GitOps Toolkit components.
// +kubebuilder:object:generate=true
package acl

3
apis/acl/go.mod Normal file
View File

@ -0,0 +1,3 @@
module github.com/fluxcd/pkg/apis/acl
go 1.24.0

View File

@ -0,0 +1,67 @@
//go:build !ignore_autogenerated
/*
Copyright 2024 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by controller-gen. DO NOT EDIT.
package acl
import ()
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AccessFrom) DeepCopyInto(out *AccessFrom) {
*out = *in
if in.NamespaceSelectors != nil {
in, out := &in.NamespaceSelectors, &out.NamespaceSelectors
*out = make([]NamespaceSelector, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AccessFrom.
func (in *AccessFrom) DeepCopy() *AccessFrom {
if in == nil {
return nil
}
out := new(AccessFrom)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NamespaceSelector) DeepCopyInto(out *NamespaceSelector) {
*out = *in
if in.MatchLabels != nil {
in, out := &in.MatchLabels, &out.MatchLabels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceSelector.
func (in *NamespaceSelector) DeepCopy() *NamespaceSelector {
if in == nil {
return nil
}
out := new(NamespaceSelector)
in.DeepCopyInto(out)
return out
}

29
apis/event/go.mod Normal file
View File

@ -0,0 +1,29 @@
module github.com/fluxcd/pkg/apis/event
go 1.24.0
require (
k8s.io/api v0.33.2
k8s.io/apimachinery v0.33.2
)
require (
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/text v0.27.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 // indirect
sigs.k8s.io/yaml v1.5.0 // indirect
)

97
apis/event/go.sum Normal file
View File

@ -0,0 +1,97 @@
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.33.2 h1:YgwIS5jKfA+BZg//OQhkJNIfie/kmRsO0BmNaVSimvY=
k8s.io/api v0.33.2/go.mod h1:fhrbphQJSM2cXzCWgqU29xLDuks4mu7ti9vveEnpSXs=
k8s.io/apimachinery v0.33.2 h1:IHFVhqg59mb8PJWTLi8m1mAoepkUNYmptHsV+Z1m5jY=
k8s.io/apimachinery v0.33.2/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
sigs.k8s.io/randfill v0.0.0-20250304075658-069ef1bbf016/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU=
sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 h1:qPeWmscJcXP0snki5IYF79Z8xrl8ETFxgMd7wez1XkI=
sigs.k8s.io/structured-merge-diff/v4 v4.7.0/go.mod h1:dDy58f92j70zLsuZVuUX5Wp9vtxXpaZnkPGWeqDfCps=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
sigs.k8s.io/yaml v1.5.0 h1:M10b2U7aEUY6hRtU870n2VTPgR5RZiL/I6Lcc2F4NUQ=
sigs.k8s.io/yaml v1.5.0/go.mod h1:wZs27Rbxoai4C0f8/9urLZtZtF3avA3gKvGyPdDqTO4=

19
apis/event/v1beta1/doc.go Normal file
View File

@ -0,0 +1,19 @@
/*
Copyright 2022 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package v1beta1 contains the API Schema definitions for the Flux eventing API.
// +kubebuilder:object:generate=true
package v1beta1

View File

@ -1,5 +1,5 @@
/*
Copyright 2020 The Flux authors
Copyright 2022 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -14,28 +14,40 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package events
package v1beta1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// Valid values for event severity.
// Group is the API Group for the Event API.
const Group = "event.toolkit.fluxcd.io"
// These constants define valid event severity values.
const (
// Information only and will not cause any problems.
// EventSeverityTrace represents a trace event, usually
// informing about actions taken during reconciliation.
EventSeverityTrace string = "trace"
// EventSeverityInfo represents an informational event, usually
// informing about changes.
EventSeverityInfo string = "info"
// These events are to warn that something might go wrong.
// EventSeverityError represent an error event, usually a warning
// that something goes wrong.
EventSeverityError string = "error"
)
// EventTypeTrace represents a trace event.
const EventTypeTrace string = "Trace"
// Event is a report of an event issued by a controller.
type Event struct {
// The object that this event is about.
// +required
InvolvedObject corev1.ObjectReference `json:"involvedObject"`
// Severity type of this event (info, error)
// Severity type of this event (trace, info, error)
// +kubebuilder:validation:Enum=trace;info;error
// +required
Severity string `json:"severity"`
@ -44,7 +56,8 @@ type Event struct {
Timestamp metav1.Time `json:"timestamp"`
// A human-readable description of this event.
// Maximum length 39,000 characters
// Maximum length 39,000 characters.
// +kubebuilder:validation:MaxLength=39000
// +required
Message string `json:"message"`
@ -65,3 +78,28 @@ type Event struct {
// +optional
ReportingInstance string `json:"reportingInstance,omitempty"`
}
// HasReason returns true if the Reason equals the given value.
func (in *Event) HasReason(reason string) bool {
return in.Reason == reason
}
// HasMetadata returns true if the given key/value pair is found in Metadata.
func (in *Event) HasMetadata(key string, val string) bool {
if v, ok := in.Metadata[key]; ok && v == val {
return true
}
return false
}
// GetRevision looks up for the MetaOriginRevisionKey and MetaRevisionKey
// keys in the Metadata and returns the first it finds.
func (in *Event) GetRevision() (string, bool) {
if r, ok := in.Metadata[MetaOriginRevisionKey]; ok {
return r, true
}
if r, ok := in.Metadata[MetaRevisionKey]; ok {
return r, true
}
return "", false
}

View File

@ -0,0 +1,42 @@
/*
Copyright 2022 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
// These constants define the Event metadata keys used throughout Flux controllers.
const (
// MetaRevisionKey is the key used to hold the source artifact revision.
MetaRevisionKey string = "revision"
// MetaOriginRevisionKey is the key used to hold the source artifact origin revision.
MetaOriginRevisionKey string = "originRevision"
// MetaChecksumKey is the key used to hold the source artifact checksum.
// Deprecated: in favor of MetaDigestKey.
MetaChecksumKey string = "checksum"
// MetaDigestKey is the key used to hold the source artifact digest.
MetaDigestKey string = "digest"
// MetaTokenKey is the key used to hold an arbitrary token whose contents
// are defined on a per-event-emitter basis for uniquely identifying the
// contents of the event payload. For example, it could be the generation
// of an object, or the hash of a set of configurations, or even a
// base64-encoded set of configurations. This is useful for example for
// rate limiting the events.
MetaTokenKey string = "token"
// MetaCommitStatusKey is the key used to signal a Git commit status event.
MetaCommitStatusKey string = "commit_status"
// MetaCommitStatusUpdateValue is the value of MetaCommitStatusKey
// used to signal a Git commit status update.
MetaCommitStatusUpdateValue string = "update"
)

View File

@ -0,0 +1,47 @@
//go:build !ignore_autogenerated
/*
Copyright 2024 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by controller-gen. DO NOT EDIT.
package v1beta1
import ()
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Event) DeepCopyInto(out *Event) {
*out = *in
out.InvolvedObject = in.InvolvedObject
in.Timestamp.DeepCopyInto(&out.Timestamp)
if in.Metadata != nil {
in, out := &in.Metadata, &out.Metadata
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Event.
func (in *Event) DeepCopy() *Event {
if in == nil {
return nil
}
out := new(Event)
in.DeepCopyInto(out)
return out
}

19
apis/kustomize/doc.go Normal file
View File

@ -0,0 +1,19 @@
/*
Copyright 2021 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package kustomize contains a selective set of Kustomize API types for use by GitOps Toolkit components.
// +kubebuilder:object:generate=true
package kustomize

28
apis/kustomize/go.mod Normal file
View File

@ -0,0 +1,28 @@
module github.com/fluxcd/pkg/apis/kustomize
go 1.24.0
require k8s.io/apiextensions-apiserver v0.33.2
require (
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/text v0.27.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/apimachinery v0.33.2 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 // indirect
sigs.k8s.io/yaml v1.5.0 // indirect
)

97
apis/kustomize/go.sum Normal file
View File

@ -0,0 +1,97 @@
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/apiextensions-apiserver v0.33.2 h1:6gnkIbngnaUflR3XwE1mCefN3YS8yTD631JXQhsU6M8=
k8s.io/apiextensions-apiserver v0.33.2/go.mod h1:IvVanieYsEHJImTKXGP6XCOjTwv2LUMos0YWc9O+QP8=
k8s.io/apimachinery v0.33.2 h1:IHFVhqg59mb8PJWTLi8m1mAoepkUNYmptHsV+Z1m5jY=
k8s.io/apimachinery v0.33.2/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
sigs.k8s.io/randfill v0.0.0-20250304075658-069ef1bbf016/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU=
sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 h1:qPeWmscJcXP0snki5IYF79Z8xrl8ETFxgMd7wez1XkI=
sigs.k8s.io/structured-merge-diff/v4 v4.7.0/go.mod h1:dDy58f92j70zLsuZVuUX5Wp9vtxXpaZnkPGWeqDfCps=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
sigs.k8s.io/yaml v1.5.0 h1:M10b2U7aEUY6hRtU870n2VTPgR5RZiL/I6Lcc2F4NUQ=
sigs.k8s.io/yaml v1.5.0/go.mod h1:wZs27Rbxoai4C0f8/9urLZtZtF3avA3gKvGyPdDqTO4=

View File

@ -0,0 +1,163 @@
/*
Copyright 2021 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package kustomize
import (
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
)
// Image contains an image name, a new name, a new tag or digest, which will replace the original name and tag.
type Image struct {
// Name is a tag-less image name.
// +required
Name string `json:"name"`
// NewName is the value used to replace the original name.
// +optional
NewName string `json:"newName,omitempty"`
// NewTag is the value used to replace the original tag.
// +optional
NewTag string `json:"newTag,omitempty"`
// Digest is the value used to replace the original image tag.
// If digest is present NewTag value is ignored.
// +optional
Digest string `json:"digest,omitempty"`
}
// Selector specifies a set of resources. Any resource that matches intersection of all conditions is included in this
// set.
type Selector struct {
// Group is the API group to select resources from.
// Together with Version and Kind it is capable of unambiguously identifying and/or selecting resources.
// https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
// +optional
Group string `json:"group,omitempty"`
// Version of the API Group to select resources from.
// Together with Group and Kind it is capable of unambiguously identifying and/or selecting resources.
// https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
// +optional
Version string `json:"version,omitempty"`
// Kind of the API Group to select resources from.
// Together with Group and Version it is capable of unambiguously
// identifying and/or selecting resources.
// https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
// +optional
Kind string `json:"kind,omitempty"`
// Namespace to select resources from.
// +optional
Namespace string `json:"namespace,omitempty"`
// Name to match resources with.
// +optional
Name string `json:"name,omitempty"`
// AnnotationSelector is a string that follows the label selection expression
// https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
// It matches with the resource annotations.
// +optional
AnnotationSelector string `json:"annotationSelector,omitempty"`
// LabelSelector is a string that follows the label selection expression
// https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
// It matches with the resource labels.
// +optional
LabelSelector string `json:"labelSelector,omitempty"`
}
// Patch contains an inline StrategicMerge or JSON6902 patch, and the target the patch should
// be applied to.
type Patch struct {
// Patch contains an inline StrategicMerge patch or an inline JSON6902 patch with
// an array of operation objects.
// +required
Patch string `json:"patch"`
// Target points to the resources that the patch document should be applied to.
// +optional
Target *Selector `json:"target,omitempty"`
}
// JSON6902 is a JSON6902 operation object.
// https://datatracker.ietf.org/doc/html/rfc6902#section-4
type JSON6902 struct {
// Op indicates the operation to perform. Its value MUST be one of "add", "remove", "replace", "move", "copy", or
// "test".
// https://datatracker.ietf.org/doc/html/rfc6902#section-4
// +kubebuilder:validation:Enum=test;remove;add;replace;move;copy
// +required
Op string `json:"op"`
// Path contains the JSON-pointer value that references a location within the target document where the operation
// is performed. The meaning of the value depends on the value of Op.
// +required
Path string `json:"path"`
// From contains a JSON-pointer value that references a location within the target document where the operation is
// performed. The meaning of the value depends on the value of Op, and is NOT taken into account by all operations.
// +optional
From string `json:"from,omitempty"`
// Value contains a valid JSON structure. The meaning of the value depends on the value of Op, and is NOT taken into
// account by all operations.
// +optional
Value *apiextensionsv1.JSON `json:"value,omitempty"`
}
// JSON6902Patch contains a JSON6902 patch and the target the patch should be applied to.
type JSON6902Patch struct {
// Patch contains the JSON6902 patch document with an array of operation objects.
// +required
Patch []JSON6902 `json:"patch"`
// Target points to the resources that the patch document should be applied to.
// +required
Target Selector `json:"target"`
}
// CustomHealthCheck defines the health check for custom resources.
type CustomHealthCheck struct {
// APIVersion of the custom resource under evaluation.
// +required
APIVersion string `json:"apiVersion"`
// Kind of the custom resource under evaluation.
// +required
Kind string `json:"kind"`
HealthCheckExpressions `json:",inline"`
}
// HealthCheckExpressions defines the CEL expressions for determining the health status
// of custom resources.
type HealthCheckExpressions struct {
// Current is the CEL expression that determines if the status
// of the custom resource has reached the desired state.
// +required
Current string `json:"current"`
// InProgress is the CEL expression that determines if the status
// of the custom resource has not yet reached the desired state.
// +optional
InProgress string `json:"inProgress,omitempty"`
// Failed is the CEL expression that determines if the status
// of the custom resource has failed to reach the desired state.
// +optional
Failed string `json:"failed,omitempty"`
}

View File

@ -0,0 +1,149 @@
//go:build !ignore_autogenerated
/*
Copyright 2024 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by controller-gen. DO NOT EDIT.
package kustomize
import (
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CustomHealthCheck) DeepCopyInto(out *CustomHealthCheck) {
*out = *in
out.HealthCheckExpressions = in.HealthCheckExpressions
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomHealthCheck.
func (in *CustomHealthCheck) DeepCopy() *CustomHealthCheck {
if in == nil {
return nil
}
out := new(CustomHealthCheck)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HealthCheckExpressions) DeepCopyInto(out *HealthCheckExpressions) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheckExpressions.
func (in *HealthCheckExpressions) DeepCopy() *HealthCheckExpressions {
if in == nil {
return nil
}
out := new(HealthCheckExpressions)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Image) DeepCopyInto(out *Image) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image.
func (in *Image) DeepCopy() *Image {
if in == nil {
return nil
}
out := new(Image)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JSON6902) DeepCopyInto(out *JSON6902) {
*out = *in
if in.Value != nil {
in, out := &in.Value, &out.Value
*out = new(v1.JSON)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JSON6902.
func (in *JSON6902) DeepCopy() *JSON6902 {
if in == nil {
return nil
}
out := new(JSON6902)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JSON6902Patch) DeepCopyInto(out *JSON6902Patch) {
*out = *in
if in.Patch != nil {
in, out := &in.Patch, &out.Patch
*out = make([]JSON6902, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
out.Target = in.Target
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JSON6902Patch.
func (in *JSON6902Patch) DeepCopy() *JSON6902Patch {
if in == nil {
return nil
}
out := new(JSON6902Patch)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Patch) DeepCopyInto(out *Patch) {
*out = *in
if in.Target != nil {
in, out := &in.Target, &out.Target
*out = new(Selector)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Patch.
func (in *Patch) DeepCopy() *Patch {
if in == nil {
return nil
}
out := new(Patch)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Selector) DeepCopyInto(out *Selector) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Selector.
func (in *Selector) DeepCopy() *Selector {
if in == nil {
return nil
}
out := new(Selector)
in.DeepCopyInto(out)
return out
}

View File

@ -17,59 +17,127 @@ limitations under the License.
package meta
const (
// ReconcileAtAnnotation is the annotation used for triggering a reconciliation
// outside of the defined schedule. Despite the name, the value is not
// interpreted as a timestamp, and any change in value shall trigger a
// reconciliation.
// DEPRECATED: has been replaced by ReconcileRequestAnnotation.
ReconcileAtAnnotation string = "fluxcd.io/reconcileAt"
// ReconcileRequestAnnotation is the new ReconcileAtAnnotation,
// with a better name. For backward-compatibility, use
// ReconcileAnnotationValue, which will account for both
// annotations.
// ReconcileRequestAnnotation is the annotation used for triggering a reconciliation
// outside of a defined interval. The value is interpreted as a token, and any change
// in value SHOULD trigger a reconciliation.
ReconcileRequestAnnotation string = "reconcile.fluxcd.io/requestedAt"
// ForceRequestAnnotation is the annotation used for triggering a one-off forced
// reconciliation, for example, of a HelmRelease when there are no new changes,
// or of something that runs on a schedule when the schedule is not due at the moment.
// The specific conditions for triggering a forced reconciliation depend on the
// specific controller implementation, but the annotation is used to standardize
// the mechanism across controllers. The value is interpreted as a token, and must
// equal the value of ReconcileRequestAnnotation in order to trigger a release.
ForceRequestAnnotation string = "reconcile.fluxcd.io/forceAt"
)
// ReconcileAnnotationValue returns a value for the reconciliation
// request annotations, which can be used to detect changes; and, a
// boolean indicating whether either annotation was set.
// ReconcileAnnotationValue returns a value for the reconciliation request annotation, which can be used to detect
// changes, and a boolean indicating whether the annotation was set.
func ReconcileAnnotationValue(annotations map[string]string) (string, bool) {
reconcileAt, ok1 := annotations[ReconcileAtAnnotation]
requestedAt, ok2 := annotations[ReconcileRequestAnnotation]
// the values are concatenated; this means
// - a change in either will be detectable*, and
// - if one is set, the value will be just that; and,
// - if neither is set, it's a zero value.
//
// *unless the change is to shift a substring across the
// interstice between the strings; e.g., by swapping the value
// from one annotation to the other. Assuming a fresh timestamp is
// used each time, this caveat won't matter.
return reconcileAt + requestedAt, ok1 || ok2
requestedAt, ok := annotations[ReconcileRequestAnnotation]
return requestedAt, ok
}
// ReconcileRequestStatus is a struct to embed in the status type, so
// that all types using the mechanism have the same field. Use it like
// this:
// ReconcileRequestStatus is a struct to embed in a status type, so that all types using the mechanism have the same
// field. Use it like this:
//
// ```
// type WhateverStatus struct {
// meta.ReconcileRequestStatus `json:",inline"`
// // other status fields...
// }
// ```
// type FooStatus struct {
// meta.ReconcileRequestStatus `json:",inline"`
// // other status fields...
// }
type ReconcileRequestStatus struct {
// LastHandledReconcileAt holds the value of the most recent
// reconcile request value, so a change can be detected.
// reconcile request value, so a change of the annotation value
// can be detected.
// +optional
LastHandledReconcileAt string `json:"lastHandledReconcileAt,omitempty"`
}
func (rs ReconcileRequestStatus) GetLastHandledReconcileRequest() string {
return rs.LastHandledReconcileAt
// GetLastHandledReconcileRequest returns the most recent reconcile request value from the ReconcileRequestStatus.
func (in ReconcileRequestStatus) GetLastHandledReconcileRequest() string {
return in.LastHandledReconcileAt
}
func (rs *ReconcileRequestStatus) SetLastHandledReconcileRequest(token string) {
rs.LastHandledReconcileAt = token
// SetLastHandledReconcileRequest sets the most recent reconcile request value in the ReconcileRequestStatus.
func (in *ReconcileRequestStatus) SetLastHandledReconcileRequest(token string) {
in.LastHandledReconcileAt = token
}
// StatusWithHandledReconcileRequest describes a status type which holds the value of the most recent
// ReconcileAnnotationValue.
// +k8s:deepcopy-gen=false
type StatusWithHandledReconcileRequest interface {
GetLastHandledReconcileRequest() string
}
// StatusWithHandledReconcileRequestSetter describes a status with a setter for the most ReconcileAnnotationValue.
// +k8s:deepcopy-gen=false
type StatusWithHandledReconcileRequestSetter interface {
SetLastHandledReconcileRequest(token string)
}
// ForceRequestStatus is a struct to embed in a status type, so that all types using the mechanism have the same
// field. Use it like this:
//
// type FooStatus struct {
// meta.ForceRequestStatus `json:",inline"`
// // other status fields...
// }
type ForceRequestStatus struct {
// LastHandledForceAt holds the value of the most recent
// force request value, so a change of the annotation value
// can be detected.
// +optional
LastHandledForceAt string `json:"lastHandledForceAt,omitempty"`
}
// ShouldHandleForceRequest returns true if the object has a force request
// annotation, and the value of the annotation matches the value of the
// ReconcileRequestAnnotation annotation.
//
// To ensure that the force request is handled only once, the value of
// <ObjectType>Status.LastHandledForceAt is updated to match the value of the
// force request annotation (even if the force request is not handled because
// the value of the ReconcileRequestAnnotation annotation does not match).
func ShouldHandleForceRequest(obj interface {
ObjectWithAnnotationRequests
GetLastHandledForceRequestStatus() *string
}) bool {
return HandleAnnotationRequest(obj, ForceRequestAnnotation, obj.GetLastHandledForceRequestStatus())
}
// ObjectWithAnnotationRequests is an interface that describes an object
// that has annotations and a status with a last handled reconcile request.
// +k8s:deepcopy-gen=false
type ObjectWithAnnotationRequests interface {
GetAnnotations() map[string]string
StatusWithHandledReconcileRequest
}
// HandleAnnotationRequest returns true if the object has a request annotation, and
// the value of the annotation matches the value of the ReconcileRequestAnnotation
// annotation.
//
// The lastHandled argument is used to ensure that the request is handled only
// once, and is updated to match the value of the request annotation (even if
// the request is not handled because the value of the ReconcileRequestAnnotation
// annotation does not match).
func HandleAnnotationRequest(obj ObjectWithAnnotationRequests, annotation string, lastHandled *string) bool {
requestAt, requestOk := obj.GetAnnotations()[annotation]
reconcileAt, reconcileOk := ReconcileAnnotationValue(obj.GetAnnotations())
var lastHandledRequest string
if requestOk {
lastHandledRequest = *lastHandled
*lastHandled = requestAt
}
if requestOk && reconcileOk && requestAt == reconcileAt {
lastHandledReconcile := obj.GetLastHandledReconcileRequest()
if lastHandledReconcile != reconcileAt && lastHandledRequest != requestAt {
return true
}
}
return false
}

View File

@ -23,14 +23,27 @@ import (
type whateverStatus struct {
ReconcileRequestStatus `json:",inline"`
ForceRequestStatus `json:",inline"`
}
type whatever struct {
Annotations map[string]string
Status whateverStatus `json:"status,omitempty"`
Status whateverStatus `json:"status"`
}
func TestGetAnnotationValue(t *testing.T) {
func (w *whatever) GetAnnotations() map[string]string {
return w.Annotations
}
func (w *whatever) GetLastHandledReconcileRequest() string {
return w.Status.GetLastHandledReconcileRequest()
}
func (w *whatever) GetLastHandledForceRequestStatus() *string {
return &w.Status.LastHandledForceAt
}
func TestGetReconcileAnnotationValue(t *testing.T) {
obj := whatever{
Annotations: map[string]string{},
}
@ -41,8 +54,8 @@ func TestGetAnnotationValue(t *testing.T) {
}
obj.Status.SetLastHandledReconcileRequest(val)
// set one annotation: should detect a change
obj.Annotations[ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano)
// set annotation: should detect a change
obj.Annotations[ReconcileRequestAnnotation] = time.Now().Format(time.RFC3339Nano)
val, ok = ReconcileAnnotationValue(obj.Annotations)
if !ok {
t.Error("expected ReconcileAnnotationValue to return true when an annotation is set")
@ -54,7 +67,7 @@ func TestGetAnnotationValue(t *testing.T) {
obj.Status.SetLastHandledReconcileRequest(val)
// set the other annotation; should detect a change
// update annotation; should detect a change
obj.Annotations[ReconcileRequestAnnotation] = time.Now().Format(time.RFC3339Nano)
val, ok = ReconcileAnnotationValue(obj.Annotations)
if !ok {
@ -65,3 +78,112 @@ func TestGetAnnotationValue(t *testing.T) {
t.Error("expected to detect change in annotation value")
}
}
func TestShouldHandleForceRequest(t *testing.T) {
obj := &whatever{
Annotations: map[string]string{
ReconcileRequestAnnotation: "b",
ForceRequestAnnotation: "b",
},
Status: whateverStatus{
ReconcileRequestStatus: ReconcileRequestStatus{
LastHandledReconcileAt: "a",
},
ForceRequestStatus: ForceRequestStatus{
LastHandledForceAt: "a",
},
},
}
if !ShouldHandleForceRequest(obj) {
t.Error("ShouldHandleForceRequest() = false")
}
if obj.Status.LastHandledForceAt != "b" {
t.Error("ShouldHandleForceRequest did not update LastHandledForceAt")
}
}
func TestHandleAnnotationRequest(t *testing.T) {
const requestAnnotation = "requestAnnotation"
tests := []struct {
name string
annotations map[string]string
lastHandledReconcile string
lastHandledRequest string
want bool
expectLastHandledRequest string
}{
{
name: "valid request and reconcile annotations",
annotations: map[string]string{
ReconcileRequestAnnotation: "b",
requestAnnotation: "b",
},
want: true,
expectLastHandledRequest: "b",
},
{
name: "mismatched annotations",
annotations: map[string]string{
ReconcileRequestAnnotation: "b",
requestAnnotation: "c",
},
want: false,
expectLastHandledRequest: "c",
},
{
name: "reconcile matches previous request",
annotations: map[string]string{
ReconcileRequestAnnotation: "b",
requestAnnotation: "b",
},
lastHandledReconcile: "a",
lastHandledRequest: "b",
want: false,
expectLastHandledRequest: "b",
},
{
name: "request matches previous reconcile",
annotations: map[string]string{
ReconcileRequestAnnotation: "b",
requestAnnotation: "b",
},
lastHandledReconcile: "b",
lastHandledRequest: "a",
want: false,
expectLastHandledRequest: "b",
},
{
name: "missing annotations",
annotations: map[string]string{},
lastHandledRequest: "a",
want: false,
expectLastHandledRequest: "a",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
obj := &whatever{
Annotations: tt.annotations,
Status: whateverStatus{
ReconcileRequestStatus: ReconcileRequestStatus{
LastHandledReconcileAt: tt.lastHandledReconcile,
},
},
}
lastHandled := tt.lastHandledRequest
result := HandleAnnotationRequest(obj, requestAnnotation, &lastHandled)
if result != tt.want {
t.Errorf("HandleAnnotationRequest() = %v, want %v", result, tt.want)
}
if lastHandled != tt.expectLastHandledRequest {
t.Errorf("lastHandledRequest = %v, want %v", lastHandled, tt.expectLastHandledRequest)
}
})
}
}

View File

@ -1,5 +1,5 @@
/*
Copyright 2020 The Flux authors
Copyright 2022 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -17,55 +17,157 @@ limitations under the License.
package meta
import (
apimeta "k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// These constants define generic Condition types to be used by GitOps Toolkit components.
//
// The ReadyCondition SHOULD be implemented by all components' Kubernetes resources to indicate they have been fully
// reconciled by their respective reconciler. This MAY suffice for simple resources, e.g. a resource that just declares
// state once and is not expected to receive any updates afterwards.
//
// For Kubernetes resources that are expected to receive spec updates over time, take a longer time to reconcile, or
// deal with more complex logic in which for example a finite error state can be observed, it is RECOMMENDED to
// implement the StalledCondition and ReconcilingCondition.
//
// By doing this, observers making use of kstatus to determine the current state of the resource will have a better
// experience while they are e.g. waiting for a change to be reconciled, and will be able to stop waiting for a change
// if a StalledCondition is observed, without having to rely on a timeout.
//
// For more information on kstatus, see:
// https://github.com/kubernetes-sigs/cli-utils/blob/v0.25.0/pkg/kstatus/README.md
const (
// ReadyCondition is the name of the Ready condition implemented by all toolkit
// resources.
// ReadyCondition indicates the resource is ready and fully reconciled.
// If the Condition is False, the resource SHOULD be considered to be in the process of reconciling and not a
// representation of actual state.
ReadyCondition string = "Ready"
// StalledCondition indicates the reconciliation of the resource has stalled, e.g. because the controller has
// encountered an error during the reconcile process or it has made insufficient progress (timeout).
// The Condition adheres to an "abnormal-true" polarity pattern, and MUST only be present on the resource if the
// Condition is True.
// For more information about polarity patterns, see:
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
StalledCondition string = "Stalled"
// ReconcilingCondition indicates the controller is currently working on reconciling the latest changes. This MAY be
// True for multiple reconciliation attempts, e.g. when an transient error occurred.
// The Condition adheres to an "abnormal-true" polarity pattern, and MUST only be present on the resource if the
// Condition is True.
// For more information about polarity patterns, see:
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
ReconcilingCondition string = "Reconciling"
// HealthyCondition represents the last recorded
// health assessment result.
HealthyCondition string = "Healthy"
)
// These constants define generic Condition reasons to be used by GitOps Toolkit components.
//
// Making use of a generic Reason is RECOMMENDED whenever it can be applied to a Condition in which it provides
// sufficient context together with the type to summarize the meaning of the Condition cause.
//
// Where any of the generic Condition reasons does not suffice, GitOps Toolkit components can introduce new reasons to
// their API specification, or use an arbitrary PascalCase string when setting the Condition.
// Declaration of domain common Condition reasons in the API specification is RECOMMENDED, as it eases observations
// for user and computer.
//
// For more information on Condition reason conventions, see:
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
const (
// ReconciliationSucceededReason represents the fact that the reconciliation of
// a toolkit resource has succeeded.
ReconciliationSucceededReason string = "ReconciliationSucceeded"
// SucceededReason indicates a condition or event observed a success, for example when declared desired state
// matches actual state, or a performed action succeeded.
//
// More information about the reason of success MAY be available as additional metadata in an attached message.
SucceededReason string = "Succeeded"
// ReconciliationFailedReason represents the fact that the reconciliation of a
// toolkit resource has failed.
ReconciliationFailedReason string = "ReconciliationFailed"
// FailedReason indicates a condition or event observed a failure, for example when declared state does not match
// actual state, or a performed action failed.
//
// More information about the reason of failure MAY be available as additional metadata in an attached message.
FailedReason string = "Failed"
// ProgressingReason represents the fact that the reconciliation of a toolkit
// resource is underway.
// ProgressingReason indicates a condition or event observed progression, for example when the reconciliation of a
// resource or an action has started.
//
// When this reason is given, other conditions and types MAY no longer be considered as an up-to-date observation.
// Producers of the specific condition type or event SHOULD provide more information about the expectations and
// precise meaning in their API specification.
//
// More information about the reason or the current state of the progression MAY be available as additional metadata
// in an attached message.
ProgressingReason string = "Progressing"
// DependencyNotReadyReason represents the fact that one of the toolkit resource
// dependencies is not ready.
// SuspendedReason indicates a condition or event has observed a suspension, for
// example because a resource has been suspended, or a dependency is.
SuspendedReason string = "Suspended"
// ProgressingWithRetryReason represents the fact that
// the reconciliation encountered an error that will be retried.
ProgressingWithRetryReason string = "ProgressingWithRetry"
// DependencyNotReadyReason represents the fact that
// one of the dependencies is not ready.
DependencyNotReadyReason string = "DependencyNotReady"
// SuspendedReason represents the fact that the reconciliation of a toolkit
// resource is suspended.
SuspendedReason string = "Suspended"
// InvalidPathReason signals a failure caused by an invalid path.
InvalidPathReason string = "InvalidPath"
// InvalidURLReason signals a failure caused by an invalid URL.
InvalidURLReason string = "InvalidURL"
// InsecureConnectionsDisallowedReason signals a failure caused by
// the use of insecure HTTP connections.
InsecureConnectionsDisallowedReason = "InsecureConnectionsDisallowed"
// UnsupportedConnectionTypeReason signals a failure caused by
// the use of unsupported network protocols.
UnsupportedConnectionTypeReason = "UnsupportedConnectionType"
// PruneFailedReason represents the fact that the
// pruning of the resources failed.
PruneFailedReason string = "PruneFailed"
// ArtifactFailedReason represents the fact that the
// source artifact download failed.
ArtifactFailedReason string = "ArtifactFailed"
// BuildFailedReason represents the fact that the
// build failed.
BuildFailedReason string = "BuildFailed"
// HealthCheckFailedReason represents the fact that
// one of the health checks failed.
HealthCheckFailedReason string = "HealthCheckFailed"
// ReconciliationSucceededReason represents the fact that
// the reconciliation succeeded.
ReconciliationSucceededReason string = "ReconciliationSucceeded"
// ReconciliationFailedReason represents the fact that
// the reconciliation failed.
ReconciliationFailedReason string = "ReconciliationFailed"
// InvalidCELExpressionReason represents the fact that a CEL expression
// in the configuration is invalid.
InvalidCELExpressionReason string = "InvalidCELExpression"
// FeatureGateDisabledReason represents the fact that a feature is trying to
// be used, but the feature gate for that feature is disabled.
FeatureGateDisabledReason string = "FeatureGateDisabled"
)
// ObjectWithStatusConditions is an interface that describes kubernetes resource
// type structs with Status Conditions
type ObjectWithStatusConditions interface {
GetStatusConditions() *[]metav1.Condition
// ObjectWithConditions describes a Kubernetes resource object with status conditions.
// +k8s:deepcopy-gen=false
type ObjectWithConditions interface {
// GetConditions returns a slice of metav1.Condition
GetConditions() []metav1.Condition
}
// SetResourceCondition sets the given condition with the given status,
// reason and message on a resource.
func SetResourceCondition(obj ObjectWithStatusConditions, condition string, status metav1.ConditionStatus, reason, message string) {
conditions := obj.GetStatusConditions()
newCondition := metav1.Condition{
Type: condition,
Status: status,
Reason: reason,
Message: message,
}
apimeta.SetStatusCondition(conditions, newCondition)
// ObjectWithConditionsSetter describes a Kubernetes resource object with a status conditions setter.
// +k8s:deepcopy-gen=false
type ObjectWithConditionsSetter interface {
// SetConditions sets the status conditions on the object
SetConditions([]metav1.Condition)
}

24
apis/meta/dependencies.go Normal file
View File

@ -0,0 +1,24 @@
/*
Copyright 2021 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package meta
// ObjectWithDependencies describes a Kubernetes resource object with dependencies.
// +k8s:deepcopy-gen=false
type ObjectWithDependencies interface {
// GetDependsOn returns a NamespacedObjectReference list the object depends on.
GetDependsOn() []NamespacedObjectReference
}

View File

@ -14,6 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package meta contains the generic metadata APIs for use by
// toolkit components.
// Package meta contains the generic metadata APIs for use by GitOps Toolkit components.
//
// It is intended only to help adhere to Kubernetes API conventions, utility integrations, and Flux project considered
// best practices. It may therefore be suitable for usage by Kubernetes resources with no relationship to the GitOps
// Toolkit.
// +kubebuilder:object:generate=true
package meta

View File

@ -1,5 +1,25 @@
module github.com/fluxcd/pkg/apis/meta
go 1.15
go 1.24.0
require k8s.io/apimachinery v0.19.4
require k8s.io/apimachinery v0.33.2
require (
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/text v0.27.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 // indirect
sigs.k8s.io/yaml v1.5.0 // indirect
)

View File

@ -1,169 +1,87 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
github.com/go-logr/logr v0.2.0 h1:QvGt2nLcHH0WK9orKa+ppBPAxREcH364nPUedEpK0TY=
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0=
github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg=
github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc=
github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I=
github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g=
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/apimachinery v0.19.4 h1:+ZoddM7nbzrDCp0T3SWnyxqf8cbWPT2fkZImoyvHUG0=
k8s.io/apimachinery v0.19.4/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA=
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.2.0 h1:XRvcwJozkgZ1UQJmfMGpvRthQHOvihEhYtDfAaxMz/A=
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o=
sigs.k8s.io/structured-merge-diff/v4 v4.0.1 h1:YXTMot5Qz/X1iBRJhAt+vI+HVttY0WkSqqhKxQ0xVbA=
sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/apimachinery v0.33.2 h1:IHFVhqg59mb8PJWTLi8m1mAoepkUNYmptHsV+Z1m5jY=
k8s.io/apimachinery v0.33.2/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
sigs.k8s.io/randfill v0.0.0-20250304075658-069ef1bbf016/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU=
sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 h1:qPeWmscJcXP0snki5IYF79Z8xrl8ETFxgMd7wez1XkI=
sigs.k8s.io/structured-merge-diff/v4 v4.7.0/go.mod h1:dDy58f92j70zLsuZVuUX5Wp9vtxXpaZnkPGWeqDfCps=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
sigs.k8s.io/yaml v1.5.0 h1:M10b2U7aEUY6hRtU870n2VTPgR5RZiL/I6Lcc2F4NUQ=
sigs.k8s.io/yaml v1.5.0/go.mod h1:wZs27Rbxoai4C0f8/9urLZtZtF3avA3gKvGyPdDqTO4=

25
apis/meta/labels.go Normal file
View File

@ -0,0 +1,25 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package meta
const (
// LabelKeyWatch is used to indicate that a resource should be watched by Flux.
LabelKeyWatch = "reconcile.fluxcd.io/watch"
// LabelValueWatchEnabled is the value for LabelKeyWatch that indicates a resource should be watched.
LabelValueWatchEnabled = "Enabled"
)

View File

@ -0,0 +1,194 @@
/*
Copyright 2020, 2024 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package meta
// LocalObjectReference contains enough information to locate the referenced Kubernetes resource object.
type LocalObjectReference struct {
// Name of the referent.
// +required
Name string `json:"name"`
}
// NamespacedObjectReference contains enough information to locate the referenced Kubernetes resource object in any
// namespace.
type NamespacedObjectReference struct {
// Name of the referent.
// +required
Name string `json:"name"`
// Namespace of the referent, when not specified it acts as LocalObjectReference.
// +optional
Namespace string `json:"namespace,omitempty"`
}
// String implements the fmt.Stringer interface for NamespacedObjectReference.
func (in NamespacedObjectReference) String() string {
if in.Namespace != "" {
return in.Namespace + "/" + in.Name
}
return in.Name
}
// NamespacedObjectKindReference contains enough information to locate the typed referenced Kubernetes resource object
// in any namespace.
type NamespacedObjectKindReference struct {
// API version of the referent, if not specified the Kubernetes preferred version will be used.
// +optional
APIVersion string `json:"apiVersion,omitempty"`
// Kind of the referent.
// +required
Kind string `json:"kind"`
// Name of the referent.
// +required
Name string `json:"name"`
// Namespace of the referent, when not specified it acts as LocalObjectReference.
// +optional
Namespace string `json:"namespace,omitempty"`
}
// SecretKeyReference contains enough information to locate the referenced Kubernetes Secret object in the same
// namespace. Optionally a key can be specified.
// Use this type instead of core/v1 SecretKeySelector when the Key is optional and the Optional field is not
// applicable.
type SecretKeyReference struct {
// Name of the Secret.
// +required
Name string `json:"name"`
// Key in the Secret, when not specified an implementation-specific default key is used.
// +optional
Key string `json:"key,omitempty"`
}
const (
// KubeConfigKeyProvider is the key in the ConfigMap that contains the provider name.
KubeConfigKeyProvider = "provider"
// KubeConfigKeyAddress is the key in the ConfigMap that contains the cluster resource
// name in the provider API
KubeConfigKeyCluster = "cluster"
// KubeConfigKeyAddress is the key in the ConfigMap that contains the address of the
// Kubernetes API server.
KubeConfigKeyAddress = "address"
// KubeConfigKeyCACert is the key in the ConfigMap that contains the PEM-encoded CA
// certificate for the Kubernetes API server.
KubeConfigKeyCACert = "ca.crt"
// KubeConfigKeyAudiences is the key in the ConfigMap that contains the audiences
// for the Kubernetes ServiceAccount token.
KubeConfigKeyAudiences = "audiences"
// KubeConfigKeyServiceAccountName is the key in the ConfigMap that contains the
// name of the Kubernetes ServiceAccount in the same namespace that should be used
// for authentication.
KubeConfigKeyServiceAccountName = "serviceAccountName"
)
// KubeConfigReference contains enough information build a kubeconfig
// in memory for connecting to remote Kubernetes clusters.
// +kubebuilder:validation:XValidation:rule="has(self.configMapRef) || has(self.secretRef)", message="exactly one of spec.kubeConfig.configMapRef or spec.kubeConfig.secretRef must be specified"
// +kubebuilder:validation:XValidation:rule="!has(self.configMapRef) || !has(self.secretRef)", message="exactly one of spec.kubeConfig.configMapRef or spec.kubeConfig.secretRef must be specified"
type KubeConfigReference struct {
// ConfigMapRef holds an optional name of a ConfigMap that contains
// the following keys:
//
// - `provider`: the provider to use. One of `aws`, `azure`, `gcp`, or
// `generic`. Required.
// - `cluster`: the fully qualified resource name of the Kubernetes
// cluster in the cloud provider API. Not used by the `generic`
// provider. Required when one of `address` or `ca.crt` is not set.
// - `address`: the address of the Kubernetes API server. Required
// for `generic`. For the other providers, if not specified, the
// first address in the cluster resource will be used, and if
// specified, it must match one of the addresses in the cluster
// resource.
// If audiences is not set, will be used as the audience for the
// `generic` provider.
// - `ca.crt`: the optional PEM-encoded CA certificate for the
// Kubernetes API server. If not set, the controller will use the
// CA certificate from the cluster resource.
// - `audiences`: the optional audiences as a list of
// line-break-separated strings for the Kubernetes ServiceAccount
// token. Defaults to the `address` for the `generic` provider, or
// to specific values for the other providers depending on the
// provider.
// - `serviceAccountName`: the optional name of the Kubernetes
// ServiceAccount in the same namespace that should be used
// for authentication. If not specified, the controller
// ServiceAccount will be used.
//
// Mutually exclusive with SecretRef.
//
// +optional
ConfigMapRef *LocalObjectReference `json:"configMapRef,omitempty"`
// SecretRef holds an optional name of a secret that contains a key with
// the kubeconfig file as the value. If no key is set, the key will default
// to 'value'. Mutually exclusive with ConfigMapRef.
// It is recommended that the kubeconfig is self-contained, and the secret
// is regularly updated if credentials such as a cloud-access-token expire.
// Cloud specific `cmd-path` auth helpers will not function without adding
// binaries and credentials to the Pod that is responsible for reconciling
// Kubernetes resources. Supported only for the generic provider.
// +optional
SecretRef *SecretKeyReference `json:"secretRef,omitempty"`
}
// ValuesReference contains a reference to a resource containing Helm values,
// and optionally the key they can be found at.
type ValuesReference struct {
// Kind of the values referent, valid values are ('Secret', 'ConfigMap').
// +kubebuilder:validation:Enum=Secret;ConfigMap
// +required
Kind string `json:"kind"`
// Name of the values referent. Should reside in the same namespace as the
// referring resource.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
// +required
Name string `json:"name"`
// ValuesKey is the data key where the values.yaml or a specific value can be
// found at. Defaults to 'values.yaml'.
// +kubebuilder:validation:MaxLength=253
// +kubebuilder:validation:Pattern=`^[\-._a-zA-Z0-9]+$`
// +optional
ValuesKey string `json:"valuesKey,omitempty"`
// TargetPath is the YAML dot notation path the value should be merged at. When
// set, the ValuesKey is expected to be a single flat value. Defaults to 'None',
// which results in the values getting merged at the root.
// +kubebuilder:validation:MaxLength=250
// +kubebuilder:validation:Pattern=`^([a-zA-Z0-9_\-.\\\/]|\[[0-9]{1,5}\])+$`
// +optional
TargetPath string `json:"targetPath,omitempty"`
// Optional marks this ValuesReference as optional. When set, a not found error
// for the values reference is ignored, but any ValuesKey, TargetPath or
// transient error will still result in a reconciliation failure.
// +optional
Optional bool `json:"optional,omitempty"`
}
// GetValuesKey returns the defined ValuesKey, or the default ('values.yaml').
func (in ValuesReference) GetValuesKey() string {
if in.ValuesKey == "" {
return "values.yaml"
}
return in.ValuesKey
}

View File

@ -0,0 +1,153 @@
//go:build !ignore_autogenerated
/*
Copyright 2024 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by controller-gen. DO NOT EDIT.
package meta
import ()
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ForceRequestStatus) DeepCopyInto(out *ForceRequestStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ForceRequestStatus.
func (in *ForceRequestStatus) DeepCopy() *ForceRequestStatus {
if in == nil {
return nil
}
out := new(ForceRequestStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *KubeConfigReference) DeepCopyInto(out *KubeConfigReference) {
*out = *in
if in.ConfigMapRef != nil {
in, out := &in.ConfigMapRef, &out.ConfigMapRef
*out = new(LocalObjectReference)
**out = **in
}
if in.SecretRef != nil {
in, out := &in.SecretRef, &out.SecretRef
*out = new(SecretKeyReference)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeConfigReference.
func (in *KubeConfigReference) DeepCopy() *KubeConfigReference {
if in == nil {
return nil
}
out := new(KubeConfigReference)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *LocalObjectReference) DeepCopyInto(out *LocalObjectReference) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalObjectReference.
func (in *LocalObjectReference) DeepCopy() *LocalObjectReference {
if in == nil {
return nil
}
out := new(LocalObjectReference)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NamespacedObjectKindReference) DeepCopyInto(out *NamespacedObjectKindReference) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespacedObjectKindReference.
func (in *NamespacedObjectKindReference) DeepCopy() *NamespacedObjectKindReference {
if in == nil {
return nil
}
out := new(NamespacedObjectKindReference)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NamespacedObjectReference) DeepCopyInto(out *NamespacedObjectReference) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespacedObjectReference.
func (in *NamespacedObjectReference) DeepCopy() *NamespacedObjectReference {
if in == nil {
return nil
}
out := new(NamespacedObjectReference)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ReconcileRequestStatus) DeepCopyInto(out *ReconcileRequestStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReconcileRequestStatus.
func (in *ReconcileRequestStatus) DeepCopy() *ReconcileRequestStatus {
if in == nil {
return nil
}
out := new(ReconcileRequestStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SecretKeyReference) DeepCopyInto(out *SecretKeyReference) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretKeyReference.
func (in *SecretKeyReference) DeepCopy() *SecretKeyReference {
if in == nil {
return nil
}
out := new(SecretKeyReference)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ValuesReference) DeepCopyInto(out *ValuesReference) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ValuesReference.
func (in *ValuesReference) DeepCopy() *ValuesReference {
if in == nil {
return nil
}
out := new(ValuesReference)
in.DeepCopyInto(out)
return out
}

185
auth/access_token.go Normal file
View File

@ -0,0 +1,185 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package auth
import (
"context"
"fmt"
"strings"
authnv1 "k8s.io/api/authentication/v1"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/fluxcd/pkg/cache"
)
// GetAccessToken returns an access token for accessing resources in the given cloud provider.
func GetAccessToken(ctx context.Context, provider Provider, opts ...Option) (Token, error) {
var o Options
o.Apply(opts...)
// Initialize access token fetcher for controller.
newAccessToken := func() (Token, error) {
token, err := provider.NewControllerToken(ctx, opts...)
if err != nil {
return nil, fmt.Errorf("failed to create provider access token for the controller: %w", err)
}
return token, nil
}
// Update access token fetcher for a service account if specified.
var serviceAccount *corev1.ServiceAccount
var providerIdentity string
var audiences []string
if o.ServiceAccount != nil {
// Fetch service account details.
var err error
serviceAccount, audiences, providerIdentity, err =
getServiceAccountAndProviderInfo(ctx, provider, o.Client, *o.ServiceAccount, opts...)
if err != nil {
return nil, err
}
// Update the function to create an access token using the service account.
newAccessToken = func() (Token, error) {
// Check the feature gate for object-level workload identity.
if !IsObjectLevelWorkloadIdentityEnabled() {
return nil, ErrObjectLevelWorkloadIdentityNotEnabled
}
// Issue Kubernetes OIDC token for the service account.
tokenReq := &authnv1.TokenRequest{
Spec: authnv1.TokenRequestSpec{
Audiences: audiences,
},
}
if err := o.Client.SubResource("token").Create(ctx, serviceAccount, tokenReq); err != nil {
return nil, fmt.Errorf("failed to create kubernetes token for service account '%s/%s': %w",
serviceAccount.Namespace, serviceAccount.Name, err)
}
oidcToken := tokenReq.Status.Token
// Exchange the Kubernetes OIDC token for a provider access token.
token, err := provider.NewTokenForServiceAccount(ctx, oidcToken, *serviceAccount, opts...)
if err != nil {
return nil, fmt.Errorf("failed to create provider access token for service account '%s/%s': %w",
serviceAccount.Namespace, serviceAccount.Name, err)
}
return token, nil
}
}
// Bail out early if cache is disabled.
if o.Cache == nil {
return newAccessToken()
}
// Build cache key.
cacheKey := buildAccessTokenCacheKey(provider, audiences, providerIdentity, serviceAccount, opts...)
// Build involved object details.
kind := o.InvolvedObject.Kind
name := o.InvolvedObject.Name
namespace := o.InvolvedObject.Namespace
operation := o.InvolvedObject.Operation
// Get token from cache.
token, _, err := o.Cache.GetOrSet(ctx, cacheKey, func(ctx context.Context) (cache.Token, error) {
return newAccessToken()
}, cache.WithInvolvedObject(kind, name, namespace, operation))
if err != nil {
return nil, err
}
return token, nil
}
func getServiceAccountAndProviderInfo(ctx context.Context, provider Provider, client client.Client,
key client.ObjectKey, opts ...Option) (*corev1.ServiceAccount, []string, string, error) {
var o Options
o.Apply(opts...)
// Get service account.
var serviceAccount corev1.ServiceAccount
if err := client.Get(ctx, key, &serviceAccount); err != nil {
return nil, nil, "", fmt.Errorf("failed to get service account '%s/%s': %w",
key.Namespace, key.Name, err)
}
// Get provider audience.
audiences := o.Audiences
if len(audiences) == 0 {
var err error
audiences, err = provider.GetAudiences(ctx, serviceAccount)
if err != nil {
return nil, nil, "", fmt.Errorf("failed to get provider audience: %w", err)
}
}
// Get provider identity.
providerIdentity, err := provider.GetIdentity(serviceAccount)
if err != nil {
return nil, nil, "", fmt.Errorf("failed to get provider identity from service account '%s/%s' annotations: %w",
key.Namespace, key.Name, err)
}
return &serviceAccount, audiences, providerIdentity, nil
}
func buildAccessTokenCacheKey(provider Provider, audiences []string, providerIdentity string,
serviceAccount *corev1.ServiceAccount, opts ...Option) string {
var o Options
o.Apply(opts...)
var parts []string
parts = append(parts, fmt.Sprintf("provider=%s", provider.GetName()))
if serviceAccount != nil {
parts = append(parts, fmt.Sprintf("providerIdentity=%s", providerIdentity))
parts = append(parts, fmt.Sprintf("serviceAccountName=%s", serviceAccount.Name))
parts = append(parts, fmt.Sprintf("serviceAccountNamespace=%s", serviceAccount.Namespace))
parts = append(parts, fmt.Sprintf("serviceAccountTokenAudiences=%s", strings.Join(audiences, ",")))
}
if len(o.Scopes) > 0 {
parts = append(parts, fmt.Sprintf("scopes=%s", strings.Join(o.Scopes, ",")))
}
if o.STSRegion != "" {
parts = append(parts, fmt.Sprintf("stsRegion=%s", o.STSRegion))
}
if o.STSEndpoint != "" {
parts = append(parts, fmt.Sprintf("stsEndpoint=%s", o.STSEndpoint))
}
if o.ProxyURL != nil {
parts = append(parts, fmt.Sprintf("proxyURL=%s", o.ProxyURL))
}
if o.CAData != "" {
parts = append(parts, fmt.Sprintf("caData=%s", o.CAData))
}
return buildCacheKey(parts...)
}

254
auth/access_token_test.go Normal file
View File

@ -0,0 +1,254 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package auth_test
import (
"context"
"net/url"
"testing"
"time"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/fluxcd/pkg/auth"
"github.com/fluxcd/pkg/cache"
)
func TestGetAccessToken(t *testing.T) {
g := NewWithT(t)
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
t.Cleanup(cancel)
kubeClient, oidcClient := newTestEnv(t, ctx)
// Create a default service account.
defaultServiceAccount := &corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
Name: "default",
Namespace: "default",
},
}
err := kubeClient.Create(ctx, defaultServiceAccount)
g.Expect(err).NotTo(HaveOccurred())
saRef := client.ObjectKey{
Name: defaultServiceAccount.Name,
Namespace: defaultServiceAccount.Namespace,
}
for _, tt := range []struct {
name string
provider *mockProvider
opts []auth.Option
disableObjectLevel bool
expectedToken auth.Token
expectedErr string
}{
{
name: "controller access token",
provider: &mockProvider{
returnControllerToken: &mockToken{token: "mock-default-token"},
},
opts: []auth.Option{
auth.WithAudiences("audience1", "audience2"),
auth.WithScopes("scope1", "scope2"),
auth.WithSTSRegion("us-east-1"),
auth.WithSTSEndpoint("https://sts.some-cloud.io"),
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.io:8080"}),
auth.WithCAData("ca-data"),
},
expectedToken: &mockToken{token: "mock-default-token"},
},
{
name: "controller access token allowing shell out",
provider: &mockProvider{
returnControllerToken: &mockToken{token: "mock-default-token"},
paramAllowShellOut: true,
},
opts: []auth.Option{
auth.WithAudiences("audience1", "audience2"),
auth.WithScopes("scope1", "scope2"),
auth.WithSTSRegion("us-east-1"),
auth.WithSTSEndpoint("https://sts.some-cloud.io"),
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.io:8080"}),
auth.WithCAData("ca-data"),
auth.WithAllowShellOut(),
},
expectedToken: &mockToken{token: "mock-default-token"},
},
{
name: "access token from service account",
provider: &mockProvider{
returnName: "mock-provider",
returnAccessToken: &mockToken{token: "mock-access-token"},
paramAudiences: []string{"audience1", "audience2"},
paramServiceAccount: *defaultServiceAccount,
paramOIDCTokenClient: oidcClient,
},
opts: []auth.Option{
auth.WithServiceAccount(saRef, kubeClient),
auth.WithAudiences("audience1", "audience2"),
auth.WithScopes("scope1", "scope2"),
auth.WithSTSRegion("us-east-1"),
auth.WithSTSEndpoint("https://sts.some-cloud.io"),
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.io:8080"}),
auth.WithCAData("ca-data"),
// Exercise the code path where a cache is set but no token is
// available in the cache.
func(o *auth.Options) {
tokenCache, err := cache.NewTokenCache(1)
g.Expect(err).NotTo(HaveOccurred())
o.Cache = tokenCache
},
},
expectedToken: &mockToken{token: "mock-access-token"},
},
{
name: "access token from service account - default audience",
provider: &mockProvider{
returnName: "mock-provider",
returnAccessToken: &mockToken{token: "mock-access-token"},
paramAudiences: []string{},
paramServiceAccount: *defaultServiceAccount,
paramOIDCTokenClient: oidcClient,
},
opts: []auth.Option{
auth.WithServiceAccount(saRef, kubeClient),
auth.WithScopes("scope1", "scope2"),
auth.WithSTSRegion("us-east-1"),
auth.WithSTSEndpoint("https://sts.some-cloud.io"),
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.io:8080"}),
auth.WithCAData("ca-data"),
},
expectedToken: &mockToken{token: "mock-access-token"},
},
{
name: "all the options are taken into account in the cache key",
provider: &mockProvider{
returnName: "mock-provider",
returnIdentity: "mock-identity",
paramAudiences: []string{"audience1", "audience2"},
paramServiceAccount: *defaultServiceAccount,
},
opts: []auth.Option{
auth.WithServiceAccount(saRef, kubeClient),
auth.WithAudiences("audience1", "audience2"),
auth.WithScopes("scope1", "scope2"),
auth.WithSTSRegion("us-east-1"),
auth.WithSTSEndpoint("https://sts.some-cloud.io"),
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.io:8080"}),
auth.WithCAData("ca-data"),
func(o *auth.Options) {
tokenCache, err := cache.NewTokenCache(1)
g.Expect(err).NotTo(HaveOccurred())
const key = "db625bd5a96dc48fcc100659c6db98857d1e0ceec930bbded0fdece14af4307c"
token := &mockToken{token: "cached-token"}
cachedToken, ok, err := tokenCache.GetOrSet(ctx, key, func(ctx context.Context) (cache.Token, error) {
return token, nil
})
g.Expect(err).NotTo(HaveOccurred())
g.Expect(ok).To(BeFalse())
g.Expect(cachedToken).To(Equal(token))
o.Cache = tokenCache
},
},
expectedToken: &mockToken{token: "cached-token"},
},
{
name: "error getting identity",
provider: &mockProvider{
returnIdentityErr: "mock error",
paramServiceAccount: *defaultServiceAccount,
},
opts: []auth.Option{
auth.WithServiceAccount(saRef, kubeClient),
auth.WithAudiences("audience1", "audience2"),
auth.WithScopes("scope1", "scope2"),
auth.WithSTSRegion("us-east-1"),
auth.WithSTSEndpoint("https://sts.some-cloud.io"),
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.io:8080"}),
auth.WithCAData("ca-data"),
},
expectedErr: "failed to get provider identity from service account 'default/default' annotations: mock error",
},
{
name: "error getting identity using cache",
provider: &mockProvider{
returnIdentityErr: "mock error",
paramServiceAccount: *defaultServiceAccount,
},
opts: []auth.Option{
auth.WithServiceAccount(saRef, kubeClient),
auth.WithAudiences("audience1", "audience2"),
auth.WithScopes("scope1", "scope2"),
auth.WithSTSRegion("us-east-1"),
auth.WithSTSEndpoint("https://sts.some-cloud.io"),
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.io:8080"}),
auth.WithCAData("ca-data"),
func(o *auth.Options) {
tokenCache, err := cache.NewTokenCache(1)
g.Expect(err).NotTo(HaveOccurred())
o.Cache = tokenCache
},
},
expectedErr: "failed to get provider identity from service account 'default/default' annotations: mock error",
},
{
name: "disable object level workload identity",
provider: &mockProvider{
paramServiceAccount: *defaultServiceAccount,
},
opts: []auth.Option{
auth.WithServiceAccount(saRef, kubeClient),
auth.WithAudiences("audience1", "audience2"),
auth.WithScopes("scope1", "scope2"),
auth.WithSTSRegion("us-east-1"),
auth.WithSTSEndpoint("https://sts.some-cloud.io"),
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.io:8080"}),
auth.WithCAData("ca-data"),
},
disableObjectLevel: true,
expectedErr: "ObjectLevelWorkloadIdentity feature gate is not enabled",
},
} {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
tt.provider.t = t
if !tt.disableObjectLevel {
t.Setenv(auth.EnvVarEnableObjectLevelWorkloadIdentity, "true")
}
token, err := auth.GetAccessToken(ctx, tt.provider, tt.opts...)
if tt.expectedErr != "" {
g.Expect(err).To(HaveOccurred())
g.Expect(err.Error()).To(Equal(tt.expectedErr))
g.Expect(token).To(BeNil())
} else {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(token).To(Equal(tt.expectedToken))
}
})
}
}

View File

@ -0,0 +1,60 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package aws
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/fluxcd/pkg/auth"
)
type credentialsProvider struct {
ctx context.Context
opts []auth.Option
}
// NewCredentialsProvider creates a new credentials provider for the given options.
func NewCredentialsProvider(ctx context.Context, opts ...auth.Option) aws.CredentialsProvider {
return &credentialsProvider{ctx, opts}
}
// Retrieve implements aws.CredentialsProvider.
// The context is ignored, use the constructor to set the context.
// This is because the GCP abstraction does not receive a context
// in the method arguments, so we unfortunately need to standardize
// the behavior of all providers around this so the usage of this
// library can be consistent regardless of the provider.
func (c *credentialsProvider) Retrieve(context.Context) (aws.Credentials, error) {
token, err := auth.GetAccessToken(c.ctx, Provider{}, c.opts...)
if err != nil {
return aws.Credentials{}, err
}
awsCreds, ok := token.(*Credentials)
if !ok {
return aws.Credentials{}, fmt.Errorf("failed to cast token to AWS token: %T", token)
}
return aws.Credentials{
AccessKeyID: *awsCreds.AccessKeyId,
SecretAccessKey: *awsCreds.SecretAccessKey,
SessionToken: *awsCreds.SessionToken,
Expires: *awsCreds.Expiration,
CanExpire: true,
}, nil
}

View File

@ -0,0 +1,65 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package aws
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
signerv4 "github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/ecr"
"github.com/aws/aws-sdk-go-v2/service/ecrpublic"
"github.com/aws/aws-sdk-go-v2/service/eks"
"github.com/aws/aws-sdk-go-v2/service/sts"
)
// Implementation provides the required methods of the AWS libraries.
type Implementation interface {
LoadDefaultConfig(ctx context.Context, optFns ...func(*config.LoadOptions) error) (aws.Config, error)
AssumeRoleWithWebIdentity(ctx context.Context, params *sts.AssumeRoleWithWebIdentityInput, options sts.Options) (*sts.AssumeRoleWithWebIdentityOutput, error)
GetAuthorizationToken(ctx context.Context, cfg aws.Config) (any, error)
GetPublicAuthorizationToken(ctx context.Context, cfg aws.Config) (any, error)
DescribeCluster(ctx context.Context, params *eks.DescribeClusterInput, options eks.Options) (*eks.DescribeClusterOutput, error)
PresignGetCallerIdentity(ctx context.Context, optFn func(*sts.PresignOptions), options sts.Options) (*signerv4.PresignedHTTPRequest, error)
}
type implementation struct{}
func (implementation) LoadDefaultConfig(ctx context.Context, optFns ...func(*config.LoadOptions) error) (aws.Config, error) {
return config.LoadDefaultConfig(ctx, optFns...)
}
func (implementation) AssumeRoleWithWebIdentity(ctx context.Context, params *sts.AssumeRoleWithWebIdentityInput, options sts.Options) (*sts.AssumeRoleWithWebIdentityOutput, error) {
return sts.New(options).AssumeRoleWithWebIdentity(ctx, params)
}
func (implementation) GetAuthorizationToken(ctx context.Context, cfg aws.Config) (any, error) {
return ecr.NewFromConfig(cfg).GetAuthorizationToken(ctx, &ecr.GetAuthorizationTokenInput{})
}
func (implementation) GetPublicAuthorizationToken(ctx context.Context, cfg aws.Config) (any, error) {
return ecrpublic.NewFromConfig(cfg).GetAuthorizationToken(ctx, &ecrpublic.GetAuthorizationTokenInput{})
}
func (implementation) DescribeCluster(ctx context.Context, params *eks.DescribeClusterInput, options eks.Options) (*eks.DescribeClusterOutput, error) {
return eks.New(options).DescribeCluster(ctx, params)
}
func (implementation) PresignGetCallerIdentity(ctx context.Context, optFn func(*sts.PresignOptions), options sts.Options) (*signerv4.PresignedHTTPRequest, error) {
return sts.NewPresignClient(sts.New(options)).PresignGetCallerIdentity(ctx, &sts.GetCallerIdentityInput{}, optFn)
}

View File

@ -0,0 +1,281 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package aws_test
import (
"context"
"encoding/base64"
"errors"
"net/http"
"net/url"
"testing"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
signerv4 "github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/ecr"
ecrtypes "github.com/aws/aws-sdk-go-v2/service/ecr/types"
"github.com/aws/aws-sdk-go-v2/service/ecrpublic"
ecrpublictypes "github.com/aws/aws-sdk-go-v2/service/ecrpublic/types"
"github.com/aws/aws-sdk-go-v2/service/eks"
ekstypes "github.com/aws/aws-sdk-go-v2/service/eks/types"
"github.com/aws/aws-sdk-go-v2/service/sts"
ststypes "github.com/aws/aws-sdk-go-v2/service/sts/types"
. "github.com/onsi/gomega"
)
type mockImplementation struct {
t *testing.T
publicECR bool
expectEKSAPICall bool
argRoleARN string
argRoleSessionName string
argOIDCToken string
argRegion string
argSTSEndpoint string
argProxyURL *url.URL
argCredsProvider aws.CredentialsProvider
argClusterName string
returnCreds aws.Credentials
returnUsername string
returnPassword string
returnEndpoint string
returnCAData string
returnPresignedURL string
}
type mockHTTPPresigner struct {
t *testing.T
argClusterName string
returnURL string
}
type mockCredentialsProvider struct{ aws.Credentials }
func (m *mockImplementation) LoadDefaultConfig(ctx context.Context, optFns ...func(*config.LoadOptions) error) (aws.Config, error) {
m.t.Helper()
g := NewWithT(m.t)
var o config.LoadOptions
for _, optFn := range optFns {
optFn(&o)
}
g.Expect(o.Region).To(Equal(m.argRegion))
g.Expect(o.BaseEndpoint).To(Equal(m.argSTSEndpoint))
g.Expect(o.HTTPClient).NotTo(BeNil())
g.Expect(o.HTTPClient.(*http.Client)).NotTo(BeNil())
g.Expect(o.HTTPClient.(*http.Client).Transport).NotTo(BeNil())
g.Expect(o.HTTPClient.(*http.Client).Transport.(*http.Transport)).NotTo(BeNil())
g.Expect(o.HTTPClient.(*http.Client).Transport.(*http.Transport).Proxy).NotTo(BeNil())
proxyURL, err := o.HTTPClient.(*http.Client).Transport.(*http.Transport).Proxy(nil)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(proxyURL).To(Equal(m.argProxyURL))
return aws.Config{Credentials: &mockCredentialsProvider{m.returnCreds}}, nil
}
func (m *mockImplementation) AssumeRoleWithWebIdentity(ctx context.Context, params *sts.AssumeRoleWithWebIdentityInput, options sts.Options) (*sts.AssumeRoleWithWebIdentityOutput, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(params).NotTo(BeNil())
g.Expect(params.RoleArn).NotTo(BeNil())
g.Expect(*params.RoleArn).To(Equal(m.argRoleARN))
g.Expect(params.RoleSessionName).NotTo(BeNil())
g.Expect(*params.RoleSessionName).To(Equal(m.argRoleSessionName))
g.Expect(params.WebIdentityToken).NotTo(BeNil())
g.Expect(*params.WebIdentityToken).To(Equal(m.argOIDCToken))
g.Expect(options.Region).To(Equal(m.argRegion))
g.Expect(options.BaseEndpoint).NotTo(BeNil())
g.Expect(*options.BaseEndpoint).To(Equal(m.argSTSEndpoint))
g.Expect(options.HTTPClient).NotTo(BeNil())
g.Expect(options.HTTPClient.(*http.Client)).NotTo(BeNil())
g.Expect(options.HTTPClient.(*http.Client).Transport).NotTo(BeNil())
g.Expect(options.HTTPClient.(*http.Client).Transport.(*http.Transport)).NotTo(BeNil())
g.Expect(options.HTTPClient.(*http.Client).Transport.(*http.Transport).Proxy).NotTo(BeNil())
proxyURL, err := options.HTTPClient.(*http.Client).Transport.(*http.Transport).Proxy(nil)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(proxyURL).To(Equal(m.argProxyURL))
return &sts.AssumeRoleWithWebIdentityOutput{
Credentials: &ststypes.Credentials{
AccessKeyId: aws.String(m.returnCreds.AccessKeyID),
SecretAccessKey: aws.String(m.returnCreds.SecretAccessKey),
SessionToken: aws.String(m.returnCreds.SessionToken),
Expiration: aws.Time(m.returnCreds.Expires),
},
}, nil
}
func (m *mockImplementation) GetAuthorizationToken(ctx context.Context, cfg aws.Config) (any, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(m.publicECR).To(BeFalse())
m.checkGetAuthorizationToken(ctx, cfg)
return &ecr.GetAuthorizationTokenOutput{
AuthorizationData: []ecrtypes.AuthorizationData{{
AuthorizationToken: aws.String(base64.StdEncoding.EncodeToString([]byte(m.returnUsername + ":" + m.returnPassword))),
ExpiresAt: aws.Time(m.returnCreds.Expires),
}},
}, nil
}
func (m *mockImplementation) GetPublicAuthorizationToken(ctx context.Context, cfg aws.Config) (any, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(m.publicECR).To(BeTrue())
m.checkGetAuthorizationToken(ctx, cfg)
return &ecrpublic.GetAuthorizationTokenOutput{
AuthorizationData: &ecrpublictypes.AuthorizationData{
AuthorizationToken: aws.String(base64.StdEncoding.EncodeToString([]byte(m.returnUsername + ":" + m.returnPassword))),
ExpiresAt: aws.Time(m.returnCreds.Expires),
},
}, nil
}
func (m *mockImplementation) DescribeCluster(ctx context.Context, params *eks.DescribeClusterInput, options eks.Options) (*eks.DescribeClusterOutput, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(m.expectEKSAPICall).To(BeTrue())
g.Expect(params).NotTo(BeNil())
g.Expect(params.Name).NotTo(BeNil())
g.Expect(*params.Name).To(Equal(m.argClusterName))
g.Expect(options.Region).To(Equal(m.argRegion))
g.Expect(options.Credentials).To(Equal(m.argCredsProvider))
g.Expect(options.HTTPClient).NotTo(BeNil())
g.Expect(options.HTTPClient.(*http.Client)).NotTo(BeNil())
g.Expect(options.HTTPClient.(*http.Client).Transport).NotTo(BeNil())
g.Expect(options.HTTPClient.(*http.Client).Transport.(*http.Transport)).NotTo(BeNil())
g.Expect(options.HTTPClient.(*http.Client).Transport.(*http.Transport).Proxy).NotTo(BeNil())
proxyURL, err := options.HTTPClient.(*http.Client).Transport.(*http.Transport).Proxy(nil)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(proxyURL).To(Equal(m.argProxyURL))
return &eks.DescribeClusterOutput{
Cluster: &ekstypes.Cluster{
Name: aws.String(m.argClusterName),
Endpoint: aws.String(m.returnEndpoint),
CertificateAuthority: &ekstypes.Certificate{
Data: aws.String(m.returnCAData),
},
},
}, nil
}
func (m *mockImplementation) PresignGetCallerIdentity(ctx context.Context, optFn func(*sts.PresignOptions), options sts.Options) (*signerv4.PresignedHTTPRequest, error) {
m.t.Helper()
g := NewWithT(m.t)
// Check that optFn adds the presigner with the custom EKS headers to the options.
g.Expect(optFn).NotTo(BeNil())
mockPresigner := &mockHTTPPresigner{
t: m.t,
argClusterName: m.argClusterName,
returnURL: m.returnPresignedURL,
}
var presignOpts sts.PresignOptions
presignOpts.Presigner = mockPresigner
optFn(&presignOpts)
g.Expect(presignOpts.Presigner).NotTo(Equal(mockPresigner))
req, _ := http.NewRequest("POST", "https://sts.amazonaws.com/", nil)
signingTime := time.Date(2023, 1, 1, 12, 0, 0, 0, time.UTC)
signerOptFn := func(opts *signerv4.SignerOptions) { opts.LogSigning = true }
creds := aws.Credentials{
AccessKeyID: "access-key-id",
SecretAccessKey: "secret-access-key",
SessionToken: "session-token",
}
presignedURL, presignedHeader, err := presignOpts.Presigner.PresignHTTP(
ctx, creds, req, "payload-hash", "sts", "us-east-1", signingTime, signerOptFn)
g.Expect(presignedURL).To(Equal(m.returnPresignedURL))
g.Expect(presignedHeader).To(Equal(http.Header{"foo": []string{"bar"}}))
g.Expect(err).To(MatchError("mock presign error"))
// Check the sts options.
g.Expect(options.Region).To(Equal(m.argRegion))
g.Expect(options.Credentials).To(Equal(m.argCredsProvider))
if m.argSTSEndpoint != "" {
g.Expect(options.BaseEndpoint).NotTo(BeNil())
g.Expect(*options.BaseEndpoint).To(Equal(m.argSTSEndpoint))
} else {
g.Expect(options.BaseEndpoint).To(BeNil())
}
g.Expect(options.HTTPClient).NotTo(BeNil())
g.Expect(options.HTTPClient.(*http.Client)).NotTo(BeNil())
g.Expect(options.HTTPClient.(*http.Client).Transport).NotTo(BeNil())
g.Expect(options.HTTPClient.(*http.Client).Transport.(*http.Transport)).NotTo(BeNil())
g.Expect(options.HTTPClient.(*http.Client).Transport.(*http.Transport).Proxy).NotTo(BeNil())
proxyURL, err := options.HTTPClient.(*http.Client).Transport.(*http.Transport).Proxy(nil)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(proxyURL).To(Equal(m.argProxyURL))
return &signerv4.PresignedHTTPRequest{
URL: m.returnPresignedURL,
}, nil
}
func (m *mockImplementation) checkGetAuthorizationToken(ctx context.Context, cfg aws.Config) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(cfg.Region).To(Equal(m.argRegion))
g.Expect(cfg.Credentials).To(Equal(m.argCredsProvider))
g.Expect(cfg.HTTPClient).NotTo(BeNil())
g.Expect(cfg.HTTPClient.(*http.Client)).NotTo(BeNil())
g.Expect(cfg.HTTPClient.(*http.Client).Transport).NotTo(BeNil())
g.Expect(cfg.HTTPClient.(*http.Client).Transport.(*http.Transport)).NotTo(BeNil())
g.Expect(cfg.HTTPClient.(*http.Client).Transport.(*http.Transport).Proxy).NotTo(BeNil())
proxyURL, err := cfg.HTTPClient.(*http.Client).Transport.(*http.Transport).Proxy(nil)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(proxyURL).To(Equal(m.argProxyURL))
}
func (m *mockHTTPPresigner) PresignHTTP(ctx context.Context, credentials aws.Credentials,
r *http.Request, payloadHash string, service string, region string, signingTime time.Time,
optFns ...func(*signerv4.SignerOptions)) (url string, signedHeader http.Header, err error) {
m.t.Helper()
g := NewWithT(m.t)
// Check args.
g.Expect(ctx).NotTo(BeNil())
g.Expect(credentials.AccessKeyID).To(Equal("access-key-id"))
g.Expect(credentials.SecretAccessKey).To(Equal("secret-access-key"))
g.Expect(credentials.SessionToken).To(Equal("session-token"))
g.Expect(r).NotTo(BeNil())
g.Expect(r.Method).To(Equal("POST"))
g.Expect(r.URL.String()).To(Equal("https://sts.amazonaws.com/"))
g.Expect(r.Header.Get("x-k8s-aws-id")).To(Equal(m.argClusterName))
g.Expect(r.Header.Get("X-Amz-Expires")).To(Equal("900"))
g.Expect(payloadHash).To(Equal("payload-hash"))
g.Expect(service).To(Equal("sts"))
g.Expect(region).To(Equal("us-east-1"))
g.Expect(signingTime).To(Equal(time.Date(2023, 1, 1, 12, 0, 0, 0, time.UTC)))
g.Expect(optFns).To(HaveLen(1))
optFn := optFns[0]
g.Expect(optFn).NotTo(BeNil())
var signerOpts signerv4.SignerOptions
optFn(&signerOpts)
g.Expect(signerOpts).To(Equal(signerv4.SignerOptions{LogSigning: true}))
return m.returnURL, http.Header{"foo": []string{"bar"}}, errors.New("mock presign error")
}
func (m *mockCredentialsProvider) Retrieve(ctx context.Context) (aws.Credentials, error) {
return m.Credentials, nil
}

81
auth/aws/options.go Normal file
View File

@ -0,0 +1,81 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package aws
import (
"fmt"
"regexp"
corev1 "k8s.io/api/core/v1"
)
const stsEndpointPattern = `^https://(.+\.)?sts(-fips)?(\.[^.]+)?(\.vpce)?\.amazonaws\.com$`
var stsEndpointRegex = regexp.MustCompile(stsEndpointPattern)
// ValidateSTSEndpoint checks if the provided STS endpoint is valid.
//
// Global and regional endpoints:
//
// https://docs.aws.amazon.com/general/latest/gr/sts.html
//
// VPC endpoint examples:
//
// https://vpce-002b7cc8966426bc6-njisq19r.sts.us-east-1.vpce.amazonaws.com
// https://vpce-002b7cc8966426bc6-njisq19r-us-east-1a.sts.us-east-1.vpce.amazonaws.com
func ValidateSTSEndpoint(endpoint string) error {
if !stsEndpointRegex.MatchString(endpoint) {
return fmt.Errorf("invalid STS endpoint: '%s'. must match %s",
endpoint, stsEndpointPattern)
}
return nil
}
const roleARNPattern = `^arn:aws[\w-]*:iam::[0-9]{1,30}:role/.{1,200}$`
var roleARNRegex = regexp.MustCompile(roleARNPattern)
func getRoleARN(serviceAccount corev1.ServiceAccount) (string, error) {
const key = "eks.amazonaws.com/role-arn"
arn := serviceAccount.Annotations[key]
if !roleARNRegex.MatchString(arn) {
return "", fmt.Errorf("invalid %s annotation: '%s'. must match %s",
key, arn, roleARNPattern)
}
return arn, nil
}
func getRoleSessionName(serviceAccount corev1.ServiceAccount, region string) string {
name := serviceAccount.Name
namespace := serviceAccount.Namespace
return fmt.Sprintf("%s.%s.%s.fluxcd.io", name, namespace, region)
}
const clusterPattern = `^arn:aws[\w-]*:eks:([^:]{1,100}):[0-9]{1,30}:cluster/(.{1,200})$`
var clusterRegex = regexp.MustCompile(clusterPattern)
func parseCluster(cluster string) (string, string, error) {
m := clusterRegex.FindStringSubmatch(cluster)
if len(m) != 3 {
return "", "", fmt.Errorf("invalid EKS cluster ARN: '%s'. must match %s",
cluster, clusterPattern)
}
region := m[1]
name := m[2]
return region, name, nil
}

154
auth/aws/options_test.go Normal file
View File

@ -0,0 +1,154 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package aws_test
import (
"testing"
. "github.com/onsi/gomega"
"github.com/fluxcd/pkg/auth/aws"
)
func TestValidateSTSEndpoint(t *testing.T) {
for _, tt := range []struct {
name string
stsEndpoint string
valid bool
}{
// valid endpoints
{
name: "global endpoint",
stsEndpoint: "https://sts.amazonaws.com",
valid: true,
},
{
name: "sts.us-east-2.amazonaws.com",
stsEndpoint: "https://sts.us-east-2.amazonaws.com",
valid: true,
},
{
name: "sts-fips.us-east-2.amazonaws.com",
stsEndpoint: "https://sts-fips.us-east-2.amazonaws.com",
valid: true,
},
{
name: "sts.us-east-1.amazonaws.com",
stsEndpoint: "https://sts.us-east-1.amazonaws.com",
valid: true,
},
{
name: "sts-fips.us-east-1.amazonaws.com",
stsEndpoint: "https://sts-fips.us-east-1.amazonaws.com",
valid: true,
},
{
name: "sts.us-west-1.amazonaws.com",
stsEndpoint: "https://sts.us-west-1.amazonaws.com",
valid: true,
},
{
name: "sts-fips.us-west-1.amazonaws.com",
stsEndpoint: "https://sts-fips.us-west-1.amazonaws.com",
valid: true,
},
{
name: "sts.us-west-2.amazonaws.com",
stsEndpoint: "https://sts.us-west-2.amazonaws.com",
valid: true,
},
{
name: "sts-fips.us-west-2.amazonaws.com",
stsEndpoint: "https://sts-fips.us-west-2.amazonaws.com",
valid: true,
},
{
name: "sts.il-central-1.amazonaws.com",
stsEndpoint: "https://sts.il-central-1.amazonaws.com",
valid: true,
},
{
name: "sts.mx-central-1.amazonaws.com",
stsEndpoint: "https://sts.mx-central-1.amazonaws.com",
valid: true,
},
{
name: "sts.me-south-1.amazonaws.com",
stsEndpoint: "https://sts.me-south-1.amazonaws.com",
valid: true,
},
{
name: "sts.me-central-1.amazonaws.com",
stsEndpoint: "https://sts.me-central-1.amazonaws.com",
valid: true,
},
{
name: "sts.sa-east-1.amazonaws.com",
stsEndpoint: "https://sts.sa-east-1.amazonaws.com",
valid: true,
},
{
name: "sts.us-gov-east-1.amazonaws.com",
stsEndpoint: "https://sts.us-gov-east-1.amazonaws.com",
valid: true,
},
{
name: "sts.us-gov-west-1.amazonaws.com",
stsEndpoint: "https://sts.us-gov-west-1.amazonaws.com",
valid: true,
},
{
name: "vpce-002b7cc8966426bc6-njisq19r.sts.us-east-1.vpce.amazonaws.com",
stsEndpoint: "https://vpce-002b7cc8966426bc6-njisq19r.sts.us-east-1.vpce.amazonaws.com",
valid: true,
},
{
name: "vpce-002b7cc8966426bc6-njisq19r-us-east-1a.sts.us-east-1.vpce.amazonaws.com",
stsEndpoint: "https://vpce-002b7cc8966426bc6-njisq19r-us-east-1a.sts.us-east-1.vpce.amazonaws.com",
valid: true,
},
// invalid endpoints
{
name: "non sts endpoint",
stsEndpoint: "https://stss.amazonaws.com",
valid: false,
},
{
name: "non aws endpoint",
stsEndpoint: "https://sts.amazonaws.example.com",
valid: false,
},
{
name: "http endpoint",
stsEndpoint: "http://sts.amazonaws.com",
valid: false,
},
{
name: "no scheme",
stsEndpoint: "sts.amazonaws.com",
valid: false,
},
} {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
err := aws.ValidateSTSEndpoint(tt.stsEndpoint)
g.Expect(err == nil).To(Equal(tt.valid))
})
}
}

412
auth/aws/provider.go Normal file
View File

@ -0,0 +1,412 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package aws
import (
"context"
"encoding/base64"
"errors"
"fmt"
"os"
"regexp"
"strings"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/ecr"
"github.com/aws/aws-sdk-go-v2/service/ecrpublic"
"github.com/aws/aws-sdk-go-v2/service/eks"
"github.com/aws/aws-sdk-go-v2/service/sts"
"github.com/google/go-containerregistry/pkg/authn"
corev1 "k8s.io/api/core/v1"
"github.com/fluxcd/pkg/auth"
)
// ProviderName is the name of the AWS authentication provider.
const ProviderName = "aws"
// Provider implements the auth.Provider interface for AWS authentication.
type Provider struct{ Implementation }
// GetName implements auth.Provider.
func (Provider) GetName() string {
return ProviderName
}
// NewControllerToken implements auth.Provider.
func (p Provider) NewControllerToken(ctx context.Context, opts ...auth.Option) (auth.Token, error) {
var o auth.Options
o.Apply(opts...)
confOpts := []func(*config.LoadOptions) error{
config.WithHTTPClient(o.GetHTTPClient()),
}
stsRegion := o.STSRegion
if stsRegion == "" {
// EKS sets this environment variable automatically if the controller pod is
// properly configured with IRSA or EKS Pod Identity, so we can rely on it.
stsRegion = os.Getenv("AWS_REGION")
if stsRegion == "" {
return nil, errors.New("AWS_REGION environment variable is not set in the Flux controller. " +
"if you have properly configured IAM Roles for Service Accounts (IRSA) or EKS Pod Identity, " +
"please delete/replace the controller pod so the EKS admission controllers can inject this " +
"environment variable, or set it manually if the cluster is not EKS")
}
}
confOpts = append(confOpts, config.WithRegion(stsRegion))
if e := o.STSEndpoint; e != "" {
if err := ValidateSTSEndpoint(e); err != nil {
return nil, err
}
confOpts = append(confOpts, config.WithBaseEndpoint(e))
}
conf, err := p.impl().LoadDefaultConfig(ctx, confOpts...)
if err != nil {
return nil, err
}
creds, err := conf.Credentials.Retrieve(ctx)
if err != nil {
return nil, err
}
return newTokenFromAWSCredentials(&creds), nil
}
// GetAudiences implements auth.Provider.
func (Provider) GetAudiences(context.Context, corev1.ServiceAccount) ([]string, error) {
return []string{"sts.amazonaws.com"}, nil
}
// GetIdentity implements auth.Provider.
func (Provider) GetIdentity(serviceAccount corev1.ServiceAccount) (string, error) {
roleARN, err := getRoleARN(serviceAccount)
if err != nil {
return "", err
}
return roleARN, nil
}
// NewTokenForServiceAccount implements auth.Provider.
func (p Provider) NewTokenForServiceAccount(ctx context.Context, oidcToken string,
serviceAccount corev1.ServiceAccount, opts ...auth.Option) (auth.Token, error) {
var o auth.Options
o.Apply(opts...)
stsRegion := o.STSRegion
if stsRegion == "" {
// In this case we can't rely on IRSA or EKS Pod Identity for the controller
// pod because this is object-level configuration, so we show a different
// error message.
// In this error message we assume an API that has a region field, e.g. the
// Bucket API. APIs that can extract the region from the ARN (e.g. KMS) will
// never reach this code path.
return nil, errors.New("an AWS region is required for authenticating with a service account. " +
"please configure one in the object spec")
}
roleARN, err := getRoleARN(serviceAccount)
if err != nil {
return nil, err
}
roleSessionName := getRoleSessionName(serviceAccount, stsRegion)
stsOpts := sts.Options{
Region: stsRegion,
HTTPClient: o.GetHTTPClient(),
}
if e := o.STSEndpoint; e != "" {
if err := ValidateSTSEndpoint(e); err != nil {
return nil, err
}
stsOpts.BaseEndpoint = &e
}
req := &sts.AssumeRoleWithWebIdentityInput{
RoleArn: &roleARN,
RoleSessionName: &roleSessionName,
WebIdentityToken: &oidcToken,
}
resp, err := p.impl().AssumeRoleWithWebIdentity(ctx, req, stsOpts)
if err != nil {
return nil, err
}
if resp.Credentials == nil {
return nil, fmt.Errorf("credentials are nil")
}
creds := &Credentials{*resp.Credentials}
if creds.Expiration == nil {
creds.Expiration = &time.Time{}
}
return creds, nil
}
// GetAccessTokenOptionsForArtifactRepository implements auth.Provider.
func (p Provider) GetAccessTokenOptionsForArtifactRepository(artifactRepository string) ([]auth.Option, error) {
// AWS requires a region for getting access credentials. To avoid requiring
// two regions to be passed in the Flux APIs we leverage the region present
// in the ECR repository.
// **Important**: This code path is required for supporting the identity of
// the EKS node! The AWS_REGION environment variable is only automatically
// set for IRSA and EKS Pod Identity. We strive to support the identity of
// the node for artifact repository APIs because EKS users also use it for
// for pulling container images to spin up pods inside the cluster, so this
// allows a simpler user experience setting up ECR authentication only once.
registryInput, err := p.ParseArtifactRepository(artifactRepository)
if err != nil {
return nil, err
}
ecrRegion := getECRRegionFromRegistryInput(registryInput)
return []auth.Option{auth.WithSTSRegion(ecrRegion)}, nil
}
// This regex is sourced from the AWS ECR Credential Helper (https://github.com/awslabs/amazon-ecr-credential-helper).
// It covers both public AWS partitions like amazonaws.com, China partitions like amazonaws.com.cn, and non-public partitions.
const registryPattern = `([0-9+]*).dkr.ecr(?:-fips)?\.([^/.]*)\.(amazonaws\.com[.cn]*|sc2s\.sgov\.gov|c2s\.ic\.gov|cloud\.adc-e\.uk|csp\.hci\.ic\.gov)`
const publicECR = "public.ecr.aws"
var registryRegex = regexp.MustCompile(registryPattern)
// ParseArtifactRepository implements auth.Provider.
// ParseArtifactRepository returns the ECR region, unless the registry
// is public.ecr.aws, in which case it returns public.ecr.aws.
func (Provider) ParseArtifactRepository(artifactRepository string) (string, error) {
registry, err := auth.GetRegistryFromArtifactRepository(artifactRepository)
if err != nil {
return "", err
}
if registry == publicECR {
return publicECR, nil
}
parts := registryRegex.FindAllStringSubmatch(registry, -1)
if len(parts) < 1 || len(parts[0]) < 3 {
return "", fmt.Errorf("invalid AWS registry: '%s'. must match %s",
registry, registryPattern)
}
ecrRegion := parts[0][2]
return ecrRegion, nil
}
func getECRRegionFromRegistryInput(registryInput string) string {
if registryInput == publicECR {
// Region is required to be us-east-1 for public ECR:
// https://docs.aws.amazon.com/AmazonECR/latest/public/public-registry-auth.html#public-registry-auth-token
return "us-east-1"
}
return registryInput
}
// NewArtifactRegistryCredentials implements auth.Provider.
func (p Provider) NewArtifactRegistryCredentials(ctx context.Context, registryInput string,
accessToken auth.Token, opts ...auth.Option) (*auth.ArtifactRegistryCredentials, error) {
var o auth.Options
o.Apply(opts...)
authTokenFunc := p.impl().GetAuthorizationToken
if registryInput == publicECR {
authTokenFunc = p.impl().GetPublicAuthorizationToken
}
conf := aws.Config{
Region: getECRRegionFromRegistryInput(registryInput),
Credentials: accessToken.(*Credentials).provider(),
HTTPClient: o.GetHTTPClient(),
}
respAny, err := authTokenFunc(ctx, conf)
if err != nil {
return nil, err
}
// Parse the authorization token.
var token string
var expiresAt time.Time
switch resp := respAny.(type) {
case *ecr.GetAuthorizationTokenOutput:
if len(resp.AuthorizationData) == 0 {
return nil, fmt.Errorf("no authorization data returned")
}
if resp.AuthorizationData[0].AuthorizationToken == nil {
return nil, fmt.Errorf("authorization token is nil")
}
if resp.AuthorizationData[0].ExpiresAt == nil {
return nil, fmt.Errorf("authorization token expiration is nil")
}
token = *resp.AuthorizationData[0].AuthorizationToken
expiresAt = *resp.AuthorizationData[0].ExpiresAt
case *ecrpublic.GetAuthorizationTokenOutput:
if resp.AuthorizationData == nil {
return nil, fmt.Errorf("no authorization data returned")
}
if resp.AuthorizationData.AuthorizationToken == nil {
return nil, fmt.Errorf("authorization token is nil")
}
if resp.AuthorizationData.ExpiresAt == nil {
return nil, fmt.Errorf("authorization token expiration is nil")
}
token = *resp.AuthorizationData.AuthorizationToken
expiresAt = *resp.AuthorizationData.ExpiresAt
}
b, err := base64.StdEncoding.DecodeString(token)
if err != nil {
return nil, fmt.Errorf("failed to parse authorization token: %w", err)
}
s := strings.Split(string(b), ":")
if len(s) != 2 {
return nil, fmt.Errorf("invalid authorization token format")
}
return &auth.ArtifactRegistryCredentials{
Authenticator: authn.FromConfig(authn.AuthConfig{
Username: s[0],
Password: s[1],
}),
ExpiresAt: expiresAt,
}, nil
}
// GetAccessTokenOptionsForCluster implements auth.Provider.
func (Provider) GetAccessTokenOptionsForCluster(opts ...auth.Option) ([][]auth.Option, error) {
var o auth.Options
o.Apply(opts...)
// ClusterResource is always needed for AWS as we need to extract the region.
region, _, err := parseCluster(o.ClusterResource)
if err != nil {
return nil, err
}
return [][]auth.Option{{auth.WithSTSRegion(region)}}, nil
}
// NewRESTConfig implements auth.Provider.
//
// Reference:
// https://docs.aws.amazon.com/eks/latest/best-practices/identity-and-access-management.html#_controlling_access_to_eks_clusters
func (p Provider) NewRESTConfig(ctx context.Context, accessTokens []auth.Token,
opts ...auth.Option) (*auth.RESTConfig, error) {
// The expiration for an EKS restconfig is always 15 minutes, see the reference above.
// Let's record time.Now() on the beginning of the procedure to be on the safe side.
expiresAt := time.Now().Add(15 * time.Minute)
creds := accessTokens[0].(*Credentials).provider()
var o auth.Options
o.Apply(opts...)
hc := o.GetHTTPClient()
// ClusterResource is always needed for AWS as we need to extract the region.
cluster := o.ClusterResource
region, clusterName, err := parseCluster(cluster)
if err != nil {
return nil, err
}
// Describe the cluster resource to get missing CA or endpoint.
host := o.ClusterAddress
caData := []byte(o.CAData)
if host == "" || len(caData) == 0 {
describeInput := &eks.DescribeClusterInput{
Name: aws.String(clusterName),
}
eksOpts := eks.Options{
Region: region,
Credentials: creds,
HTTPClient: hc,
}
clusterResource, err := p.impl().DescribeCluster(ctx, describeInput, eksOpts)
if err != nil {
return nil, fmt.Errorf("failed to describe EKS cluster '%s': %w", cluster, err)
}
// Compare specified address and address from the cluster resource.
endpoint := *clusterResource.Cluster.Endpoint
if host != "" {
canonicalAddress, err := auth.ParseClusterAddress(host)
if err != nil {
return nil, fmt.Errorf("failed to parse specified cluster address '%s': %w", host, err)
}
canonicalEndpoint, err := auth.ParseClusterAddress(endpoint)
if err != nil {
return nil, fmt.Errorf("failed to parse EKS endpoint '%s': %w", endpoint, err)
}
if canonicalAddress != canonicalEndpoint {
return nil, fmt.Errorf("EKS endpoint '%s' does not match specified address: '%s'", endpoint, host)
}
}
// Update host and CA with cluster details.
host = endpoint
if len(caData) == 0 {
caData, err = base64.StdEncoding.DecodeString(*clusterResource.Cluster.CertificateAuthority.Data)
if err != nil {
return nil, fmt.Errorf("failed to decode EKS CA certificate: %w", err)
}
}
}
// Build token. See reference above.
presignOpts := func(po *sts.PresignOptions) {
po.Presigner = &eksHTTPPresignerV4{
HTTPPresignerV4: po.Presigner,
clusterName: clusterName,
}
}
stsOpts := sts.Options{
Region: region,
Credentials: creds,
HTTPClient: hc,
}
if e := o.STSEndpoint; e != "" {
if err := ValidateSTSEndpoint(e); err != nil {
return nil, err
}
stsOpts.BaseEndpoint = &e
}
presignedReq, err := p.impl().PresignGetCallerIdentity(ctx, presignOpts, stsOpts)
if err != nil {
return nil, fmt.Errorf("failed to presign GetCallerIdentity request: %w", err)
}
token := fmt.Sprintf("k8s-aws-v1.%s", base64.RawURLEncoding.EncodeToString([]byte(presignedReq.URL)))
// Build and return the REST config.
return &auth.RESTConfig{
Host: host,
BearerToken: token,
CAData: caData,
ExpiresAt: expiresAt,
}, nil
}
func (p Provider) impl() Implementation {
if p.Implementation == nil {
return implementation{}
}
return p.Implementation
}

495
auth/aws/provider_test.go Normal file
View File

@ -0,0 +1,495 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package aws_test
import (
"context"
"net/url"
"testing"
"time"
awssdk "github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/credentials"
"github.com/aws/aws-sdk-go-v2/service/sts/types"
"github.com/google/go-containerregistry/pkg/authn"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/fluxcd/pkg/auth"
"github.com/fluxcd/pkg/auth/aws"
)
func TestProvider_NewControllerToken(t *testing.T) {
impl := &mockImplementation{
t: t,
argRegion: "us-east-1",
argProxyURL: &url.URL{Scheme: "http", Host: "proxy.example.com"},
argSTSEndpoint: "https://sts.amazonaws.com",
returnCreds: awssdk.Credentials{AccessKeyID: "access-key-id"},
}
for _, tt := range []struct {
name string
stsEndpoint string
artifactRepository string
skipSTSRegion bool
err string
}{
{
name: "valid",
stsEndpoint: "https://sts.amazonaws.com",
},
{
name: "invalid sts endpoint",
stsEndpoint: "https://something.amazonaws.com",
err: `invalid STS endpoint: 'https://something.amazonaws.com'. must match ^https://(.+\.)?sts(-fips)?(\.[^.]+)?(\.vpce)?\.amazonaws\.com$`,
},
{
name: "missing region",
stsEndpoint: "https://sts.amazonaws.com",
skipSTSRegion: true,
err: "AWS_REGION environment variable is not set in the Flux controller. " +
"if you have properly configured IAM Roles for Service Accounts (IRSA) or EKS Pod Identity, " +
"please delete/replace the controller pod so the EKS admission controllers can inject this " +
"environment variable, or set it manually if the cluster is not EKS",
},
} {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
if !tt.skipSTSRegion {
t.Setenv("AWS_REGION", "us-east-1")
}
opts := []auth.Option{
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.example.com"}),
auth.WithSTSEndpoint(tt.stsEndpoint),
}
provider := aws.Provider{Implementation: impl}
token, err := provider.NewControllerToken(context.Background(), opts...)
if tt.err == "" {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(token).To(Equal(&aws.Credentials{Credentials: types.Credentials{
AccessKeyId: awssdk.String("access-key-id"),
SecretAccessKey: awssdk.String(""),
SessionToken: awssdk.String(""),
Expiration: awssdk.Time(time.Time{}),
}}))
} else {
g.Expect(err).To(HaveOccurred())
g.Expect(err.Error()).To(Equal(tt.err))
g.Expect(token).To(BeNil())
}
})
}
}
func TestProvider_NewTokenForServiceAccount(t *testing.T) {
for _, tt := range []struct {
name string
roleARN string
stsEndpoint string
artifactRepository string
skipSTSRegion bool
err string
}{
{
name: "valid",
roleARN: "arn:aws:iam::1234567890:role/some-role",
stsEndpoint: "https://sts.amazonaws.com",
},
{
name: "us gov is valid",
roleARN: "arn:aws-us-gov:iam::1234567890:role/some-role",
stsEndpoint: "https://sts.amazonaws.com",
},
{
name: "invalid sts endpoint",
roleARN: "arn:aws:iam::1234567890:role/some-role",
stsEndpoint: "https://something.amazonaws.com",
err: `invalid STS endpoint: 'https://something.amazonaws.com'. must match ^https://(.+\.)?sts(-fips)?(\.[^.]+)?(\.vpce)?\.amazonaws\.com$`,
},
{
name: "missing region",
roleARN: "arn:aws:iam::1234567890:role/some-role",
stsEndpoint: "https://sts.amazonaws.com",
skipSTSRegion: true,
err: "an AWS region is required for authenticating with a service account. " +
"please configure one in the object spec",
},
{
name: "invalid role ARN",
roleARN: "foobar",
stsEndpoint: "https://sts.amazonaws.com",
err: `invalid eks.amazonaws.com/role-arn annotation: 'foobar'. must match ^arn:aws[\w-]*:iam::[0-9]{1,30}:role/.{1,200}$`,
},
} {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
impl := &mockImplementation{
t: t,
argRegion: "us-east-1",
argRoleARN: tt.roleARN,
argRoleSessionName: "test-sa.test-ns.us-east-1.fluxcd.io",
argOIDCToken: "oidc-token",
argProxyURL: &url.URL{Scheme: "http", Host: "proxy.example.com"},
argSTSEndpoint: "https://sts.amazonaws.com",
returnCreds: awssdk.Credentials{AccessKeyID: "access-key-id"},
}
oidcToken := "oidc-token"
serviceAccount := corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
Name: "test-sa",
Namespace: "test-ns",
Annotations: map[string]string{"eks.amazonaws.com/role-arn": tt.roleARN},
},
}
opts := []auth.Option{
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.example.com"}),
auth.WithSTSEndpoint(tt.stsEndpoint),
}
if !tt.skipSTSRegion {
opts = append(opts, auth.WithSTSRegion("us-east-1"))
}
provider := aws.Provider{Implementation: impl}
token, err := provider.NewTokenForServiceAccount(context.Background(), oidcToken, serviceAccount, opts...)
if tt.err == "" {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(token).To(Equal(&aws.Credentials{Credentials: types.Credentials{
AccessKeyId: awssdk.String("access-key-id"),
SecretAccessKey: awssdk.String(""),
SessionToken: awssdk.String(""),
Expiration: awssdk.Time(time.Time{}),
}}))
} else {
g.Expect(err).To(HaveOccurred())
g.Expect(err.Error()).To(Equal(tt.err))
g.Expect(token).To(BeNil())
}
})
}
}
func TestProvider_GetAudiences(t *testing.T) {
g := NewWithT(t)
aud, err := aws.Provider{}.GetAudiences(context.Background(), corev1.ServiceAccount{})
g.Expect(err).NotTo(HaveOccurred())
g.Expect(aud).To(Equal([]string{"sts.amazonaws.com"}))
}
func TestProvider_GetIdentity(t *testing.T) {
g := NewWithT(t)
identity, err := aws.Provider{}.GetIdentity(corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
"eks.amazonaws.com/role-arn": "arn:aws:iam::1234567890:role/some-role",
},
},
})
g.Expect(err).NotTo(HaveOccurred())
g.Expect(identity).To(Equal("arn:aws:iam::1234567890:role/some-role"))
}
func TestProvider_NewArtifactRegistryCredentials(t *testing.T) {
for _, tt := range []struct {
name string
artifactRepository string
expectedPublicECR bool
expectedRegion string
}{
{
name: "non public ECR, us-east-1",
artifactRepository: "012345678901.dkr.ecr.us-east-1.amazonaws.com/foo",
expectedRegion: "us-east-1",
expectedPublicECR: false,
},
{
name: "non public ECR, us-west-2",
artifactRepository: "012345678901.dkr.ecr.us-west-2.amazonaws.com/foo",
expectedRegion: "us-west-2",
expectedPublicECR: false,
},
{
name: "public ECR",
artifactRepository: "public.ecr.aws",
expectedRegion: "us-east-1", // Public ECR is always us-east-1
expectedPublicECR: true,
},
} {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
impl := &mockImplementation{
t: t,
publicECR: tt.expectedPublicECR,
argRegion: tt.expectedRegion,
argProxyURL: &url.URL{Scheme: "http", Host: "proxy.example.com"},
argCredsProvider: credentials.NewStaticCredentialsProvider("access-key-id", "secret-access-key", "session-token"),
returnCreds: awssdk.Credentials{
AccessKeyID: "access-key-id",
SecretAccessKey: "secret-access-key",
SessionToken: "session-token",
},
returnUsername: "username",
returnPassword: "password",
}
opts := []auth.Option{
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.example.com"}),
}
provider := aws.Provider{Implementation: impl}
creds, err := auth.GetArtifactRegistryCredentials(
context.Background(), provider, tt.artifactRepository, opts...)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(creds).To(Equal(&auth.ArtifactRegistryCredentials{
Authenticator: authn.FromConfig(authn.AuthConfig{
Username: "username",
Password: "password",
}),
}))
})
}
}
func TestProvider_GetAccessTokenOptionsForArtifactRepository(t *testing.T) {
g := NewWithT(t)
opts, err := aws.Provider{}.GetAccessTokenOptionsForArtifactRepository(
"012345678901.dkr.ecr.us-east-1.amazonaws.com/foo:v1")
g.Expect(err).NotTo(HaveOccurred())
var o auth.Options
o.Apply(opts...)
g.Expect(o.STSRegion).To(Equal("us-east-1"))
}
func TestProvider_ParseArtifactRepository(t *testing.T) {
tests := []struct {
artifactRepository string
expectedRegion string
expectValid bool
}{
{
artifactRepository: "012345678901.dkr.ecr.us-east-1.amazonaws.com/foo:v1",
expectedRegion: "us-east-1",
expectValid: true,
},
{
artifactRepository: "012345678901.dkr.ecr.us-east-1.amazonaws.com/foo",
expectedRegion: "us-east-1",
expectValid: true,
},
{
artifactRepository: "012345678901.dkr.ecr.us-east-1.amazonaws.com",
expectedRegion: "us-east-1",
expectValid: true,
},
{
artifactRepository: "012345678901.dkr.ecr.us-east-1.amazonaws.com/v2/part/part",
expectedRegion: "us-east-1",
expectValid: true,
},
{
artifactRepository: "012345678901.dkr.ecr.cn-north-1.amazonaws.com.cn/foo",
expectedRegion: "cn-north-1",
expectValid: true,
},
{
artifactRepository: "012345678901.dkr.ecr-fips.us-gov-west-1.amazonaws.com",
expectedRegion: "us-gov-west-1",
expectValid: true,
},
{
artifactRepository: "012345678901.dkr.ecr.us-secret-region.sc2s.sgov.gov",
expectedRegion: "us-secret-region",
expectValid: true,
},
{
artifactRepository: "012345678901.dkr.ecr-fips.us-ts-region.c2s.ic.gov",
expectedRegion: "us-ts-region",
expectValid: true,
},
{
artifactRepository: "012345678901.dkr.ecr.uk-region.cloud.adc-e.uk",
expectedRegion: "uk-region",
expectValid: true,
},
{
artifactRepository: "012345678901.dkr.ecr.us-ts-region.csp.hci.ic.gov",
expectedRegion: "us-ts-region",
expectValid: true,
},
{
artifactRepository: "gcr.io/foo/bar:baz",
expectValid: false,
},
{
artifactRepository: "public.ecr.aws/foo/bar",
expectedRegion: "public.ecr.aws",
expectValid: true,
},
}
for _, tt := range tests {
t.Run(tt.artifactRepository, func(t *testing.T) {
g := NewWithT(t)
region, err := aws.Provider{}.ParseArtifactRepository(tt.artifactRepository)
g.Expect(err == nil).To(Equal(tt.expectValid))
g.Expect(region).To(Equal(tt.expectedRegion))
})
}
}
func TestProvider_NewRESTConfig(t *testing.T) {
for _, tt := range []struct {
name string
cluster string
clusterAddress string
caData string
stsEndpoint string
err string
}{
{
name: "valid EKS cluster",
cluster: "arn:aws:eks:us-east-1:123456789012:cluster/test-cluster",
},
{
name: "us gov EKS cluster is valid",
cluster: "arn:aws-us-gov:eks:us-east-1:123456789012:cluster/test-cluster",
},
{
name: "valid EKS cluster with address match",
cluster: "arn:aws:eks:us-east-1:123456789012:cluster/test-cluster",
clusterAddress: "https://EXAMPLE1234567890123456789012345678.gr7.us-east-1.eks.amazonaws.com:443",
},
{
name: "valid EKS cluster with CA",
cluster: "arn:aws:eks:us-east-1:123456789012:cluster/test-cluster",
caData: "-----BEGIN CERTIFICATE-----",
},
{
name: "CA and address only. EKS requires cluster to extract region",
clusterAddress: "https://EXAMPLE1234567890123456789012345678.gr7.us-east-1.eks.amazonaws.com:443",
caData: "-----BEGIN CERTIFICATE-----",
err: `invalid EKS cluster ARN: ''. must match ^arn:aws[\w-]*:eks:([^:]{1,100}):[0-9]{1,30}:cluster/(.{1,200})$`,
},
{
name: "cluster address mismatch",
cluster: "arn:aws:eks:us-east-1:123456789012:cluster/test-cluster",
clusterAddress: "https://different-endpoint.eks.amazonaws.com:443",
err: "EKS endpoint 'https://EXAMPLE1234567890123456789012345678.gr7.us-east-1.eks.amazonaws.com' does not match specified address: 'https://different-endpoint.eks.amazonaws.com:443'",
},
{
name: "valid EKS cluster with custom STS endpoint",
cluster: "arn:aws:eks:us-east-1:123456789012:cluster/test-cluster",
stsEndpoint: "https://sts.amazonaws.com",
},
{
name: "invalid STS endpoint",
cluster: "arn:aws:eks:us-east-1:123456789012:cluster/test-cluster",
stsEndpoint: "https://invalid.amazonaws.com",
err: `invalid STS endpoint: 'https://invalid.amazonaws.com'. must match ^https://(.+\.)?sts(-fips)?(\.[^.]+)?(\.vpce)?\.amazonaws\.com$`,
},
{
name: "invalid cluster ARN",
cluster: "invalid-cluster-arn",
err: `invalid EKS cluster ARN: 'invalid-cluster-arn'. must match ^arn:aws[\w-]*:eks:([^:]{1,100}):[0-9]{1,30}:cluster/(.{1,200})$`,
},
} {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
impl := &mockImplementation{
t: t,
expectEKSAPICall: tt.clusterAddress == "" || tt.caData == "",
argRegion: "us-east-1",
argClusterName: "test-cluster",
argProxyURL: &url.URL{Scheme: "http", Host: "proxy.example.com"},
argSTSEndpoint: tt.stsEndpoint,
argCredsProvider: credentials.NewStaticCredentialsProvider("access-key-id", "secret-access-key", "session-token"),
returnCreds: awssdk.Credentials{AccessKeyID: "access-key-id", SecretAccessKey: "secret-access-key", SessionToken: "session-token"},
returnEndpoint: "https://EXAMPLE1234567890123456789012345678.gr7.us-east-1.eks.amazonaws.com",
returnCAData: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0t", // base64 encoded "-----BEGIN CERTIFICATE-----"
returnPresignedURL: "https://sts.us-east-1.amazonaws.com/?Action=GetCallerIdentity&Version=2011-06-15&X-Amz-Algorithm=AWS4-HMAC-SHA256",
}
opts := []auth.Option{
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.example.com"}),
}
if tt.cluster != "" {
opts = append(opts, auth.WithClusterResource(tt.cluster))
}
if tt.clusterAddress != "" {
opts = append(opts, auth.WithClusterAddress(tt.clusterAddress))
}
if tt.caData != "" {
opts = append(opts, auth.WithCAData(tt.caData))
}
if tt.stsEndpoint != "" {
opts = append(opts, auth.WithSTSEndpoint(tt.stsEndpoint))
}
provider := aws.Provider{Implementation: impl}
restConfig, err := auth.GetRESTConfig(context.Background(), provider, opts...)
if tt.err == "" {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(restConfig).NotTo(BeNil())
g.Expect(restConfig.Host).To(Equal("https://EXAMPLE1234567890123456789012345678.gr7.us-east-1.eks.amazonaws.com"))
g.Expect(restConfig.BearerToken).To(Equal("k8s-aws-v1.aHR0cHM6Ly9zdHMudXMtZWFzdC0xLmFtYXpvbmF3cy5jb20vP0FjdGlvbj1HZXRDYWxsZXJJZGVudGl0eSZWZXJzaW9uPTIwMTEtMDYtMTUmWC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTY"))
g.Expect(restConfig.CAData).To(Equal([]byte("-----BEGIN CERTIFICATE-----")))
g.Expect(restConfig.ExpiresAt).To(BeTemporally(">", time.Now().Add(14*time.Minute)))
g.Expect(restConfig.ExpiresAt).To(BeTemporally("<", time.Now().Add(16*time.Minute)))
} else {
g.Expect(err).To(HaveOccurred())
g.Expect(err.Error()).To(ContainSubstring(tt.err))
g.Expect(restConfig).To(BeNil())
}
})
}
}
func TestProvider_GetAccessTokenOptionsForCluster(t *testing.T) {
g := NewWithT(t)
opts, err := aws.Provider{}.GetAccessTokenOptionsForCluster(
auth.WithClusterResource("arn:aws:eks:us-west-2:123456789012:cluster/my-cluster"))
g.Expect(err).NotTo(HaveOccurred())
g.Expect(opts).To(HaveLen(1))
var o auth.Options
o.Apply(opts[0]...)
g.Expect(o.STSRegion).To(Equal("us-west-2"))
}

45
auth/aws/restconfig.go Normal file
View File

@ -0,0 +1,45 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package aws
import (
"context"
"net/http"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
signerv4 "github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/sts"
)
// eksHTTPPresignerV4 implements sts.HTTPPresignerV4 adding the cluster name
// to the request header x-k8s-aws-id, as required by EKS authentication.
type eksHTTPPresignerV4 struct {
sts.HTTPPresignerV4
clusterName string
}
// PresignHTTP implements sts.HTTPPresignerV4.
func (e *eksHTTPPresignerV4) PresignHTTP(
ctx context.Context, credentials aws.Credentials, r *http.Request,
payloadHash string, service string, region string, signingTime time.Time,
optFns ...func(*signerv4.SignerOptions),
) (string, http.Header, error) {
r.Header.Add("x-k8s-aws-id", e.clusterName)
r.Header.Add("X-Amz-Expires", "900") // ref: https://github.com/aws/aws-sdk-go-v2/issues/1922#issuecomment-1429063756
return e.HTTPPresignerV4.PresignHTTP(ctx, credentials, r, payloadHash, service, region, signingTime, optFns...)
}

46
auth/aws/token.go Normal file
View File

@ -0,0 +1,46 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package aws
import (
"time"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/credentials"
"github.com/aws/aws-sdk-go-v2/service/sts/types"
)
// Credentials is the AWS token.
type Credentials struct{ types.Credentials }
func newTokenFromAWSCredentials(creds *aws.Credentials) *Credentials {
return &Credentials{types.Credentials{
AccessKeyId: &creds.AccessKeyID,
SecretAccessKey: &creds.SecretAccessKey,
SessionToken: &creds.SessionToken,
Expiration: &creds.Expires,
}}
}
// GetDuration implements auth.Token.
func (c *Credentials) GetDuration() time.Duration {
return time.Until(*c.Expiration)
}
func (c *Credentials) provider() aws.CredentialsProvider {
return credentials.NewStaticCredentialsProvider(*c.AccessKeyId, *c.SecretAccessKey, *c.SessionToken)
}

View File

@ -0,0 +1,64 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package azure
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/containers/azcontainerregistry"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice"
)
// Implementation provides the required methods of the Azure libraries.
type Implementation interface {
NewDefaultAzureCredential(options *azidentity.DefaultAzureCredentialOptions) (azcore.TokenCredential, error)
NewDefaultAzureCredentialWithoutShellOut(options *azidentity.DefaultAzureCredentialOptions) (azcore.TokenCredential, error)
NewClientAssertionCredential(tenantID string, clientID string, getAssertion func(context.Context) (string, error), options *azidentity.ClientAssertionCredentialOptions) (azcore.TokenCredential, error)
ExchangeAADAccessTokenForACRRefreshToken(ctx context.Context, client *azcontainerregistry.AuthenticationClient, grantType azcontainerregistry.PostContentSchemaGrantType, service string, options *azcontainerregistry.AuthenticationClientExchangeAADAccessTokenForACRRefreshTokenOptions) (azcontainerregistry.AuthenticationClientExchangeAADAccessTokenForACRRefreshTokenResponse, error)
NewManagedClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (AKSClient, error)
}
// AKSClient provides the required methods of the AKS client.
type AKSClient interface {
Get(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientGetOptions) (armcontainerservice.ManagedClustersClientGetResponse, error)
ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientListClusterUserCredentialsOptions) (armcontainerservice.ManagedClustersClientListClusterUserCredentialsResponse, error)
}
type implementation struct{}
func (implementation) NewDefaultAzureCredential(options *azidentity.DefaultAzureCredentialOptions) (azcore.TokenCredential, error) {
return azidentity.NewDefaultAzureCredential(options)
}
func (implementation) NewDefaultAzureCredentialWithoutShellOut(options *azidentity.DefaultAzureCredentialOptions) (azcore.TokenCredential, error) {
return newDefaultAzureCredential(options)
}
func (implementation) NewClientAssertionCredential(tenantID string, clientID string, getAssertion func(context.Context) (string, error), options *azidentity.ClientAssertionCredentialOptions) (azcore.TokenCredential, error) {
return azidentity.NewClientAssertionCredential(tenantID, clientID, getAssertion, options)
}
func (implementation) ExchangeAADAccessTokenForACRRefreshToken(ctx context.Context, client *azcontainerregistry.AuthenticationClient, grantType azcontainerregistry.PostContentSchemaGrantType, service string, options *azcontainerregistry.AuthenticationClientExchangeAADAccessTokenForACRRefreshTokenOptions) (azcontainerregistry.AuthenticationClientExchangeAADAccessTokenForACRRefreshTokenResponse, error) {
return client.ExchangeAADAccessTokenForACRRefreshToken(ctx, grantType, service, options)
}
func (implementation) NewManagedClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (AKSClient, error) {
return armcontainerservice.NewManagedClustersClient(subscriptionID, credential, options)
}

View File

@ -0,0 +1,268 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package azure_test
import (
"context"
"net/http"
"net/url"
"reflect"
"testing"
"time"
"unsafe"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/containers/azcontainerregistry"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice"
. "github.com/onsi/gomega"
"github.com/fluxcd/pkg/auth/azure"
)
type mockImplementation struct {
t *testing.T
shellOut bool
expectAKSAPICall bool
argTenantID string
argClientID string
argOIDCToken string
argProxyURL *url.URL
argScopes []string
argToken string
argRegistry string
argSubscription string
argResourceGroup string
argClusterName string
// For dual-token flow (RESTConfig)
argFirstScopes []string
argSecondScopes []string
firstCallMade bool
returnToken string
returnACRToken string
returnCluster armcontainerservice.ManagedCluster
returnKubeconfigs []*armcontainerservice.CredentialResult
}
type mockTokenCredential struct {
t *testing.T
argScopes []string
returnToken string
}
type mockAKSClient struct {
t *testing.T
argResourceGroup string
argClusterName string
returnCluster armcontainerservice.ManagedCluster
returnKubeconfigs []*armcontainerservice.CredentialResult
}
func (m *mockImplementation) NewDefaultAzureCredential(options *azidentity.DefaultAzureCredentialOptions) (azcore.TokenCredential, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(m.shellOut).To(BeTrue())
return m.newDefaultAzureCredential(options)
}
func (m *mockImplementation) NewDefaultAzureCredentialWithoutShellOut(options *azidentity.DefaultAzureCredentialOptions) (azcore.TokenCredential, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(m.shellOut).To(BeFalse())
return m.newDefaultAzureCredential(options)
}
func (m *mockImplementation) newDefaultAzureCredential(options *azidentity.DefaultAzureCredentialOptions) (azcore.TokenCredential, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(options.Transport).NotTo(BeNil())
g.Expect(options.Transport.(*http.Client)).NotTo(BeNil())
g.Expect(options.Transport.(*http.Client).Transport).NotTo(BeNil())
g.Expect(options.Transport.(*http.Client).Transport.(*http.Transport)).NotTo(BeNil())
g.Expect(options.Transport.(*http.Client).Transport.(*http.Transport).Proxy).NotTo(BeNil())
proxyURL, err := options.Transport.(*http.Client).Transport.(*http.Transport).Proxy(nil)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(proxyURL).To(Equal(m.argProxyURL))
// Determine which scopes to expect based on dual-token flow
expectedScopes := m.argScopes
if m.argFirstScopes != nil && m.argSecondScopes != nil {
if !m.firstCallMade {
expectedScopes = m.argFirstScopes
m.firstCallMade = true
} else {
expectedScopes = m.argSecondScopes
}
}
return &mockTokenCredential{t: m.t, argScopes: expectedScopes, returnToken: m.returnToken}, nil
}
func (m *mockImplementation) NewClientAssertionCredential(tenantID string, clientID string, getAssertion func(context.Context) (string, error), options *azidentity.ClientAssertionCredentialOptions) (azcore.TokenCredential, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(tenantID).To(Equal(m.argTenantID))
g.Expect(clientID).To(Equal(m.argClientID))
g.Expect(getAssertion).NotTo(BeNil())
oidcToken, err := getAssertion(context.Background())
g.Expect(err).NotTo(HaveOccurred())
g.Expect(oidcToken).To(Equal(m.argOIDCToken))
g.Expect(options).NotTo(BeNil())
g.Expect(options.Transport).NotTo(BeNil())
g.Expect(options.Transport.(*http.Client)).NotTo(BeNil())
g.Expect(options.Transport.(*http.Client).Transport).NotTo(BeNil())
g.Expect(options.Transport.(*http.Client).Transport.(*http.Transport)).NotTo(BeNil())
g.Expect(options.Transport.(*http.Client).Transport.(*http.Transport).Proxy).NotTo(BeNil())
proxyURL, err := options.Transport.(*http.Client).Transport.(*http.Transport).Proxy(nil)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(proxyURL).To(Equal(m.argProxyURL))
// Determine which scopes to expect based on dual-token flow
expectedScopes := m.argScopes
if m.argFirstScopes != nil && m.argSecondScopes != nil {
if !m.firstCallMade {
expectedScopes = m.argFirstScopes
m.firstCallMade = true
} else {
expectedScopes = m.argSecondScopes
}
}
return &mockTokenCredential{t: m.t, argScopes: expectedScopes, returnToken: m.returnToken}, nil
}
func (m *mockImplementation) ExchangeAADAccessTokenForACRRefreshToken(ctx context.Context, client *azcontainerregistry.AuthenticationClient, grantType azcontainerregistry.PostContentSchemaGrantType, service string, options *azcontainerregistry.AuthenticationClientExchangeAADAccessTokenForACRRefreshTokenOptions) (azcontainerregistry.AuthenticationClientExchangeAADAccessTokenForACRRefreshTokenResponse, error) {
m.t.Helper()
g := NewWithT(m.t)
// Assert registry endpoint.
endpointField := reflect.ValueOf(client).Elem().FieldByName("endpoint")
endpointValue := reflect.NewAt(endpointField.Type(), unsafe.Pointer(endpointField.UnsafeAddr())).Elem().Interface().(string)
g.Expect(endpointValue).To(Equal("https://" + m.argRegistry))
// Assert proxy URL.
azcoreClientField := reflect.ValueOf(client).Elem().FieldByName("internal")
azcoreClientValue := reflect.NewAt(azcoreClientField.Type(), unsafe.Pointer(azcoreClientField.UnsafeAddr())).Elem().Interface().(*azcore.Client)
g.Expect(azcoreClientValue).NotTo(BeNil())
pipeline := azcoreClientValue.Pipeline()
g.Expect(pipeline).NotTo(BeNil())
pipelineValue := reflect.ValueOf(pipeline)
pipelinePtr := reflect.New(pipelineValue.Type())
pipelinePtr.Elem().Set(pipelineValue)
policiesField := pipelinePtr.Elem().FieldByName("policies")
policiesValue := reflect.NewAt(policiesField.Type(), unsafe.Pointer(policiesField.UnsafeAddr())).Elem().Interface().([]policy.Policy)
g.Expect(policiesValue).NotTo(BeNil())
transportPolicy := policiesValue[len(policiesValue)-1]
transportPolicyValue := reflect.ValueOf(transportPolicy)
transportPolicyPtr := reflect.New(transportPolicyValue.Type())
transportPolicyPtr.Elem().Set(transportPolicyValue)
transportField := transportPolicyPtr.Elem().FieldByName("trans")
transportValue := reflect.NewAt(transportField.Type(), unsafe.Pointer(transportField.UnsafeAddr())).Elem().Interface().(policy.Transporter)
g.Expect(transportValue).NotTo(BeNil())
g.Expect(transportValue.(*http.Client)).NotTo(BeNil())
g.Expect(transportValue.(*http.Client).Transport).NotTo(BeNil())
g.Expect(transportValue.(*http.Client).Transport.(*http.Transport)).NotTo(BeNil())
g.Expect(transportValue.(*http.Client).Transport.(*http.Transport).Proxy).NotTo(BeNil())
proxyURL, err := transportValue.(*http.Client).Transport.(*http.Transport).Proxy(nil)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(proxyURL).To(Equal(m.argProxyURL))
// Assert trivial inputs.
g.Expect(grantType).To(Equal(azcontainerregistry.PostContentSchemaGrantTypeAccessToken))
g.Expect(service).To(Equal(m.argRegistry))
g.Expect(options).To(Equal(&azcontainerregistry.AuthenticationClientExchangeAADAccessTokenForACRRefreshTokenOptions{
AccessToken: &m.argToken,
}))
return azcontainerregistry.AuthenticationClientExchangeAADAccessTokenForACRRefreshTokenResponse{
ACRRefreshToken: azcontainerregistry.ACRRefreshToken{RefreshToken: &m.returnACRToken},
}, nil
}
func (m *mockImplementation) NewManagedClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (azure.AKSClient, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(m.expectAKSAPICall).To(BeTrue())
g.Expect(subscriptionID).To(Equal(m.argSubscription))
g.Expect(credential).NotTo(BeNil())
token, err := credential.GetToken(context.Background(), policy.TokenRequestOptions{})
g.Expect(err).NotTo(HaveOccurred())
g.Expect(token.Token).To(Equal(m.argToken))
g.Expect(options).NotTo(BeNil())
g.Expect(options.Transport).NotTo(BeNil())
g.Expect(options.Transport.(*http.Client)).NotTo(BeNil())
g.Expect(options.Transport.(*http.Client).Transport).NotTo(BeNil())
g.Expect(options.Transport.(*http.Client).Transport.(*http.Transport)).NotTo(BeNil())
g.Expect(options.Transport.(*http.Client).Transport.(*http.Transport).Proxy).NotTo(BeNil())
proxyURL, err := options.Transport.(*http.Client).Transport.(*http.Transport).Proxy(nil)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(proxyURL).To(Equal(m.argProxyURL))
return &mockAKSClient{
t: m.t,
argResourceGroup: m.argResourceGroup,
argClusterName: m.argClusterName,
returnCluster: m.returnCluster,
returnKubeconfigs: m.returnKubeconfigs,
}, nil
}
func (m *mockAKSClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientGetOptions) (armcontainerservice.ManagedClustersClientGetResponse, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(ctx).NotTo(BeNil())
g.Expect(resourceGroupName).To(Equal(m.argResourceGroup))
g.Expect(resourceName).To(Equal(m.argClusterName))
g.Expect(options).To(BeNil())
return armcontainerservice.ManagedClustersClientGetResponse{
ManagedCluster: m.returnCluster,
}, nil
}
func (m *mockAKSClient) ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientListClusterUserCredentialsOptions) (armcontainerservice.ManagedClustersClientListClusterUserCredentialsResponse, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(ctx).NotTo(BeNil())
g.Expect(resourceGroupName).To(Equal(m.argResourceGroup))
g.Expect(resourceName).To(Equal(m.argClusterName))
g.Expect(options).To(BeNil())
return armcontainerservice.ManagedClustersClientListClusterUserCredentialsResponse{
CredentialResults: armcontainerservice.CredentialResults{
Kubeconfigs: m.returnKubeconfigs,
},
}, nil
}
func (m *mockTokenCredential) GetToken(ctx context.Context, options policy.TokenRequestOptions) (azcore.AccessToken, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(options.Scopes).To(Equal(m.argScopes))
return azcore.AccessToken{
Token: m.returnToken,
ExpiresOn: time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC), // Fixed expiry for testing
}, nil
}

View File

@ -0,0 +1,91 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package azure
import (
"errors"
"fmt"
"os"
"strings"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
)
// newDefaultAzureCredential is like azidentity.NewDefaultAzureCredential(),
// but does not call the functions that shell out to Azure CLIs.
func newDefaultAzureCredential(options *azidentity.DefaultAzureCredentialOptions) (azcore.TokenCredential, error) {
const (
azureClientID = "AZURE_CLIENT_ID"
azureFederatedTokenFile = "AZURE_FEDERATED_TOKEN_FILE"
azureAuthorityHost = "AZURE_AUTHORITY_HOST"
azureTenantID = "AZURE_TENANT_ID"
)
var errorMessages []string
envCred, err := azidentity.NewEnvironmentCredential(&azidentity.EnvironmentCredentialOptions{
ClientOptions: options.ClientOptions, DisableInstanceDiscovery: options.DisableInstanceDiscovery},
)
if err == nil {
return envCred, nil
} else {
errorMessages = append(errorMessages, "EnvironmentCredential: "+err.Error())
}
// workload identity requires values for AZURE_AUTHORITY_HOST, AZURE_CLIENT_ID, AZURE_FEDERATED_TOKEN_FILE, AZURE_TENANT_ID
haveWorkloadConfig := false
clientID, haveClientID := os.LookupEnv(azureClientID)
if haveClientID {
if file, ok := os.LookupEnv(azureFederatedTokenFile); ok {
if _, ok := os.LookupEnv(azureAuthorityHost); ok {
if tenantID, ok := os.LookupEnv(azureTenantID); ok {
haveWorkloadConfig = true
workloadCred, err := azidentity.NewWorkloadIdentityCredential(&azidentity.WorkloadIdentityCredentialOptions{
ClientID: clientID,
TenantID: tenantID,
TokenFilePath: file,
ClientOptions: options.ClientOptions,
DisableInstanceDiscovery: options.DisableInstanceDiscovery,
})
if err == nil {
return workloadCred, nil
} else {
errorMessages = append(errorMessages, "Workload Identity"+": "+err.Error())
}
}
}
}
}
if !haveWorkloadConfig {
err := errors.New("missing environment variables for workload identity. Check webhook and pod configuration")
errorMessages = append(errorMessages, fmt.Sprintf("Workload Identity: %s", err))
}
o := &azidentity.ManagedIdentityCredentialOptions{ClientOptions: options.ClientOptions}
if haveClientID {
o.ID = azidentity.ClientID(clientID)
}
miCred, err := azidentity.NewManagedIdentityCredential(o)
if err == nil {
return miCred, nil
} else {
errorMessages = append(errorMessages, "ManagedIdentity"+": "+err.Error())
}
return nil, errors.New(strings.Join(errorMessages, "\n"))
}

148
auth/azure/options.go Normal file
View File

@ -0,0 +1,148 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package azure
import (
"encoding/json"
"fmt"
"os"
"regexp"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
corev1 "k8s.io/api/core/v1"
)
func getIdentity(serviceAccount corev1.ServiceAccount) (string, error) {
tenantID, err := getTenantID(serviceAccount)
if err != nil {
return "", err
}
clientID, err := getClientID(serviceAccount)
if err != nil {
return "", err
}
return fmt.Sprintf("%s/%s", tenantID, clientID), nil
}
func getTenantID(serviceAccount corev1.ServiceAccount) (string, error) {
const key = "azure.workload.identity/tenant-id"
if tenantID, ok := serviceAccount.Annotations[key]; ok {
return tenantID, nil
}
return "", fmt.Errorf("azure tenant ID is not set in the service account annotation %s", key)
}
func getClientID(serviceAccount corev1.ServiceAccount) (string, error) {
const key = "azure.workload.identity/client-id"
if clientID, ok := serviceAccount.Annotations[key]; ok {
return clientID, nil
}
return "", fmt.Errorf("azure client ID is not set in the service account annotation %s", key)
}
const clusterPattern = `(?i)^/subscriptions/([^/]{36})/resourceGroups/([^/]{1,200})/providers/Microsoft\.ContainerService/managedClusters/([^/]{1,200})$`
var clusterRegex = regexp.MustCompile(clusterPattern)
func parseCluster(cluster string) (string, string, string, error) {
m := clusterRegex.FindStringSubmatch(cluster)
if len(m) != 4 {
return "", "", "", fmt.Errorf("invalid AKS cluster ID: '%s'. must match %s",
cluster, clusterPattern)
}
subscriptionID := m[1]
resourceGroup := m[2]
clusterName := m[3]
return subscriptionID, resourceGroup, clusterName, nil
}
// envVarAzureEnvironmentFilepath is the environment variable name used to specify the path of the configuration file with custom Azure endpoints.
const envVarAzureEnvironmentFilepath = "AZURE_ENVIRONMENT_FILEPATH"
// Environment is used to read the Azure environment configuration from a JSON file, it is a subset of the struct defined in
// https://github.com/kubernetes-sigs/cloud-provider-azure/blob/e68bd888a7616d52f45f39238691f32821884120/pkg/azclient/cloud.go#L152-L185
// with exact same field names and json annotations.
// We define this struct here for two reasons:
// 1. We are not aware of any libraries we could import this struct from.
// 2. We don't use all the fields defined in the original struct.
type Environment struct {
ContainerRegistryDNSSuffix string `json:"containerRegistryDNSSuffix,omitempty"`
ResourceManagerEndpoint string `json:"resourceManagerEndpoint,omitempty"`
TokenAudience string `json:"tokenAudience,omitempty"`
}
// hasEnvironmentFile checks if the environment variable AZURE_ENVIRONMENT_FILEPATH is set
func hasEnvironmentFile() bool {
_, ok := os.LookupEnv(envVarAzureEnvironmentFilepath)
return ok
}
// getEnvironmentConfig reads the Azure environment configuration from a JSON file
// located at the path specified by the environment variable AZURE_ENVIRONMENT_FILEPATH.
// Call hasEnvironmentFile() before calling this function to ensure the file exists.
func getEnvironmentConfig() (*Environment, error) {
envFilePath := os.Getenv(envVarAzureEnvironmentFilepath)
if len(envFilePath) == 0 {
return nil, fmt.Errorf("environment variable %s is not set", envVarAzureEnvironmentFilepath)
}
content, err := os.ReadFile(envFilePath)
if err != nil {
return nil, err
}
env := &Environment{}
if err = json.Unmarshal(content, env); err != nil {
return nil, err
}
return env, nil
}
// getCloudConfigFromEnvironment reads the Azure environment configuration and returns a cloud.Configuration object.
func getCloudConfigFromEnvironment() (*cloud.Configuration, error) {
env, err := getEnvironmentConfig()
if err != nil {
return nil, err
}
cloudConf := cloud.Configuration{
Services: make(map[cloud.ServiceName]cloud.ServiceConfiguration),
}
if len(env.ResourceManagerEndpoint) > 0 && len(env.TokenAudience) > 0 {
cloudConf.Services[cloud.ResourceManager] = cloud.ServiceConfiguration{
Endpoint: env.ResourceManagerEndpoint,
Audience: env.TokenAudience,
}
} else {
return nil, fmt.Errorf("resourceManagerEndpoint and tokenAudience must be set in the environment file")
}
return &cloudConf, nil
}
// getContainerRegistryDNSSuffix reads the Azure environment configuration and returns the container registry DNS suffix.
func getContainerRegistryDNSSuffix() (string, error) {
env, err := getEnvironmentConfig()
if err != nil {
return "", err
}
if len(env.ContainerRegistryDNSSuffix) == 0 {
return "", fmt.Errorf("containerRegistryDNSSuffix must be set in the environment file")
}
return env.ContainerRegistryDNSSuffix, nil
}

393
auth/azure/provider.go Normal file
View File

@ -0,0 +1,393 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package azure
import (
"context"
"fmt"
"os"
"regexp"
"strings"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/containers/azcontainerregistry"
"github.com/golang-jwt/jwt/v5"
"github.com/google/go-containerregistry/pkg/authn"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"github.com/fluxcd/pkg/auth"
)
// ProviderName is the name of the Azure authentication provider.
const ProviderName = "azure"
// Provider implements the auth.Provider interface for Azure authentication.
type Provider struct{ Implementation }
// GetName implements auth.Provider.
func (Provider) GetName() string {
return ProviderName
}
// NewControllerToken implements auth.Provider.
func (p Provider) NewControllerToken(ctx context.Context, opts ...auth.Option) (auth.Token, error) {
var o auth.Options
o.Apply(opts...)
azOpts := azidentity.DefaultAzureCredentialOptions{
ClientOptions: azcore.ClientOptions{
Transport: o.GetHTTPClient(),
},
}
credFunc := p.impl().NewDefaultAzureCredentialWithoutShellOut
if o.AllowShellOut {
credFunc = p.impl().NewDefaultAzureCredential
}
cred, err := credFunc(&azOpts)
if err != nil {
return nil, err
}
token, err := cred.GetToken(ctx, policy.TokenRequestOptions{
Scopes: o.Scopes,
})
if err != nil {
return nil, err
}
return &Token{token}, nil
}
// GetAudiences implements auth.Provider.
func (Provider) GetAudiences(context.Context, corev1.ServiceAccount) ([]string, error) {
return []string{"api://AzureADTokenExchange"}, nil
}
// GetIdentity implements auth.Provider.
func (Provider) GetIdentity(serviceAccount corev1.ServiceAccount) (string, error) {
return getIdentity(serviceAccount)
}
// NewTokenForServiceAccount implements auth.Provider.
func (p Provider) NewTokenForServiceAccount(ctx context.Context, oidcToken string,
serviceAccount corev1.ServiceAccount, opts ...auth.Option) (auth.Token, error) {
var o auth.Options
o.Apply(opts...)
identity, err := getIdentity(serviceAccount)
if err != nil {
return nil, err
}
s := strings.Split(identity, "/")
tenantID, clientID := s[0], s[1]
azOpts := &azidentity.ClientAssertionCredentialOptions{
ClientOptions: azcore.ClientOptions{
Transport: o.GetHTTPClient(),
},
}
cred, err := p.impl().NewClientAssertionCredential(tenantID, clientID, func(context.Context) (string, error) {
return oidcToken, nil
}, azOpts)
if err != nil {
return nil, err
}
token, err := cred.GetToken(ctx, policy.TokenRequestOptions{
Scopes: o.Scopes,
})
if err != nil {
return nil, err
}
return &Token{token}, nil
}
// GetAccessTokenOptionsForArtifactRepository implements auth.Provider.
func (p Provider) GetAccessTokenOptionsForArtifactRepository(artifactRepository string) ([]auth.Option, error) {
// Azure requires scopes for getting access tokens. Here we compute
// the scope for ACR, which is based on the registry host.
registry, err := auth.GetRegistryFromArtifactRepository(artifactRepository)
if err != nil {
return nil, err
}
var conf *cloud.Configuration
switch {
case hasEnvironmentFile():
var err error
conf, err = getCloudConfigFromEnvironment()
if err != nil {
return nil, err
}
case strings.HasSuffix(registry, ".azurecr.cn"):
conf = &cloud.AzureChina
case strings.HasSuffix(registry, ".azurecr.us"):
conf = &cloud.AzureGovernment
default:
conf = &cloud.AzurePublic
}
acrScope := conf.Services[cloud.ResourceManager].Endpoint + "/.default"
return []auth.Option{auth.WithScopes(acrScope)}, nil
}
// https://github.com/kubernetes/kubernetes/blob/v1.23.1/pkg/credentialprovider/azure/azure_credentials.go#L55
const registryPattern = `^.+\.(azurecr\.io|azurecr\.cn|azurecr\.de|azurecr\.us)$`
var registryRegex = regexp.MustCompile(registryPattern)
// ParseArtifactRepository implements auth.Provider.
// ParseArtifactRepository returns the ACR registry host.
func (Provider) ParseArtifactRepository(artifactRepository string) (string, error) {
registry, err := auth.GetRegistryFromArtifactRepository(artifactRepository)
if err != nil {
return "", err
}
// For issuing Azure registry credentials the registry host is required.
if registryRegex.MatchString(registry) {
return registry, nil
}
// Check if environment variable is configured for container registry suffix
if hasEnvironmentFile() {
// Load the environment configuration from the file
registrySuffix, err := getContainerRegistryDNSSuffix()
if err != nil {
return "", fmt.Errorf("failed to get container registry suffix from environment file: %w", err)
}
if strings.HasSuffix(registry, registrySuffix) {
return registry, nil
}
return "", fmt.Errorf("invalid Azure registry: '%s'. must end with %s",
registry, registrySuffix)
}
return "", fmt.Errorf("invalid Azure registry: '%s'. must match %s",
registry, registryPattern)
}
// NewArtifactRegistryCredentials implements auth.Provider.
func (p Provider) NewArtifactRegistryCredentials(ctx context.Context, registry string,
accessToken auth.Token, opts ...auth.Option) (*auth.ArtifactRegistryCredentials, error) {
var o auth.Options
o.Apply(opts...)
// Create the ACR authentication client.
endpoint := fmt.Sprintf("https://%s", registry)
clientOpts := azcontainerregistry.AuthenticationClientOptions{
ClientOptions: azcore.ClientOptions{
Transport: o.GetHTTPClient(),
},
}
client, err := azcontainerregistry.NewAuthenticationClient(endpoint, &clientOpts)
if err != nil {
return nil, err
}
// Exchange the access token for an ACR token.
grantType := azcontainerregistry.PostContentSchemaGrantTypeAccessToken
service := registry
tokenOpts := &azcontainerregistry.AuthenticationClientExchangeAADAccessTokenForACRRefreshTokenOptions{
AccessToken: &accessToken.(*Token).Token,
}
resp, err := p.impl().ExchangeAADAccessTokenForACRRefreshToken(ctx, client, grantType, service, tokenOpts)
if err != nil {
return nil, err
}
token := *resp.RefreshToken
// Parse the refresh token to get the expiry time.
var claims jwt.MapClaims
if _, _, err := jwt.NewParser().ParseUnverified(token, &claims); err != nil {
return nil, err
}
expiry, err := claims.GetExpirationTime()
if err != nil {
return nil, err
}
// Return the credentials.
return &auth.ArtifactRegistryCredentials{
Authenticator: authn.FromConfig(authn.AuthConfig{
// https://docs.microsoft.com/en-us/azure/container-registry/container-registry-authentication?tabs=azure-cli#az-acr-login-with---expose-token
Username: "00000000-0000-0000-0000-000000000000",
Password: token,
}),
ExpiresAt: expiry.Time,
}, nil
}
// GetAccessTokenOptionsForCluster implements auth.Provider.
func (Provider) GetAccessTokenOptionsForCluster(opts ...auth.Option) ([][]auth.Option, error) {
var o auth.Options
o.Apply(opts...)
var atOpts [][]auth.Option
// Token used for impersonating the Managed Identity inside the AKS cluster.
const aksScope = "6dae42f8-4368-4678-94ff-3960e28e3630/.default"
aksTokenOpts := []auth.Option{auth.WithScopes(aksScope)}
atOpts = append(atOpts, aksTokenOpts)
// Token needed for looking up details of the cluster resource.
if o.ClusterAddress == "" || o.CAData == "" {
conf := &cloud.AzurePublic
switch authorityHost := os.Getenv("AZURE_AUTHORITY_HOST"); {
case hasEnvironmentFile():
var err error
conf, err = getCloudConfigFromEnvironment()
if err != nil {
return nil, err
}
case strings.Contains(authorityHost, "chinacloudapi.cn"):
conf = &cloud.AzureChina
case strings.Contains(authorityHost, "microsoftonline.us"):
conf = &cloud.AzureGovernment
}
armScope := conf.Services[cloud.ResourceManager].Audience + "/.default"
armTokenOpts := []auth.Option{auth.WithScopes(armScope)}
atOpts = append(atOpts, armTokenOpts)
}
return atOpts, nil
}
// NewRESTConfig implements auth.Provider.
func (p Provider) NewRESTConfig(ctx context.Context, accessTokens []auth.Token,
opts ...auth.Option) (*auth.RESTConfig, error) {
aksToken := accessTokens[0].(*Token)
var armToken *Token
if len(accessTokens) == 2 {
armToken = accessTokens[1].(*Token)
}
var o auth.Options
o.Apply(opts...)
// Describe the cluster resource to get missing CA or endpoint.
host := o.ClusterAddress
caData := []byte(o.CAData)
if host == "" || len(caData) == 0 {
cluster := o.ClusterResource
subscriptionID, resourceGroup, clusterName, err := parseCluster(cluster)
if err != nil {
return nil, err
}
// Create client for describing the cluster resource.
clientOpts := arm.ClientOptions{
ClientOptions: azcore.ClientOptions{
Transport: o.GetHTTPClient(),
},
}
client, err := p.impl().NewManagedClustersClient(
subscriptionID, armToken.credential(), &clientOpts)
if err != nil {
return nil, fmt.Errorf("failed to create client for describing AKS cluster: %w", err)
}
// Describe the cluster resource.
clusterResource, err := client.Get(ctx, resourceGroup, clusterName, nil)
if err != nil {
return nil, fmt.Errorf("failed to describe AKS cluster: %w", err)
}
// We only support clusters with Microsoft Entra ID integration enabled.
if clusterResource.Properties.AADProfile == nil {
return nil, fmt.Errorf("AKS cluster %s does not have Microsoft Entra ID integration enabled. "+
"See docs for enabling: https://learn.microsoft.com/en-us/azure/aks/enable-authentication-microsoft-entra-id",
cluster)
}
// Parse specified cluster address.
var canonicalHost string
if host != "" {
var err error
canonicalHost, err = auth.ParseClusterAddress(host)
if err != nil {
return nil, fmt.Errorf("failed to parse specified cluster address '%s': %w", host, err)
}
}
// List kubeconfigs for this AKS cluster. We need to find the one
// matching the canonical address, or the first one if no address
// is specified.
resp, err := client.ListClusterUserCredentials(ctx, resourceGroup, clusterName, nil)
if err != nil {
return nil, err
}
var restConfig *rest.Config
var addresses []string
for i, kc := range resp.Kubeconfigs {
conf, err := clientcmd.RESTConfigFromKubeConfig(kc.Value)
if err != nil {
return nil, fmt.Errorf("failed to parse kubeconfig[%d]: %w", i, err)
}
addresses = append(addresses, fmt.Sprintf("'%s'", conf.Host))
canonicalHostFromAPI, err := auth.ParseClusterAddress(conf.Host)
if err != nil {
return nil, fmt.Errorf("failed to parse address '%s' from kubeconfig[%d]: %w", conf.Host, i, err)
}
if canonicalHost == "" || canonicalHostFromAPI == canonicalHost {
restConfig = conf
break
}
}
if restConfig == nil {
if canonicalHost == "" {
return nil, fmt.Errorf("no kubeconfig found for AKS cluster %s", cluster)
}
return nil, fmt.Errorf("AKS cluster %s does not match specified address '%s'. cluster addresses: [%s]",
cluster, o.ClusterAddress, strings.Join(addresses, ", "))
}
// Update host and CA with cluster details.
host = restConfig.Host
if len(caData) == 0 {
caData = restConfig.CAData
}
}
// Build and return the REST config.
return &auth.RESTConfig{
Host: host,
BearerToken: aksToken.Token,
CAData: caData,
ExpiresAt: aksToken.ExpiresOn,
}, nil
}
func (p Provider) impl() Implementation {
if p.Implementation == nil {
return implementation{}
}
return p.Implementation
}

710
auth/azure/provider_test.go Normal file
View File

@ -0,0 +1,710 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package azure_test
import (
"context"
"crypto/rand"
"crypto/rsa"
"fmt"
"net/url"
"os"
"testing"
"time"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice"
"github.com/golang-jwt/jwt/v5"
"github.com/google/go-containerregistry/pkg/authn"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/fluxcd/pkg/auth"
"github.com/fluxcd/pkg/auth/azure"
)
func TestProvider_NewControllerToken(t *testing.T) {
for _, tt := range []struct {
name string
shellOut bool
}{
{
name: "without shell out",
shellOut: false,
},
{
name: "with shell out",
shellOut: true,
},
} {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
impl := &mockImplementation{
t: t,
shellOut: tt.shellOut,
argProxyURL: &url.URL{Scheme: "http", Host: "proxy.example.com"},
argScopes: []string{"scope1", "scope2"},
returnToken: "access-token",
}
opts := []auth.Option{
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.example.com"}),
auth.WithScopes("scope1", "scope2"),
}
if tt.shellOut {
opts = append(opts, auth.WithAllowShellOut())
}
provider := azure.Provider{Implementation: impl}
token, err := provider.NewControllerToken(context.Background(), opts...)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(token).To(Equal(&azure.Token{AccessToken: azcore.AccessToken{
Token: "access-token",
ExpiresOn: time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC),
}}))
})
}
}
func TestProvider_NewTokenForServiceAccount(t *testing.T) {
for _, tt := range []struct {
name string
annotations map[string]string
err string
}{
{
name: "valid",
annotations: map[string]string{
"azure.workload.identity/tenant-id": "tenant-id",
"azure.workload.identity/client-id": "client-id",
},
},
{
name: "tenant id missing",
annotations: map[string]string{
"azure.workload.identity/client-id": "client-id",
},
err: "azure tenant ID is not set in the service account annotation azure.workload.identity/tenant-id",
},
{
name: "client id missing",
annotations: map[string]string{
"azure.workload.identity/tenant-id": "tenant-id",
},
err: "azure client ID is not set in the service account annotation azure.workload.identity/client-id",
},
} {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
impl := &mockImplementation{
t: t,
argTenantID: "tenant-id",
argClientID: "client-id",
argOIDCToken: "oidc-token",
argProxyURL: &url.URL{Scheme: "http", Host: "proxy.example.com"},
argScopes: []string{"scope1", "scope2"},
returnToken: "access-token",
}
oidcToken := "oidc-token"
serviceAccount := corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
Annotations: tt.annotations,
},
}
opts := []auth.Option{
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.example.com"}),
auth.WithScopes("scope1", "scope2"),
}
provider := azure.Provider{Implementation: impl}
token, err := provider.NewTokenForServiceAccount(context.Background(), oidcToken, serviceAccount, opts...)
if tt.err == "" {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(token).To(Equal(&azure.Token{AccessToken: azcore.AccessToken{
Token: "access-token",
ExpiresOn: time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC),
}}))
} else {
g.Expect(err).To(HaveOccurred())
g.Expect(err.Error()).To(Equal(tt.err))
g.Expect(token).To(BeNil())
}
})
}
}
func TestProvider_GetAudiences(t *testing.T) {
g := NewWithT(t)
aud, err := azure.Provider{}.GetAudiences(context.Background(), corev1.ServiceAccount{})
g.Expect(err).NotTo(HaveOccurred())
g.Expect(aud).To(Equal([]string{"api://AzureADTokenExchange"}))
}
func TestProvider_GetIdentity(t *testing.T) {
g := NewWithT(t)
identity, err := azure.Provider{}.GetIdentity(corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
"azure.workload.identity/client-id": "client-id",
"azure.workload.identity/tenant-id": "tenant-id",
},
},
})
g.Expect(err).NotTo(HaveOccurred())
g.Expect(identity).To(Equal("tenant-id/client-id"))
}
func TestProvider_NewArtifactRegistryCredentials(t *testing.T) {
g := NewWithT(t)
privateKey, err := rsa.GenerateKey(rand.Reader, 2048)
g.Expect(err).NotTo(HaveOccurred())
exp := time.Now().Add(time.Hour).Unix()
refreshToken, err := jwt.NewWithClaims(jwt.SigningMethodRS256, jwt.MapClaims{
"exp": exp,
}).SignedString(privateKey)
g.Expect(err).NotTo(HaveOccurred())
for _, tt := range []struct {
registry string
expectedScope string
}{
{
registry: "foo.azurecr.io",
expectedScope: "https://management.azure.com/.default",
},
{
registry: "foo.azurecr.cn",
expectedScope: "https://management.chinacloudapi.cn/.default",
},
{
registry: "foo.azurecr.us",
expectedScope: "https://management.usgovcloudapi.net/.default",
},
} {
t.Run(tt.registry, func(t *testing.T) {
g := NewWithT(t)
impl := &mockImplementation{
t: t,
argRegistry: tt.registry,
argToken: "access-token",
argProxyURL: &url.URL{Scheme: "http", Host: "proxy.example.com"},
argScopes: []string{tt.expectedScope},
returnToken: "access-token",
returnACRToken: refreshToken,
}
provider := azure.Provider{Implementation: impl}
artifactRepository := fmt.Sprintf("%s/repo", tt.registry)
opts := []auth.Option{
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.example.com"}),
}
creds, err := auth.GetArtifactRegistryCredentials(context.Background(), provider, artifactRepository, opts...)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(creds).To(Equal(&auth.ArtifactRegistryCredentials{
Authenticator: authn.FromConfig(authn.AuthConfig{
Username: "00000000-0000-0000-0000-000000000000",
Password: refreshToken,
}),
ExpiresAt: time.Unix(exp, 0),
}))
})
}
}
func TestProvider_ParseArtifactRegistry(t *testing.T) {
for _, tt := range []struct {
artifactRepository string
expectedRegistryURL string
containerRegistryDNSSuffix string
expectValid bool
}{
{
artifactRepository: "foo.azurecr.io/repo",
expectedRegistryURL: "foo.azurecr.io",
expectValid: true,
},
{
artifactRepository: "foo.azurecr.cn/repo",
expectedRegistryURL: "foo.azurecr.cn",
expectValid: true,
},
{
artifactRepository: "foo.azurecr.de/repo",
expectedRegistryURL: "foo.azurecr.de",
expectValid: true,
},
{
artifactRepository: "foo.azurecr.us/repo",
expectedRegistryURL: "foo.azurecr.us",
expectValid: true,
},
{
artifactRepository: "foo.azurecr.com/repo",
expectValid: false,
},
{
artifactRepository: ".azurecr.io/repo",
expectValid: false,
},
{
artifactRepository: "012345678901.dkr.ecr.us-east-1.amazonaws.com",
expectValid: false,
},
{
artifactRepository: "foo.azurecr.private/repo",
expectedRegistryURL: "foo.azurecr.private",
containerRegistryDNSSuffix: "azurecr.private",
expectValid: true,
},
{
artifactRepository: "foo.azurecr.private/repo",
expectedRegistryURL: "foo.azurecr.private",
containerRegistryDNSSuffix: "azurecr.pr",
expectValid: false,
},
} {
t.Run(tt.artifactRepository, func(t *testing.T) {
g := NewWithT(t)
// Create a temporary JSON file if containerRegistryDNS is defined
if tt.containerRegistryDNSSuffix != "" {
envContent := fmt.Sprintf(`{"containerRegistryDNSSuffix": "%s"}`, tt.containerRegistryDNSSuffix)
tempFileName, err := createTempAzureEnvFile(envContent)
g.Expect(err).NotTo(HaveOccurred())
defer os.Remove(tempFileName)
// Set the environment variable to point to the temp file
t.Setenv("AZURE_ENVIRONMENT_FILEPATH", tempFileName)
}
registryURL, err := azure.Provider{}.ParseArtifactRepository(tt.artifactRepository)
if tt.expectValid {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(registryURL).To(Equal(tt.expectedRegistryURL))
} else {
g.Expect(err).To(HaveOccurred())
g.Expect(registryURL).To(BeEmpty())
}
})
}
}
func TestProvider_GetAccessTokenOptionsForArtifactRepository(t *testing.T) {
for _, tt := range []struct {
name string
artifactRepository string
readFromEnv bool
expectedScope string
}{
{
name: "Azure Public Cloud",
artifactRepository: "myregistry.azurecr.io",
expectedScope: "https://management.azure.com/.default",
},
{
name: "Azure China Cloud",
artifactRepository: "myregistry.azurecr.cn",
expectedScope: "https://management.chinacloudapi.cn/.default",
},
{
name: "Azure Government Cloud",
artifactRepository: "myregistry.azurecr.us",
expectedScope: "https://management.usgovcloudapi.net/.default",
},
{
name: "Invalid registry",
artifactRepository: "myregistry.invalid.io",
expectedScope: "https://management.azure.com/.default",
},
{
name: "Custom environment file",
artifactRepository: "myregistry.private.io",
readFromEnv: true,
expectedScope: "https://management.core.azure.private/.default",
},
} {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
if tt.readFromEnv {
envContent := fmt.Sprintf(`{"resourceManagerEndpoint": "%s", "tokenAudience": "%s", "extraField": "%s"}`, "https://management.core.azure.private", "https://management.core.azure.private", "random-extra-field-for-testing")
tempFileName, err := createTempAzureEnvFile(envContent)
g.Expect(err).NotTo(HaveOccurred())
defer os.Remove(tempFileName)
// Set the environment variable to point to the temp file
t.Setenv("AZURE_ENVIRONMENT_FILEPATH", tempFileName)
}
provider := azure.Provider{}
opts, err := provider.GetAccessTokenOptionsForArtifactRepository(tt.artifactRepository)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(opts).To(HaveLen(1))
var armOptions auth.Options
armOptions.Apply(opts...)
g.Expect(armOptions.Scopes).To(Equal([]string{tt.expectedScope}))
})
}
}
func TestProvider_NewRESTConfig(t *testing.T) {
for _, tt := range []struct {
name string
cluster string
clusterAddress string
caData string
aadProfile *armcontainerservice.ManagedClusterAADProfile
kubeconfigs []*armcontainerservice.CredentialResult
authorityHost string
secondScope string
err string
}{
{
name: "valid AKS cluster",
cluster: "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/test-cluster",
aadProfile: &armcontainerservice.ManagedClusterAADProfile{
Managed: &[]bool{true}[0],
},
kubeconfigs: []*armcontainerservice.CredentialResult{
{
Name: &[]string{"clusterUser"}[0],
Value: createKubeconfig("test-cluster", "https://test-cluster-12345678.hcp.eastus.azmk8s.io:443"),
},
{
Name: &[]string{"clusterUser-secondary"}[0],
Value: createKubeconfig("test-cluster-secondary", "https://test-cluster-secondary-87654321.hcp.westus.azmk8s.io:443"),
},
},
},
{
name: "valid AKS cluster - china",
cluster: "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/test-cluster",
aadProfile: &armcontainerservice.ManagedClusterAADProfile{
Managed: &[]bool{true}[0],
},
kubeconfigs: []*armcontainerservice.CredentialResult{
{
Name: &[]string{"clusterUser"}[0],
Value: createKubeconfig("test-cluster", "https://test-cluster-12345678.hcp.eastus.azmk8s.io:443"),
},
{
Name: &[]string{"clusterUser-secondary"}[0],
Value: createKubeconfig("test-cluster-secondary", "https://test-cluster-secondary-87654321.hcp.westus.azmk8s.io:443"),
},
},
authorityHost: "https://login.chinacloudapi.cn/",
secondScope: "https://management.core.chinacloudapi.cn/.default",
},
{
name: "valid AKS cluster - us gov",
cluster: "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/test-cluster",
aadProfile: &armcontainerservice.ManagedClusterAADProfile{
Managed: &[]bool{true}[0],
},
kubeconfigs: []*armcontainerservice.CredentialResult{
{
Name: &[]string{"clusterUser"}[0],
Value: createKubeconfig("test-cluster", "https://test-cluster-12345678.hcp.eastus.azmk8s.io:443"),
},
{
Name: &[]string{"clusterUser-secondary"}[0],
Value: createKubeconfig("test-cluster-secondary", "https://test-cluster-secondary-87654321.hcp.westus.azmk8s.io:443"),
},
},
authorityHost: "https://login.microsoftonline.us/",
secondScope: "https://management.core.usgovcloudapi.net/.default",
},
{
name: "valid AKS cluster - lowercase",
cluster: "/subscriptions/12345678-1234-1234-1234-123456789012/resourcegroups/test-rg/providers/Microsoft.ContainerService/managedClusters/test-cluster",
aadProfile: &armcontainerservice.ManagedClusterAADProfile{
Managed: &[]bool{true}[0],
},
kubeconfigs: []*armcontainerservice.CredentialResult{
{
Name: &[]string{"clusterUser"}[0],
Value: createKubeconfig("test-cluster", "https://test-cluster-12345678.hcp.eastus.azmk8s.io:443"),
},
{
Name: &[]string{"clusterUser-secondary"}[0],
Value: createKubeconfig("test-cluster-secondary", "https://test-cluster-secondary-87654321.hcp.westus.azmk8s.io:443"),
},
},
},
{
name: "valid AKS cluster with address match",
cluster: "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/test-cluster",
clusterAddress: "https://test-cluster-secondary-87654321.hcp.westus.azmk8s.io:443",
aadProfile: &armcontainerservice.ManagedClusterAADProfile{
Managed: &[]bool{true}[0],
},
kubeconfigs: []*armcontainerservice.CredentialResult{
{
Name: &[]string{"clusterUser"}[0],
Value: createKubeconfig("test-cluster", "https://test-cluster-12345678.hcp.eastus.azmk8s.io:443"),
},
{
Name: &[]string{"clusterUser-secondary"}[0],
Value: createKubeconfig("test-cluster-secondary", "https://test-cluster-secondary-87654321.hcp.westus.azmk8s.io:443"),
},
},
},
{
name: "valid AKS cluster with CA",
cluster: "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/test-cluster",
caData: "-----BEGIN CERTIFICATE-----",
aadProfile: &armcontainerservice.ManagedClusterAADProfile{
Managed: &[]bool{true}[0],
},
kubeconfigs: []*armcontainerservice.CredentialResult{
{
Name: &[]string{"clusterUser"}[0],
Value: createKubeconfig("test-cluster", "https://test-cluster-12345678.hcp.eastus.azmk8s.io:443"),
},
{
Name: &[]string{"clusterUser-secondary"}[0],
Value: createKubeconfig("test-cluster-secondary", "https://test-cluster-secondary-87654321.hcp.westus.azmk8s.io:443"),
},
},
},
{
name: "CA and address only",
clusterAddress: "https://test-cluster-secondary-87654321.hcp.westus.azmk8s.io:443",
caData: "-----BEGIN CERTIFICATE-----",
aadProfile: &armcontainerservice.ManagedClusterAADProfile{
Managed: &[]bool{true}[0],
},
kubeconfigs: []*armcontainerservice.CredentialResult{
{
Name: &[]string{"clusterUser"}[0],
Value: createKubeconfig("test-cluster", "https://test-cluster-12345678.hcp.eastus.azmk8s.io:443"),
},
{
Name: &[]string{"clusterUser-secondary"}[0],
Value: createKubeconfig("test-cluster-secondary", "https://test-cluster-secondary-87654321.hcp.westus.azmk8s.io:443"),
},
},
},
{
name: "cluster address mismatch",
cluster: "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/test-cluster",
clusterAddress: "https://different-cluster.hcp.eastus.azmk8s.io:443",
aadProfile: &armcontainerservice.ManagedClusterAADProfile{
Managed: &[]bool{true}[0],
},
kubeconfigs: []*armcontainerservice.CredentialResult{
{
Name: &[]string{"clusterUser"}[0],
Value: createKubeconfig("test-cluster", "https://test-cluster-12345678.hcp.eastus.azmk8s.io:443"),
},
},
err: "AKS cluster /subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/test-cluster does not match specified address 'https://different-cluster.hcp.eastus.azmk8s.io:443'. cluster addresses: ['https://test-cluster-12345678.hcp.eastus.azmk8s.io:443']",
},
{
name: "cluster without AAD integration",
cluster: "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/test-cluster",
err: "AKS cluster /subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/test-cluster does not have Microsoft Entra ID integration enabled. See docs for enabling: https://learn.microsoft.com/en-us/azure/aks/enable-authentication-microsoft-entra-id",
},
{
name: "invalid cluster ID",
cluster: "invalid-cluster-id",
err: `invalid AKS cluster ID: 'invalid-cluster-id'. must match (?i)^/subscriptions/([^/]{36})/resourceGroups/([^/]{1,200})/providers/Microsoft\.ContainerService/managedClusters/([^/]{1,200})$`,
},
} {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
if tt.authorityHost != "" {
t.Setenv("AZURE_AUTHORITY_HOST", tt.authorityHost)
}
secondScope := "https://management.core.windows.net//.default"
if tt.secondScope != "" {
secondScope = tt.secondScope
}
impl := &mockImplementation{
t: t,
expectAKSAPICall: tt.clusterAddress == "" || tt.caData == "",
argToken: "access-token",
argFirstScopes: []string{"6dae42f8-4368-4678-94ff-3960e28e3630/.default"},
argSecondScopes: []string{secondScope},
argSubscription: "12345678-1234-1234-1234-123456789012",
argResourceGroup: "test-rg",
argClusterName: "test-cluster",
argProxyURL: &url.URL{Scheme: "http", Host: "proxy.example.com"},
returnToken: "access-token",
returnCluster: armcontainerservice.ManagedCluster{
Properties: &armcontainerservice.ManagedClusterProperties{
AADProfile: tt.aadProfile,
},
},
returnKubeconfigs: tt.kubeconfigs,
}
opts := []auth.Option{
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.example.com"}),
}
if tt.cluster != "" {
opts = append(opts, auth.WithClusterResource(tt.cluster))
}
if tt.clusterAddress != "" {
opts = append(opts, auth.WithClusterAddress(tt.clusterAddress))
}
if tt.caData != "" {
opts = append(opts, auth.WithCAData(tt.caData))
}
provider := azure.Provider{Implementation: impl}
restConfig, err := auth.GetRESTConfig(context.Background(), provider, opts...)
if tt.err == "" {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(restConfig).NotTo(BeNil())
expectedHost := "https://test-cluster-12345678.hcp.eastus.azmk8s.io:443"
if tt.clusterAddress != "" {
expectedHost = tt.clusterAddress
}
g.Expect(restConfig.Host).To(Equal(expectedHost))
g.Expect(restConfig.BearerToken).To(Equal("access-token"))
g.Expect(restConfig.CAData).To(Equal([]byte("-----BEGIN CERTIFICATE-----")))
g.Expect(restConfig.ExpiresAt).To(Equal(time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)))
} else {
g.Expect(err).To(HaveOccurred())
g.Expect(err.Error()).To(ContainSubstring(tt.err))
g.Expect(restConfig).To(BeNil())
}
})
}
}
func TestProvider_GetAccessTokenOptionsForCluster(t *testing.T) {
g := NewWithT(t)
t.Run("needs to fetch cluster", func(t *testing.T) {
opts, err := azure.Provider{}.GetAccessTokenOptionsForCluster(
auth.WithClusterResource("/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/test-cluster"))
g.Expect(err).NotTo(HaveOccurred())
g.Expect(opts).To(HaveLen(2))
// AKS token options
var aksOptions auth.Options
aksOptions.Apply(opts[0]...)
g.Expect(aksOptions.Scopes).To(Equal([]string{"6dae42f8-4368-4678-94ff-3960e28e3630/.default"}))
// ARM token options
var armOptions auth.Options
armOptions.Apply(opts[1]...)
g.Expect(armOptions.Scopes).To(Equal([]string{"https://management.core.windows.net//.default"}))
})
t.Run("needs to fetch cluster arm options from env", func(t *testing.T) {
envContent := fmt.Sprintf(`{"resourceManagerEndpoint": "%s", "tokenAudience": "%s", "extraField": "%s"}`, "https://management.core.azure.private/", "https://management.core.azure.private/", "random-extra-field-for-testing")
tempFileName, err := createTempAzureEnvFile(envContent)
g.Expect(err).NotTo(HaveOccurred())
defer os.Remove(tempFileName)
// Set the environment variable to point to the temp file
t.Setenv("AZURE_ENVIRONMENT_FILEPATH", tempFileName)
opts, err := azure.Provider{}.GetAccessTokenOptionsForCluster(
auth.WithClusterResource("/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/test-rg/providers/Microsoft.ContainerService/managedClusters/test-cluster"))
g.Expect(err).NotTo(HaveOccurred())
g.Expect(opts).To(HaveLen(2))
// AKS token options
var aksOptions auth.Options
aksOptions.Apply(opts[0]...)
g.Expect(aksOptions.Scopes).To(Equal([]string{"6dae42f8-4368-4678-94ff-3960e28e3630/.default"}))
// ARM token options
var armOptions auth.Options
armOptions.Apply(opts[1]...)
g.Expect(armOptions.Scopes).To(Equal([]string{"https://management.core.azure.private//.default"}))
})
t.Run("no need to fetch cluster", func(t *testing.T) {
opts, err := azure.Provider{}.GetAccessTokenOptionsForCluster(
auth.WithClusterAddress("https://test-cluster-12345678.hcp.eastus.azmk8s.io:443"),
auth.WithCAData("-----BEGIN CERTIFICATE-----"))
g.Expect(err).NotTo(HaveOccurred())
g.Expect(opts).To(HaveLen(1))
// AKS token options
var aksOptions auth.Options
aksOptions.Apply(opts[0]...)
g.Expect(aksOptions.Scopes).To(Equal([]string{"6dae42f8-4368-4678-94ff-3960e28e3630/.default"}))
})
}
func createKubeconfig(clusterName, serverURL string) []byte {
return []byte(fmt.Sprintf(`apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0t
server: %s
name: %s
contexts:
- context:
cluster: %s
user: clusterUser_test-rg_%s
name: %s
current-context: %s
kind: Config
users:
- name: clusterUser_test-rg_%s
user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
command: kubelogin
env: null
`, serverURL, clusterName, clusterName, clusterName, clusterName, clusterName, clusterName))
}
func createTempAzureEnvFile(content string) (string, error) {
tempFile, err := os.CreateTemp("", "azure_env_*.json")
if err != nil {
return "", err
}
if err := tempFile.Close(); err != nil {
os.Remove(tempFile.Name())
return "", err
}
if err := os.WriteFile(tempFile.Name(), []byte(content), 0644); err != nil {
return "", err
}
return tempFile.Name(), nil
}

28
auth/azure/scopes.go Normal file
View File

@ -0,0 +1,28 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package azure
const (
// https://learn.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/service-principal-managed-identity?view=azure-devops#q-can-i-add-a-managed-identity-from-a-different-tenant-to-my-organization
ScopeDevOps = "499b84ac-1321-427f-aa17-267ca6975798/.default"
// https://github.com/Azure/azure-sdk-for-go/blob/f5dfe3b53fe63aacd3aeba948bbe21d961edf376/sdk/storage/azqueue/internal/shared/shared.go#L18
ScopeBlobStorage = "https://storage.azure.com/.default"
// https://github.com/Azure/azure-sdk-for-go/blob/f5dfe3b53fe63aacd3aeba948bbe21d961edf376/sdk/messaging/azeventhubs/internal/sbauth/token_provider.go#L99
ScopeEventHubs = "https://eventhubs.azure.net//.default"
)

44
auth/azure/token.go Normal file
View File

@ -0,0 +1,44 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package azure
import (
"context"
"time"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
)
// Token is the Azure token.
type Token struct{ azcore.AccessToken }
type staticTokenCredential struct{ azcore.AccessToken }
// GetDuration implements auth.Token.
func (t *Token) GetDuration() time.Duration {
return time.Until(t.ExpiresOn)
}
func (t *Token) credential() azcore.TokenCredential {
return &staticTokenCredential{t.AccessToken}
}
// GetToken implements azcore.TokenCredential.
func (s *staticTokenCredential) GetToken(context.Context, policy.TokenRequestOptions) (azcore.AccessToken, error) {
return s.AccessToken, nil
}

View File

@ -0,0 +1,59 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package azure
import (
"context"
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/fluxcd/pkg/auth"
)
type tokenCredential struct {
ctx context.Context
opts []auth.Option
}
// NewTokenCredential creates a new token credential for the given options.
func NewTokenCredential(ctx context.Context, opts ...auth.Option) azcore.TokenCredential {
return &tokenCredential{ctx, opts}
}
// GetToken implements exported.TokenCredential.
// The context is ignored, use the constructor to set the context.
// This is because the GCP abstraction does not receive a context
// in the method arguments, so we unfortunately need to standardize
// the behavior of all providers around this so the usage of this
// library can be consistent regardless of the provider.
func (t *tokenCredential) GetToken(_ context.Context, tokenOpts policy.TokenRequestOptions) (azcore.AccessToken, error) {
opts := t.opts
if tokenOpts.Scopes != nil {
opts = append(opts, auth.WithScopes(tokenOpts.Scopes...))
}
token, err := auth.GetAccessToken(t.ctx, Provider{}, opts...)
if err != nil {
return azcore.AccessToken{}, err
}
azureToken, ok := token.(*Token)
if !ok {
return azcore.AccessToken{}, fmt.Errorf("failed to cast token to Azure token: %T", token)
}
return azureToken.AccessToken, nil
}

29
auth/cache_key.go Normal file
View File

@ -0,0 +1,29 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package auth
import (
"crypto/sha256"
"fmt"
"strings"
)
func buildCacheKey(parts ...string) string {
s := strings.Join(parts, "\n")
hash := sha256.Sum256([]byte(s))
return fmt.Sprintf("%x", hash)
}

18
auth/doc.go Normal file
View File

@ -0,0 +1,18 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// auth is a package for handling secret-less authentication with cloud providers.
package auth

53
auth/feature_gate.go Normal file
View File

@ -0,0 +1,53 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package auth
import (
"fmt"
"os"
)
// FeatureGateObjectLevelWorkloadIdentity is a feature gate that enables the use of
// object-level workload identity for authentication.
const FeatureGateObjectLevelWorkloadIdentity = "ObjectLevelWorkloadIdentity"
// ErrObjectLevelWorkloadIdentityNotEnabled is returned when object-level
// workload identity is attempted but not enabled.
var ErrObjectLevelWorkloadIdentityNotEnabled = fmt.Errorf(
"%s feature gate is not enabled", FeatureGateObjectLevelWorkloadIdentity)
// SetFeatureGates sets the default values for the feature gates.
func SetFeatureGates(features map[string]bool) {
// opt-in from Flux v2.6.
features[FeatureGateObjectLevelWorkloadIdentity] = false
}
// EnvVarEnableObjectLevelWorkloadIdentity is the environment variable that
// enables the use of object-level workload identity for authentication.
const EnvVarEnableObjectLevelWorkloadIdentity = "ENABLE_OBJECT_LEVEL_WORKLOAD_IDENTITY"
// EnableObjectLevelWorkloadIdentity enables the use of object-level workload
// identity for authentication.
func EnableObjectLevelWorkloadIdentity() {
os.Setenv(EnvVarEnableObjectLevelWorkloadIdentity, "true")
}
// IsObjectLevelWorkloadIdentityEnabled returns true if the object-level
// workload identity feature gate is enabled.
func IsObjectLevelWorkloadIdentityEnabled() bool {
return os.Getenv(EnvVarEnableObjectLevelWorkloadIdentity) == "true"
}

127
auth/gcp/gke_metadata.go Normal file
View File

@ -0,0 +1,127 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package gcp
import (
"context"
"fmt"
"sync"
"cloud.google.com/go/compute/metadata"
)
type gkeMetadataLoader struct {
projectID string
location string
name string
mu sync.RWMutex
loaded bool
}
var gkeMetadata gkeMetadataLoader
func (g *gkeMetadataLoader) getAudience(ctx context.Context) (string, error) {
if err := g.load(ctx); err != nil {
return "", err
}
wiPool, _ := g.workloadIdentityPool(ctx)
wiProvider, _ := g.workloadIdentityProvider(ctx)
return fmt.Sprintf("identitynamespace:%s:%s", wiPool, wiProvider), nil
}
func (g *gkeMetadataLoader) workloadIdentityPool(ctx context.Context) (string, error) {
if err := g.load(ctx); err != nil {
return "", err
}
return fmt.Sprintf("%s.svc.id.goog", g.projectID), nil
}
func (g *gkeMetadataLoader) workloadIdentityProvider(ctx context.Context) (string, error) {
if err := g.load(ctx); err != nil {
return "", err
}
return fmt.Sprintf("https://container.googleapis.com/v1/projects/%s/locations/%s/clusters/%s",
g.projectID,
g.location,
g.name), nil
}
// load loads the GKE cluster metadata from the metadata service, assuming the
// pod is running on a GKE node/pod. It will fail otherwise, and this
// is the reason why this method should be called lazily. If this code ran on any
// other cluster that is not GKE it would fail consistently and throw the pods
// in crash loop if running on startup. This method is thread-safe and will
// only load the metadata successfully once.
//
// Technically we could receive options here to use a custom HTTP client with
// a proxy, but this proxy is configured at the object level and here we are
// loading cluster-level metadata that doesn't change during the lifetime of
// the pod. So we can't use an object-level proxy here. Furthermore, this
// implementation targets specifically GKE clusters, and in such clusters the
// metadata server is usually a DaemonSet pod that serves only node-local
// traffic, so a proxy doesn't make sense here anyway.
func (g *gkeMetadataLoader) load(ctx context.Context) error {
// Bail early if the metadata was already loaded.
g.mu.RLock()
loaded := g.loaded
g.mu.RUnlock()
if loaded {
return nil
}
g.mu.Lock()
defer g.mu.Unlock()
// Check again if the metadata was loaded while we were waiting for the lock.
if g.loaded {
return nil
}
client := metadata.NewClient(nil)
projectID, err := client.GetWithContext(ctx, "project/project-id")
if err != nil {
return fmt.Errorf("failed to get GKE cluster project ID from the metadata service: %w", err)
}
if projectID == "" {
return fmt.Errorf("failed to get GKE cluster project ID from the metadata service: empty value")
}
location, err := client.GetWithContext(ctx, "instance/attributes/cluster-location")
if err != nil {
return fmt.Errorf("failed to get GKE cluster location from the metadata service: %w", err)
}
if location == "" {
return fmt.Errorf("failed to get GKE cluster location from the metadata service: empty value")
}
name, err := client.GetWithContext(ctx, "instance/attributes/cluster-name")
if err != nil {
return fmt.Errorf("failed to get GKE cluster name from the metadata service: %w", err)
}
if name == "" {
return fmt.Errorf("failed to get GKE cluster name from the metadata service: empty value")
}
g.projectID = projectID
g.location = location
g.name = name
g.loaded = true
return nil
}

View File

@ -0,0 +1,41 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package gcp_test
import (
"fmt"
"net/http"
"net/http/httptest"
"strings"
"testing"
)
func startGKEMetadataServer(t *testing.T) {
t.Helper()
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case "/computeMetadata/v1/project/project-id":
fmt.Fprintf(w, "%s", "project-id")
case "/computeMetadata/v1/instance/attributes/cluster-location":
fmt.Fprintf(w, "%s", "cluster-location")
case "/computeMetadata/v1/instance/attributes/cluster-name":
fmt.Fprintf(w, "%s", "cluster-name")
}
}))
t.Cleanup(srv.Close)
t.Setenv("GCE_METADATA_HOST", strings.TrimPrefix(srv.URL, "http://"))
}

View File

@ -0,0 +1,47 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package gcp
import (
"context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"golang.org/x/oauth2/google/externalaccount"
"google.golang.org/api/container/v1"
)
// Implementation provides the required methods of the GCP libraries.
type Implementation interface {
DefaultTokenSource(ctx context.Context, scope ...string) (oauth2.TokenSource, error)
NewTokenSource(ctx context.Context, conf externalaccount.Config) (oauth2.TokenSource, error)
GetCluster(ctx context.Context, cluster string, client *container.Service) (*container.Cluster, error)
}
type implementation struct{}
func (implementation) DefaultTokenSource(ctx context.Context, scope ...string) (oauth2.TokenSource, error) {
return google.DefaultTokenSource(ctx, scope...)
}
func (implementation) NewTokenSource(ctx context.Context, conf externalaccount.Config) (oauth2.TokenSource, error) {
return externalaccount.NewTokenSource(ctx, conf)
}
func (implementation) GetCluster(ctx context.Context, cluster string, client *container.Service) (*container.Cluster, error) {
return client.Projects.Locations.Clusters.Get(cluster).Context(ctx).Do()
}

View File

@ -0,0 +1,112 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package gcp_test
import (
"context"
"net/http"
"net/url"
"reflect"
"testing"
"unsafe"
. "github.com/onsi/gomega"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google/externalaccount"
"google.golang.org/api/container/v1"
)
type mockImplementation struct {
t *testing.T
expectGKEAPICall bool
argConfig externalaccount.Config
argProxyURL *url.URL
argCluster string
returnToken *oauth2.Token
returnCluster *container.Cluster
}
func (m *mockImplementation) DefaultTokenSource(ctx context.Context, scope ...string) (oauth2.TokenSource, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(ctx).NotTo(BeNil())
g.Expect(ctx.Value(oauth2.HTTPClient)).NotTo(BeNil())
g.Expect(ctx.Value(oauth2.HTTPClient).(*http.Client)).NotTo(BeNil())
g.Expect(ctx.Value(oauth2.HTTPClient).(*http.Client).Transport).NotTo(BeNil())
g.Expect(ctx.Value(oauth2.HTTPClient).(*http.Client).Transport.(*http.Transport)).NotTo(BeNil())
g.Expect(ctx.Value(oauth2.HTTPClient).(*http.Client).Transport.(*http.Transport).Proxy).NotTo(BeNil())
proxyURL, err := ctx.Value(oauth2.HTTPClient).(*http.Client).Transport.(*http.Transport).Proxy(nil)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(proxyURL).To(Equal(m.argProxyURL))
g.Expect(scope).To(Equal([]string{
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/userinfo.email",
}))
return oauth2.StaticTokenSource(m.returnToken), nil
}
func (m *mockImplementation) NewTokenSource(ctx context.Context, conf externalaccount.Config) (oauth2.TokenSource, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(ctx).NotTo(BeNil())
g.Expect(ctx.Value(oauth2.HTTPClient)).NotTo(BeNil())
g.Expect(ctx.Value(oauth2.HTTPClient).(*http.Client)).NotTo(BeNil())
g.Expect(ctx.Value(oauth2.HTTPClient).(*http.Client).Transport).NotTo(BeNil())
g.Expect(ctx.Value(oauth2.HTTPClient).(*http.Client).Transport.(*http.Transport)).NotTo(BeNil())
g.Expect(ctx.Value(oauth2.HTTPClient).(*http.Client).Transport.(*http.Transport).Proxy).NotTo(BeNil())
proxyURL, err := ctx.Value(oauth2.HTTPClient).(*http.Client).Transport.(*http.Transport).Proxy(nil)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(proxyURL).To(Equal(m.argProxyURL))
g.Expect(conf).To(Equal(m.argConfig))
return oauth2.StaticTokenSource(m.returnToken), nil
}
func (m *mockImplementation) GetCluster(ctx context.Context, cluster string, client *container.Service) (*container.Cluster, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(m.expectGKEAPICall).To(BeTrue())
g.Expect(ctx).NotTo(BeNil())
g.Expect(cluster).To(Equal(m.argCluster))
g.Expect(client).NotTo(BeNil())
g.Expect(client.BasePath).To(Equal("https://container.googleapis.com/"))
httpClientField := reflect.ValueOf(client).Elem().FieldByName("client")
httpClientValue := reflect.NewAt(httpClientField.Type(), unsafe.Pointer(httpClientField.UnsafeAddr())).Elem().Interface().(*http.Client)
g.Expect(httpClientValue).NotTo(BeNil())
g.Expect(httpClientValue.Transport).NotTo(BeNil())
g.Expect(httpClientValue.Transport.(*oauth2.Transport)).NotTo(BeNil())
g.Expect(httpClientValue.Transport.(*oauth2.Transport).Source).NotTo(BeNil())
token, err := httpClientValue.Transport.(*oauth2.Transport).Source.Token()
g.Expect(err).NotTo(HaveOccurred())
g.Expect(token).To(Equal(m.returnToken))
g.Expect(httpClientValue.Transport.(*oauth2.Transport).Base).NotTo(BeNil())
g.Expect(httpClientValue.Transport.(*oauth2.Transport).Base.(*otelhttp.Transport)).NotTo(BeNil())
otelRoundTripperField := reflect.ValueOf(httpClientValue.Transport.(*oauth2.Transport).Base.(*otelhttp.Transport)).Elem().FieldByName("rt")
otelRoundTripperValue := reflect.NewAt(otelRoundTripperField.Type(), unsafe.Pointer(otelRoundTripperField.UnsafeAddr())).Elem().Interface()
g.Expect(otelRoundTripperValue).NotTo(BeNil())
parameterRoundTripperField := reflect.ValueOf(otelRoundTripperValue).Elem().FieldByName("base")
parameterRoundTripperValue := reflect.NewAt(parameterRoundTripperField.Type(), unsafe.Pointer(parameterRoundTripperField.UnsafeAddr())).Elem().Interface()
g.Expect(parameterRoundTripperValue.(*http.Transport)).NotTo(BeNil())
g.Expect(parameterRoundTripperValue.(*http.Transport).Proxy).NotTo(BeNil())
proxyURL, err := parameterRoundTripperValue.(*http.Transport).Proxy(nil)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(proxyURL).To(Equal(m.argProxyURL))
return m.returnCluster, nil
}

70
auth/gcp/options.go Normal file
View File

@ -0,0 +1,70 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package gcp
import (
"fmt"
"regexp"
corev1 "k8s.io/api/core/v1"
)
const serviceAccountEmailPattern = `^[a-zA-Z0-9-]{1,100}@[a-zA-Z0-9-]{1,100}\.iam\.gserviceaccount\.com$`
var serviceAccountEmailRegex = regexp.MustCompile(serviceAccountEmailPattern)
func getServiceAccountEmail(serviceAccount corev1.ServiceAccount) (string, error) {
const key = "iam.gke.io/gcp-service-account"
email := serviceAccount.Annotations[key]
if email == "" {
return "", nil
}
if !serviceAccountEmailRegex.MatchString(email) {
return "", fmt.Errorf("invalid %s annotation: '%s'. must match %s",
key, email, serviceAccountEmailPattern)
}
return email, nil
}
const workloadIdentityProviderPattern = `^projects/\d{1,30}/locations/global/workloadIdentityPools/[^/]{1,100}/providers/[^/]{1,100}$`
var workloadIdentityProviderRegex = regexp.MustCompile(workloadIdentityProviderPattern)
func getWorkloadIdentityProviderAudience(serviceAccount corev1.ServiceAccount) (string, error) {
const key = "gcp.auth.fluxcd.io/workload-identity-provider"
wip := serviceAccount.Annotations[key]
if wip == "" {
return "", nil
}
if !workloadIdentityProviderRegex.MatchString(wip) {
return "", fmt.Errorf("invalid %s annotation: '%s'. must match %s",
key, wip, workloadIdentityProviderPattern)
}
return fmt.Sprintf("//iam.googleapis.com/%s", wip), nil
}
const clusterPattern = `^projects/[^/]{1,200}/locations/[^/]{1,200}/clusters/[^/]{1,200}$`
var clusterRegex = regexp.MustCompile(clusterPattern)
func parseCluster(cluster string) error {
if !clusterRegex.MatchString(cluster) {
return fmt.Errorf("invalid GKE cluster ID: '%s'. must match %s",
cluster, clusterPattern)
}
return nil
}

286
auth/gcp/provider.go Normal file
View File

@ -0,0 +1,286 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package gcp
import (
"context"
"encoding/base64"
"fmt"
"net/http"
"regexp"
"github.com/google/go-containerregistry/pkg/authn"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google/externalaccount"
"google.golang.org/api/container/v1"
"google.golang.org/api/option"
htransport "google.golang.org/api/transport/http"
corev1 "k8s.io/api/core/v1"
auth "github.com/fluxcd/pkg/auth"
)
// ProviderName is the name of the GCP authentication provider.
const ProviderName = "gcp"
var scopes = []string{
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/userinfo.email",
}
// Provider implements the auth.Provider interface for GCP authentication.
type Provider struct{ Implementation }
// GetName implements auth.Provider.
func (Provider) GetName() string {
return ProviderName
}
// NewControllerToken implements auth.Provider.
func (p Provider) NewControllerToken(ctx context.Context, opts ...auth.Option) (auth.Token, error) {
var o auth.Options
o.Apply(opts...)
ctx = context.WithValue(ctx, oauth2.HTTPClient, o.GetHTTPClient())
src, err := p.impl().DefaultTokenSource(ctx, scopes...)
if err != nil {
return nil, err
}
token, err := src.Token()
if err != nil {
return nil, err
}
return &Token{*token}, nil
}
// GetAudiences implements auth.Provider.
func (Provider) GetAudiences(ctx context.Context, serviceAccount corev1.ServiceAccount) ([]string, error) {
// Check if a workload identity provider is specified in the service account.
// If so, the current cluster is not GKE and the audience is the provider itself.
audience, err := getWorkloadIdentityProviderAudience(serviceAccount)
if err != nil {
return nil, err
}
if audience != "" {
return []string{audience}, nil
}
// Assume we are in GKE. In this case, the audience is the workload identity pool.
audience, err = gkeMetadata.workloadIdentityPool(ctx)
if err != nil {
return nil, err
}
return []string{audience}, nil
}
// GetIdentity implements auth.Provider.
func (Provider) GetIdentity(serviceAccount corev1.ServiceAccount) (string, error) {
email, err := getServiceAccountEmail(serviceAccount)
if err != nil {
return "", err
}
return email, nil
}
// NewTokenForServiceAccount implements auth.Provider.
func (p Provider) NewTokenForServiceAccount(ctx context.Context, oidcToken string,
serviceAccount corev1.ServiceAccount, opts ...auth.Option) (auth.Token, error) {
var o auth.Options
o.Apply(opts...)
// Check if a workload identity provider is specified in the service account.
// If so, the current cluster is not GKE and the audience is the provider itself.
audience, err := getWorkloadIdentityProviderAudience(serviceAccount)
if err != nil {
return nil, err
}
// Assume we are in GKE. In this case, retrieve the audience from the metadata.
if audience == "" {
audience, err = gkeMetadata.getAudience(ctx)
if err != nil {
return nil, err
}
}
conf := externalaccount.Config{
UniverseDomain: "googleapis.com",
Audience: audience,
SubjectTokenType: "urn:ietf:params:oauth:token-type:jwt",
TokenURL: "https://sts.googleapis.com/v1/token",
SubjectTokenSupplier: StaticTokenSupplier(oidcToken),
Scopes: scopes,
}
email, err := getServiceAccountEmail(serviceAccount)
if err != nil {
return nil, err
}
if email != "" { // impersonation
conf.ServiceAccountImpersonationURL = fmt.Sprintf(
"https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/%s:generateAccessToken",
email)
} else { // direct access
conf.TokenInfoURL = "https://sts.googleapis.com/v1/introspect"
}
ctx = context.WithValue(ctx, oauth2.HTTPClient, o.GetHTTPClient())
src, err := p.impl().NewTokenSource(ctx, conf)
if err != nil {
return nil, err
}
token, err := src.Token()
if err != nil {
return nil, err
}
return &Token{*token}, nil
}
// GetAccessTokenOptionsForArtifactRepository implements auth.Provider.
func (Provider) GetAccessTokenOptionsForArtifactRepository(string) ([]auth.Option, error) {
// GCP does not require any special options to retrieve access tokens.
return nil, nil
}
const registryPattern = `^(((.+\.)?gcr\.io)|(.+-docker\.pkg\.dev))$`
var registryRegex = regexp.MustCompile(registryPattern)
// ParseArtifactRepository implements auth.Provider.
func (Provider) ParseArtifactRepository(artifactRepository string) (string, error) {
registry, err := auth.GetRegistryFromArtifactRepository(artifactRepository)
if err != nil {
return "", err
}
if !registryRegex.MatchString(registry) {
return "", fmt.Errorf("invalid GCP registry: '%s'. must match %s",
registry, registryPattern)
}
// The artifact repository is irrelevant for issuing GCP registry credentials,
// just return the provider name for inclusion in the cache key.
return ProviderName, nil
}
// NewArtifactRegistryCredentials implements auth.Provider.
func (Provider) NewArtifactRegistryCredentials(_ context.Context, _ string,
accessToken auth.Token, _ ...auth.Option) (*auth.ArtifactRegistryCredentials, error) {
t := accessToken.(*Token)
return &auth.ArtifactRegistryCredentials{
Authenticator: authn.FromConfig(authn.AuthConfig{
Username: "oauth2accesstoken",
Password: t.AccessToken,
}),
ExpiresAt: t.Expiry,
}, nil
}
// GetAccessTokenOptionsForCluster implements auth.Provider.
func (Provider) GetAccessTokenOptionsForCluster(opts ...auth.Option) ([][]auth.Option, error) {
// A single token is needed. No options.
return [][]auth.Option{{}}, nil
}
// NewRESTConfig implements auth.Provider.
func (p Provider) NewRESTConfig(ctx context.Context, accessTokens []auth.Token,
opts ...auth.Option) (*auth.RESTConfig, error) {
token := accessTokens[0].(*Token)
var o auth.Options
o.Apply(opts...)
// Describe the cluster resource to get missing CA or endpoint.
host := o.ClusterAddress
caData := []byte(o.CAData)
if host == "" || len(caData) == 0 {
cluster := o.ClusterResource
if err := parseCluster(cluster); err != nil {
return nil, err
}
// Create client for describing the cluster resource.
baseTransport := http.DefaultTransport.(*http.Transport).Clone()
if p := o.ProxyURL; p != nil {
baseTransport.Proxy = http.ProxyURL(p)
}
transport, err := htransport.NewTransport(ctx, baseTransport, option.WithTokenSource(token.source()))
if err != nil {
return nil, fmt.Errorf("failed to create google http transport for describing GKE cluster: %w", err)
}
client, err := container.NewService(ctx, option.WithHTTPClient(&http.Client{Transport: transport}))
if err != nil {
return nil, fmt.Errorf("failed to create client for describing GKE cluster: %w", err)
}
// Describe the cluster resource.
clusterResource, err := p.impl().GetCluster(ctx, cluster, client)
if err != nil {
return nil, fmt.Errorf("failed to describe GKE cluster '%s': %w", cluster, err)
}
// Compare specified address and address from the cluster resource.
endpoint := clusterResource.Endpoint
if host != "" {
canonicalAddress, err := auth.ParseClusterAddress(host)
if err != nil {
return nil, fmt.Errorf("failed to parse specified cluster address '%s': %w", host, err)
}
canonicalEndpoint, err := auth.ParseClusterAddress(endpoint)
if err != nil {
return nil, fmt.Errorf("failed to parse GKE endpoint '%s': %w", endpoint, err)
}
if canonicalAddress != canonicalEndpoint {
return nil, fmt.Errorf("GKE endpoint '%s' does not match specified address: '%s'", endpoint, host)
}
}
// Update host and CA with cluster details.
host = endpoint
if len(caData) == 0 {
caData, err = base64.StdEncoding.DecodeString(clusterResource.MasterAuth.ClusterCaCertificate)
if err != nil {
return nil, fmt.Errorf("failed to decode GKE CA certificate: %w", err)
}
}
}
// Build and return the REST config.
return &auth.RESTConfig{
Host: host,
BearerToken: token.AccessToken,
CAData: caData,
ExpiresAt: token.Expiry,
}, nil
}
func (p Provider) impl() Implementation {
if p.Implementation == nil {
return implementation{}
}
return p.Implementation
}

460
auth/gcp/provider_test.go Normal file
View File

@ -0,0 +1,460 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package gcp_test
import (
"context"
"net/url"
"testing"
"time"
"github.com/google/go-containerregistry/pkg/authn"
. "github.com/onsi/gomega"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google/externalaccount"
"google.golang.org/api/container/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/fluxcd/pkg/auth"
"github.com/fluxcd/pkg/auth/gcp"
)
func TestProvider_NewControllerToken(t *testing.T) {
g := NewWithT(t)
impl := &mockImplementation{
t: t,
argProxyURL: &url.URL{Scheme: "http", Host: "proxy.example.com"},
returnToken: &oauth2.Token{AccessToken: "access-token"},
}
opts := []auth.Option{
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.example.com"}),
}
provider := gcp.Provider{Implementation: impl}
token, err := provider.NewControllerToken(context.Background(), opts...)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(token).To(Equal(&gcp.Token{oauth2.Token{AccessToken: "access-token"}}))
}
func TestProvider_NewTokenForServiceAccount(t *testing.T) {
startGKEMetadataServer(t)
for _, tt := range []struct {
name string
conf externalaccount.Config
annotations map[string]string
err string
}{
{
name: "direct access",
conf: externalaccount.Config{
Audience: "identitynamespace:project-id.svc.id.goog:https://container.googleapis.com/v1/projects/project-id/locations/cluster-location/clusters/cluster-name",
SubjectTokenType: "urn:ietf:params:oauth:token-type:jwt",
TokenURL: "https://sts.googleapis.com/v1/token",
TokenInfoURL: "https://sts.googleapis.com/v1/introspect",
Scopes: []string{
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/userinfo.email",
},
SubjectTokenSupplier: gcp.StaticTokenSupplier("oidc-token"),
UniverseDomain: "googleapis.com",
},
},
{
name: "impersonation",
conf: externalaccount.Config{
Audience: "identitynamespace:project-id.svc.id.goog:https://container.googleapis.com/v1/projects/project-id/locations/cluster-location/clusters/cluster-name",
SubjectTokenType: "urn:ietf:params:oauth:token-type:jwt",
TokenURL: "https://sts.googleapis.com/v1/token",
ServiceAccountImpersonationURL: "https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/test-sa@project-id.iam.gserviceaccount.com:generateAccessToken",
Scopes: []string{
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/userinfo.email",
},
SubjectTokenSupplier: gcp.StaticTokenSupplier("oidc-token"),
UniverseDomain: "googleapis.com",
},
annotations: map[string]string{
"iam.gke.io/gcp-service-account": "test-sa@project-id.iam.gserviceaccount.com",
},
},
{
name: "direct access - federation",
conf: externalaccount.Config{
Audience: "//iam.googleapis.com/projects/1234567890/locations/global/workloadIdentityPools/test-pool/providers/test-provider",
SubjectTokenType: "urn:ietf:params:oauth:token-type:jwt",
TokenURL: "https://sts.googleapis.com/v1/token",
TokenInfoURL: "https://sts.googleapis.com/v1/introspect",
Scopes: []string{
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/userinfo.email",
},
SubjectTokenSupplier: gcp.StaticTokenSupplier("oidc-token"),
UniverseDomain: "googleapis.com",
},
annotations: map[string]string{
"gcp.auth.fluxcd.io/workload-identity-provider": "projects/1234567890/locations/global/workloadIdentityPools/test-pool/providers/test-provider",
},
},
{
name: "impersonation - federation",
conf: externalaccount.Config{
Audience: "//iam.googleapis.com/projects/1234567890/locations/global/workloadIdentityPools/test-pool/providers/test-provider",
SubjectTokenType: "urn:ietf:params:oauth:token-type:jwt",
TokenURL: "https://sts.googleapis.com/v1/token",
ServiceAccountImpersonationURL: "https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/test-sa@project-id.iam.gserviceaccount.com:generateAccessToken",
Scopes: []string{
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/userinfo.email",
},
SubjectTokenSupplier: gcp.StaticTokenSupplier("oidc-token"),
UniverseDomain: "googleapis.com",
},
annotations: map[string]string{
"iam.gke.io/gcp-service-account": "test-sa@project-id.iam.gserviceaccount.com",
"gcp.auth.fluxcd.io/workload-identity-provider": "projects/1234567890/locations/global/workloadIdentityPools/test-pool/providers/test-provider",
},
},
{
name: "invalid sa email",
annotations: map[string]string{
"iam.gke.io/gcp-service-account": "foobar",
},
err: `invalid iam.gke.io/gcp-service-account annotation: 'foobar'. must match ^[a-zA-Z0-9-]{1,100}@[a-zA-Z0-9-]{1,100}\.iam\.gserviceaccount\.com$`,
},
{
name: "invalid workload identity provider",
annotations: map[string]string{
"gcp.auth.fluxcd.io/workload-identity-provider": "foobar",
},
err: `invalid gcp.auth.fluxcd.io/workload-identity-provider annotation: 'foobar'. must match ^projects/\d{1,30}/locations/global/workloadIdentityPools/[^/]{1,100}/providers/[^/]{1,100}$`,
},
} {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
impl := &mockImplementation{
t: t,
argConfig: tt.conf,
argProxyURL: &url.URL{Scheme: "http", Host: "proxy.example.com"},
returnToken: &oauth2.Token{AccessToken: "access-token"},
}
oidcToken := "oidc-token"
serviceAccount := corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
Name: "test-sa",
Namespace: "test-ns",
Annotations: tt.annotations,
},
}
opts := []auth.Option{
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.example.com"}),
auth.WithSTSEndpoint("https://sts.example.com"),
}
provider := gcp.Provider{Implementation: impl}
token, err := provider.NewTokenForServiceAccount(context.Background(), oidcToken, serviceAccount, opts...)
if tt.err == "" {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(token).To(Equal(&gcp.Token{oauth2.Token{AccessToken: "access-token"}}))
} else {
g.Expect(err).To(HaveOccurred())
g.Expect(err.Error()).To(Equal(tt.err))
g.Expect(token).To(BeNil())
}
})
}
}
func TestProvider_GetAudience(t *testing.T) {
startGKEMetadataServer(t)
for _, tt := range []struct {
name string
annotations map[string]string
expected string
}{
{
name: "federation",
annotations: map[string]string{
"gcp.auth.fluxcd.io/workload-identity-provider": "projects/1234567890/locations/global/workloadIdentityPools/test-pool/providers/test-provider",
},
expected: "//iam.googleapis.com/projects/1234567890/locations/global/workloadIdentityPools/test-pool/providers/test-provider",
},
{
name: "gke",
expected: "project-id.svc.id.goog",
},
} {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
serviceAccount := corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
Annotations: tt.annotations,
},
}
aud, err := gcp.Provider{}.GetAudiences(context.Background(), serviceAccount)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(aud).To(Equal([]string{tt.expected}))
})
}
}
func TestProvider_GetIdentity(t *testing.T) {
for _, tt := range []struct {
name string
annotations map[string]string
expected string
}{
{
name: "impersonation",
annotations: map[string]string{
"iam.gke.io/gcp-service-account": "test-sa@project-id.iam.gserviceaccount.com",
},
expected: "test-sa@project-id.iam.gserviceaccount.com",
},
{
name: "direct access",
expected: "",
},
} {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
serviceAccount := corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
Annotations: tt.annotations,
},
}
identity, err := gcp.Provider{}.GetIdentity(serviceAccount)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(identity).To(Equal(tt.expected))
})
}
}
func TestProvider_NewArtifactRegistryCredentials(t *testing.T) {
g := NewWithT(t)
exp := time.Now()
provider := gcp.Provider{
Implementation: &mockImplementation{
t: t,
argProxyURL: &url.URL{Scheme: "http", Host: "proxy.example.com"},
returnToken: &oauth2.Token{
AccessToken: "access-token",
Expiry: exp,
},
},
}
creds, err := auth.GetArtifactRegistryCredentials(context.Background(), provider, "gcr.io",
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.example.com"}))
g.Expect(err).NotTo(HaveOccurred())
g.Expect(creds).NotTo(BeNil())
g.Expect(creds.ExpiresAt).To(Equal(exp))
g.Expect(creds.Authenticator).NotTo(BeNil())
authConf, err := creds.Authenticator.Authorization()
g.Expect(err).NotTo(HaveOccurred())
g.Expect(authConf).To(Equal(&authn.AuthConfig{
Username: "oauth2accesstoken",
Password: "access-token",
}))
}
func TestProvider_ParseArtifactRegistry(t *testing.T) {
for _, tt := range []struct {
artifactRepository string
expectValid bool
}{
{
artifactRepository: "gcr.io",
expectValid: true,
},
{
artifactRepository: ".gcr.io",
expectValid: false,
},
{
artifactRepository: "a.gcr.io",
expectValid: true,
},
{
artifactRepository: "-docker.pkg.dev",
expectValid: false,
},
{
artifactRepository: "a-docker.pkg.dev",
expectValid: true,
},
{
artifactRepository: "012345678901.dkr.ecr.us-east-1.amazonaws.com",
expectValid: false,
},
} {
t.Run(tt.artifactRepository, func(t *testing.T) {
g := NewWithT(t)
cacheKey, err := gcp.Provider{}.ParseArtifactRepository(tt.artifactRepository)
if tt.expectValid {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(cacheKey).To(Equal("gcp"))
} else {
g.Expect(err).To(HaveOccurred())
g.Expect(cacheKey).To(BeEmpty())
}
})
}
}
func TestProvider_NewRESTConfig(t *testing.T) {
for _, tt := range []struct {
name string
cluster string
clusterAddress string
caData string
masterAuth *container.MasterAuth
endpoint string
err string
}{
{
name: "valid GKE cluster",
cluster: "projects/test-project/locations/us-central1/clusters/test-cluster",
masterAuth: &container.MasterAuth{
ClusterCaCertificate: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0t", // base64 encoded "-----BEGIN CERTIFICATE-----"
},
endpoint: "https://203.0.113.10",
},
{
name: "valid GKE cluster with address match",
cluster: "projects/test-project/locations/us-central1/clusters/test-cluster",
clusterAddress: "https://203.0.113.10:443",
masterAuth: &container.MasterAuth{
ClusterCaCertificate: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0t",
},
endpoint: "https://203.0.113.10",
},
{
name: "valid GKE cluster with CA",
cluster: "projects/test-project/locations/us-central1/clusters/test-cluster",
caData: "-----BEGIN CERTIFICATE-----",
endpoint: "https://203.0.113.10",
},
{
name: "CA and address only",
clusterAddress: "https://203.0.113.10",
caData: "-----BEGIN CERTIFICATE-----",
endpoint: "https://203.0.113.10",
},
{
name: "cluster address mismatch",
cluster: "projects/test-project/locations/us-central1/clusters/test-cluster",
clusterAddress: "https://198.51.100.10:443",
masterAuth: &container.MasterAuth{
ClusterCaCertificate: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0t",
},
endpoint: "https://203.0.113.10",
err: "GKE endpoint 'https://203.0.113.10' does not match specified address: 'https://198.51.100.10:443'",
},
{
name: "invalid cluster ID",
cluster: "invalid-cluster-id",
err: "invalid GKE cluster ID: 'invalid-cluster-id'. must match ^projects/[^/]{1,200}/locations/[^/]{1,200}/clusters/[^/]{1,200}$",
},
} {
t.Run(tt.name, func(t *testing.T) {
g := NewWithT(t)
tokenExpiry := time.Now().Add(1 * time.Hour)
impl := &mockImplementation{
t: t,
expectGKEAPICall: tt.clusterAddress == "" || tt.caData == "",
argCluster: tt.cluster,
argProxyURL: &url.URL{Scheme: "http", Host: "proxy.example.com"},
returnToken: &oauth2.Token{
AccessToken: "access-token",
Expiry: tokenExpiry,
},
returnCluster: &container.Cluster{
Endpoint: tt.endpoint,
MasterAuth: tt.masterAuth,
},
}
opts := []auth.Option{
auth.WithProxyURL(url.URL{Scheme: "http", Host: "proxy.example.com"}),
}
if tt.cluster != "" {
opts = append(opts, auth.WithClusterResource(tt.cluster))
}
if tt.clusterAddress != "" {
opts = append(opts, auth.WithClusterAddress(tt.clusterAddress))
}
if tt.caData != "" {
opts = append(opts, auth.WithCAData(tt.caData))
}
provider := gcp.Provider{Implementation: impl}
restConfig, err := auth.GetRESTConfig(context.Background(), provider, opts...)
if tt.err == "" {
g.Expect(err).NotTo(HaveOccurred())
g.Expect(restConfig).NotTo(BeNil())
g.Expect(restConfig.Host).To(Equal(tt.endpoint))
g.Expect(restConfig.BearerToken).To(Equal("access-token"))
g.Expect(restConfig.CAData).To(Equal([]byte("-----BEGIN CERTIFICATE-----")))
g.Expect(restConfig.ExpiresAt).To(Equal(tokenExpiry))
} else {
g.Expect(err).To(HaveOccurred())
g.Expect(err.Error()).To(ContainSubstring(tt.err))
g.Expect(restConfig).To(BeNil())
}
})
}
}
func TestProvider_GetAccessTokenOptionsForCluster(t *testing.T) {
g := NewWithT(t)
t.Run("with cluster resource", func(t *testing.T) {
opts, err := gcp.Provider{}.GetAccessTokenOptionsForCluster(
auth.WithClusterResource("projects/test-project/locations/us-central1/clusters/test-cluster"))
g.Expect(err).NotTo(HaveOccurred())
g.Expect(opts).To(HaveLen(1))
g.Expect(opts[0]).To(HaveLen(0)) // Empty slice - no options needed for GCP
})
t.Run("without cluster resource", func(t *testing.T) {
opts, err := gcp.Provider{}.GetAccessTokenOptionsForCluster()
g.Expect(err).NotTo(HaveOccurred())
g.Expect(opts).To(HaveLen(1))
g.Expect(opts[0]).To(HaveLen(0)) // Empty slice - no options needed for GCP
})
}

35
auth/gcp/token.go Normal file
View File

@ -0,0 +1,35 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package gcp
import (
"time"
"golang.org/x/oauth2"
)
// Token is the GCP token.
type Token struct{ oauth2.Token }
// GetDuration implements auth.Token.
func (t *Token) GetDuration() time.Duration {
return time.Until(t.Expiry)
}
func (t *Token) source() oauth2.TokenSource {
return oauth2.StaticTokenSource(&t.Token)
}

49
auth/gcp/token_source.go Normal file
View File

@ -0,0 +1,49 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package gcp
import (
"context"
"fmt"
"golang.org/x/oauth2"
auth "github.com/fluxcd/pkg/auth"
)
type tokenSource struct {
ctx context.Context
opts []auth.Option
}
// NewTokenSource creates a new token source for the given context and options.
func NewTokenSource(ctx context.Context, opts ...auth.Option) oauth2.TokenSource {
return &tokenSource{ctx, opts}
}
// Token implements oauth2.TokenSource.
func (t *tokenSource) Token() (*oauth2.Token, error) {
token, err := auth.GetAccessToken(t.ctx, Provider{}, t.opts...)
if err != nil {
return nil, err
}
gcpToken, ok := token.(*Token)
if !ok {
return nil, fmt.Errorf("failed to cast token to GCP token: %T", token)
}
return &gcpToken.Token, nil
}

View File

@ -0,0 +1,31 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package gcp
import (
"context"
"golang.org/x/oauth2/google/externalaccount"
)
// StaticTokenSupplier provides a static OIDC token.
type StaticTokenSupplier string
// SubjectToken implements externalaccount.SubjectTokenSupplier.
func (s StaticTokenSupplier) SubjectToken(context.Context, externalaccount.SupplierOptions) (string, error) {
return string(s), nil
}

View File

@ -0,0 +1,30 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package generic
import "os"
// Implementation provides the required methods of the generic libraries.
type Implementation interface {
ReadFile(name string) ([]byte, error)
}
type implementation struct{}
func (implementation) ReadFile(name string) ([]byte, error) {
return os.ReadFile(name)
}

View File

@ -0,0 +1,36 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package generic_test
import (
"testing"
. "github.com/onsi/gomega"
)
type mockImplementation struct {
t *testing.T
b []byte
}
func (m *mockImplementation) ReadFile(name string) ([]byte, error) {
m.t.Helper()
g := NewWithT(m.t)
g.Expect(name).To(Equal("/var/run/secrets/kubernetes.io/serviceaccount/token"))
return m.b, nil
}

201
auth/generic/provider.go Normal file
View File

@ -0,0 +1,201 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package generic
import (
"context"
"errors"
"fmt"
"strings"
"time"
"github.com/golang-jwt/jwt/v5"
authnv1 "k8s.io/api/authentication/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/fluxcd/pkg/auth"
)
// ProviderName is the name of the generic authentication provider.
const ProviderName = "generic"
// Provider implements the auth.Provider interface for generic authentication.
type Provider struct{ Implementation }
// GetName implements auth.RESTConfigProvider.
func (p Provider) GetName() string {
return ProviderName
}
// NewControllerToken implements auth.RESTConfigProvider.
func (p Provider) NewControllerToken(ctx context.Context, opts ...auth.Option) (auth.Token, error) {
var o auth.Options
o.Apply(opts...)
if o.Client == nil {
return nil, errors.New("client is required to create a controller token")
}
// Like all providers, this one should fetch controller-level credentials
// from the environment. In this case, this means opening the well-known
// Kubernetes service account token file and parsing it to figure out
// the controller's identity.
const tokenFile = "/var/run/secrets/kubernetes.io/serviceaccount/token"
b, err := p.impl().ReadFile(tokenFile)
if err != nil {
return nil, fmt.Errorf("failed to read service account token file %s: %w", tokenFile, err)
}
// Get controller service account from token subject.
tok, _, err := jwt.NewParser().ParseUnverified(string(b), jwt.MapClaims{})
if err != nil {
return nil, fmt.Errorf("failed to parse service account token: %w", err)
}
sub, err := tok.Claims.GetSubject()
if err != nil {
return nil, fmt.Errorf("failed to get subject from service account token: %w", err)
}
parts := strings.Split(sub, ":")
if len(parts) != 4 {
return nil, fmt.Errorf("invalid subject format in service account token: %s", sub)
}
serviceAccount := corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
Name: parts[3],
Namespace: parts[2],
},
}
// Create token.
tokenReq := &authnv1.TokenRequest{
Spec: authnv1.TokenRequestSpec{
Audiences: o.Audiences,
},
}
if err := o.Client.SubResource("token").Create(ctx, &serviceAccount, tokenReq); err != nil {
return nil, fmt.Errorf("failed to create kubernetes token for controller service account '%s': %w",
client.ObjectKeyFromObject(&serviceAccount), err)
}
token := tokenReq.Status.Token
exp, err := getExpirationFromToken(token)
if err != nil {
return nil, err
}
return &Token{
Token: token,
ExpiresAt: *exp,
}, nil
}
// GetAudiences implements auth.RESTConfigProvider.
func (Provider) GetAudiences(context.Context, corev1.ServiceAccount) ([]string, error) {
// Use TokenRequest default audiences.
return nil, nil
}
// GetIdentity implements auth.RESTConfigProvider.
func (Provider) GetIdentity(serviceAccount corev1.ServiceAccount) (string, error) {
return fmt.Sprintf("system:serviceaccount:%s:%s", serviceAccount.Namespace, serviceAccount.Name), nil
}
// NewTokenForServiceAccount implements auth.RESTConfigProvider.
func (Provider) NewTokenForServiceAccount(ctx context.Context, oidcToken string,
serviceAccount corev1.ServiceAccount, opts ...auth.Option) (auth.Token, error) {
exp, err := getExpirationFromToken(oidcToken)
if err != nil {
return nil, err
}
return &Token{
Token: oidcToken,
ExpiresAt: *exp,
}, nil
}
// GetAccessTokenOptionsForCluster implements auth.RESTConfigProvider.
func (Provider) GetAccessTokenOptionsForCluster(opts ...auth.Option) ([][]auth.Option, error) {
var o auth.Options
o.Apply(opts...)
audiences := o.Audiences
if len(audiences) == 0 {
// Use cluster address as the default audience.
audiences = []string{o.ClusterAddress}
}
return [][]auth.Option{{auth.WithAudiences(audiences...)}}, nil
}
// NewRESTConfig implements auth.RESTConfigProvider.
func (Provider) NewRESTConfig(ctx context.Context, accessTokens []auth.Token,
opts ...auth.Option) (*auth.RESTConfig, error) {
token := accessTokens[0].(*Token)
var o auth.Options
o.Apply(opts...)
// Parse the cluster address.
host := o.ClusterAddress
if host == "" {
return nil, errors.New("cluster address is required to create a REST config")
}
var err error
host, err = auth.ParseClusterAddress(host)
if err != nil {
return nil, fmt.Errorf("failed to parse cluster address %s: %w", o.ClusterAddress, err)
}
// Get CA if provided.
var caData []byte
if o.CAData != "" {
caData = []byte(o.CAData)
}
return &auth.RESTConfig{
Host: host,
CAData: caData,
BearerToken: token.Token,
ExpiresAt: token.ExpiresAt,
}, nil
}
func (p Provider) impl() Implementation {
if p.Implementation == nil {
return implementation{}
}
return p.Implementation
}
func getExpirationFromToken(token string) (*time.Time, error) {
tok, _, err := jwt.NewParser().ParseUnverified(token, jwt.MapClaims{})
if err != nil {
return nil, fmt.Errorf("failed to parse service account token: %w", err)
}
exp, err := tok.Claims.GetExpirationTime()
if err != nil {
return nil, fmt.Errorf("failed to get expiration time from service account token: %w", err)
}
return &exp.Time, nil
}

Some files were not shown because too many files have changed in this diff Show More