-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1007 from jkataja/feature/fluxcd-bucket-source
Add FluxCD support for S3 Bucket sources
- Loading branch information
Showing
4 changed files
with
301 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { setPath } from "../../utils"; | ||
|
||
/** | ||
* Flux Bucket API defines a Source to produce an Artifact for objects from storage solutions like Amazon S3. | ||
* @see https://fluxcd.io/flux/components/source/buckets/ | ||
*/ | ||
export class FluxBucket { | ||
|
||
constructor(private readonly bucketName: string, private readonly region: string, private readonly prefixPath?: string) {} | ||
|
||
public generate(name: string, namespace: string, fluxSyncInterval: string, provider: string, endpoint: string, fluxSecretRefName?: string) { | ||
|
||
const bucketManifest = { | ||
apiVersion: "source.toolkit.fluxcd.io/v1beta2", | ||
kind: "Bucket", | ||
metadata: { | ||
name: name, | ||
namespace: namespace | ||
}, | ||
spec: { | ||
interval: fluxSyncInterval, | ||
bucketName: this.bucketName, | ||
provider: provider, | ||
endpoint: endpoint, | ||
region: this.region, | ||
} | ||
}; | ||
|
||
if (fluxSecretRefName) { | ||
setPath(bucketManifest, "spec.secretRef.name", fluxSecretRefName); | ||
} | ||
|
||
if (this.prefixPath) { | ||
setPath(bucketManifest, "spec.prefix", this.prefixPath); | ||
} | ||
|
||
return bucketManifest; | ||
} | ||
} |
Oops, something went wrong.