flux-libs

module
v0.0.0-...-9ca8186 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2022 License: MIT

README

Flux CRD libraries

This repository has libraries to interact with Flux related CRDs like HelmRelease, GitRepository and HelmRepository.

Example usage

import (
	"fmt"

	helmrelease "github.com/kinvolk/flux-libs/lib/helm-release"
	gitrepocontroller "github.com/kinvolk/flux-libs/lib/source-controller/git-repo-controller"
	helmrepocontroller "github.com/kinvolk/flux-libs/lib/source-controller/helm-repo-controller"

	sourceapi "github.com/fluxcd/source-controller/api/v1beta1"
	helmreleaseapi "github.com/fluxcd/helm-controller/api/v2beta1"
)

func getHelmRelease() *helmreleaseapi.HelmRelease {}
func getGitRepository() *sourceapi.GitRepository {}
func getHelmRepository() *sourceapi.HelmRepository {}

// Note: The error handling is neglected to keep the code crisp.
func InstallComponent(kubeconfig []byte) error {
	gitRepoCfg, err = gitrepocontroller.NewGitRepoConfig(
		gitrepocontroller.WithKubeconfig(kubeconfig),
	)
	gitRepo := getGitRepository()
	err := gitRepoCfg.CreateOrUpdate(gitRepo)

	helmReleaseCfg, err = helmrelease.NewHelmReleaseConfig(
		helmrelease.WithKubeconfig(kubeconfig),
	)
	helmRelease := getHelmRelease()
	err := helmReleaseCfg.CreateOrUpdate(helmRelease)

	helmRepoCfg, err = helmrepocontroller.NewHelmRepoConfig(
		helmrepocontroller.WithKubeconfig(kubeconfig),
	)
	helmRepo := getHelmRepository()
	err := helmRepoCfg.CreateOrUpdate(helmRepo)

	return nil
}

Contributing

Please check out the contributing guide, and observe our Code of Conduct when participating in this project.

License

This project is released under the MIT license.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL