Skip to content

feat(stackable-operator): Add git-sync support #1024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
68677a5
Add git-sync support
siegfriedweber Apr 11, 2025
1ad347d
Merge branch 'main' into feat/git-sync
siegfriedweber May 8, 2025
5d7a007
Version the git_sync structure as v1alpha1
siegfriedweber May 8, 2025
613e58d
Rephrase the comment for GitSync::git_folder
siegfriedweber May 9, 2025
6619fe4
Add logging support to git-sync containers
siegfriedweber May 12, 2025
5bba49d
Use the type Url for the git-sync repository URL
siegfriedweber May 14, 2025
e8ad04b
Extend the comment of the GitSync structure
siegfriedweber May 16, 2025
2cf42ff
Improve a comment in the GitSync structure
siegfriedweber May 16, 2025
80c75f6
Extend the comment of the GitSync structure
siegfriedweber May 16, 2025
d04e4e9
Merge branch 'feat/git-sync' of github.com:stackabletech/operator-rs …
siegfriedweber May 16, 2025
7dc7926
Reformat the code
siegfriedweber May 16, 2025
84aa733
Improve the code style
siegfriedweber May 16, 2025
d8a8b45
Improve the code style
siegfriedweber May 16, 2025
8a13bba
Improve the code style
siegfriedweber May 16, 2025
ea4e63f
Improve the code style
siegfriedweber May 16, 2025
dccf07d
Add always the git-sync parameter one-time
siegfriedweber May 16, 2025
b3e460e
Merge branch 'feat/git-sync' of github.com:stackabletech/operator-rs …
siegfriedweber May 16, 2025
c69b2d2
Improve the code style
siegfriedweber May 16, 2025
a2baa65
Improve the code style
siegfriedweber May 16, 2025
b41837a
Merge branch 'main' into feat/git-sync
siegfriedweber May 16, 2025
80d7b3e
Disallow variants of the option `--git-config`
siegfriedweber May 20, 2025
519c65d
Merge branch 'main' into feat/git-sync
siegfriedweber May 20, 2025
cb28be3
Merge branch 'main' into feat/git-sync
siegfriedweber May 20, 2025
19a0ac9
Extend a comment in the GitSync structure
siegfriedweber May 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions crates/stackable-operator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Added

- Add git-sync support ([#1024]).

### Changed

- BREAKING: Version common CRD structs and enums ([#968]).
Expand All @@ -17,6 +21,7 @@ All notable changes to this project will be documented in this file.
- Re-export versioned CRD-specific error types ([#1025]).

[#968]: https://github.com/stackabletech/operator-rs/pull/968
[#1024]: https://github.com/stackabletech/operator-rs/pull/1024
[#1025]: https://github.com/stackabletech/operator-rs/pull/1025

## [0.92.0] - 2025-04-14
Expand Down
58 changes: 58 additions & 0 deletions crates/stackable-operator/src/crd/git_sync/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//! GitSync structure for CRDs

use std::{collections::BTreeMap, path::PathBuf};

use schemars::{self, JsonSchema};
use serde::{Deserialize, Serialize};

use crate::{time::Duration, versioned::versioned};

mod v1alpha1_impl;

#[versioned(version(name = "v1alpha1"))]
pub mod versioned {
pub mod v1alpha1 {
pub use v1alpha1_impl::{Error, GitSyncResources};
}

#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Eq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct GitSync {
/// The git repository URL that will be cloned, for example: `https://github.com/stackabletech/airflow-operator`.
pub repo: String,

/// The branch to clone; defaults to `main`.
///
/// Since git-sync v4.x.x this field is mapped to the flag `--ref`.
#[serde(default = "GitSync::default_branch")]
pub branch: String,

/// Location in the Git repository containing the resource.
///
/// It can optionally start with `/`, however, no trailing slash is recommended.
/// An empty string (``) or slash (`/`) corresponds to the root folder in Git.
#[serde(default = "GitSync::default_git_folder")]
pub git_folder: PathBuf,

/// The depth of syncing, i.e. the number of commits to clone; defaults to 1.
#[serde(default = "GitSync::default_depth")]
pub depth: u32,

/// The synchronization interval, e.g. `20s` or `5m`; defaults to `20s`.
///
/// Since git-sync v4.x.x this field is mapped to the flag `--period`.
#[serde(default = "GitSync::default_wait")]
pub wait: Duration,

/// The name of the Secret used to access the repository if it is not public.
/// This should include two fields: `user` and `password`.
/// The `password` field can either be an actual password (not recommended) or a GitHub token,
/// as described [here](https://github.com/kubernetes/git-sync/tree/v4.2.4?tab=readme-ov-file#manual).
pub credentials_secret: Option<String>,

/// A map of optional configuration settings that are listed in the [git-sync documentation](https://github.com/kubernetes/git-sync/tree/v4.2.4?tab=readme-ov-file#manual).
/// Read the [git sync example](DOCS_BASE_URL_PLACEHOLDER/airflow/usage-guide/mounting-dags#_example).
#[serde(default)]
pub git_sync_conf: BTreeMap<String, String>,
}
}
Loading