Documentation ¶
Index ¶
- func CompareUnOrdered(a, b []int) bool
- func CreateEcrRepo(repoName string, RegistryURL string, reg string, accessKey string, ...) error
- func GetLogger() *zap.SugaredLoggerdeprecated
- func IntValidator() (*validator.Validate, error)
- func IsErrNoRows(err error) bool
- func NewHttpClient() *http.Client
- func NewSugardLogger() *zap.SugaredLogger
- func TopoSort(graph map[int][]int) []int
- func Tprintf(tmpl string, data interface{}) (string, error)
- func ValidateCheckoutPath(fl validator.FieldLevel) bool
- func ValidateName(fl validator.FieldLevel) bool
- type ApiError
- type ChartConfig
- type ChartGitAttribute
- type ChartTemplateService
- type ChartTemplateServiceImpl
- func (impl ChartTemplateServiceImpl) CleanDir(dir string)
- func (impl ChartTemplateServiceImpl) CreateChart(chartMetaData *chart.Metadata, refChartLocation string, templateName string) (*ChartValues, *ChartGitAttribute, error)
- func (impl ChartTemplateServiceImpl) CreateChartProxy(chartMetaData *chart.Metadata, refChartLocation string, templateName string, ...) (string, *ChartGitAttribute, error)
- func (ChartTemplateServiceImpl) GetChartVersion(location string) (string, error)
- func (impl ChartTemplateServiceImpl) GitPull(clonedDir string, repoUrl string, appStoreName string) error
- type ChartValues
- type ChartWorkingDir
- type ClusterConfig
- type GitClient
- type GitConfig
- type GitFactory
- type GitHubClient
- type GitLabClient
- func (impl GitLabClient) CommitValues(config *ChartConfig) (commitHash string, err error)
- func (impl GitLabClient) CreateRepository(name, description string) (url string, isNew bool, err error)
- func (impl GitLabClient) DeleteProject(projectName string) (err error)
- func (impl GitLabClient) GetRepoUrl(projectName string) (repoUrl string, err error)
- type GitService
- type GitServiceImpl
- func (impl GitServiceImpl) Clone(url, targetDir string) (clonedDir string, err error)
- func (impl GitServiceImpl) CommitAndPushAllChanges(repoRoot, commitMsg string) (commitHash string, err error)
- func (impl GitServiceImpl) CommitValues(config *ChartConfig) (commitHash string, err error)
- func (impl GitServiceImpl) ForceResetHead(repoRoot string) (err error)
- func (impl GitServiceImpl) GetCloneDirectory(targetDir string) (clonedDir string)
- func (impl GitServiceImpl) Pull(repoRoot string) (err error)
- type JsonPatchType
- type K8sUtil
- func (impl K8sUtil) CreateNsIfNotExists(namespace string, clusterConfig *ClusterConfig) (err error)
- func (impl K8sUtil) CreateSecretFast(namespace string, data map[string][]byte, secretName string, ...) (*v1.Secret, error)
- func (impl K8sUtil) GetClient(clusterConfig *ClusterConfig) (*v12.CoreV1Client, error)
- func (impl K8sUtil) GetConfigMap(namespace string, name string, clusterConfig *ClusterConfig) (*v1.ConfigMap, error)
- func (impl K8sUtil) GetConfigMapFast(namespace string, name string, client *v12.CoreV1Client) (*v1.ConfigMap, error)
- func (impl K8sUtil) GetSecretFast(namespace string, name string, client *v12.CoreV1Client) (*v1.Secret, error)
- func (impl K8sUtil) PatchConfigMap(namespace string, clusterConfig *ClusterConfig, name string, ...) (*v1.ConfigMap, error)
- func (impl K8sUtil) PatchConfigMapJsonType(namespace string, clusterConfig *ClusterConfig, name string, data interface{}, ...) (*v1.ConfigMap, error)
- func (impl K8sUtil) UpdateConfigMap(namespace string, cm *v1.ConfigMap, clusterConfig *ClusterConfig) (*v1.ConfigMap, error)
- func (impl K8sUtil) UpdateConfigMapFast(namespace string, cm *v1.ConfigMap, client *v12.CoreV1Client) (*v1.ConfigMap, error)
- func (impl K8sUtil) UpdateSecretFast(namespace string, secret *v1.Secret, client *v12.CoreV1Client) (*v1.Secret, error)
- type LogConfig
- type MergeUtil
- func (m MergeUtil) ConfigMapMerge(appLevelConfigMapJson string, envLevelConfigMapJson string) (data string, err error)
- func (m MergeUtil) ConfigSecretMerge(appLevelSecretJson string, envLevelSecretJson string, chartMajorVersion int, ...) (data string, err error)
- func (m MergeUtil) JsonPatch(target, patch []byte) (data []byte, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareUnOrdered ¶
func CreateEcrRepo ¶
func CreateEcrRepo(repoName string, RegistryURL string, reg string, accessKey string, secretKey string) error
FIXME: this code is temp
func GetLogger
deprecated
func GetLogger() *zap.SugaredLogger
Deprecated: instead calling this method inject logger from wire
func IntValidator ¶
func IntValidator() (*validator.Validate, error)
func IsErrNoRows ¶
func NewHttpClient ¶
func NewSugardLogger ¶
func NewSugardLogger() *zap.SugaredLogger
func Tprintf ¶
Tprintf passed template string is formatted usign its operands and returns the resulting string. Spaces are added between operands when neither is a string.
func ValidateCheckoutPath ¶
func ValidateCheckoutPath(fl validator.FieldLevel) bool
func ValidateName ¶
func ValidateName(fl validator.FieldLevel) bool
Types ¶
type ApiError ¶
type ApiError struct { HttpStatusCode int `json:"-"` Code string `json:"code,omitempty"` InternalMessage string `json:"internalMessage,omitempty"` UserMessage interface{} `json:"userMessage,omitempty"` UserDetailMessage string `json:"userDetailMessage,omitempty"` }
func (*ApiError) ErrorfInternal ¶
default internal will be set
func (ApiError) ErrorfUser ¶
default user message will be set
type ChartConfig ¶
type ChartGitAttribute ¶
type ChartGitAttribute struct {
RepoUrl, ChartLocation string
}
type ChartTemplateService ¶
type ChartTemplateService interface { CreateChart(chartMetaData *chart.Metadata, refChartLocation string, templateName string) (*ChartValues, *ChartGitAttribute, error) GetChartVersion(location string) (string, error) CreateChartProxy(chartMetaData *chart.Metadata, refChartLocation string, templateName string, version string, envName string, appName string) (string, *ChartGitAttribute, error) GitPull(clonedDir string, repoUrl string, appStoreName string) error }
type ChartTemplateServiceImpl ¶
type ChartTemplateServiceImpl struct {
// contains filtered or unexported fields
}
func NewChartTemplateServiceImpl ¶
func NewChartTemplateServiceImpl(logger *zap.SugaredLogger, chartWorkingDir ChartWorkingDir, client *http.Client, gitFactory *GitFactory) *ChartTemplateServiceImpl
func (ChartTemplateServiceImpl) CleanDir ¶
func (impl ChartTemplateServiceImpl) CleanDir(dir string)
func (ChartTemplateServiceImpl) CreateChart ¶
func (impl ChartTemplateServiceImpl) CreateChart(chartMetaData *chart.Metadata, refChartLocation string, templateName string) (*ChartValues, *ChartGitAttribute, error)
func (ChartTemplateServiceImpl) CreateChartProxy ¶
func (ChartTemplateServiceImpl) GetChartVersion ¶
func (ChartTemplateServiceImpl) GetChartVersion(location string) (string, error)
type ChartValues ¶
type ChartValues struct { Values string `json:"values"` //yaml AppOverrides string `json:"appOverrides"` //json EnvOverrides string `json:"envOverrides"` //json ReleaseOverrides string `json:"releaseOverrides"` //json PipelineOverrides string `json:"pipelineOverrides"` //json ImageDescriptorTemplate string `json:"-"` }
type ChartWorkingDir ¶
type ChartWorkingDir string
type ClusterConfig ¶
type GitClient ¶
type GitClient interface { CreateRepository(name, description string) (url string, isNew bool, err error) CommitValues(config *ChartConfig) (commitHash string, err error) GetRepoUrl(projectName string) (repoUrl string, err error) }
func NewGitLabClient ¶
func NewGitLabClient(config *GitConfig, logger *zap.SugaredLogger, gitService GitService) (GitClient, error)
type GitConfig ¶
type GitConfig struct { GitlabGroupId string //local GitlabGroupPath string //local GitToken string `env:"GIT_TOKEN" ` //not null // public GitUserName string `env:"GIT_USERNAME" ` //not null // public GitWorkingDir string `env:"GIT_WORKING_DIRECTORY" envDefault:"/tmp/gitops/"` //working directory for git. might use pvc GithubOrganization string GitProvider string `env:"GIT_PROVIDER" envDefault:"GITHUB"` // SUPPORTED VALUES GITHUB, GITLAB GitHost string `env:"GIT_HOST" envDefault:""` }
func GetGitConfig ¶
func GetGitConfig(gitOpsRepository repository.GitOpsConfigRepository) (*GitConfig, error)
type GitFactory ¶
type GitFactory struct { Client GitClient GitWorkingDir string // contains filtered or unexported fields }
func NewGitFactory ¶
func NewGitFactory(logger *zap.SugaredLogger, gitOpsRepository repository.GitOpsConfigRepository) (*GitFactory, error)
func (*GitFactory) Reload ¶
func (factory *GitFactory) Reload() error
type GitHubClient ¶
type GitHubClient struct {
// contains filtered or unexported fields
}
func NewGithubClient ¶
func NewGithubClient(token string, org string, logger *zap.SugaredLogger, gitService GitService) GitHubClient
func (GitHubClient) CommitValues ¶
func (impl GitHubClient) CommitValues(config *ChartConfig) (commitHash string, err error)
func (GitHubClient) CreateRepository ¶
func (impl GitHubClient) CreateRepository(name, description string) (url string, isNew bool, err error)
func (GitHubClient) GetRepoUrl ¶
func (impl GitHubClient) GetRepoUrl(projectName string) (repoUrl string, err error)
type GitLabClient ¶
type GitLabClient struct {
// contains filtered or unexported fields
}
func (GitLabClient) CommitValues ¶
func (impl GitLabClient) CommitValues(config *ChartConfig) (commitHash string, err error)
func (GitLabClient) CreateRepository ¶
func (impl GitLabClient) CreateRepository(name, description string) (url string, isNew bool, err error)
func (GitLabClient) DeleteProject ¶
func (impl GitLabClient) DeleteProject(projectName string) (err error)
func (GitLabClient) GetRepoUrl ¶
func (impl GitLabClient) GetRepoUrl(projectName string) (repoUrl string, err error)
type GitService ¶
type GitService interface { Clone(url, targetDir string) (clonedDir string, err error) CommitAndPushAllChanges(repoRoot, commitMsg string) (commitHash string, err error) ForceResetHead(repoRoot string) (err error) CommitValues(config *ChartConfig) (commitHash string, err error) GetCloneDirectory(targetDir string) (clonedDir string) Pull(repoRoot string) (err error) }
-------------------- go-git integration -------------------
type GitServiceImpl ¶
type GitServiceImpl struct { Auth transport.AuthMethod // contains filtered or unexported fields }
func NewGitServiceImpl ¶
func NewGitServiceImpl(config *GitConfig, logger *zap.SugaredLogger) *GitServiceImpl
func (GitServiceImpl) Clone ¶
func (impl GitServiceImpl) Clone(url, targetDir string) (clonedDir string, err error)
func (GitServiceImpl) CommitAndPushAllChanges ¶
func (impl GitServiceImpl) CommitAndPushAllChanges(repoRoot, commitMsg string) (commitHash string, err error)
func (GitServiceImpl) CommitValues ¶
func (impl GitServiceImpl) CommitValues(config *ChartConfig) (commitHash string, err error)
func (GitServiceImpl) ForceResetHead ¶
func (impl GitServiceImpl) ForceResetHead(repoRoot string) (err error)
func (GitServiceImpl) GetCloneDirectory ¶
func (impl GitServiceImpl) GetCloneDirectory(targetDir string) (clonedDir string)
func (GitServiceImpl) Pull ¶
func (impl GitServiceImpl) Pull(repoRoot string) (err error)
type JsonPatchType ¶
type K8sUtil ¶
type K8sUtil struct {
// contains filtered or unexported fields
}
func NewK8sUtil ¶
func NewK8sUtil(logger *zap.SugaredLogger) *K8sUtil
func (K8sUtil) CreateNsIfNotExists ¶
func (impl K8sUtil) CreateNsIfNotExists(namespace string, clusterConfig *ClusterConfig) (err error)
func (K8sUtil) CreateSecretFast ¶
func (K8sUtil) GetClient ¶
func (impl K8sUtil) GetClient(clusterConfig *ClusterConfig) (*v12.CoreV1Client, error)
func (K8sUtil) GetConfigMap ¶
func (K8sUtil) GetConfigMapFast ¶
func (K8sUtil) GetSecretFast ¶
func (K8sUtil) PatchConfigMap ¶
func (K8sUtil) PatchConfigMapJsonType ¶
func (K8sUtil) UpdateConfigMap ¶
func (K8sUtil) UpdateConfigMapFast ¶
type MergeUtil ¶
type MergeUtil struct {
Logger *zap.SugaredLogger
}
func (MergeUtil) ConfigMapMerge ¶
func (MergeUtil) ConfigSecretMerge ¶
func (MergeUtil) JsonPatch ¶
//returns json representation of merged values
func (m MergeUtil) MergeOverride(helmValues string, override []byte) ([]byte, error) { cf, err := conflate.FromData([]byte(helmValues), override) if err != nil { m.Logger.Errorw("error in merging config", "original", helmValues, "override", override, "error", err) return nil, err } jsonBytes, err := cf.MarshalJSON() if err != nil { m.Logger.Errorw("error in marshaling yaml ", "cf", cf, "error", err) return nil, err } dst := new(bytes.Buffer) err = json.Compact(dst, jsonBytes) if err != nil { return nil, err } jsonBytes = dst.Bytes() m.Logger.Infow("merged config ", "original", helmValues, "override", override, "yaml", jsonBytes, ) return jsonBytes, nil }
func (m MergeUtil) MergeOverrideVal(data ...[]byte) ([]byte, error) { cf, err := conflate.FromData(data...) if err != nil { m.Logger.Errorw("error in merging config", "val", data, "error", err) return nil, err } jsonBytes, err := cf.MarshalJSON() if err != nil { m.Logger.Errorw("error in marshaling yaml ", "cf", cf, "error", err) return nil, err } dst := new(bytes.Buffer) err = json.Compact(dst, jsonBytes) if err != nil { return nil, err } jsonBytes = dst.Bytes() return jsonBytes, nil }
merges two json objects
Source Files ¶
Click to show internal directories.
Click to hide internal directories.