diff --git a/cmd/katenary/main.go b/cmd/katenary/main.go index f2810aa..63a6cbc 100644 --- a/cmd/katenary/main.go +++ b/cmd/katenary/main.go @@ -6,14 +6,15 @@ package main import ( "fmt" - "katenary/generator" - "katenary/generator/katenaryfile" - "katenary/generator/labels" - "katenary/utils" "log" "os" "strings" + "github.com/katenary/katenary/internal/generator" + "github.com/katenary/katenary/internal/generator/katenaryfile" + "github.com/katenary/katenary/internal/generator/labels" + "github.com/katenary/katenary/internal/utils" + "github.com/compose-spec/compose-go/cli" "github.com/spf13/cobra" ) diff --git a/doc/docs/dependencies.md b/doc/docs/dependencies.md index 08c458c..c18f8da 100644 --- a/doc/docs/dependencies.md +++ b/doc/docs/dependencies.md @@ -3,14 +3,14 @@ Katenary uses `compose-go` and several Kubernetes official packages. - `github.com/compose-spec/compose-go`: to parse compose files. It ensures : - - that the project respects the "compose" specification - - that Katenary uses the "compose" struct exactly the same way `podman compose` or `docker copose` does + - that the project respects the "compose" specification + - that Katenary uses the "compose" struct exactly the same way `podman compose` or `docker copose` does - `github.com/spf13/cobra`: to parse command line arguments, sub-commands and flags. It also generates completion for bash, zsh, fish and PowerShell. - `github.com/thediveo/netdb`: to get the standard names of a service from its port number - `gopkg.in/yaml.v3`: - - to generate `Chart.yaml` and `values.yaml` files (only) - - to parse Katenary labels in the compose file + - to generate `Chart.yaml` and `values.yaml` files (only) + - to parse Katenary labels in the compose file - `k8s.io/api` and `k8s.io/apimachinery` to create Kubernetes objects - `sigs.k8s.io/yaml`: to generate Katenary YAML files in the format of Kubernetes objects diff --git a/doc/docs/packages/cmd/katenary.md b/doc/docs/packages/cmd/katenary.md index 9261889..7436644 100644 --- a/doc/docs/packages/cmd/katenary.md +++ b/doc/docs/packages/cmd/katenary.md @@ -3,7 +3,7 @@ # katenary ```go -import "katenary/cmd/katenary" +import "github.com/katenary/katenary/cmd/katenary" ``` Katenary CLI, main package. diff --git a/doc/docs/packages/generator/katenaryfile.md b/doc/docs/packages/generator/katenaryfile.md deleted file mode 100644 index acd3d03..0000000 --- a/doc/docs/packages/generator/katenaryfile.md +++ /dev/null @@ -1,67 +0,0 @@ - - -# katenaryfile - -```go -import "katenary/generator/katenaryfile" -``` - -Package katenaryfile is a package for reading and writing katenary files. - -A katenary file, named "katenary.yml" or "katenary.yaml", is a file where you can define the configuration of the conversion avoiding the use of labels in the compose file. - -Formely, the file describe the same structure as in labels, and so that can be validated and completed by LSP. It also ease the use of katenary. - -## func [GenerateSchema]() - -```go -func GenerateSchema() string -``` - -GenerateSchema generates the schema for the katenary.yaml file. - - -## func [OverrideWithConfig]() - -```go -func OverrideWithConfig(project *types.Project) -``` - -OverrideWithConfig overrides the project with the katenary.yaml file. It will set the labels of the services with the values from the katenary.yaml file. It work in memory, so it will not modify the original project. - - -## type [Service]() - -Service is a struct that contains the service configuration for katenary - -```go -type Service struct { - MainApp *bool `json:"main-app,omitempty" jsonschema:"title=Is this service the main application"` - Values []StringOrMap `json:"values,omitempty" jsonschema:"description=Environment variables to be set in values.yaml with or without a description"` - Secrets *labelstructs.Secrets `json:"secrets,omitempty" jsonschema:"title=Secrets,description=Environment variables to be set as secrets"` - Ports *labelstructs.Ports `json:"ports,omitempty" jsonschema:"title=Ports,description=Ports to be exposed in services"` - Ingress *labelstructs.Ingress `json:"ingress,omitempty" jsonschema:"title=Ingress,description=Ingress configuration"` - HealthCheck *labelstructs.HealthCheck `json:"health-check,omitempty" jsonschema:"title=Health Check,description=Health check configuration that respects the kubernetes api"` - SamePod *string `json:"same-pod,omitempty" jsonschema:"title=Same Pod,description=Service that should be in the same pod"` - Description *string `json:"description,omitempty" jsonschema:"title=Description,description=Description of the service that will be injected in the values.yaml file"` - Ignore *bool `json:"ignore,omitempty" jsonschema:"title=Ignore,description=Ignore the service in the conversion"` - Dependencies []labelstructs.Dependency `json:"dependencies,omitempty" jsonschema:"title=Dependencies,description=Services that should be injected in the Chart.yaml file"` - ConfigMapFile *labelstructs.ConfigMapFile `json:"configmap-files,omitempty" jsonschema:"title=ConfigMap Files,description=Files that should be injected as ConfigMap"` - MapEnv *labelstructs.MapEnv `json:"map-env,omitempty" jsonschema:"title=Map Env,description=Map environment variables to another value"` - CronJob *labelstructs.CronJob `json:"cron-job,omitempty" jsonschema:"title=Cron Job,description=Cron Job configuration"` - EnvFrom *labelstructs.EnvFrom `json:"env-from,omitempty" jsonschema:"title=Env From,description=Inject environment variables from another service"` - ExchangeVolumes []*labelstructs.ExchangeVolume `json:"exchange-volumes,omitempty" jsonschema:"title=Exchange Volumes,description=Exchange volumes between services"` - ValuesFrom *labelstructs.ValueFrom `json:"values-from,omitempty" jsonschema:"title=Values From,description=Inject values from another service (secret or configmap environment variables)"` -} -``` - - -## type [StringOrMap]() - -StringOrMap is a struct that can be either a string or a map of strings. It's a helper struct to unmarshal the katenary.yaml file and produce the schema - -```go -type StringOrMap any -``` - -Generated by [gomarkdoc]() diff --git a/doc/docs/packages/generator.md b/doc/docs/packages/internal/generator.md similarity index 80% rename from doc/docs/packages/generator.md rename to doc/docs/packages/internal/generator.md index 95faa04..f8ce06a 100644 --- a/doc/docs/packages/generator.md +++ b/doc/docs/packages/internal/generator.md @@ -3,7 +3,7 @@ # generator ```go -import "katenary/generator" +import "github.com/katenary/katenary/internal/generator" ``` Package generator generates kubernetes objects from a "compose" file and transforms them into a helm chart. @@ -35,7 +35,7 @@ var Version = "master" // changed at compile time ``` -## func [Convert]() +## func [Convert]() ```go func Convert(config ConvertOptions, dockerComposeFile ...string) error @@ -44,7 +44,7 @@ func Convert(config ConvertOptions, dockerComposeFile ...string) error Convert a compose \(docker, podman...\) project to a helm chart. It calls Generate\(\) to generate the chart and then write it to the disk. -## func [GetLabels]() +## func [GetLabels]() ```go func GetLabels(serviceName, appName string) map[string]string @@ -53,7 +53,7 @@ func GetLabels(serviceName, appName string) map[string]string GetLabels returns the labels for a service. It uses the appName to replace the \_\_replace\_\_ in the labels. This is used to generate the labels in the templates. -## func [GetMatchLabels]() +## func [GetMatchLabels]() ```go func GetMatchLabels(serviceName, appName string) map[string]string @@ -62,7 +62,7 @@ func GetMatchLabels(serviceName, appName string) map[string]string GetMatchLabels returns the matchLabels for a service. It uses the appName to replace the \_\_replace\_\_ in the labels. This is used to generate the matchLabels in the templates. -## func [GetVersion]() +## func [GetVersion]() ```go func GetVersion() string @@ -71,7 +71,7 @@ func GetVersion() string GetVersion return the version of katneary. It's important to understand that the version is set at compile time for the github release. But, it the user get katneary using \`go install\`, the version should be different. -## func [Helper]() +## func [Helper]() ```go func Helper(name string) string @@ -80,7 +80,7 @@ func Helper(name string) string Helper returns the \_helpers.tpl file for a chart. -## func [NewCronJob]() +## func [NewCronJob]() ```go func NewCronJob(service types.ServiceConfig, chart *HelmChart, appName string) (*CronJob, *RBAC) @@ -89,7 +89,7 @@ func NewCronJob(service types.ServiceConfig, chart *HelmChart, appName string) ( NewCronJob creates a new CronJob from a compose service. The appName is the name of the application taken from the project name. -## func [ToK8SYaml]() +## func [ToK8SYaml]() ```go func ToK8SYaml(obj any) ([]byte, error) @@ -98,7 +98,7 @@ func ToK8SYaml(obj any) ([]byte, error) -## func [UnWrapTPL]() +## func [UnWrapTPL]() ```go func UnWrapTPL(in []byte) []byte @@ -107,7 +107,7 @@ func UnWrapTPL(in []byte) []byte UnWrapTPL removes the line wrapping from a template. -## type [ChartTemplate]() +## type [ChartTemplate]() ChartTemplate is a template of a chart. It contains the content of the template and the name of the service. This is used internally to generate the templates. @@ -119,7 +119,7 @@ type ChartTemplate struct { ``` -## type [ConfigMap]() +## type [ConfigMap]() ConfigMap is a kubernetes ConfigMap. Implements the DataMap interface. @@ -131,7 +131,7 @@ type ConfigMap struct { ``` -### func [NewConfigMap]() +### func [NewConfigMap]() ```go func NewConfigMap(service types.ServiceConfig, appName string, forFile bool) *ConfigMap @@ -140,7 +140,7 @@ func NewConfigMap(service types.ServiceConfig, appName string, forFile bool) *Co NewConfigMap creates a new ConfigMap from a compose service. The appName is the name of the application taken from the project name. The ConfigMap is filled by environment variables and labels "map\-env". -### func [NewConfigMapFromDirectory]() +### func [NewConfigMapFromDirectory]() ```go func NewConfigMapFromDirectory(service types.ServiceConfig, appName, path string) *ConfigMap @@ -149,7 +149,7 @@ func NewConfigMapFromDirectory(service types.ServiceConfig, appName, path string NewConfigMapFromDirectory creates a new ConfigMap from a compose service. This path is the path to the file or directory. If the path is a directory, all files in the directory are added to the ConfigMap. Each subdirectory are ignored. Note that the Generate\(\) function will create the subdirectories ConfigMaps. -### func \(\*ConfigMap\) [AddBinaryData]() +### func \(\*ConfigMap\) [AddBinaryData]() ```go func (c *ConfigMap) AddBinaryData(key string, value []byte) @@ -158,7 +158,7 @@ func (c *ConfigMap) AddBinaryData(key string, value []byte) AddBinaryData adds binary data to the configmap. Append or overwrite the value if the key already exists. -### func \(\*ConfigMap\) [AddData]() +### func \(\*ConfigMap\) [AddData]() ```go func (c *ConfigMap) AddData(key, value string) @@ -167,7 +167,7 @@ func (c *ConfigMap) AddData(key, value string) AddData adds a key value pair to the configmap. Append or overwrite the value if the key already exists. -### func \(\*ConfigMap\) [AppendDir]() +### func \(\*ConfigMap\) [AppendDir]() ```go func (c *ConfigMap) AppendDir(path string) error @@ -176,7 +176,7 @@ func (c *ConfigMap) AppendDir(path string) error AppendDir adds files from given path to the configmap. It is not recursive, to add all files in a directory, you need to call this function for each subdirectory. -### func \(\*ConfigMap\) [AppendFile]() +### func \(\*ConfigMap\) [AppendFile]() ```go func (c *ConfigMap) AppendFile(path string) error @@ -185,7 +185,7 @@ func (c *ConfigMap) AppendFile(path string) error -### func \(\*ConfigMap\) [Filename]() +### func \(\*ConfigMap\) [Filename]() ```go func (c *ConfigMap) Filename() string @@ -194,7 +194,7 @@ func (c *ConfigMap) Filename() string Filename returns the filename of the configmap. If the configmap is used for files, the filename contains the path. -### func \(\*ConfigMap\) [SetData]() +### func \(\*ConfigMap\) [SetData]() ```go func (c *ConfigMap) SetData(data map[string]string) @@ -203,7 +203,7 @@ func (c *ConfigMap) SetData(data map[string]string) SetData sets the data of the configmap. It replaces the entire data. -### func \(\*ConfigMap\) [Yaml]() +### func \(\*ConfigMap\) [Yaml]() ```go func (c *ConfigMap) Yaml() ([]byte, error) @@ -212,7 +212,7 @@ func (c *ConfigMap) Yaml() ([]byte, error) Yaml returns the yaml representation of the configmap -## type [ConfigMapMount]() +## type [ConfigMapMount]() @@ -223,7 +223,7 @@ type ConfigMapMount struct { ``` -## type [ConvertOptions]() +## type [ConvertOptions]() ConvertOptions are the options to convert a compose project to a helm chart. @@ -241,7 +241,7 @@ type ConvertOptions struct { ``` -## type [CronJob]() +## type [CronJob]() CronJob is a kubernetes CronJob. @@ -253,7 +253,7 @@ type CronJob struct { ``` -### func \(\*CronJob\) [Filename]() +### func \(\*CronJob\) [Filename]() ```go func (c *CronJob) Filename() string @@ -264,7 +264,7 @@ Filename returns the filename of the cronjob. Implements the Yaml interface. -### func \(\*CronJob\) [Yaml]() +### func \(\*CronJob\) [Yaml]() ```go func (c *CronJob) Yaml() ([]byte, error) @@ -275,7 +275,7 @@ Yaml returns the yaml representation of the cronjob. Implements the Yaml interface. -## type [CronJobValue]() +## type [CronJobValue]() CronJobValue is a cronjob configuration that will be saved in values.yaml. @@ -289,7 +289,7 @@ type CronJobValue struct { ``` -## type [DataMap]() +## type [DataMap]() DataMap is a kubernetes ConfigMap or Secret. It can be used to add data to the ConfigMap or Secret. @@ -301,7 +301,7 @@ type DataMap interface { ``` -## type [Deployment]() +## type [Deployment]() Deployment is a kubernetes Deployment. @@ -313,7 +313,7 @@ type Deployment struct { ``` -### func [NewDeployment]() +### func [NewDeployment]() ```go func NewDeployment(service types.ServiceConfig, chart *HelmChart) *Deployment @@ -322,7 +322,7 @@ func NewDeployment(service types.ServiceConfig, chart *HelmChart) *Deployment NewDeployment creates a new Deployment from a compose service. The appName is the name of the application taken from the project name. It also creates the Values map that will be used to create the values.yaml file. -### func \(\*Deployment\) [AddContainer]() +### func \(\*Deployment\) [AddContainer]() ```go func (d *Deployment) AddContainer(service types.ServiceConfig) @@ -331,7 +331,7 @@ func (d *Deployment) AddContainer(service types.ServiceConfig) AddContainer adds a container to the deployment. -### func \(\*Deployment\) [AddHealthCheck]() +### func \(\*Deployment\) [AddHealthCheck]() ```go func (d *Deployment) AddHealthCheck(service types.ServiceConfig, container *corev1.Container) @@ -340,7 +340,7 @@ func (d *Deployment) AddHealthCheck(service types.ServiceConfig, container *core -### func \(\*Deployment\) [AddIngress]() +### func \(\*Deployment\) [AddIngress]() ```go func (d *Deployment) AddIngress(service types.ServiceConfig, appName string) *Ingress @@ -349,7 +349,7 @@ func (d *Deployment) AddIngress(service types.ServiceConfig, appName string) *In AddIngress adds an ingress to the deployment. It creates the ingress object. -### func \(\*Deployment\) [AddLegacyVolume]() +### func \(\*Deployment\) [AddLegacyVolume]() ```go func (d *Deployment) AddLegacyVolume(name, kind string) @@ -358,7 +358,7 @@ func (d *Deployment) AddLegacyVolume(name, kind string) -### func \(\*Deployment\) [AddVolumes]() +### func \(\*Deployment\) [AddVolumes]() ```go func (d *Deployment) AddVolumes(service types.ServiceConfig, appName string) @@ -367,7 +367,7 @@ func (d *Deployment) AddVolumes(service types.ServiceConfig, appName string) AddVolumes adds a volume to the deployment. It does not create the PVC, it only adds the volumes to the deployment. If the volume is a bind volume it will warn the user that it is not supported yet. -### func \(\*Deployment\) [BindFrom]() +### func \(\*Deployment\) [BindFrom]() ```go func (d *Deployment) BindFrom(service types.ServiceConfig, binded *Deployment) @@ -376,7 +376,7 @@ func (d *Deployment) BindFrom(service types.ServiceConfig, binded *Deployment) -### func \(\*Deployment\) [BindMapFilesToContainer]() +### func \(\*Deployment\) [BindMapFilesToContainer]() ```go func (d *Deployment) BindMapFilesToContainer(service types.ServiceConfig, secrets []string, appName string) (*corev1.Container, int) @@ -385,7 +385,7 @@ func (d *Deployment) BindMapFilesToContainer(service types.ServiceConfig, secret -### func \(\*Deployment\) [DependsOn]() +### func \(\*Deployment\) [DependsOn]() ```go func (d *Deployment) DependsOn(to *Deployment, servicename string) error @@ -394,7 +394,7 @@ func (d *Deployment) DependsOn(to *Deployment, servicename string) error DependsOn adds a initContainer to the deployment that will wait for the service to be up. -### func \(\*Deployment\) [Filename]() +### func \(\*Deployment\) [Filename]() ```go func (d *Deployment) Filename() string @@ -403,7 +403,7 @@ func (d *Deployment) Filename() string Filename returns the filename of the deployment. -### func \(\*Deployment\) [MountExchangeVolumes]() +### func \(\*Deployment\) [MountExchangeVolumes]() ```go func (d *Deployment) MountExchangeVolumes() @@ -412,7 +412,7 @@ func (d *Deployment) MountExchangeVolumes() -### func \(\*Deployment\) [SetEnvFrom]() +### func \(\*Deployment\) [SetEnvFrom]() ```go func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, samePod ...bool) @@ -421,7 +421,7 @@ func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, sam SetEnvFrom sets the environment variables to a configmap. The configmap is created. -### func \(\*Deployment\) [Yaml]() +### func \(\*Deployment\) [Yaml]() ```go func (d *Deployment) Yaml() ([]byte, error) @@ -430,7 +430,7 @@ func (d *Deployment) Yaml() ([]byte, error) Yaml returns the yaml representation of the deployment. -## type [FileMapUsage]() +## type [FileMapUsage]() FileMapUsage is the usage of the filemap. @@ -448,7 +448,7 @@ const ( ``` -## type [HelmChart]() +## type [HelmChart]() HelmChart is a Helm Chart representation. It contains all the templates, values, versions, helpers... @@ -471,7 +471,7 @@ type HelmChart struct { ``` -### func [Generate]() +### func [Generate]() ```go func Generate(project *types.Project) (*HelmChart, error) @@ -491,7 +491,7 @@ The Generate function will create the HelmChart object this way: - Merge the same\-pod services. -### func [NewChart]() +### func [NewChart]() ```go func NewChart(name string) *HelmChart @@ -500,7 +500,7 @@ func NewChart(name string) *HelmChart NewChart creates a new empty chart with the given name. -### func \(\*HelmChart\) [SaveTemplates]() +### func \(\*HelmChart\) [SaveTemplates]() ```go func (chart *HelmChart) SaveTemplates(templateDir string) @@ -509,7 +509,7 @@ func (chart *HelmChart) SaveTemplates(templateDir string) SaveTemplates the templates of the chart to the given directory. -## type [Ingress]() +## type [Ingress]() @@ -521,7 +521,7 @@ type Ingress struct { ``` -### func [NewIngress]() +### func [NewIngress]() ```go func NewIngress(service types.ServiceConfig, Chart *HelmChart) *Ingress @@ -530,7 +530,7 @@ func NewIngress(service types.ServiceConfig, Chart *HelmChart) *Ingress NewIngress creates a new Ingress from a compose service. -### func \(\*Ingress\) [Filename]() +### func \(\*Ingress\) [Filename]() ```go func (ingress *Ingress) Filename() string @@ -539,7 +539,7 @@ func (ingress *Ingress) Filename() string -### func \(\*Ingress\) [Yaml]() +### func \(\*Ingress\) [Yaml]() ```go func (ingress *Ingress) Yaml() ([]byte, error) @@ -548,7 +548,7 @@ func (ingress *Ingress) Yaml() ([]byte, error) -## type [IngressValue]() +## type [IngressValue]() IngressValue is a ingress configuration that will be saved in values.yaml. @@ -564,7 +564,7 @@ type IngressValue struct { ``` -## type [PersistenceValue]() +## type [PersistenceValue]() PersistenceValue is a persistence configuration that will be saved in values.yaml. @@ -578,7 +578,7 @@ type PersistenceValue struct { ``` -## type [RBAC]() +## type [RBAC]() RBAC is a kubernetes RBAC containing a role, a rolebinding and an associated serviceaccount. @@ -591,7 +591,7 @@ type RBAC struct { ``` -### func [NewRBAC]() +### func [NewRBAC]() ```go func NewRBAC(service types.ServiceConfig, appName string) *RBAC @@ -600,7 +600,7 @@ func NewRBAC(service types.ServiceConfig, appName string) *RBAC NewRBAC creates a new RBAC from a compose service. The appName is the name of the application taken from the project name. -## type [RepositoryValue]() +## type [RepositoryValue]() RepositoryValue is a docker repository image and tag that will be saved in values.yaml. @@ -612,7 +612,7 @@ type RepositoryValue struct { ``` -## type [Role]() +## type [Role]() Role is a kubernetes Role. @@ -624,7 +624,7 @@ type Role struct { ``` -### func \(\*Role\) [Filename]() +### func \(\*Role\) [Filename]() ```go func (r *Role) Filename() string @@ -633,7 +633,7 @@ func (r *Role) Filename() string -### func \(\*Role\) [Yaml]() +### func \(\*Role\) [Yaml]() ```go func (r *Role) Yaml() ([]byte, error) @@ -642,7 +642,7 @@ func (r *Role) Yaml() ([]byte, error) -## type [RoleBinding]() +## type [RoleBinding]() RoleBinding is a kubernetes RoleBinding. @@ -654,7 +654,7 @@ type RoleBinding struct { ``` -### func \(\*RoleBinding\) [Filename]() +### func \(\*RoleBinding\) [Filename]() ```go func (r *RoleBinding) Filename() string @@ -663,7 +663,7 @@ func (r *RoleBinding) Filename() string -### func \(\*RoleBinding\) [Yaml]() +### func \(\*RoleBinding\) [Yaml]() ```go func (r *RoleBinding) Yaml() ([]byte, error) @@ -672,7 +672,7 @@ func (r *RoleBinding) Yaml() ([]byte, error) -## type [Secret]() +## type [Secret]() Secret is a kubernetes Secret. @@ -686,7 +686,7 @@ type Secret struct { ``` -### func [NewSecret]() +### func [NewSecret]() ```go func NewSecret(service types.ServiceConfig, appName string) *Secret @@ -695,7 +695,7 @@ func NewSecret(service types.ServiceConfig, appName string) *Secret NewSecret creates a new Secret from a compose service -### func \(\*Secret\) [AddData]() +### func \(\*Secret\) [AddData]() ```go func (s *Secret) AddData(key, value string) @@ -704,7 +704,7 @@ func (s *Secret) AddData(key, value string) AddData adds a key value pair to the secret. -### func \(\*Secret\) [Filename]() +### func \(\*Secret\) [Filename]() ```go func (s *Secret) Filename() string @@ -713,7 +713,7 @@ func (s *Secret) Filename() string Filename returns the filename of the secret. -### func \(\*Secret\) [SetData]() +### func \(\*Secret\) [SetData]() ```go func (s *Secret) SetData(data map[string]string) @@ -722,7 +722,7 @@ func (s *Secret) SetData(data map[string]string) SetData sets the data of the secret. -### func \(\*Secret\) [Yaml]() +### func \(\*Secret\) [Yaml]() ```go func (s *Secret) Yaml() ([]byte, error) @@ -731,7 +731,7 @@ func (s *Secret) Yaml() ([]byte, error) Yaml returns the yaml representation of the secret. -## type [Service]() +## type [Service]() Service is a kubernetes Service. @@ -743,7 +743,7 @@ type Service struct { ``` -### func [NewService]() +### func [NewService]() ```go func NewService(service types.ServiceConfig, appName string) *Service @@ -752,7 +752,7 @@ func NewService(service types.ServiceConfig, appName string) *Service NewService creates a new Service from a compose service. -### func \(\*Service\) [AddPort]() +### func \(\*Service\) [AddPort]() ```go func (s *Service) AddPort(port types.ServicePortConfig, serviceName ...string) @@ -761,7 +761,7 @@ func (s *Service) AddPort(port types.ServicePortConfig, serviceName ...string) AddPort adds a port to the service. -### func \(\*Service\) [Filename]() +### func \(\*Service\) [Filename]() ```go func (s *Service) Filename() string @@ -770,7 +770,7 @@ func (s *Service) Filename() string Filename returns the filename of the service. -### func \(\*Service\) [Yaml]() +### func \(\*Service\) [Yaml]() ```go func (s *Service) Yaml() ([]byte, error) @@ -779,7 +779,7 @@ func (s *Service) Yaml() ([]byte, error) Yaml returns the yaml representation of the service. -## type [ServiceAccount]() +## type [ServiceAccount]() ServiceAccount is a kubernetes ServiceAccount. @@ -791,7 +791,7 @@ type ServiceAccount struct { ``` -### func \(\*ServiceAccount\) [Filename]() +### func \(\*ServiceAccount\) [Filename]() ```go func (r *ServiceAccount) Filename() string @@ -800,7 +800,7 @@ func (r *ServiceAccount) Filename() string -### func \(\*ServiceAccount\) [Yaml]() +### func \(\*ServiceAccount\) [Yaml]() ```go func (r *ServiceAccount) Yaml() ([]byte, error) @@ -809,7 +809,7 @@ func (r *ServiceAccount) Yaml() ([]byte, error) -## type [TLS]() +## type [TLS]() @@ -821,7 +821,7 @@ type TLS struct { ``` -## type [Value]() +## type [Value]() Value will be saved in values.yaml. It contains configuration for all deployment and services. @@ -841,7 +841,7 @@ type Value struct { ``` -### func [NewValue]() +### func [NewValue]() ```go func NewValue(service types.ServiceConfig, main ...bool) *Value @@ -852,7 +852,7 @@ NewValue creates a new Value from a compose service. The value contains the nece If \`main\` is true, the tag will be empty because it will be set in the helm chart appVersion. -### func \(\*Value\) [AddIngress]() +### func \(\*Value\) [AddIngress]() ```go func (v *Value) AddIngress(host, path string) @@ -861,7 +861,7 @@ func (v *Value) AddIngress(host, path string) -### func \(\*Value\) [AddPersistence]() +### func \(\*Value\) [AddPersistence]() ```go func (v *Value) AddPersistence(volumeName string) @@ -870,7 +870,7 @@ func (v *Value) AddPersistence(volumeName string) AddPersistence adds persistence configuration to the Value. -## type [VolumeClaim]() +## type [VolumeClaim]() VolumeClaim is a kubernetes VolumeClaim. This is a PersistentVolumeClaim. @@ -882,7 +882,7 @@ type VolumeClaim struct { ``` -### func [NewVolumeClaim]() +### func [NewVolumeClaim]() ```go func NewVolumeClaim(service types.ServiceConfig, volumeName, appName string) *VolumeClaim @@ -891,7 +891,7 @@ func NewVolumeClaim(service types.ServiceConfig, volumeName, appName string) *Vo NewVolumeClaim creates a new VolumeClaim from a compose service. -### func \(\*VolumeClaim\) [Filename]() +### func \(\*VolumeClaim\) [Filename]() ```go func (v *VolumeClaim) Filename() string @@ -900,7 +900,7 @@ func (v *VolumeClaim) Filename() string Filename returns the suggested filename for a VolumeClaim. -### func \(\*VolumeClaim\) [Yaml]() +### func \(\*VolumeClaim\) [Yaml]() ```go func (v *VolumeClaim) Yaml() ([]byte, error) @@ -909,7 +909,7 @@ func (v *VolumeClaim) Yaml() ([]byte, error) Yaml marshals a VolumeClaim into yaml. -## type [Yaml]() +## type [Yaml]() Yaml is a kubernetes object that can be converted to yaml. diff --git a/doc/docs/packages/generator/extrafiles.md b/doc/docs/packages/internal/generator/extrafiles.md similarity index 71% rename from doc/docs/packages/generator/extrafiles.md rename to doc/docs/packages/internal/generator/extrafiles.md index 5987179..da78080 100644 --- a/doc/docs/packages/generator/extrafiles.md +++ b/doc/docs/packages/internal/generator/extrafiles.md @@ -3,12 +3,12 @@ # extrafiles ```go -import "katenary/generator/extrafiles" +import "github.com/katenary/katenary/internal/generator/extrafiles" ``` Package extrafiles provides function to generate the Chart files that are not objects. Like README.md and notes.txt... -## func [NotesFile]() +## func [NotesFile]() ```go func NotesFile(services []string) string @@ -17,7 +17,7 @@ func NotesFile(services []string) string NotesFile returns the content of the note.txt file. -## func [ReadMeFile]() +## func [ReadMeFile]() ```go func ReadMeFile(charname, description string, values map[string]any) string diff --git a/doc/docs/packages/internal/generator/katenaryfile.md b/doc/docs/packages/internal/generator/katenaryfile.md new file mode 100644 index 0000000..ecf6530 --- /dev/null +++ b/doc/docs/packages/internal/generator/katenaryfile.md @@ -0,0 +1,67 @@ + + +# katenaryfile + +```go +import "github.com/katenary/katenary/internal/generator/katenaryfile" +``` + +Package katenaryfile is a package for reading and writing katenary files. + +A katenary file, named "katenary.yml" or "katenary.yaml", is a file where you can define the configuration of the conversion avoiding the use of labels in the compose file. + +Formely, the file describe the same structure as in labels, and so that can be validated and completed by LSP. It also ease the use of katenary. + +## func [GenerateSchema]() + +```go +func GenerateSchema() string +``` + +GenerateSchema generates the schema for the katenary.yaml file. + + +## func [OverrideWithConfig]() + +```go +func OverrideWithConfig(project *types.Project) +``` + +OverrideWithConfig overrides the project with the katenary.yaml file. It will set the labels of the services with the values from the katenary.yaml file. It work in memory, so it will not modify the original project. + + +## type [Service]() + +Service is a struct that contains the service configuration for katenary + +```go +type Service struct { + MainApp *bool `yaml:"main-app,omitempty" json:"main-app,omitempty" jsonschema:"title=Is this service the main application"` + Values []StringOrMap `yaml:"values,omitempty" json:"values,omitempty" jsonschema:"description=Environment variables to be set in values.yaml with or without a description"` + Secrets *labelstructs.Secrets `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"title=Secrets,description=Environment variables to be set as secrets"` + Ports *labelstructs.Ports `yaml:"ports,omitempty" json:"ports,omitempty" jsonschema:"title=Ports,description=Ports to be exposed in services"` + Ingress *labelstructs.Ingress `yaml:"ingress,omitempty" json:"ingress,omitempty" jsonschema:"title=Ingress,description=Ingress configuration"` + HealthCheck *labelstructs.HealthCheck `yaml:"health-check,omitempty" json:"health-check,omitempty" jsonschema:"title=Health Check,description=Health check configuration that respects the kubernetes api"` + SamePod *string `yaml:"same-pod,omitempty" json:"same-pod,omitempty" jsonschema:"title=Same Pod,description=Service that should be in the same pod"` + Description *string `yaml:"description,omitempty" json:"description,omitempty" jsonschema:"title=Description,description=Description of the service that will be injected in the values.yaml file"` + Ignore *bool `yaml:"ignore,omitempty" json:"ignore,omitempty" jsonschema:"title=Ignore,description=Ignore the service in the conversion"` + Dependencies []labelstructs.Dependency `yaml:"dependencies,omitempty" json:"dependencies,omitempty" jsonschema:"title=Dependencies,description=Services that should be injected in the Chart.yaml file"` + ConfigMapFiles *labelstructs.ConfigMapFiles `yaml:"configmap-files,omitempty" json:"configmap-files,omitempty" jsonschema:"title=ConfigMap Files,description=Files that should be injected as ConfigMap"` + MapEnv *labelstructs.MapEnv `yaml:"map-env,omitempty" json:"map-env,omitempty" jsonschema:"title=Map Env,description=Map environment variables to another value"` + CronJob *labelstructs.CronJob `yaml:"cron-job,omitempty" json:"cron-job,omitempty" jsonschema:"title=Cron Job,description=Cron Job configuration"` + EnvFrom *labelstructs.EnvFrom `yaml:"env-from,omitempty" json:"env-from,omitempty" jsonschema:"title=Env From,description=Inject environment variables from another service"` + ExchangeVolumes []*labelstructs.ExchangeVolume `yaml:"exchange-volumes,omitempty" json:"exchange-volumes,omitempty" jsonschema:"title=Exchange Volumes,description=Exchange volumes between services"` + ValuesFrom *labelstructs.ValueFrom `yaml:"values-from,omitempty" json:"values-from,omitempty" jsonschema:"title=Values From,description=Inject values from another service (secret or configmap environment variables)"` +} +``` + + +## type [StringOrMap]() + +StringOrMap is a struct that can be either a string or a map of strings. It's a helper struct to unmarshal the katenary.yaml file and produce the schema + +```go +type StringOrMap any +``` + +Generated by [gomarkdoc]() diff --git a/doc/docs/packages/generator/labels.md b/doc/docs/packages/internal/generator/labels.md similarity index 77% rename from doc/docs/packages/generator/labels.md rename to doc/docs/packages/internal/generator/labels.md index 1d01d9f..884c504 100644 --- a/doc/docs/packages/generator/labels.md +++ b/doc/docs/packages/internal/generator/labels.md @@ -3,7 +3,7 @@ # labels ```go -import "katenary/generator/labels" +import "github.com/katenary/katenary/internal/generator/labels" ``` Package labels provides functionality to parse and manipulate labels. @@ -17,7 +17,7 @@ const KatenaryLabelPrefix = "katenary.v3" ``` -## func [GetLabelHelp]() +## func [GetLabelHelp]() ```go func GetLabelHelp(asMarkdown bool) string @@ -26,7 +26,7 @@ func GetLabelHelp(asMarkdown bool) string GetLabelHelp return the help for the labels. -## func [GetLabelHelpFor]() +## func [GetLabelHelpFor]() ```go func GetLabelHelpFor(labelname string, asMarkdown bool) string @@ -35,7 +35,7 @@ func GetLabelHelpFor(labelname string, asMarkdown bool) string GetLabelHelpFor returns the help for a specific label. -## func [GetLabelNames]() +## func [GetLabelNames]() ```go func GetLabelNames() []string @@ -44,7 +44,7 @@ func GetLabelNames() []string GetLabelNames returns a sorted list of all katenary label names. -## func [Prefix]() +## func [Prefix]() ```go func Prefix() string @@ -53,7 +53,7 @@ func Prefix() string -## type [Help]() +## type [Help]() Help is the documentation of a label. @@ -67,7 +67,7 @@ type Help struct { ``` -## type [Label]() +## type [Label]() Label is a katenary label to find in compose files. @@ -94,12 +94,12 @@ const ( LabelCronJob Label = KatenaryLabelPrefix + "/cronjob" LabelEnvFrom Label = KatenaryLabelPrefix + "/env-from" LabelExchangeVolume Label = KatenaryLabelPrefix + "/exchange-volumes" - LabelValueFrom Label = KatenaryLabelPrefix + "/values-from" + LabelValuesFrom Label = KatenaryLabelPrefix + "/values-from" ) ``` -### func [LabelName]() +### func [LabelName]() ```go func LabelName(name string) Label diff --git a/doc/docs/packages/generator/labels/labelstructs.md b/doc/docs/packages/internal/generator/labels/labelstructs.md similarity index 68% rename from doc/docs/packages/generator/labels/labelstructs.md rename to doc/docs/packages/internal/generator/labels/labelstructs.md index 7fbe210..f9a1991 100644 --- a/doc/docs/packages/generator/labels/labelstructs.md +++ b/doc/docs/packages/internal/generator/labels/labelstructs.md @@ -3,30 +3,30 @@ # labelstructs ```go -import "katenary/generator/labels/labelstructs" +import "github.com/katenary/katenary/internal/generator/labels/labelstructs" ``` Package labelstructs is a package that contains the structs used to represent the labels in the yaml files. -## type [ConfigMapFile]() +## type [ConfigMapFiles]() ```go -type ConfigMapFile []string +type ConfigMapFiles []string ``` -### func [ConfigMapFileFrom]() +### func [ConfigMapFileFrom]() ```go -func ConfigMapFileFrom(data string) (ConfigMapFile, error) +func ConfigMapFileFrom(data string) (ConfigMapFiles, error) ``` -## type [CronJob]() +## type [CronJob]() @@ -40,7 +40,7 @@ type CronJob struct { ``` -### func [CronJobFrom]() +### func [CronJobFrom]() ```go func CronJobFrom(data string) (*CronJob, error) @@ -49,7 +49,7 @@ func CronJobFrom(data string) (*CronJob, error) -## type [Dependency]() +## type [Dependency]() Dependency is a dependency of a chart to other charts. @@ -64,7 +64,7 @@ type Dependency struct { ``` -### func [DependenciesFrom]() +### func [DependenciesFrom]() ```go func DependenciesFrom(data string) ([]Dependency, error) @@ -73,7 +73,7 @@ func DependenciesFrom(data string) ([]Dependency, error) DependenciesFrom returns a slice of dependencies from the given string. -## type [EnvFrom]() +## type [EnvFrom]() @@ -82,7 +82,7 @@ type EnvFrom []string ``` -### func [EnvFromFrom]() +### func [EnvFromFrom]() ```go func EnvFromFrom(data string) (EnvFrom, error) @@ -91,7 +91,7 @@ func EnvFromFrom(data string) (EnvFrom, error) EnvFromFrom returns a EnvFrom from the given string. -## type [ExchangeVolume]() +## type [ExchangeVolume]() @@ -105,7 +105,7 @@ type ExchangeVolume struct { ``` -### func [NewExchangeVolumes]() +### func [NewExchangeVolumes]() ```go func NewExchangeVolumes(data string) ([]*ExchangeVolume, error) @@ -114,7 +114,7 @@ func NewExchangeVolumes(data string) ([]*ExchangeVolume, error) -## type [HealthCheck]() +## type [HealthCheck]() @@ -126,7 +126,7 @@ type HealthCheck struct { ``` -### func [ProbeFrom]() +### func [ProbeFrom]() ```go func ProbeFrom(data string) (*HealthCheck, error) @@ -135,7 +135,7 @@ func ProbeFrom(data string) (*HealthCheck, error) -## type [Ingress]() +## type [Ingress]() @@ -152,7 +152,7 @@ type Ingress struct { ``` -### func [IngressFrom]() +### func [IngressFrom]() ```go func IngressFrom(data string) (*Ingress, error) @@ -161,7 +161,7 @@ func IngressFrom(data string) (*Ingress, error) IngressFrom creates a new Ingress from a compose service. -## type [MapEnv]() +## type [MapEnv]() @@ -170,7 +170,7 @@ type MapEnv map[string]string ``` -### func [MapEnvFrom]() +### func [MapEnvFrom]() ```go func MapEnvFrom(data string) (MapEnv, error) @@ -179,7 +179,7 @@ func MapEnvFrom(data string) (MapEnv, error) MapEnvFrom returns a MapEnv from the given string. -## type [Ports]() +## type [Ports]() @@ -188,7 +188,7 @@ type Ports []uint32 ``` -### func [PortsFrom]() +### func [PortsFrom]() ```go func PortsFrom(data string) (Ports, error) @@ -197,7 +197,7 @@ func PortsFrom(data string) (Ports, error) PortsFrom returns a Ports from the given string. -## type [Secrets]() +## type [Secrets]() @@ -206,7 +206,7 @@ type Secrets []string ``` -### func [SecretsFrom]() +### func [SecretsFrom]() ```go func SecretsFrom(data string) (Secrets, error) @@ -215,7 +215,7 @@ func SecretsFrom(data string) (Secrets, error) -## type [TLS]() +## type [TLS]() @@ -226,7 +226,7 @@ type TLS struct { ``` -## type [ValueFrom]() +## type [ValueFrom]() @@ -235,7 +235,7 @@ type ValueFrom map[string]string ``` -### func [GetValueFrom]() +### func [GetValueFrom]() ```go func GetValueFrom(data string) (*ValueFrom, error) diff --git a/doc/docs/packages/parser.md b/doc/docs/packages/internal/parser.md similarity index 73% rename from doc/docs/packages/parser.md rename to doc/docs/packages/internal/parser.md index 4a17872..358e2db 100644 --- a/doc/docs/packages/parser.md +++ b/doc/docs/packages/internal/parser.md @@ -3,12 +3,12 @@ # parser ```go -import "katenary/parser" +import "github.com/katenary/katenary/internal/parser" ``` Package parser is a wrapper around compose\-go to parse compose files. -## func [Parse]() +## func [Parse]() ```go func Parse(profiles []string, envFiles []string, dockerComposeFile ...string) (*types.Project, error) diff --git a/doc/docs/packages/utils.md b/doc/docs/packages/internal/utils.md similarity index 76% rename from doc/docs/packages/utils.md rename to doc/docs/packages/internal/utils.md index 70c5c24..bb73567 100644 --- a/doc/docs/packages/utils.md +++ b/doc/docs/packages/internal/utils.md @@ -3,7 +3,7 @@ # utils ```go -import "katenary/utils" +import "github.com/katenary/katenary/internal/utils" ``` Package utils provides some utility functions used in katenary. It defines some constants and functions used in the whole project. @@ -17,7 +17,7 @@ const DirectoryPermission = 0o755 ``` -## func [AsResourceName]() +## func [AsResourceName]() ```go func AsResourceName(name string) string @@ -26,7 +26,7 @@ func AsResourceName(name string) string AsResourceName returns a resource name with underscores to respect the kubernetes naming convention. It's the opposite of FixedResourceName. -## func [Confirm]() +## func [Confirm]() ```go func Confirm(question string, icon ...Icon) bool @@ -35,7 +35,7 @@ func Confirm(question string, icon ...Icon) bool Confirm asks a question and returns true if the answer is y. -## func [CountStartingSpaces]() +## func [CountStartingSpaces]() ```go func CountStartingSpaces(line string) int @@ -44,7 +44,7 @@ func CountStartingSpaces(line string) int CountStartingSpaces counts the number of spaces at the beginning of a string. -## func [EncodeBasicYaml]() +## func [EncodeBasicYaml]() ```go func EncodeBasicYaml(data any) ([]byte, error) @@ -53,7 +53,7 @@ func EncodeBasicYaml(data any) ([]byte, error) EncodeBasicYaml encodes a basic yaml from an interface. -## func [FixedResourceName]() +## func [FixedResourceName]() ```go func FixedResourceName(name string) string @@ -62,7 +62,7 @@ func FixedResourceName(name string) string FixedResourceName returns a resource name without underscores to respect the kubernetes naming convention. -## func [GetContainerByName]() +## func [GetContainerByName]() ```go func GetContainerByName(name string, containers []corev1.Container) (*corev1.Container, int) @@ -71,7 +71,7 @@ func GetContainerByName(name string, containers []corev1.Container) (*corev1.Con GetContainerByName returns a container by name and its index in the array. It returns nil, \-1 if not found. -## func [GetKind]() +## func [GetKind]() ```go func GetKind(path string) (kind string) @@ -80,7 +80,7 @@ func GetKind(path string) (kind string) GetKind returns the kind of the resource from the file path. -## func [GetServiceNameByPort]() +## func [GetServiceNameByPort]() ```go func GetServiceNameByPort(port int) string @@ -89,7 +89,7 @@ func GetServiceNameByPort(port int) string GetServiceNameByPort returns the service name for a port. It the service name is not found, it returns an empty string. -## func [GetValuesFromLabel]() +## func [GetValuesFromLabel]() ```go func GetValuesFromLabel(service types.ServiceConfig, LabelValues string) map[string]*EnvConfig @@ -98,7 +98,7 @@ func GetValuesFromLabel(service types.ServiceConfig, LabelValues string) map[str GetValuesFromLabel returns a map of values from a label. -## func [HashComposefiles]() +## func [HashComposefiles]() ```go func HashComposefiles(files []string) (string, error) @@ -107,7 +107,7 @@ func HashComposefiles(files []string) (string, error) HashComposefiles returns a hash of the compose files. -## func [Int32Ptr]() +## func [Int32Ptr]() ```go func Int32Ptr(i int32) *int32 @@ -116,7 +116,7 @@ func Int32Ptr(i int32) *int32 Int32Ptr returns a pointer to an int32. -## func [PathToName]() +## func [PathToName]() ```go func PathToName(path string) string @@ -125,7 +125,7 @@ func PathToName(path string) string PathToName converts a path to a kubernetes complient name. -## func [StrPtr]() +## func [StrPtr]() ```go func StrPtr(s string) *string @@ -134,7 +134,7 @@ func StrPtr(s string) *string StrPtr returns a pointer to a string. -## func [TplName]() +## func [TplName]() ```go func TplName(serviceName, appname string, suffix ...string) string @@ -143,7 +143,7 @@ func TplName(serviceName, appname string, suffix ...string) string TplName returns the name of the kubernetes resource as a template string. It is used in the templates and defined in \_helper.tpl file. -## func [TplValue]() +## func [TplValue]() ```go func TplValue(serviceName, variable string, pipes ...string) string @@ -152,7 +152,7 @@ func TplValue(serviceName, variable string, pipes ...string) string TplValue returns a string that can be used in a template to access a value from the values file. -## func [Warn]() +## func [Warn]() ```go func Warn(msg ...any) @@ -161,7 +161,7 @@ func Warn(msg ...any) Warn prints a warning message -## func [WordWrap]() +## func [WordWrap]() ```go func WordWrap(text string, lineWidth int) string @@ -170,7 +170,7 @@ func WordWrap(text string, lineWidth int) string WordWrap wraps a string to a given line width. Warning: it may break the string. You need to check the result. -## func [Wrap]() +## func [Wrap]() ```go func Wrap(src, above, below string) string @@ -179,7 +179,7 @@ func Wrap(src, above, below string) string Wrap wraps a string with a string above and below. It will respect the indentation of the src string. -## type [EnvConfig]() +## type [EnvConfig]() EnvConfig is a struct to hold the description of an environment variable. @@ -191,7 +191,7 @@ type EnvConfig struct { ``` -## type [Icon]() +## type [Icon]() Icon is a unicode icon diff --git a/doc/mkdocs.yml b/doc/mkdocs.yml index 6d35a14..f81b11c 100644 --- a/doc/mkdocs.yml +++ b/doc/mkdocs.yml @@ -63,12 +63,12 @@ nav: - FAQ: faq.md - Go Packages: - packages/cmd/katenary.md - - packages/parser.md - - packages/utils.md + - packages/internal/parser.md + - packages/internal/utils.md - Generator: - - Index: packages/generator.md - - ExtraFiles: packages/generator/extrafiles.md + - Index: packages/internal/generator.md + - ExtraFiles: packages/internal/generator/extrafiles.md - labels: - - packages/generator/labels.md - - Labelstructs: packages/generator/labels/labelstructs.md - - KatenaryFile: packages/generator/katenaryfile.md + - packages/internal/generator/labels.md + - Labelstructs: packages/internal/generator/labels/labelstructs.md + - KatenaryFile: packages/internal/generator/katenaryfile.md diff --git a/go.mod b/go.mod index 5bffa26..c31cef4 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module katenary // github.com/katenay/katenary +module github.com/katenary/katenary go 1.24.0 diff --git a/generator/chart.go b/internal/generator/chart.go similarity index 98% rename from generator/chart.go rename to internal/generator/chart.go index 8bfa65e..39512a6 100644 --- a/generator/chart.go +++ b/internal/generator/chart.go @@ -2,9 +2,6 @@ package generator import ( "fmt" - "katenary/generator/labels" - "katenary/generator/labels/labelstructs" - "katenary/utils" "log" "maps" "os" @@ -12,6 +9,10 @@ import ( "slices" "strings" + "github.com/katenary/katenary/internal/generator/labels" + "github.com/katenary/katenary/internal/generator/labels/labelstructs" + "github.com/katenary/katenary/internal/utils" + "github.com/compose-spec/compose-go/types" corev1 "k8s.io/api/core/v1" ) diff --git a/generator/chart_test.go b/internal/generator/chart_test.go similarity index 98% rename from generator/chart_test.go rename to internal/generator/chart_test.go index dde6a54..0b9b209 100644 --- a/generator/chart_test.go +++ b/internal/generator/chart_test.go @@ -2,11 +2,12 @@ package generator import ( "fmt" - "katenary/generator/labels" "os" "strings" "testing" + "github.com/katenary/katenary/internal/generator/labels" + appsv1 "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" "sigs.k8s.io/yaml" diff --git a/generator/configMap.go b/internal/generator/configMap.go similarity index 97% rename from generator/configMap.go rename to internal/generator/configMap.go index d7fedf5..804cdba 100644 --- a/generator/configMap.go +++ b/internal/generator/configMap.go @@ -2,9 +2,9 @@ package generator import ( "fmt" - "katenary/generator/labels" - "katenary/generator/labels/labelstructs" - "katenary/utils" + "github.com/katenary/katenary/internal/generator/labels" + "github.com/katenary/katenary/internal/generator/labels/labelstructs" + "github.com/katenary/katenary/internal/utils" "log" "os" "path/filepath" diff --git a/generator/configMap_test.go b/internal/generator/configMap_test.go similarity index 98% rename from generator/configMap_test.go rename to internal/generator/configMap_test.go index 47d5680..3efd83a 100644 --- a/generator/configMap_test.go +++ b/internal/generator/configMap_test.go @@ -3,7 +3,7 @@ package generator import ( "fmt" "io" - "katenary/generator/labels" + "github.com/katenary/katenary/internal/generator/labels" "os" "regexp" "testing" diff --git a/generator/converter.go b/internal/generator/converter.go similarity index 98% rename from generator/converter.go rename to internal/generator/converter.go index 52f9451..274fc71 100644 --- a/generator/converter.go +++ b/internal/generator/converter.go @@ -4,12 +4,6 @@ import ( "bytes" "errors" "fmt" - "katenary/generator/extrafiles" - "katenary/generator/katenaryfile" - "katenary/generator/labels" - "katenary/generator/labels/labelstructs" - "katenary/parser" - "katenary/utils" "log" "os" "os/exec" @@ -18,6 +12,13 @@ import ( "strings" "time" + "github.com/katenary/katenary/internal/generator/extrafiles" + "github.com/katenary/katenary/internal/generator/katenaryfile" + "github.com/katenary/katenary/internal/generator/labels" + "github.com/katenary/katenary/internal/generator/labels/labelstructs" + "github.com/katenary/katenary/internal/parser" + "github.com/katenary/katenary/internal/utils" + "github.com/compose-spec/compose-go/types" ) diff --git a/generator/cronJob.go b/internal/generator/cronJob.go similarity index 94% rename from generator/cronJob.go rename to internal/generator/cronJob.go index 0c33c9f..a762733 100644 --- a/generator/cronJob.go +++ b/internal/generator/cronJob.go @@ -1,9 +1,9 @@ package generator import ( - "katenary/generator/labels" - "katenary/generator/labels/labelstructs" - "katenary/utils" + "github.com/katenary/katenary/internal/generator/labels" + "github.com/katenary/katenary/internal/generator/labels/labelstructs" + "github.com/katenary/katenary/internal/utils" "log" "strings" diff --git a/generator/cronJob_test.go b/internal/generator/cronJob_test.go similarity index 100% rename from generator/cronJob_test.go rename to internal/generator/cronJob_test.go diff --git a/generator/deployment.go b/internal/generator/deployment.go similarity index 99% rename from generator/deployment.go rename to internal/generator/deployment.go index 37abd0e..6cf03cb 100644 --- a/generator/deployment.go +++ b/internal/generator/deployment.go @@ -2,9 +2,9 @@ package generator import ( "fmt" - "katenary/generator/labels" - "katenary/generator/labels/labelstructs" - "katenary/utils" + "github.com/katenary/katenary/internal/generator/labels" + "github.com/katenary/katenary/internal/generator/labels/labelstructs" + "github.com/katenary/katenary/internal/utils" "log" "os" "path/filepath" diff --git a/generator/deployment_test.go b/internal/generator/deployment_test.go similarity index 99% rename from generator/deployment_test.go rename to internal/generator/deployment_test.go index 6139629..d16123f 100644 --- a/generator/deployment_test.go +++ b/internal/generator/deployment_test.go @@ -2,7 +2,7 @@ package generator import ( "fmt" - "katenary/generator/labels" + "github.com/katenary/katenary/internal/generator/labels" "os" "strings" "testing" diff --git a/generator/doc.go b/internal/generator/doc.go similarity index 100% rename from generator/doc.go rename to internal/generator/doc.go diff --git a/generator/extrafiles/doc.go b/internal/generator/extrafiles/doc.go similarity index 100% rename from generator/extrafiles/doc.go rename to internal/generator/extrafiles/doc.go diff --git a/generator/extrafiles/notes.go b/internal/generator/extrafiles/notes.go similarity index 100% rename from generator/extrafiles/notes.go rename to internal/generator/extrafiles/notes.go diff --git a/generator/extrafiles/notes.tpl b/internal/generator/extrafiles/notes.tpl similarity index 100% rename from generator/extrafiles/notes.tpl rename to internal/generator/extrafiles/notes.tpl diff --git a/generator/extrafiles/notes_test.go b/internal/generator/extrafiles/notes_test.go similarity index 100% rename from generator/extrafiles/notes_test.go rename to internal/generator/extrafiles/notes_test.go diff --git a/generator/extrafiles/readme.go b/internal/generator/extrafiles/readme.go similarity index 100% rename from generator/extrafiles/readme.go rename to internal/generator/extrafiles/readme.go diff --git a/generator/extrafiles/readme.tpl b/internal/generator/extrafiles/readme.tpl similarity index 100% rename from generator/extrafiles/readme.tpl rename to internal/generator/extrafiles/readme.tpl diff --git a/generator/extrafiles/readme_test.go b/internal/generator/extrafiles/readme_test.go similarity index 100% rename from generator/extrafiles/readme_test.go rename to internal/generator/extrafiles/readme_test.go diff --git a/generator/generator.go b/internal/generator/generator.go similarity index 98% rename from generator/generator.go rename to internal/generator/generator.go index 109e61b..fdbd0d6 100644 --- a/generator/generator.go +++ b/internal/generator/generator.go @@ -3,13 +3,14 @@ package generator import ( "bytes" "fmt" - "katenary/generator/labels" - "katenary/generator/labels/labelstructs" - "katenary/utils" "log" "regexp" "strings" + "github.com/katenary/katenary/internal/generator/labels" + "github.com/katenary/katenary/internal/generator/labels/labelstructs" + "github.com/katenary/katenary/internal/utils" + "github.com/compose-spec/compose-go/types" corev1 "k8s.io/api/core/v1" "sigs.k8s.io/yaml" diff --git a/generator/globals.go b/internal/generator/globals.go similarity index 88% rename from generator/globals.go rename to internal/generator/globals.go index 6c313fd..5751682 100644 --- a/generator/globals.go +++ b/internal/generator/globals.go @@ -1,8 +1,9 @@ package generator import ( - "katenary/generator/labels" "regexp" + + "github.com/katenary/katenary/internal/generator/labels" ) var ( diff --git a/generator/helmHelper.tpl b/internal/generator/helmHelper.tpl similarity index 100% rename from generator/helmHelper.tpl rename to internal/generator/helmHelper.tpl diff --git a/generator/helper.go b/internal/generator/helper.go similarity index 89% rename from generator/helper.go rename to internal/generator/helper.go index 2494d93..5c43bce 100644 --- a/generator/helper.go +++ b/internal/generator/helper.go @@ -2,7 +2,7 @@ package generator import ( _ "embed" - "katenary/generator/labels" + "github.com/katenary/katenary/internal/generator/labels" "strings" ) diff --git a/generator/ingress.go b/internal/generator/ingress.go similarity index 96% rename from generator/ingress.go rename to internal/generator/ingress.go index 31d9ed9..0831fa1 100644 --- a/generator/ingress.go +++ b/internal/generator/ingress.go @@ -1,12 +1,13 @@ package generator import ( - "katenary/generator/labels" - "katenary/generator/labels/labelstructs" - "katenary/utils" "log" "strings" + "github.com/katenary/katenary/internal/generator/labels" + "github.com/katenary/katenary/internal/generator/labels/labelstructs" + "github.com/katenary/katenary/internal/utils" + "github.com/compose-spec/compose-go/types" networkv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/generator/ingress_test.go b/internal/generator/ingress_test.go similarity index 98% rename from generator/ingress_test.go rename to internal/generator/ingress_test.go index 506d86c..be4a341 100644 --- a/generator/ingress_test.go +++ b/internal/generator/ingress_test.go @@ -2,7 +2,7 @@ package generator import ( "fmt" - "katenary/generator/labels" + "github.com/katenary/katenary/internal/generator/labels" "os" "testing" diff --git a/generator/katenaryfile/doc.go b/internal/generator/katenaryfile/doc.go similarity index 100% rename from generator/katenaryfile/doc.go rename to internal/generator/katenaryfile/doc.go diff --git a/generator/katenaryfile/main.go b/internal/generator/katenaryfile/main.go similarity index 97% rename from generator/katenaryfile/main.go rename to internal/generator/katenaryfile/main.go index 8b276c0..909d681 100644 --- a/generator/katenaryfile/main.go +++ b/internal/generator/katenaryfile/main.go @@ -4,9 +4,9 @@ import ( "bytes" "encoding/json" "fmt" - "katenary/generator/labels" - "katenary/generator/labels/labelstructs" - "katenary/utils" + "github.com/katenary/katenary/internal/generator/labels" + "github.com/katenary/katenary/internal/generator/labels/labelstructs" + "github.com/katenary/katenary/internal/utils" "log" "os" "reflect" diff --git a/generator/katenaryfile/main_test.go b/internal/generator/katenaryfile/main_test.go similarity index 98% rename from generator/katenaryfile/main_test.go rename to internal/generator/katenaryfile/main_test.go index 8b71e9b..d84e283 100644 --- a/generator/katenaryfile/main_test.go +++ b/internal/generator/katenaryfile/main_test.go @@ -1,7 +1,7 @@ package katenaryfile import ( - "katenary/generator/labels" + "github.com/katenary/katenary/internal/generator/labels" "log" "os" "path/filepath" diff --git a/generator/labels.go b/internal/generator/labels.go similarity index 94% rename from generator/labels.go rename to internal/generator/labels.go index 188b84a..7a83595 100644 --- a/generator/labels.go +++ b/internal/generator/labels.go @@ -2,7 +2,7 @@ package generator import ( "fmt" - "katenary/generator/labels" + "github.com/katenary/katenary/internal/generator/labels" ) var componentLabel = labels.LabelName("component") diff --git a/generator/labels/doc.go b/internal/generator/labels/doc.go similarity index 100% rename from generator/labels/doc.go rename to internal/generator/labels/doc.go diff --git a/generator/labels/help-template.md.tpl b/internal/generator/labels/help-template.md.tpl similarity index 100% rename from generator/labels/help-template.md.tpl rename to internal/generator/labels/help-template.md.tpl diff --git a/generator/labels/help-template.tpl b/internal/generator/labels/help-template.tpl similarity index 100% rename from generator/labels/help-template.tpl rename to internal/generator/labels/help-template.tpl diff --git a/generator/labels/katenaryLabels.go b/internal/generator/labels/katenaryLabels.go similarity index 99% rename from generator/labels/katenaryLabels.go rename to internal/generator/labels/katenaryLabels.go index c926fc5..32b66ce 100644 --- a/generator/labels/katenaryLabels.go +++ b/internal/generator/labels/katenaryLabels.go @@ -4,7 +4,7 @@ import ( "bytes" _ "embed" "fmt" - "katenary/utils" + "github.com/katenary/katenary/internal/utils" "log" "regexp" "sort" diff --git a/generator/labels/katenaryLabelsDoc.yaml b/internal/generator/labels/katenaryLabelsDoc.yaml similarity index 100% rename from generator/labels/katenaryLabelsDoc.yaml rename to internal/generator/labels/katenaryLabelsDoc.yaml diff --git a/generator/labels/katenaryLabels_test.go b/internal/generator/labels/katenaryLabels_test.go similarity index 100% rename from generator/labels/katenaryLabels_test.go rename to internal/generator/labels/katenaryLabels_test.go diff --git a/generator/labels/labelstructs/configMap.go b/internal/generator/labels/labelstructs/configMap.go similarity index 100% rename from generator/labels/labelstructs/configMap.go rename to internal/generator/labels/labelstructs/configMap.go diff --git a/generator/labels/labelstructs/configMap_test.go b/internal/generator/labels/labelstructs/configMap_test.go similarity index 83% rename from generator/labels/labelstructs/configMap_test.go rename to internal/generator/labels/labelstructs/configMap_test.go index 55f11f2..22efabe 100644 --- a/generator/labels/labelstructs/configMap_test.go +++ b/internal/generator/labels/labelstructs/configMap_test.go @@ -1,7 +1,7 @@ package labelstructs_test import ( - "katenary/generator/labels/labelstructs" + "github.com/katenary/katenary/internal/generator/labels/labelstructs" "testing" ) diff --git a/generator/labels/labelstructs/cronJob.go b/internal/generator/labels/labelstructs/cronJob.go similarity index 100% rename from generator/labels/labelstructs/cronJob.go rename to internal/generator/labels/labelstructs/cronJob.go diff --git a/generator/labels/labelstructs/cronJob_test.go b/internal/generator/labels/labelstructs/cronJob_test.go similarity index 100% rename from generator/labels/labelstructs/cronJob_test.go rename to internal/generator/labels/labelstructs/cronJob_test.go diff --git a/generator/labels/labelstructs/dependencies.go b/internal/generator/labels/labelstructs/dependencies.go similarity index 100% rename from generator/labels/labelstructs/dependencies.go rename to internal/generator/labels/labelstructs/dependencies.go diff --git a/generator/labels/labelstructs/dependencies_test.go b/internal/generator/labels/labelstructs/dependencies_test.go similarity index 100% rename from generator/labels/labelstructs/dependencies_test.go rename to internal/generator/labels/labelstructs/dependencies_test.go diff --git a/generator/labels/labelstructs/doc.go b/internal/generator/labels/labelstructs/doc.go similarity index 100% rename from generator/labels/labelstructs/doc.go rename to internal/generator/labels/labelstructs/doc.go diff --git a/generator/labels/labelstructs/envFrom.go b/internal/generator/labels/labelstructs/envFrom.go similarity index 100% rename from generator/labels/labelstructs/envFrom.go rename to internal/generator/labels/labelstructs/envFrom.go diff --git a/generator/labels/labelstructs/envFrom_test.go b/internal/generator/labels/labelstructs/envFrom_test.go similarity index 100% rename from generator/labels/labelstructs/envFrom_test.go rename to internal/generator/labels/labelstructs/envFrom_test.go diff --git a/generator/labels/labelstructs/exchangeVolume.go b/internal/generator/labels/labelstructs/exchangeVolume.go similarity index 100% rename from generator/labels/labelstructs/exchangeVolume.go rename to internal/generator/labels/labelstructs/exchangeVolume.go diff --git a/generator/labels/labelstructs/exchangeVolume_test.go b/internal/generator/labels/labelstructs/exchangeVolume_test.go similarity index 100% rename from generator/labels/labelstructs/exchangeVolume_test.go rename to internal/generator/labels/labelstructs/exchangeVolume_test.go diff --git a/generator/labels/labelstructs/ingress.go b/internal/generator/labels/labelstructs/ingress.go similarity index 96% rename from generator/labels/labelstructs/ingress.go rename to internal/generator/labels/labelstructs/ingress.go index b7285cb..30ba0fa 100644 --- a/generator/labels/labelstructs/ingress.go +++ b/internal/generator/labels/labelstructs/ingress.go @@ -2,7 +2,7 @@ package labelstructs import ( "fmt" - "katenary/utils" + "github.com/katenary/katenary/internal/utils" "gopkg.in/yaml.v3" ) diff --git a/generator/labels/labelstructs/ingress_test.go b/internal/generator/labels/labelstructs/ingress_test.go similarity index 100% rename from generator/labels/labelstructs/ingress_test.go rename to internal/generator/labels/labelstructs/ingress_test.go diff --git a/generator/labels/labelstructs/mapenv.go b/internal/generator/labels/labelstructs/mapenv.go similarity index 100% rename from generator/labels/labelstructs/mapenv.go rename to internal/generator/labels/labelstructs/mapenv.go diff --git a/generator/labels/labelstructs/mapenv_test.go b/internal/generator/labels/labelstructs/mapenv_test.go similarity index 100% rename from generator/labels/labelstructs/mapenv_test.go rename to internal/generator/labels/labelstructs/mapenv_test.go diff --git a/generator/labels/labelstructs/ports.go b/internal/generator/labels/labelstructs/ports.go similarity index 100% rename from generator/labels/labelstructs/ports.go rename to internal/generator/labels/labelstructs/ports.go diff --git a/generator/labels/labelstructs/ports_test.go b/internal/generator/labels/labelstructs/ports_test.go similarity index 100% rename from generator/labels/labelstructs/ports_test.go rename to internal/generator/labels/labelstructs/ports_test.go diff --git a/generator/labels/labelstructs/probes.go b/internal/generator/labels/labelstructs/probes.go similarity index 100% rename from generator/labels/labelstructs/probes.go rename to internal/generator/labels/labelstructs/probes.go diff --git a/generator/labels/labelstructs/probes_test.go b/internal/generator/labels/labelstructs/probes_test.go similarity index 100% rename from generator/labels/labelstructs/probes_test.go rename to internal/generator/labels/labelstructs/probes_test.go diff --git a/generator/labels/labelstructs/secrets.go b/internal/generator/labels/labelstructs/secrets.go similarity index 100% rename from generator/labels/labelstructs/secrets.go rename to internal/generator/labels/labelstructs/secrets.go diff --git a/generator/labels/labelstructs/secrets_test.go b/internal/generator/labels/labelstructs/secrets_test.go similarity index 100% rename from generator/labels/labelstructs/secrets_test.go rename to internal/generator/labels/labelstructs/secrets_test.go diff --git a/generator/labels/labelstructs/valueFrom.go b/internal/generator/labels/labelstructs/valueFrom.go similarity index 100% rename from generator/labels/labelstructs/valueFrom.go rename to internal/generator/labels/labelstructs/valueFrom.go diff --git a/generator/labels/labelstructs/valueFrom_test.go b/internal/generator/labels/labelstructs/valueFrom_test.go similarity index 100% rename from generator/labels/labelstructs/valueFrom_test.go rename to internal/generator/labels/labelstructs/valueFrom_test.go diff --git a/generator/rbac.go b/internal/generator/rbac.go similarity index 98% rename from generator/rbac.go rename to internal/generator/rbac.go index b2495b0..1dbd52f 100644 --- a/generator/rbac.go +++ b/internal/generator/rbac.go @@ -1,7 +1,7 @@ package generator import ( - "katenary/utils" + "github.com/katenary/katenary/internal/utils" "github.com/compose-spec/compose-go/types" corev1 "k8s.io/api/core/v1" diff --git a/generator/secret.go b/internal/generator/secret.go similarity index 96% rename from generator/secret.go rename to internal/generator/secret.go index 7f67bd7..588a3ea 100644 --- a/generator/secret.go +++ b/internal/generator/secret.go @@ -2,8 +2,8 @@ package generator import ( "encoding/base64" - "katenary/generator/labels" - "katenary/utils" + "github.com/katenary/katenary/internal/generator/labels" + "github.com/katenary/katenary/internal/utils" "strings" "github.com/compose-spec/compose-go/types" diff --git a/generator/secret_test.go b/internal/generator/secret_test.go similarity index 97% rename from generator/secret_test.go rename to internal/generator/secret_test.go index 62dae1f..3a43cdf 100644 --- a/generator/secret_test.go +++ b/internal/generator/secret_test.go @@ -3,7 +3,7 @@ package generator import ( "bytes" "fmt" - "katenary/generator/labels" + "github.com/katenary/katenary/internal/generator/labels" "os" "testing" diff --git a/generator/service.go b/internal/generator/service.go similarity index 97% rename from generator/service.go rename to internal/generator/service.go index 2070641..9290006 100644 --- a/generator/service.go +++ b/internal/generator/service.go @@ -2,7 +2,7 @@ package generator import ( "fmt" - "katenary/utils" + "github.com/katenary/katenary/internal/utils" "regexp" "strings" diff --git a/generator/service_test.go b/internal/generator/service_test.go similarity index 100% rename from generator/service_test.go rename to internal/generator/service_test.go diff --git a/generator/tools_test.go b/internal/generator/tools_test.go similarity index 97% rename from generator/tools_test.go rename to internal/generator/tools_test.go index 66d586e..232ef84 100644 --- a/generator/tools_test.go +++ b/internal/generator/tools_test.go @@ -1,11 +1,12 @@ package generator import ( - "katenary/parser" "log" "os" "os/exec" "testing" + + "github.com/katenary/katenary/internal/parser" ) const unmarshalError = "Failed to unmarshal the output: %s" diff --git a/generator/types.go b/internal/generator/types.go similarity index 100% rename from generator/types.go rename to internal/generator/types.go diff --git a/generator/utils.go b/internal/generator/utils.go similarity index 93% rename from generator/utils.go rename to internal/generator/utils.go index 51feb08..73198d1 100644 --- a/generator/utils.go +++ b/internal/generator/utils.go @@ -1,13 +1,14 @@ package generator import ( - "katenary/generator/labels" - "katenary/generator/labels/labelstructs" - "katenary/utils" "regexp" "strconv" "strings" + "github.com/katenary/katenary/internal/generator/labels" + "github.com/katenary/katenary/internal/generator/labels/labelstructs" + "github.com/katenary/katenary/internal/utils" + "github.com/compose-spec/compose-go/types" corev1 "k8s.io/api/core/v1" "sigs.k8s.io/yaml" diff --git a/generator/utils_test.go b/internal/generator/utils_test.go similarity index 95% rename from generator/utils_test.go rename to internal/generator/utils_test.go index f6a92f6..97399b6 100644 --- a/generator/utils_test.go +++ b/internal/generator/utils_test.go @@ -2,8 +2,8 @@ package generator import ( "fmt" - "katenary/generator/labels" - "katenary/utils" + "github.com/katenary/katenary/internal/generator/labels" + "github.com/katenary/katenary/internal/utils" "os" "path/filepath" "testing" diff --git a/generator/values.go b/internal/generator/values.go similarity index 100% rename from generator/values.go rename to internal/generator/values.go diff --git a/generator/version.go b/internal/generator/version.go similarity index 100% rename from generator/version.go rename to internal/generator/version.go diff --git a/generator/version_test.go b/internal/generator/version_test.go similarity index 100% rename from generator/version_test.go rename to internal/generator/version_test.go diff --git a/generator/volume.go b/internal/generator/volume.go similarity index 98% rename from generator/volume.go rename to internal/generator/volume.go index 71711a0..3585a4e 100644 --- a/generator/volume.go +++ b/internal/generator/volume.go @@ -1,7 +1,7 @@ package generator import ( - "katenary/utils" + "github.com/katenary/katenary/internal/utils" "strings" "github.com/compose-spec/compose-go/types" diff --git a/generator/volume_test.go b/internal/generator/volume_test.go similarity index 98% rename from generator/volume_test.go rename to internal/generator/volume_test.go index 8f0b78a..cc63a0d 100644 --- a/generator/volume_test.go +++ b/internal/generator/volume_test.go @@ -5,8 +5,8 @@ import ( "image" "image/color" "image/png" - "katenary/generator/labels" - "katenary/utils" + "github.com/katenary/katenary/internal/generator/labels" + "github.com/katenary/katenary/internal/utils" "log" "os" "path/filepath" diff --git a/parser/main.go b/internal/parser/main.go similarity index 100% rename from parser/main.go rename to internal/parser/main.go diff --git a/parser/main_test.go b/internal/parser/main_test.go similarity index 100% rename from parser/main_test.go rename to internal/parser/main_test.go diff --git a/utils/doc.go b/internal/utils/doc.go similarity index 100% rename from utils/doc.go rename to internal/utils/doc.go diff --git a/utils/hash.go b/internal/utils/hash.go similarity index 100% rename from utils/hash.go rename to internal/utils/hash.go diff --git a/utils/hash_test.go b/internal/utils/hash_test.go similarity index 100% rename from utils/hash_test.go rename to internal/utils/hash_test.go diff --git a/utils/icons.go b/internal/utils/icons.go similarity index 100% rename from utils/icons.go rename to internal/utils/icons.go diff --git a/utils/utils.go b/internal/utils/utils.go similarity index 100% rename from utils/utils.go rename to internal/utils/utils.go diff --git a/utils/utils_test.go b/internal/utils/utils_test.go similarity index 100% rename from utils/utils_test.go rename to internal/utils/utils_test.go