-
Notifications
You must be signed in to change notification settings - Fork 89
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
[FluxCD Integration] Update the gitops.kubesphere.io/v1alpha1 CRD to Support FluxCD Application #717
Comments
General DesignFile Change
pkg/api/gitops/v1alpha1
├── application.go (UPDATE)
├── helmtemplate.go (ADD)
├── constants.go
├── groupversion_info.go
├── groupversion_info_test.go
├── image-updater.go
├── image-updater_test.go
└── zz_generated.deepcopy.go
controllers/fluxcd
├── git-repository-controller.go
├── application-controller.go (ADD)
├── helmtemplate-controller.go (ADD) application.goupdate ApplicationSpec field like below: // ApplicationSpec is the specification of the Application
type ApplicationSpec struct {
Kind Engine `json:"kind"`
ArgoApp *ArgoApplication `json:"argoApp,omitempty"`
FluxApp *FluxApplication `json:"fluxApp,omitempty"`
}
// constants.go
type Engine string
const (
ArgoCD Engine = "argocd"
FluxCD Engine = "fluxcd"
) and FluxApplication is like below: type FluxApplication struct {
Spec FluxApplicationSpec `json:"spec,omitempty"`
}
type FluxApplicationSpec struct {
Interval metav1.Duration `json:"interval"`
Source FluxApplicationSource `json:"source"`
Destination FluxApplicationDestination `json:"destination"`
Config FluxApplicationConfig `json:"config"`
} I think a GitOps Application should be better to abstract into three parts [Source, Destination and Config] . the Source part is a SourceRef link to the FluxGitRepo or FluxHelmRepo we created type FluxApplicationSource struct {
SourceRef CrossNamespaceObjectReference `json:"sourceRef"`
}
// use case
// sourceRef:
// kind: HelmRepository
// name: podinfo
// namespace: default the Destination part: type FluxApplicationDestination struct {
KubeConfig *KubeConfig `json:"kubeConfig,omitempty"`
TargetNamespace string `json:"targetNamespace,omitempty"`
} and the Config part: type FluxApplicationConfig struct {
// the following four fields are the same in both flux Kustomization and flux HelmRelease CRD
Suspend bool `json:"suspend,omitempty"`
Timeout *metav1.Duration `json:"timeout,omitempty"`
DependsOn []meta.NamespacedObjectReference `json:"dependsOn,omitempty"`
ServiceAccountName string `json:"serviceAccountName,omitempty"`
// Two Application Type
// same as fluxcd spec exclude the above four fields.
HelmRelease HelmReleaseSpec `json:"helmRelease,omitempty"`
// same as fluxcd spec exclude the above four fields.
Kustomization KustomizationSpec `json:"kustomization,omitempty"`
} helmtemplate.gohelmtemplate thing is already exist in helmcharts.source.toolkit.fluxcd.io . we can use the same design like this. example: ---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmChart
metadata:
name: podinfo
namespace: default
spec:
interval: 5m0s
chart: podinfo
reconcileStrategy: ChartVersion
sourceRef:
kind: HelmRepository
name: podinfo
version: '5.*' this helmchart named podinfo is persisted. Because we directly told flux source-controller to create and maintain this thing. But another way to create a helmchart thing is indirectly by creating helmrelease. the flux helm-controller will detect the charts field in the yaml file to create a ephemeral helmchart. the ephemeral helmchart will be deleted when the corresponding helmrelease is deleted. helmtemplate-controller.goIf we want to reuse the helm chart. We should create a controller to make the information of a helm chart persisted and may create some CRUD operations on it. And argocd application controller also can use the information of the helmtemplate. application-controller.gothe main job of application-controller is to Reconcile Flux Kustomization and Flux HelmRelease resource. use case: the UI will provide Three GitOps Application Type [ Helm | Kustomization | Template ] the application-controller will first check the kind of engine whether is "fluxcd".
|
Is that possible to keep using the same version |
Sure. |
We also need to establish a releation between helmrelease and helmchart using
there's a option that whether user want to save the chartinfo as a template, we need to check this. |
In addition, is it possible for us to make such a template mechanism for kustomizate |
Yes. I agree. |
Four use-cases1. User just wants to create a HelmRelease without saving the information (
|
/kind feature
The text was updated successfully, but these errors were encountered: