Compare commits
1 Commits
feature/be
...
33e74b9758
| Author | SHA1 | Date | |
|---|---|---|---|
|
33e74b9758
|
@@ -67,7 +67,7 @@ jobs:
|
|||||||
echo "Building binary version $VERSION"
|
echo "Building binary version $VERSION"
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
GOARCH=${{ matrix.goarch }} GOOS=${{ matrix.goos }}\
|
GOARCH=${{ matrix.goarch }} GOOS=${{ matrix.goos }}\
|
||||||
go build -ldflags="-X 'repo.katenary.io/katenary/katenary/internal/generator.Version=v$VERSION'" \
|
go build -ldflags="-X 'repo.katenary.io/katenary/katenary/internal/generator.Version=$VERSION'" \
|
||||||
-trimpath -o dist/katenary-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/katenary
|
-trimpath -o dist/katenary-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/katenary
|
||||||
|
|
||||||
- name: Package (Linux)
|
- name: Package (Linux)
|
||||||
|
|||||||
@@ -18,21 +18,12 @@ jobs:
|
|||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- name: Extract version and image name
|
- name: Extract version
|
||||||
run: |
|
run: |
|
||||||
# remove "releases/"
|
|
||||||
VERSION="${VERSION#releases/}"
|
VERSION="${VERSION#releases/}"
|
||||||
# set image name to lower case
|
|
||||||
IMAGE_NAME="${IMAGE_NAME,,}"
|
|
||||||
|
|
||||||
echo "Exporting variable VERSION=$VERSION"
|
echo "Exporting variable VERSION=$VERSION"
|
||||||
echo "Exporting variable IMAGE_NAME=$IMAGE_NAME"
|
|
||||||
|
|
||||||
echo "VERSION=$VERSION" >> $GITEA_OUTPUT
|
echo "VERSION=$VERSION" >> $GITEA_OUTPUT
|
||||||
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITEA_OUTPUT
|
|
||||||
|
|
||||||
echo "VERSION=$VERSION" >> $GITEA_ENV
|
echo "VERSION=$VERSION" >> $GITEA_ENV
|
||||||
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITEA_ENV
|
|
||||||
|
|
||||||
- name: Install Buildah
|
- name: Install Buildah
|
||||||
run: |-
|
run: |-
|
||||||
@@ -53,12 +44,12 @@ jobs:
|
|||||||
|
|
||||||
- name: Build and tag
|
- name: Build and tag
|
||||||
run: |-
|
run: |-
|
||||||
echo "Building image ${REGISTRY}/${IMAGE_NAME}:${VERSION} / latest"
|
echo "Building image $REGISTRY/${IMAGE_NAME,,}:$VERSION / latest"
|
||||||
buildah build --isolation=chroot --build-arg VERSION=${VERSION} -t katenary -f ./oci/katenary/Containerfile .
|
buildah build --isolation=chroot --build-arg VERSION=$VERSION -t katenary -f ./oci/katenary/Containerfile .
|
||||||
buildah tag katenary ${REGISTRY}/${IMAGE_NAME}:${VERSION}
|
buildah tag katenary $REGISTRY/${IMAGE_NAME,,}:$VERSION
|
||||||
buildah tag katenary ${REGISTRY}/${IMAGE_NAME}:latest
|
buildah tag katenary $REGISTRY/${IMAGE_NAME,,}:latest
|
||||||
|
|
||||||
- name: Push image
|
- name: Push image
|
||||||
run: |-
|
run: |-
|
||||||
buildah push ${REGISTRY}/${IMAGE_NAME}:${VERSION}
|
buildah push $REGISTRY/${IMAGE_NAME,,}:$VERSION
|
||||||
buildah push ${REGISTRY}/${IMAGE_NAME}:latest
|
buildah push $REGISTRY/${IMAGE_NAME,,}:latest
|
||||||
|
|||||||
@@ -5,18 +5,10 @@ on:
|
|||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
- edited
|
- edited
|
||||||
paths-ignore:
|
|
||||||
- "doc/**"
|
|
||||||
- "README.md"
|
|
||||||
- "*.sh"
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "master"
|
- "master"
|
||||||
- "main"
|
- "main"
|
||||||
paths-ignore:
|
|
||||||
- "doc/**"
|
|
||||||
- "README.md"
|
|
||||||
- "*.sh"
|
|
||||||
env:
|
env:
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
|
||||||
@@ -41,9 +33,7 @@ jobs:
|
|||||||
- name: Launch Test
|
- name: Launch Test
|
||||||
run: |
|
run: |
|
||||||
go vet ./...
|
go vet ./...
|
||||||
go test -tags ci -coverprofile=coverprofile.out -v ./...
|
go test -coverprofile=coverprofile.out -json -v ./... > gotest.json
|
||||||
go test -tags ci -coverprofile=coverprofile.out -json -v ./... > gotest.json
|
|
||||||
go tool cover -func=coverprofile.out
|
|
||||||
# - uses: actions/upload-artifact@v4
|
# - uses: actions/upload-artifact@v4
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: christopherhx/gitea-upload-artifact@v4
|
uses: christopherhx/gitea-upload-artifact@v4
|
||||||
|
|||||||
@@ -6,16 +6,16 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"katenary.io/internal/generator"
|
"katenary.io/internal/generator"
|
||||||
"katenary.io/internal/generator/katenaryfile"
|
"katenary.io/internal/generator/katenaryfile"
|
||||||
"katenary.io/internal/generator/labels"
|
"katenary.io/internal/generator/labels"
|
||||||
"katenary.io/internal/logger"
|
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/cli"
|
"github.com/compose-spec/compose-go/cli"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ func main() {
|
|||||||
rootCmd := buildRootCmd()
|
rootCmd := buildRootCmd()
|
||||||
|
|
||||||
if err := rootCmd.Execute(); err != nil {
|
if err := rootCmd.Execute(); err != nil {
|
||||||
logger.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,11 +146,11 @@ func generateConvertCommand() *cobra.Command {
|
|||||||
convertCmd := &cobra.Command{
|
convertCmd := &cobra.Command{
|
||||||
Use: "convert",
|
Use: "convert",
|
||||||
Short: "Converts a docker-compose file to a Helm Chart",
|
Short: "Converts a docker-compose file to a Helm Chart",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if len(strings.TrimSpace(givenAppVersion)) > 0 {
|
if len(strings.TrimSpace(givenAppVersion)) > 0 {
|
||||||
appVersion = &givenAppVersion
|
appVersion = &givenAppVersion
|
||||||
}
|
}
|
||||||
if err := generator.Convert(generator.ConvertOptions{
|
return generator.Convert(generator.ConvertOptions{
|
||||||
Force: force,
|
Force: force,
|
||||||
OutputDir: outputDir,
|
OutputDir: outputDir,
|
||||||
Profiles: profiles,
|
Profiles: profiles,
|
||||||
@@ -159,9 +159,7 @@ func generateConvertCommand() *cobra.Command {
|
|||||||
ChartVersion: chartVersion,
|
ChartVersion: chartVersion,
|
||||||
Icon: icon,
|
Icon: icon,
|
||||||
EnvFiles: envFiles,
|
EnvFiles: envFiles,
|
||||||
}, dockerComposeFile...); err != nil {
|
}, dockerComposeFile...)
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ tested some concepts.
|
|||||||
You can help us in many ways.
|
You can help us in many ways.
|
||||||
|
|
||||||
- The first things we really need, more than money, more than anything else, is to have feedback. If you use Katenary,
|
- The first things we really need, more than money, more than anything else, is to have feedback. If you use Katenary,
|
||||||
if you have some issues, if you have some ideas, please open an issue on [our repository](https://repo.katenary.io/Katenary/katenary).
|
if you have some issues, if you have some ideas, please open an issue on the [GitHub repository](https://github.com/Katenary/katenary).
|
||||||
- The second thing is to help us to fix issues. If you're a Go developer, or if you want to fix the documentation,
|
- The second thing is to help us to fix issues. If you're a Go developer, or if you want to fix the documentation,
|
||||||
your help is greatly appreciated.
|
your help is greatly appreciated.
|
||||||
- And then, of course, we need money, or sponsors.
|
- And then, of course, we need money, or sponsors.
|
||||||
@@ -88,8 +88,6 @@ You can help us in many ways.
|
|||||||
We will be happy to communicate your help by putting your logo on the website and in the documentation. You can sponsor
|
We will be happy to communicate your help by putting your logo on the website and in the documentation. You can sponsor
|
||||||
us by giving us some money, or by giving us some time of your developers, or leaving us some time to work on the project.
|
us by giving us some money, or by giving us some time of your developers, or leaving us some time to work on the project.
|
||||||
|
|
||||||
Please, contact us by email at [contact at katenary dot io](mailto:contact@katenary.io).
|
|
||||||
|
|
||||||
### If you're an individual
|
### If you're an individual
|
||||||
|
|
||||||
All main contributors[^3] will be listed on the website and in the documentation.
|
All main contributors[^3] will be listed on the website and in the documentation.
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ Katenary will try to _Unmarshal_ these labels.
|
|||||||
| `katenary.v3/configmap-files` | Inject files as Configmap. | `[]string` |
|
| `katenary.v3/configmap-files` | Inject files as Configmap. | `[]string` |
|
||||||
| `katenary.v3/cronjob` | Create a cronjob from the service. | `object` |
|
| `katenary.v3/cronjob` | Create a cronjob from the service. | `object` |
|
||||||
| `katenary.v3/dependencies` | Add Helm dependencies to the service. | `[]object` |
|
| `katenary.v3/dependencies` | Add Helm dependencies to the service. | `[]object` |
|
||||||
| `katenary.v3/depends-on` | Method to check if a service is ready (for depends_on). | `string` |
|
|
||||||
| `katenary.v3/description` | Description of the service | `string` |
|
| `katenary.v3/description` | Description of the service | `string` |
|
||||||
| `katenary.v3/env-from` | Add environment variables from another service. | `[]string` |
|
| `katenary.v3/env-from` | Add environment variables from another service. | `[]string` |
|
||||||
| `katenary.v3/exchange-volumes` | Add exchange volumes (empty directory on the node) to share data | `[]object` |
|
| `katenary.v3/exchange-volumes` | Add exchange volumes (empty directory on the node) to share data | `[]object` |
|
||||||
@@ -145,45 +144,6 @@ labels:
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### katenary.v3/depends-on
|
|
||||||
|
|
||||||
Method to check if a service is ready (for depends_on).
|
|
||||||
|
|
||||||
**Type**: `string`
|
|
||||||
|
|
||||||
When a service uses `depends_on`, Katenary creates an initContainer to wait
|
|
||||||
for the dependent service to be ready.
|
|
||||||
|
|
||||||
By default, Katenary uses the Kubernetes API to check if the service endpoint
|
|
||||||
has ready addresses. This method does not require the service to expose a port
|
|
||||||
and does not create a Kubernetes Service automatically.
|
|
||||||
|
|
||||||
If you need to create a Kubernetes Service for external access, use the
|
|
||||||
`katenary.v3/ports` label instead.
|
|
||||||
|
|
||||||
Set this label to `legacy` to use the old netcat method that requires a port
|
|
||||||
to be defined for the dependent service.
|
|
||||||
|
|
||||||
**Example:**
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
web:
|
|
||||||
image: nginx
|
|
||||||
depends_on:
|
|
||||||
- database
|
|
||||||
labels:
|
|
||||||
# Use legacy netcat method (requires port)
|
|
||||||
katenary.v3/depends-on: legacy
|
|
||||||
|
|
||||||
database:
|
|
||||||
image: mysql
|
|
||||||
labels:
|
|
||||||
# Create a Kubernetes Service for external access
|
|
||||||
katenary.v3/ports:
|
|
||||||
- 3306
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### katenary.v3/description
|
### katenary.v3/description
|
||||||
|
|
||||||
Description of the service
|
Description of the service
|
||||||
@@ -392,12 +352,7 @@ Ports to be added to the service.
|
|||||||
**Type**: `[]uint32`
|
**Type**: `[]uint32`
|
||||||
|
|
||||||
Only useful for services without exposed port. It is mandatory if the
|
Only useful for services without exposed port. It is mandatory if the
|
||||||
service is a dependency of another service AND you want to create a
|
service is a dependency of another service.
|
||||||
Kubernetes Service for external access.
|
|
||||||
|
|
||||||
If you only need to check if the service is ready (using depends_on),
|
|
||||||
you don't need to declare ports. The service will not be created automatically
|
|
||||||
unless you add this label.
|
|
||||||
|
|
||||||
**Example:**
|
**Example:**
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ var Version = "master" // changed at compile time
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="Convert"></a>
|
<a name="Convert"></a>
|
||||||
## func [Convert](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/converter.go#L100>)
|
## func [Convert](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/converter.go#L100>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func Convert(config ConvertOptions, dockerComposeFile ...string) error
|
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.
|
Convert a compose \(docker, podman...\) project to a helm chart. It calls Generate\(\) to generate the chart and then write it to the disk.
|
||||||
|
|
||||||
<a name="GetLabels"></a>
|
<a name="GetLabels"></a>
|
||||||
## func [GetLabels](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels.go#L13>)
|
## func [GetLabels](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels.go#L13>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func GetLabels(serviceName, appName string) map[string]string
|
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.
|
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.
|
||||||
|
|
||||||
<a name="GetMatchLabels"></a>
|
<a name="GetMatchLabels"></a>
|
||||||
## func [GetMatchLabels](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels.go#L26>)
|
## func [GetMatchLabels](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels.go#L26>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func GetMatchLabels(serviceName, appName string) map[string]string
|
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.
|
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.
|
||||||
|
|
||||||
<a name="GetVersion"></a>
|
<a name="GetVersion"></a>
|
||||||
## func [GetVersion](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/version.go#L15>)
|
## func [GetVersion](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/version.go#L15>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func GetVersion() string
|
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.
|
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.
|
||||||
|
|
||||||
<a name="Helper"></a>
|
<a name="Helper"></a>
|
||||||
## func [Helper](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/helper.go#L16>)
|
## func [Helper](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/helper.go#L16>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func Helper(name string) string
|
func Helper(name string) string
|
||||||
@@ -80,7 +80,7 @@ func Helper(name string) string
|
|||||||
Helper returns the \_helpers.tpl file for a chart.
|
Helper returns the \_helpers.tpl file for a chart.
|
||||||
|
|
||||||
<a name="NewCronJob"></a>
|
<a name="NewCronJob"></a>
|
||||||
## func [NewCronJob](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/cronJob.go#L29>)
|
## func [NewCronJob](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/cronJob.go#L29>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func NewCronJob(service types.ServiceConfig, chart *HelmChart, appName string) (*CronJob, *RBAC)
|
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.
|
NewCronJob creates a new CronJob from a compose service. The appName is the name of the application taken from the project name.
|
||||||
|
|
||||||
<a name="ToK8SYaml"></a>
|
<a name="ToK8SYaml"></a>
|
||||||
## func [ToK8SYaml](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/utils.go#L91>)
|
## func [ToK8SYaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/utils.go#L91>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func ToK8SYaml(obj any) ([]byte, error)
|
func ToK8SYaml(obj any) ([]byte, error)
|
||||||
@@ -98,7 +98,7 @@ func ToK8SYaml(obj any) ([]byte, error)
|
|||||||
|
|
||||||
|
|
||||||
<a name="UnWrapTPL"></a>
|
<a name="UnWrapTPL"></a>
|
||||||
## func [UnWrapTPL](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/utils.go#L87>)
|
## func [UnWrapTPL](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/utils.go#L87>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func UnWrapTPL(in []byte) []byte
|
func UnWrapTPL(in []byte) []byte
|
||||||
@@ -107,7 +107,7 @@ func UnWrapTPL(in []byte) []byte
|
|||||||
UnWrapTPL removes the line wrapping from a template.
|
UnWrapTPL removes the line wrapping from a template.
|
||||||
|
|
||||||
<a name="ChartTemplate"></a>
|
<a name="ChartTemplate"></a>
|
||||||
## type [ChartTemplate](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/chart.go#L22-L25>)
|
## type [ChartTemplate](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/chart.go#L22-L25>)
|
||||||
|
|
||||||
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.
|
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 {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="ConfigMap"></a>
|
<a name="ConfigMap"></a>
|
||||||
## type [ConfigMap](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/configMap.go#L38-L43>)
|
## type [ConfigMap](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/configMap.go#L38-L43>)
|
||||||
|
|
||||||
ConfigMap is a kubernetes ConfigMap. Implements the DataMap interface.
|
ConfigMap is a kubernetes ConfigMap. Implements the DataMap interface.
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ type ConfigMap struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="NewConfigMap"></a>
|
<a name="NewConfigMap"></a>
|
||||||
### func [NewConfigMap](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/configMap.go#L47>)
|
### func [NewConfigMap](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/configMap.go#L47>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func NewConfigMap(service types.ServiceConfig, appName string, forFile bool) *ConfigMap
|
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".
|
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".
|
||||||
|
|
||||||
<a name="NewConfigMapFromDirectory"></a>
|
<a name="NewConfigMapFromDirectory"></a>
|
||||||
### func [NewConfigMapFromDirectory](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/configMap.go#L120>)
|
### func [NewConfigMapFromDirectory](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/configMap.go#L120>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func NewConfigMapFromDirectory(service types.ServiceConfig, appName, path string) *ConfigMap
|
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.
|
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.
|
||||||
|
|
||||||
<a name="ConfigMap.AddBinaryData"></a>
|
<a name="ConfigMap.AddBinaryData"></a>
|
||||||
### func \(\*ConfigMap\) [AddBinaryData](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/configMap.go#L158>)
|
### func \(\*ConfigMap\) [AddBinaryData](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/configMap.go#L158>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *ConfigMap) AddBinaryData(key string, value []byte)
|
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.
|
AddBinaryData adds binary data to the configmap. Append or overwrite the value if the key already exists.
|
||||||
|
|
||||||
<a name="ConfigMap.AddData"></a>
|
<a name="ConfigMap.AddData"></a>
|
||||||
### func \(\*ConfigMap\) [AddData](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/configMap.go#L153>)
|
### func \(\*ConfigMap\) [AddData](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/configMap.go#L153>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *ConfigMap) AddData(key, value string)
|
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.
|
AddData adds a key value pair to the configmap. Append or overwrite the value if the key already exists.
|
||||||
|
|
||||||
<a name="ConfigMap.AppendDir"></a>
|
<a name="ConfigMap.AppendDir"></a>
|
||||||
### func \(\*ConfigMap\) [AppendDir](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/configMap.go#L167>)
|
### func \(\*ConfigMap\) [AppendDir](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/configMap.go#L167>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *ConfigMap) AppendDir(path string) error
|
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.
|
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.
|
||||||
|
|
||||||
<a name="ConfigMap.AppendFile"></a>
|
<a name="ConfigMap.AppendFile"></a>
|
||||||
### func \(\*ConfigMap\) [AppendFile](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/configMap.go#L214>)
|
### func \(\*ConfigMap\) [AppendFile](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/configMap.go#L214>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *ConfigMap) AppendFile(path string) error
|
func (c *ConfigMap) AppendFile(path string) error
|
||||||
@@ -185,7 +185,7 @@ func (c *ConfigMap) AppendFile(path string) error
|
|||||||
|
|
||||||
|
|
||||||
<a name="ConfigMap.Filename"></a>
|
<a name="ConfigMap.Filename"></a>
|
||||||
### func \(\*ConfigMap\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/configMap.go#L238>)
|
### func \(\*ConfigMap\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/configMap.go#L238>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *ConfigMap) Filename() string
|
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.
|
Filename returns the filename of the configmap. If the configmap is used for files, the filename contains the path.
|
||||||
|
|
||||||
<a name="ConfigMap.SetData"></a>
|
<a name="ConfigMap.SetData"></a>
|
||||||
### func \(\*ConfigMap\) [SetData](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/configMap.go#L248>)
|
### func \(\*ConfigMap\) [SetData](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/configMap.go#L248>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *ConfigMap) SetData(data map[string]string)
|
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.
|
SetData sets the data of the configmap. It replaces the entire data.
|
||||||
|
|
||||||
<a name="ConfigMap.Yaml"></a>
|
<a name="ConfigMap.Yaml"></a>
|
||||||
### func \(\*ConfigMap\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/configMap.go#L253>)
|
### func \(\*ConfigMap\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/configMap.go#L253>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *ConfigMap) Yaml() ([]byte, error)
|
func (c *ConfigMap) Yaml() ([]byte, error)
|
||||||
@@ -212,7 +212,7 @@ func (c *ConfigMap) Yaml() ([]byte, error)
|
|||||||
Yaml returns the yaml representation of the configmap
|
Yaml returns the yaml representation of the configmap
|
||||||
|
|
||||||
<a name="ConfigMapMount"></a>
|
<a name="ConfigMapMount"></a>
|
||||||
## type [ConfigMapMount](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L31-L34>)
|
## type [ConfigMapMount](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L29-L32>)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ type ConfigMapMount struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="ConvertOptions"></a>
|
<a name="ConvertOptions"></a>
|
||||||
## type [ConvertOptions](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/chart.go#L28-L37>)
|
## type [ConvertOptions](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/chart.go#L28-L37>)
|
||||||
|
|
||||||
ConvertOptions are the options to convert a compose project to a helm chart.
|
ConvertOptions are the options to convert a compose project to a helm chart.
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ type ConvertOptions struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="CronJob"></a>
|
<a name="CronJob"></a>
|
||||||
## type [CronJob](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/cronJob.go#L23-L26>)
|
## type [CronJob](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/cronJob.go#L23-L26>)
|
||||||
|
|
||||||
CronJob is a kubernetes CronJob.
|
CronJob is a kubernetes CronJob.
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ type CronJob struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="CronJob.Filename"></a>
|
<a name="CronJob.Filename"></a>
|
||||||
### func \(\*CronJob\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/cronJob.go#L113>)
|
### func \(\*CronJob\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/cronJob.go#L113>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *CronJob) Filename() string
|
func (c *CronJob) Filename() string
|
||||||
@@ -264,7 +264,7 @@ Filename returns the filename of the cronjob.
|
|||||||
Implements the Yaml interface.
|
Implements the Yaml interface.
|
||||||
|
|
||||||
<a name="CronJob.Yaml"></a>
|
<a name="CronJob.Yaml"></a>
|
||||||
### func \(\*CronJob\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/cronJob.go#L120>)
|
### func \(\*CronJob\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/cronJob.go#L120>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (c *CronJob) Yaml() ([]byte, error)
|
func (c *CronJob) Yaml() ([]byte, error)
|
||||||
@@ -275,7 +275,7 @@ Yaml returns the yaml representation of the cronjob.
|
|||||||
Implements the Yaml interface.
|
Implements the Yaml interface.
|
||||||
|
|
||||||
<a name="CronJobValue"></a>
|
<a name="CronJobValue"></a>
|
||||||
## type [CronJobValue](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/values.go#L118-L123>)
|
## type [CronJobValue](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/values.go#L118-L123>)
|
||||||
|
|
||||||
CronJobValue is a cronjob configuration that will be saved in values.yaml.
|
CronJobValue is a cronjob configuration that will be saved in values.yaml.
|
||||||
|
|
||||||
@@ -289,7 +289,7 @@ type CronJobValue struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="DataMap"></a>
|
<a name="DataMap"></a>
|
||||||
## type [DataMap](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/types.go#L4-L7>)
|
## type [DataMap](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/types.go#L4-L7>)
|
||||||
|
|
||||||
DataMap is a kubernetes ConfigMap or Secret. It can be used to add data to the ConfigMap or Secret.
|
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 {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="Deployment"></a>
|
<a name="Deployment"></a>
|
||||||
## type [Deployment](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L37-L48>)
|
## type [Deployment](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L35-L45>)
|
||||||
|
|
||||||
Deployment is a kubernetes Deployment.
|
Deployment is a kubernetes Deployment.
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ type Deployment struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="NewDeployment"></a>
|
<a name="NewDeployment"></a>
|
||||||
### func [NewDeployment](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L52>)
|
### func [NewDeployment](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L49>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func NewDeployment(service types.ServiceConfig, chart *HelmChart) *Deployment
|
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.
|
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.
|
||||||
|
|
||||||
<a name="Deployment.AddContainer"></a>
|
<a name="Deployment.AddContainer"></a>
|
||||||
### func \(\*Deployment\) [AddContainer](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L119>)
|
### func \(\*Deployment\) [AddContainer](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L116>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) AddContainer(service types.ServiceConfig)
|
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.
|
AddContainer adds a container to the deployment.
|
||||||
|
|
||||||
<a name="Deployment.AddHealthCheck"></a>
|
<a name="Deployment.AddHealthCheck"></a>
|
||||||
### func \(\*Deployment\) [AddHealthCheck](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L166>)
|
### func \(\*Deployment\) [AddHealthCheck](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L163>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) AddHealthCheck(service types.ServiceConfig, container *corev1.Container)
|
func (d *Deployment) AddHealthCheck(service types.ServiceConfig, container *corev1.Container)
|
||||||
@@ -340,7 +340,7 @@ func (d *Deployment) AddHealthCheck(service types.ServiceConfig, container *core
|
|||||||
|
|
||||||
|
|
||||||
<a name="Deployment.AddIngress"></a>
|
<a name="Deployment.AddIngress"></a>
|
||||||
### func \(\*Deployment\) [AddIngress](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L195>)
|
### func \(\*Deployment\) [AddIngress](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L192>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) AddIngress(service types.ServiceConfig, appName string) *Ingress
|
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.
|
AddIngress adds an ingress to the deployment. It creates the ingress object.
|
||||||
|
|
||||||
<a name="Deployment.AddLegacyVolume"></a>
|
<a name="Deployment.AddLegacyVolume"></a>
|
||||||
### func \(\*Deployment\) [AddLegacyVolume](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L218>)
|
### func \(\*Deployment\) [AddLegacyVolume](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L222>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) AddLegacyVolume(name, kind string)
|
func (d *Deployment) AddLegacyVolume(name, kind string)
|
||||||
@@ -358,7 +358,7 @@ func (d *Deployment) AddLegacyVolume(name, kind string)
|
|||||||
|
|
||||||
|
|
||||||
<a name="Deployment.AddVolumes"></a>
|
<a name="Deployment.AddVolumes"></a>
|
||||||
### func \(\*Deployment\) [AddVolumes](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L201>)
|
### func \(\*Deployment\) [AddVolumes](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L198>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) AddVolumes(service types.ServiceConfig, appName string)
|
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.
|
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.
|
||||||
|
|
||||||
<a name="Deployment.BindFrom"></a>
|
<a name="Deployment.BindFrom"></a>
|
||||||
### func \(\*Deployment\) [BindFrom](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L239>)
|
### func \(\*Deployment\) [BindFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L243>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) BindFrom(service types.ServiceConfig, binded *Deployment)
|
func (d *Deployment) BindFrom(service types.ServiceConfig, binded *Deployment)
|
||||||
@@ -376,7 +376,7 @@ func (d *Deployment) BindFrom(service types.ServiceConfig, binded *Deployment)
|
|||||||
|
|
||||||
|
|
||||||
<a name="Deployment.BindMapFilesToContainer"></a>
|
<a name="Deployment.BindMapFilesToContainer"></a>
|
||||||
### func \(\*Deployment\) [BindMapFilesToContainer](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L419>)
|
### func \(\*Deployment\) [BindMapFilesToContainer](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L377>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) BindMapFilesToContainer(service types.ServiceConfig, secrets []string, appName string) (*corev1.Container, int)
|
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
|
|||||||
|
|
||||||
|
|
||||||
<a name="Deployment.DependsOn"></a>
|
<a name="Deployment.DependsOn"></a>
|
||||||
### func \(\*Deployment\) [DependsOn](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L267>)
|
### func \(\*Deployment\) [DependsOn](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L271>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) DependsOn(to *Deployment, servicename string) error
|
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.
|
DependsOn adds a initContainer to the deployment that will wait for the service to be up.
|
||||||
|
|
||||||
<a name="Deployment.Filename"></a>
|
<a name="Deployment.Filename"></a>
|
||||||
### func \(\*Deployment\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L344>)
|
### func \(\*Deployment\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L302>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) Filename() string
|
func (d *Deployment) Filename() string
|
||||||
@@ -403,7 +403,7 @@ func (d *Deployment) Filename() string
|
|||||||
Filename returns the filename of the deployment.
|
Filename returns the filename of the deployment.
|
||||||
|
|
||||||
<a name="Deployment.MountExchangeVolumes"></a>
|
<a name="Deployment.MountExchangeVolumes"></a>
|
||||||
### func \(\*Deployment\) [MountExchangeVolumes](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L470>)
|
### func \(\*Deployment\) [MountExchangeVolumes](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L428>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) MountExchangeVolumes()
|
func (d *Deployment) MountExchangeVolumes()
|
||||||
@@ -412,7 +412,7 @@ func (d *Deployment) MountExchangeVolumes()
|
|||||||
|
|
||||||
|
|
||||||
<a name="Deployment.SetEnvFrom"></a>
|
<a name="Deployment.SetEnvFrom"></a>
|
||||||
### func \(\*Deployment\) [SetEnvFrom](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L349>)
|
### func \(\*Deployment\) [SetEnvFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L307>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, samePod ...bool)
|
func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, samePod ...bool)
|
||||||
@@ -420,17 +420,8 @@ func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, sam
|
|||||||
|
|
||||||
SetEnvFrom sets the environment variables to a configmap. The configmap is created.
|
SetEnvFrom sets the environment variables to a configmap. The configmap is created.
|
||||||
|
|
||||||
<a name="Deployment.SetServiceAccountName"></a>
|
|
||||||
### func \(\*Deployment\) [SetServiceAccountName](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L654>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func (d *Deployment) SetServiceAccountName()
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="Deployment.Yaml"></a>
|
<a name="Deployment.Yaml"></a>
|
||||||
### func \(\*Deployment\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/deployment.go#L494>)
|
### func \(\*Deployment\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L452>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) Yaml() ([]byte, error)
|
func (d *Deployment) Yaml() ([]byte, error)
|
||||||
@@ -439,7 +430,7 @@ func (d *Deployment) Yaml() ([]byte, error)
|
|||||||
Yaml returns the yaml representation of the deployment.
|
Yaml returns the yaml representation of the deployment.
|
||||||
|
|
||||||
<a name="FileMapUsage"></a>
|
<a name="FileMapUsage"></a>
|
||||||
## type [FileMapUsage](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/configMap.go#L22>)
|
## type [FileMapUsage](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/configMap.go#L22>)
|
||||||
|
|
||||||
FileMapUsage is the usage of the filemap.
|
FileMapUsage is the usage of the filemap.
|
||||||
|
|
||||||
@@ -457,7 +448,7 @@ const (
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="HelmChart"></a>
|
<a name="HelmChart"></a>
|
||||||
## type [HelmChart](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/chart.go#L41-L54>)
|
## type [HelmChart](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/chart.go#L41-L54>)
|
||||||
|
|
||||||
HelmChart is a Helm Chart representation. It contains all the templates, values, versions, helpers...
|
HelmChart is a Helm Chart representation. It contains all the templates, values, versions, helpers...
|
||||||
|
|
||||||
@@ -480,7 +471,7 @@ type HelmChart struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="Generate"></a>
|
<a name="Generate"></a>
|
||||||
### func [Generate](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/generator.go#L32>)
|
### func [Generate](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/generator.go#L32>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func Generate(project *types.Project) (*HelmChart, error)
|
func Generate(project *types.Project) (*HelmChart, error)
|
||||||
@@ -491,7 +482,7 @@ Generate a chart from a compose project. This does not write files to disk, it o
|
|||||||
The Generate function will create the HelmChart object this way:
|
The Generate function will create the HelmChart object this way:
|
||||||
|
|
||||||
- Detect the service port name or leave the port number if not found.
|
- Detect the service port name or leave the port number if not found.
|
||||||
- Create a deployment for each service that are not ingore.
|
- Create a deployment for each service that are not ingnore.
|
||||||
- Create a service and ingresses for each service that has ports and/or declared ingresses.
|
- Create a service and ingresses for each service that has ports and/or declared ingresses.
|
||||||
- Create a PVC or Configmap volumes for each volume.
|
- Create a PVC or Configmap volumes for each volume.
|
||||||
- Create init containers for each service which has dependencies to other services.
|
- Create init containers for each service which has dependencies to other services.
|
||||||
@@ -500,7 +491,7 @@ The Generate function will create the HelmChart object this way:
|
|||||||
- Merge the same\-pod services.
|
- Merge the same\-pod services.
|
||||||
|
|
||||||
<a name="NewChart"></a>
|
<a name="NewChart"></a>
|
||||||
### func [NewChart](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/chart.go#L57>)
|
### func [NewChart](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/chart.go#L57>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func NewChart(name string) *HelmChart
|
func NewChart(name string) *HelmChart
|
||||||
@@ -509,7 +500,7 @@ func NewChart(name string) *HelmChart
|
|||||||
NewChart creates a new empty chart with the given name.
|
NewChart creates a new empty chart with the given name.
|
||||||
|
|
||||||
<a name="HelmChart.SaveTemplates"></a>
|
<a name="HelmChart.SaveTemplates"></a>
|
||||||
### func \(\*HelmChart\) [SaveTemplates](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/chart.go#L72>)
|
### func \(\*HelmChart\) [SaveTemplates](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/chart.go#L72>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (chart *HelmChart) SaveTemplates(templateDir string)
|
func (chart *HelmChart) SaveTemplates(templateDir string)
|
||||||
@@ -518,7 +509,7 @@ func (chart *HelmChart) SaveTemplates(templateDir string)
|
|||||||
SaveTemplates the templates of the chart to the given directory.
|
SaveTemplates the templates of the chart to the given directory.
|
||||||
|
|
||||||
<a name="Ingress"></a>
|
<a name="Ingress"></a>
|
||||||
## type [Ingress](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/ingress.go#L18-L22>)
|
## type [Ingress](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/ingress.go#L18-L22>)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -530,7 +521,7 @@ type Ingress struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="NewIngress"></a>
|
<a name="NewIngress"></a>
|
||||||
### func [NewIngress](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/ingress.go#L25>)
|
### func [NewIngress](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/ingress.go#L25>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func NewIngress(service types.ServiceConfig, Chart *HelmChart) *Ingress
|
func NewIngress(service types.ServiceConfig, Chart *HelmChart) *Ingress
|
||||||
@@ -539,7 +530,7 @@ func NewIngress(service types.ServiceConfig, Chart *HelmChart) *Ingress
|
|||||||
NewIngress creates a new Ingress from a compose service.
|
NewIngress creates a new Ingress from a compose service.
|
||||||
|
|
||||||
<a name="Ingress.Filename"></a>
|
<a name="Ingress.Filename"></a>
|
||||||
### func \(\*Ingress\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/ingress.go#L129>)
|
### func \(\*Ingress\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/ingress.go#L129>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (ingress *Ingress) Filename() string
|
func (ingress *Ingress) Filename() string
|
||||||
@@ -548,7 +539,7 @@ func (ingress *Ingress) Filename() string
|
|||||||
|
|
||||||
|
|
||||||
<a name="Ingress.Yaml"></a>
|
<a name="Ingress.Yaml"></a>
|
||||||
### func \(\*Ingress\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/ingress.go#L133>)
|
### func \(\*Ingress\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/ingress.go#L133>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (ingress *Ingress) Yaml() ([]byte, error)
|
func (ingress *Ingress) Yaml() ([]byte, error)
|
||||||
@@ -557,7 +548,7 @@ func (ingress *Ingress) Yaml() ([]byte, error)
|
|||||||
|
|
||||||
|
|
||||||
<a name="IngressValue"></a>
|
<a name="IngressValue"></a>
|
||||||
## type [IngressValue](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/values.go#L29-L36>)
|
## type [IngressValue](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/values.go#L29-L36>)
|
||||||
|
|
||||||
IngressValue is a ingress configuration that will be saved in values.yaml.
|
IngressValue is a ingress configuration that will be saved in values.yaml.
|
||||||
|
|
||||||
@@ -573,7 +564,7 @@ type IngressValue struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="PersistenceValue"></a>
|
<a name="PersistenceValue"></a>
|
||||||
## type [PersistenceValue](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/values.go#L16-L21>)
|
## type [PersistenceValue](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/values.go#L16-L21>)
|
||||||
|
|
||||||
PersistenceValue is a persistence configuration that will be saved in values.yaml.
|
PersistenceValue is a persistence configuration that will be saved in values.yaml.
|
||||||
|
|
||||||
@@ -587,7 +578,7 @@ type PersistenceValue struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="RBAC"></a>
|
<a name="RBAC"></a>
|
||||||
## type [RBAC](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/rbac.go#L20-L24>)
|
## type [RBAC](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/rbac.go#L20-L24>)
|
||||||
|
|
||||||
RBAC is a kubernetes RBAC containing a role, a rolebinding and an associated serviceaccount.
|
RBAC is a kubernetes RBAC containing a role, a rolebinding and an associated serviceaccount.
|
||||||
|
|
||||||
@@ -600,7 +591,7 @@ type RBAC struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="NewRBAC"></a>
|
<a name="NewRBAC"></a>
|
||||||
### func [NewRBAC](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/rbac.go#L27>)
|
### func [NewRBAC](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/rbac.go#L27>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func NewRBAC(service types.ServiceConfig, appName string) *RBAC
|
func NewRBAC(service types.ServiceConfig, appName string) *RBAC
|
||||||
@@ -609,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.
|
NewRBAC creates a new RBAC from a compose service. The appName is the name of the application taken from the project name.
|
||||||
|
|
||||||
<a name="RepositoryValue"></a>
|
<a name="RepositoryValue"></a>
|
||||||
## type [RepositoryValue](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/values.go#L10-L13>)
|
## type [RepositoryValue](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/values.go#L10-L13>)
|
||||||
|
|
||||||
RepositoryValue is a docker repository image and tag that will be saved in values.yaml.
|
RepositoryValue is a docker repository image and tag that will be saved in values.yaml.
|
||||||
|
|
||||||
@@ -621,7 +612,7 @@ type RepositoryValue struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="Role"></a>
|
<a name="Role"></a>
|
||||||
## type [Role](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/rbac.go#L114-L117>)
|
## type [Role](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/rbac.go#L114-L117>)
|
||||||
|
|
||||||
Role is a kubernetes Role.
|
Role is a kubernetes Role.
|
||||||
|
|
||||||
@@ -632,17 +623,8 @@ type Role struct {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="NewRestrictedRole"></a>
|
|
||||||
### func [NewRestrictedRole](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/rbac.go#L150>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func NewRestrictedRole(service types.ServiceConfig, appName string) *Role
|
|
||||||
```
|
|
||||||
|
|
||||||
NewRestrictedRole creates a Role with minimal permissions for init containers.
|
|
||||||
|
|
||||||
<a name="Role.Filename"></a>
|
<a name="Role.Filename"></a>
|
||||||
### func \(\*Role\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/rbac.go#L119>)
|
### func \(\*Role\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/rbac.go#L119>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (r *Role) Filename() string
|
func (r *Role) Filename() string
|
||||||
@@ -651,7 +633,7 @@ func (r *Role) Filename() string
|
|||||||
|
|
||||||
|
|
||||||
<a name="Role.Yaml"></a>
|
<a name="Role.Yaml"></a>
|
||||||
### func \(\*Role\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/rbac.go#L123>)
|
### func \(\*Role\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/rbac.go#L123>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (r *Role) Yaml() ([]byte, error)
|
func (r *Role) Yaml() ([]byte, error)
|
||||||
@@ -660,7 +642,7 @@ func (r *Role) Yaml() ([]byte, error)
|
|||||||
|
|
||||||
|
|
||||||
<a name="RoleBinding"></a>
|
<a name="RoleBinding"></a>
|
||||||
## type [RoleBinding](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/rbac.go#L100-L103>)
|
## type [RoleBinding](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/rbac.go#L100-L103>)
|
||||||
|
|
||||||
RoleBinding is a kubernetes RoleBinding.
|
RoleBinding is a kubernetes RoleBinding.
|
||||||
|
|
||||||
@@ -671,17 +653,8 @@ type RoleBinding struct {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="NewRestrictedRoleBinding"></a>
|
|
||||||
### func [NewRestrictedRoleBinding](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/rbac.go#L175>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func NewRestrictedRoleBinding(service types.ServiceConfig, appName string) *RoleBinding
|
|
||||||
```
|
|
||||||
|
|
||||||
NewRestrictedRoleBinding creates a RoleBinding that binds the restricted role to the ServiceAccount.
|
|
||||||
|
|
||||||
<a name="RoleBinding.Filename"></a>
|
<a name="RoleBinding.Filename"></a>
|
||||||
### func \(\*RoleBinding\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/rbac.go#L105>)
|
### func \(\*RoleBinding\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/rbac.go#L105>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (r *RoleBinding) Filename() string
|
func (r *RoleBinding) Filename() string
|
||||||
@@ -690,7 +663,7 @@ func (r *RoleBinding) Filename() string
|
|||||||
|
|
||||||
|
|
||||||
<a name="RoleBinding.Yaml"></a>
|
<a name="RoleBinding.Yaml"></a>
|
||||||
### func \(\*RoleBinding\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/rbac.go#L109>)
|
### func \(\*RoleBinding\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/rbac.go#L109>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (r *RoleBinding) Yaml() ([]byte, error)
|
func (r *RoleBinding) Yaml() ([]byte, error)
|
||||||
@@ -699,7 +672,7 @@ func (r *RoleBinding) Yaml() ([]byte, error)
|
|||||||
|
|
||||||
|
|
||||||
<a name="Secret"></a>
|
<a name="Secret"></a>
|
||||||
## type [Secret](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/secret.go#L23-L26>)
|
## type [Secret](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/secret.go#L23-L26>)
|
||||||
|
|
||||||
Secret is a kubernetes Secret.
|
Secret is a kubernetes Secret.
|
||||||
|
|
||||||
@@ -713,7 +686,7 @@ type Secret struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="NewSecret"></a>
|
<a name="NewSecret"></a>
|
||||||
### func [NewSecret](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/secret.go#L29>)
|
### func [NewSecret](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/secret.go#L29>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func NewSecret(service types.ServiceConfig, appName string) *Secret
|
func NewSecret(service types.ServiceConfig, appName string) *Secret
|
||||||
@@ -722,7 +695,7 @@ func NewSecret(service types.ServiceConfig, appName string) *Secret
|
|||||||
NewSecret creates a new Secret from a compose service
|
NewSecret creates a new Secret from a compose service
|
||||||
|
|
||||||
<a name="Secret.AddData"></a>
|
<a name="Secret.AddData"></a>
|
||||||
### func \(\*Secret\) [AddData](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/secret.go#L71>)
|
### func \(\*Secret\) [AddData](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/secret.go#L71>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (s *Secret) AddData(key, value string)
|
func (s *Secret) AddData(key, value string)
|
||||||
@@ -731,7 +704,7 @@ func (s *Secret) AddData(key, value string)
|
|||||||
AddData adds a key value pair to the secret.
|
AddData adds a key value pair to the secret.
|
||||||
|
|
||||||
<a name="Secret.Filename"></a>
|
<a name="Secret.Filename"></a>
|
||||||
### func \(\*Secret\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/secret.go#L87>)
|
### func \(\*Secret\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/secret.go#L87>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (s *Secret) Filename() string
|
func (s *Secret) Filename() string
|
||||||
@@ -740,7 +713,7 @@ func (s *Secret) Filename() string
|
|||||||
Filename returns the filename of the secret.
|
Filename returns the filename of the secret.
|
||||||
|
|
||||||
<a name="Secret.SetData"></a>
|
<a name="Secret.SetData"></a>
|
||||||
### func \(\*Secret\) [SetData](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/secret.go#L92>)
|
### func \(\*Secret\) [SetData](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/secret.go#L92>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (s *Secret) SetData(data map[string]string)
|
func (s *Secret) SetData(data map[string]string)
|
||||||
@@ -749,7 +722,7 @@ func (s *Secret) SetData(data map[string]string)
|
|||||||
SetData sets the data of the secret.
|
SetData sets the data of the secret.
|
||||||
|
|
||||||
<a name="Secret.Yaml"></a>
|
<a name="Secret.Yaml"></a>
|
||||||
### func \(\*Secret\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/secret.go#L99>)
|
### func \(\*Secret\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/secret.go#L99>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (s *Secret) Yaml() ([]byte, error)
|
func (s *Secret) Yaml() ([]byte, error)
|
||||||
@@ -758,7 +731,7 @@ func (s *Secret) Yaml() ([]byte, error)
|
|||||||
Yaml returns the yaml representation of the secret.
|
Yaml returns the yaml representation of the secret.
|
||||||
|
|
||||||
<a name="Service"></a>
|
<a name="Service"></a>
|
||||||
## type [Service](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/service.go#L19-L22>)
|
## type [Service](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/service.go#L19-L22>)
|
||||||
|
|
||||||
Service is a kubernetes Service.
|
Service is a kubernetes Service.
|
||||||
|
|
||||||
@@ -770,7 +743,7 @@ type Service struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="NewService"></a>
|
<a name="NewService"></a>
|
||||||
### func [NewService](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/service.go#L25>)
|
### func [NewService](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/service.go#L25>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func NewService(service types.ServiceConfig, appName string) *Service
|
func NewService(service types.ServiceConfig, appName string) *Service
|
||||||
@@ -779,7 +752,7 @@ func NewService(service types.ServiceConfig, appName string) *Service
|
|||||||
NewService creates a new Service from a compose service.
|
NewService creates a new Service from a compose service.
|
||||||
|
|
||||||
<a name="Service.AddPort"></a>
|
<a name="Service.AddPort"></a>
|
||||||
### func \(\*Service\) [AddPort](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/service.go#L54>)
|
### func \(\*Service\) [AddPort](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/service.go#L54>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (s *Service) AddPort(port types.ServicePortConfig, serviceName ...string)
|
func (s *Service) AddPort(port types.ServicePortConfig, serviceName ...string)
|
||||||
@@ -788,7 +761,7 @@ func (s *Service) AddPort(port types.ServicePortConfig, serviceName ...string)
|
|||||||
AddPort adds a port to the service.
|
AddPort adds a port to the service.
|
||||||
|
|
||||||
<a name="Service.Filename"></a>
|
<a name="Service.Filename"></a>
|
||||||
### func \(\*Service\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/service.go#L75>)
|
### func \(\*Service\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/service.go#L75>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (s *Service) Filename() string
|
func (s *Service) Filename() string
|
||||||
@@ -797,7 +770,7 @@ func (s *Service) Filename() string
|
|||||||
Filename returns the filename of the service.
|
Filename returns the filename of the service.
|
||||||
|
|
||||||
<a name="Service.Yaml"></a>
|
<a name="Service.Yaml"></a>
|
||||||
### func \(\*Service\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/service.go#L80>)
|
### func \(\*Service\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/service.go#L80>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (s *Service) Yaml() ([]byte, error)
|
func (s *Service) Yaml() ([]byte, error)
|
||||||
@@ -806,7 +779,7 @@ func (s *Service) Yaml() ([]byte, error)
|
|||||||
Yaml returns the yaml representation of the service.
|
Yaml returns the yaml representation of the service.
|
||||||
|
|
||||||
<a name="ServiceAccount"></a>
|
<a name="ServiceAccount"></a>
|
||||||
## type [ServiceAccount](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/rbac.go#L205-L208>)
|
## type [ServiceAccount](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/rbac.go#L132-L135>)
|
||||||
|
|
||||||
ServiceAccount is a kubernetes ServiceAccount.
|
ServiceAccount is a kubernetes ServiceAccount.
|
||||||
|
|
||||||
@@ -817,17 +790,8 @@ type ServiceAccount struct {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="NewServiceAccount"></a>
|
|
||||||
### func [NewServiceAccount](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/rbac.go#L132>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func NewServiceAccount(service types.ServiceConfig, appName string) *ServiceAccount
|
|
||||||
```
|
|
||||||
|
|
||||||
NewServiceAccount creates a new ServiceAccount from a compose service.
|
|
||||||
|
|
||||||
<a name="ServiceAccount.Filename"></a>
|
<a name="ServiceAccount.Filename"></a>
|
||||||
### func \(\*ServiceAccount\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/rbac.go#L210>)
|
### func \(\*ServiceAccount\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/rbac.go#L137>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (r *ServiceAccount) Filename() string
|
func (r *ServiceAccount) Filename() string
|
||||||
@@ -836,7 +800,7 @@ func (r *ServiceAccount) Filename() string
|
|||||||
|
|
||||||
|
|
||||||
<a name="ServiceAccount.Yaml"></a>
|
<a name="ServiceAccount.Yaml"></a>
|
||||||
### func \(\*ServiceAccount\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/rbac.go#L214>)
|
### func \(\*ServiceAccount\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/rbac.go#L141>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (r *ServiceAccount) Yaml() ([]byte, error)
|
func (r *ServiceAccount) Yaml() ([]byte, error)
|
||||||
@@ -845,7 +809,7 @@ func (r *ServiceAccount) Yaml() ([]byte, error)
|
|||||||
|
|
||||||
|
|
||||||
<a name="TLS"></a>
|
<a name="TLS"></a>
|
||||||
## type [TLS](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/values.go#L23-L26>)
|
## type [TLS](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/values.go#L23-L26>)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -857,7 +821,7 @@ type TLS struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="Value"></a>
|
<a name="Value"></a>
|
||||||
## type [Value](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/values.go#L39-L50>)
|
## type [Value](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/values.go#L39-L50>)
|
||||||
|
|
||||||
Value will be saved in values.yaml. It contains configuration for all deployment and services.
|
Value will be saved in values.yaml. It contains configuration for all deployment and services.
|
||||||
|
|
||||||
@@ -877,7 +841,7 @@ type Value struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="NewValue"></a>
|
<a name="NewValue"></a>
|
||||||
### func [NewValue](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/values.go#L57>)
|
### func [NewValue](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/values.go#L57>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func NewValue(service types.ServiceConfig, main ...bool) *Value
|
func NewValue(service types.ServiceConfig, main ...bool) *Value
|
||||||
@@ -888,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.
|
If \`main\` is true, the tag will be empty because it will be set in the helm chart appVersion.
|
||||||
|
|
||||||
<a name="Value.AddIngress"></a>
|
<a name="Value.AddIngress"></a>
|
||||||
### func \(\*Value\) [AddIngress](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/values.go#L90>)
|
### func \(\*Value\) [AddIngress](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/values.go#L90>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (v *Value) AddIngress(host, path string)
|
func (v *Value) AddIngress(host, path string)
|
||||||
@@ -897,7 +861,7 @@ func (v *Value) AddIngress(host, path string)
|
|||||||
|
|
||||||
|
|
||||||
<a name="Value.AddPersistence"></a>
|
<a name="Value.AddPersistence"></a>
|
||||||
### func \(\*Value\) [AddPersistence](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/values.go#L104>)
|
### func \(\*Value\) [AddPersistence](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/values.go#L104>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (v *Value) AddPersistence(volumeName string)
|
func (v *Value) AddPersistence(volumeName string)
|
||||||
@@ -906,7 +870,7 @@ func (v *Value) AddPersistence(volumeName string)
|
|||||||
AddPersistence adds persistence configuration to the Value.
|
AddPersistence adds persistence configuration to the Value.
|
||||||
|
|
||||||
<a name="VolumeClaim"></a>
|
<a name="VolumeClaim"></a>
|
||||||
## type [VolumeClaim](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/volume.go#L19-L24>)
|
## type [VolumeClaim](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/volume.go#L19-L24>)
|
||||||
|
|
||||||
VolumeClaim is a kubernetes VolumeClaim. This is a PersistentVolumeClaim.
|
VolumeClaim is a kubernetes VolumeClaim. This is a PersistentVolumeClaim.
|
||||||
|
|
||||||
@@ -918,7 +882,7 @@ type VolumeClaim struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="NewVolumeClaim"></a>
|
<a name="NewVolumeClaim"></a>
|
||||||
### func [NewVolumeClaim](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/volume.go#L27>)
|
### func [NewVolumeClaim](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/volume.go#L27>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func NewVolumeClaim(service types.ServiceConfig, volumeName, appName string) *VolumeClaim
|
func NewVolumeClaim(service types.ServiceConfig, volumeName, appName string) *VolumeClaim
|
||||||
@@ -927,7 +891,7 @@ func NewVolumeClaim(service types.ServiceConfig, volumeName, appName string) *Vo
|
|||||||
NewVolumeClaim creates a new VolumeClaim from a compose service.
|
NewVolumeClaim creates a new VolumeClaim from a compose service.
|
||||||
|
|
||||||
<a name="VolumeClaim.Filename"></a>
|
<a name="VolumeClaim.Filename"></a>
|
||||||
### func \(\*VolumeClaim\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/volume.go#L63>)
|
### func \(\*VolumeClaim\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/volume.go#L63>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (v *VolumeClaim) Filename() string
|
func (v *VolumeClaim) Filename() string
|
||||||
@@ -936,7 +900,7 @@ func (v *VolumeClaim) Filename() string
|
|||||||
Filename returns the suggested filename for a VolumeClaim.
|
Filename returns the suggested filename for a VolumeClaim.
|
||||||
|
|
||||||
<a name="VolumeClaim.Yaml"></a>
|
<a name="VolumeClaim.Yaml"></a>
|
||||||
### func \(\*VolumeClaim\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/volume.go#L68>)
|
### func \(\*VolumeClaim\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/volume.go#L68>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (v *VolumeClaim) Yaml() ([]byte, error)
|
func (v *VolumeClaim) Yaml() ([]byte, error)
|
||||||
@@ -945,7 +909,7 @@ func (v *VolumeClaim) Yaml() ([]byte, error)
|
|||||||
Yaml marshals a VolumeClaim into yaml.
|
Yaml marshals a VolumeClaim into yaml.
|
||||||
|
|
||||||
<a name="Yaml"></a>
|
<a name="Yaml"></a>
|
||||||
## type [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/types.go#L10-L13>)
|
## type [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/types.go#L10-L13>)
|
||||||
|
|
||||||
Yaml is a kubernetes object that can be converted to yaml.
|
Yaml is a kubernetes object that can be converted to yaml.
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import "katenary.io/internal/generator/extrafiles"
|
|||||||
|
|
||||||
Package extrafiles provides function to generate the Chart files that are not objects. Like README.md and notes.txt...
|
Package extrafiles provides function to generate the Chart files that are not objects. Like README.md and notes.txt...
|
||||||
|
|
||||||
## func [NotesFile](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/extrafiles/notes.go#L13>)
|
## func [NotesFile](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/extrafiles/notes.go#L13>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func NotesFile(services []string) string
|
func NotesFile(services []string) string
|
||||||
@@ -17,7 +17,7 @@ func NotesFile(services []string) string
|
|||||||
NotesFile returns the content of the note.txt file.
|
NotesFile returns the content of the note.txt file.
|
||||||
|
|
||||||
<a name="ReadMeFile"></a>
|
<a name="ReadMeFile"></a>
|
||||||
## func [ReadMeFile](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/extrafiles/readme.go#L46>)
|
## func [ReadMeFile](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/extrafiles/readme.go#L46>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func ReadMeFile(charname, description string, values map[string]any) string
|
func ReadMeFile(charname, description string, values map[string]any) string
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ A katenary file, named "katenary.yml" or "katenary.yaml", is a file where you ca
|
|||||||
|
|
||||||
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.
|
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](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/katenaryfile/main.go#L141>)
|
## func [GenerateSchema](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/katenaryfile/main.go#L138>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func GenerateSchema() string
|
func GenerateSchema() string
|
||||||
@@ -21,7 +21,7 @@ func GenerateSchema() string
|
|||||||
GenerateSchema generates the schema for the katenary.yaml file.
|
GenerateSchema generates the schema for the katenary.yaml file.
|
||||||
|
|
||||||
<a name="OverrideWithConfig"></a>
|
<a name="OverrideWithConfig"></a>
|
||||||
## func [OverrideWithConfig](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/katenaryfile/main.go#L48>)
|
## func [OverrideWithConfig](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/katenaryfile/main.go#L50>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func OverrideWithConfig(project *types.Project)
|
func OverrideWithConfig(project *types.Project)
|
||||||
@@ -30,7 +30,7 @@ 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.
|
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.
|
||||||
|
|
||||||
<a name="Service"></a>
|
<a name="Service"></a>
|
||||||
## type [Service](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/katenaryfile/main.go#L26-L43>)
|
## type [Service](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/katenaryfile/main.go#L28-L45>)
|
||||||
|
|
||||||
Service is a struct that contains the service configuration for katenary
|
Service is a struct that contains the service configuration for katenary
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ type Service struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="StringOrMap"></a>
|
<a name="StringOrMap"></a>
|
||||||
## type [StringOrMap](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/katenaryfile/main.go#L23>)
|
## type [StringOrMap](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/katenaryfile/main.go#L25>)
|
||||||
|
|
||||||
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
|
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
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const KatenaryLabelPrefix = "katenary.v3"
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="GetLabelHelp"></a>
|
<a name="GetLabelHelp"></a>
|
||||||
## func [GetLabelHelp](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/katenaryLabels.go#L90>)
|
## func [GetLabelHelp](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/katenaryLabels.go#L89>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func GetLabelHelp(asMarkdown bool) string
|
func GetLabelHelp(asMarkdown bool) string
|
||||||
@@ -26,7 +26,7 @@ func GetLabelHelp(asMarkdown bool) string
|
|||||||
GetLabelHelp return the help for the labels.
|
GetLabelHelp return the help for the labels.
|
||||||
|
|
||||||
<a name="GetLabelHelpFor"></a>
|
<a name="GetLabelHelpFor"></a>
|
||||||
## func [GetLabelHelpFor](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/katenaryLabels.go#L99>)
|
## func [GetLabelHelpFor](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/katenaryLabels.go#L98>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func GetLabelHelpFor(labelname string, asMarkdown bool) string
|
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.
|
GetLabelHelpFor returns the help for a specific label.
|
||||||
|
|
||||||
<a name="GetLabelNames"></a>
|
<a name="GetLabelNames"></a>
|
||||||
## func [GetLabelNames](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/katenaryLabels.go#L74>)
|
## func [GetLabelNames](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/katenaryLabels.go#L73>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func GetLabelNames() []string
|
func GetLabelNames() []string
|
||||||
@@ -44,7 +44,7 @@ func GetLabelNames() []string
|
|||||||
GetLabelNames returns a sorted list of all katenary label names.
|
GetLabelNames returns a sorted list of all katenary label names.
|
||||||
|
|
||||||
<a name="Prefix"></a>
|
<a name="Prefix"></a>
|
||||||
## func [Prefix](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/katenaryLabels.go#L237>)
|
## func [Prefix](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/katenaryLabels.go#L236>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func Prefix() string
|
func Prefix() string
|
||||||
@@ -53,7 +53,7 @@ func Prefix() string
|
|||||||
|
|
||||||
|
|
||||||
<a name="Help"></a>
|
<a name="Help"></a>
|
||||||
## type [Help](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/katenaryLabels.go#L66-L71>)
|
## type [Help](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/katenaryLabels.go#L65-L70>)
|
||||||
|
|
||||||
Help is the documentation of a label.
|
Help is the documentation of a label.
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ type Help struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="Label"></a>
|
<a name="Label"></a>
|
||||||
## type [Label](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/katenaryLabels.go#L59>)
|
## type [Label](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/katenaryLabels.go#L58>)
|
||||||
|
|
||||||
Label is a katenary label to find in compose files.
|
Label is a katenary label to find in compose files.
|
||||||
|
|
||||||
@@ -95,12 +95,11 @@ const (
|
|||||||
LabelEnvFrom Label = KatenaryLabelPrefix + "/env-from"
|
LabelEnvFrom Label = KatenaryLabelPrefix + "/env-from"
|
||||||
LabelExchangeVolume Label = KatenaryLabelPrefix + "/exchange-volumes"
|
LabelExchangeVolume Label = KatenaryLabelPrefix + "/exchange-volumes"
|
||||||
LabelValuesFrom Label = KatenaryLabelPrefix + "/values-from"
|
LabelValuesFrom Label = KatenaryLabelPrefix + "/values-from"
|
||||||
LabelDependsOn Label = KatenaryLabelPrefix + "/depends-on"
|
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="LabelName"></a>
|
<a name="LabelName"></a>
|
||||||
### func [LabelName](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/katenaryLabels.go#L61>)
|
### func [LabelName](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/katenaryLabels.go#L60>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func LabelName(name string) Label
|
func LabelName(name string) Label
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import "katenary.io/internal/generator/labels/labelstructs"
|
|||||||
|
|
||||||
Package labelstructs is a package that contains the structs used to represent the labels in the yaml files.
|
Package labelstructs is a package that contains the structs used to represent the labels in the yaml files.
|
||||||
|
|
||||||
## type [ConfigMapFiles](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/configMap.go#L5>)
|
## type [ConfigMapFiles](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/configMap.go#L5>)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ type ConfigMapFiles []string
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="ConfigMapFileFrom"></a>
|
<a name="ConfigMapFileFrom"></a>
|
||||||
### func [ConfigMapFileFrom](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/configMap.go#L7>)
|
### func [ConfigMapFileFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/configMap.go#L7>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func ConfigMapFileFrom(data string) (ConfigMapFiles, error)
|
func ConfigMapFileFrom(data string) (ConfigMapFiles, error)
|
||||||
@@ -26,7 +26,7 @@ func ConfigMapFileFrom(data string) (ConfigMapFiles, error)
|
|||||||
|
|
||||||
|
|
||||||
<a name="CronJob"></a>
|
<a name="CronJob"></a>
|
||||||
## type [CronJob](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/cronJob.go#L5-L10>)
|
## type [CronJob](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/cronJob.go#L5-L10>)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ type CronJob struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="CronJobFrom"></a>
|
<a name="CronJobFrom"></a>
|
||||||
### func [CronJobFrom](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/cronJob.go#L12>)
|
### func [CronJobFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/cronJob.go#L12>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func CronJobFrom(data string) (*CronJob, error)
|
func CronJobFrom(data string) (*CronJob, error)
|
||||||
@@ -49,7 +49,7 @@ func CronJobFrom(data string) (*CronJob, error)
|
|||||||
|
|
||||||
|
|
||||||
<a name="Dependency"></a>
|
<a name="Dependency"></a>
|
||||||
## type [Dependency](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/dependencies.go#L6-L12>)
|
## type [Dependency](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/dependencies.go#L6-L12>)
|
||||||
|
|
||||||
Dependency is a dependency of a chart to other charts.
|
Dependency is a dependency of a chart to other charts.
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ type Dependency struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="DependenciesFrom"></a>
|
<a name="DependenciesFrom"></a>
|
||||||
### func [DependenciesFrom](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/dependencies.go#L15>)
|
### func [DependenciesFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/dependencies.go#L15>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func DependenciesFrom(data string) ([]Dependency, error)
|
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.
|
DependenciesFrom returns a slice of dependencies from the given string.
|
||||||
|
|
||||||
<a name="EnvFrom"></a>
|
<a name="EnvFrom"></a>
|
||||||
## type [EnvFrom](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/envFrom.go#L5>)
|
## type [EnvFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/envFrom.go#L5>)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ type EnvFrom []string
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="EnvFromFrom"></a>
|
<a name="EnvFromFrom"></a>
|
||||||
### func [EnvFromFrom](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/envFrom.go#L8>)
|
### func [EnvFromFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/envFrom.go#L8>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func EnvFromFrom(data string) (EnvFrom, error)
|
func EnvFromFrom(data string) (EnvFrom, error)
|
||||||
@@ -91,7 +91,7 @@ func EnvFromFrom(data string) (EnvFrom, error)
|
|||||||
EnvFromFrom returns a EnvFrom from the given string.
|
EnvFromFrom returns a EnvFrom from the given string.
|
||||||
|
|
||||||
<a name="ExchangeVolume"></a>
|
<a name="ExchangeVolume"></a>
|
||||||
## type [ExchangeVolume](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/exchangeVolume.go#L5-L10>)
|
## type [ExchangeVolume](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/exchangeVolume.go#L5-L10>)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ type ExchangeVolume struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="NewExchangeVolumes"></a>
|
<a name="NewExchangeVolumes"></a>
|
||||||
### func [NewExchangeVolumes](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/exchangeVolume.go#L12>)
|
### func [NewExchangeVolumes](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/exchangeVolume.go#L12>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func NewExchangeVolumes(data string) ([]*ExchangeVolume, error)
|
func NewExchangeVolumes(data string) ([]*ExchangeVolume, error)
|
||||||
@@ -114,7 +114,7 @@ func NewExchangeVolumes(data string) ([]*ExchangeVolume, error)
|
|||||||
|
|
||||||
|
|
||||||
<a name="HealthCheck"></a>
|
<a name="HealthCheck"></a>
|
||||||
## type [HealthCheck](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/probes.go#L11-L14>)
|
## type [HealthCheck](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/probes.go#L11-L14>)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ type HealthCheck struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="ProbeFrom"></a>
|
<a name="ProbeFrom"></a>
|
||||||
### func [ProbeFrom](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/probes.go#L16>)
|
### func [ProbeFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/probes.go#L16>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func ProbeFrom(data string) (*HealthCheck, error)
|
func ProbeFrom(data string) (*HealthCheck, error)
|
||||||
@@ -135,7 +135,7 @@ func ProbeFrom(data string) (*HealthCheck, error)
|
|||||||
|
|
||||||
|
|
||||||
<a name="Ingress"></a>
|
<a name="Ingress"></a>
|
||||||
## type [Ingress](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/ingress.go#L15-L23>)
|
## type [Ingress](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/ingress.go#L15-L23>)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ type Ingress struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="IngressFrom"></a>
|
<a name="IngressFrom"></a>
|
||||||
### func [IngressFrom](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/ingress.go#L26>)
|
### func [IngressFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/ingress.go#L26>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func IngressFrom(data string) (*Ingress, error)
|
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.
|
IngressFrom creates a new Ingress from a compose service.
|
||||||
|
|
||||||
<a name="MapEnv"></a>
|
<a name="MapEnv"></a>
|
||||||
## type [MapEnv](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/mapenv.go#L5>)
|
## type [MapEnv](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/mapenv.go#L5>)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ type MapEnv map[string]string
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="MapEnvFrom"></a>
|
<a name="MapEnvFrom"></a>
|
||||||
### func [MapEnvFrom](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/mapenv.go#L8>)
|
### func [MapEnvFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/mapenv.go#L8>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func MapEnvFrom(data string) (MapEnv, error)
|
func MapEnvFrom(data string) (MapEnv, error)
|
||||||
@@ -179,7 +179,7 @@ func MapEnvFrom(data string) (MapEnv, error)
|
|||||||
MapEnvFrom returns a MapEnv from the given string.
|
MapEnvFrom returns a MapEnv from the given string.
|
||||||
|
|
||||||
<a name="Ports"></a>
|
<a name="Ports"></a>
|
||||||
## type [Ports](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/ports.go#L5>)
|
## type [Ports](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/ports.go#L5>)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ type Ports []uint32
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="PortsFrom"></a>
|
<a name="PortsFrom"></a>
|
||||||
### func [PortsFrom](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/ports.go#L8>)
|
### func [PortsFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/ports.go#L8>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func PortsFrom(data string) (Ports, error)
|
func PortsFrom(data string) (Ports, error)
|
||||||
@@ -197,7 +197,7 @@ func PortsFrom(data string) (Ports, error)
|
|||||||
PortsFrom returns a Ports from the given string.
|
PortsFrom returns a Ports from the given string.
|
||||||
|
|
||||||
<a name="Secrets"></a>
|
<a name="Secrets"></a>
|
||||||
## type [Secrets](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/secrets.go#L5>)
|
## type [Secrets](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/secrets.go#L5>)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ type Secrets []string
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="SecretsFrom"></a>
|
<a name="SecretsFrom"></a>
|
||||||
### func [SecretsFrom](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/secrets.go#L7>)
|
### func [SecretsFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/secrets.go#L7>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func SecretsFrom(data string) (Secrets, error)
|
func SecretsFrom(data string) (Secrets, error)
|
||||||
@@ -215,7 +215,7 @@ func SecretsFrom(data string) (Secrets, error)
|
|||||||
|
|
||||||
|
|
||||||
<a name="TLS"></a>
|
<a name="TLS"></a>
|
||||||
## type [TLS](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/ingress.go#L11-L13>)
|
## type [TLS](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/ingress.go#L11-L13>)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ type TLS struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="ValueFrom"></a>
|
<a name="ValueFrom"></a>
|
||||||
## type [ValueFrom](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/valueFrom.go#L5>)
|
## type [ValueFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/valueFrom.go#L5>)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -235,7 +235,7 @@ type ValueFrom map[string]string
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="GetValueFrom"></a>
|
<a name="GetValueFrom"></a>
|
||||||
### func [GetValueFrom](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/generator/labels/labelstructs/valueFrom.go#L7>)
|
### func [GetValueFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/labels/labelstructs/valueFrom.go#L7>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func GetValueFrom(data string) (*ValueFrom, error)
|
func GetValueFrom(data string) (*ValueFrom, error)
|
||||||
|
|||||||
@@ -1,164 +0,0 @@
|
|||||||
<!-- Code generated by gomarkdoc. DO NOT EDIT -->
|
|
||||||
|
|
||||||
# logger
|
|
||||||
|
|
||||||
```go
|
|
||||||
import "katenary.io/internal/logger"
|
|
||||||
```
|
|
||||||
|
|
||||||
Package logger provides simple logging functions with icons and colors.
|
|
||||||
|
|
||||||
## func [Failure](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/logger/logger.go#L75>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func Failure(msg ...any)
|
|
||||||
```
|
|
||||||
|
|
||||||
Failure prints a failure message.
|
|
||||||
|
|
||||||
<a name="Failuref"></a>
|
|
||||||
## func [Failuref](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/logger/logger.go#L81>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func Failuref(format string, msg ...any)
|
|
||||||
```
|
|
||||||
|
|
||||||
Failuref prints a formatted failure message.
|
|
||||||
|
|
||||||
<a name="Fatal"></a>
|
|
||||||
## func [Fatal](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/logger/logger.go#L108>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func Fatal(msg ...any)
|
|
||||||
```
|
|
||||||
|
|
||||||
Fatal prints a fatal error message and exits with code 1.
|
|
||||||
|
|
||||||
<a name="Fatalf"></a>
|
|
||||||
## func [Fatalf](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/logger/logger.go#L114>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func Fatalf(format string, msg ...any)
|
|
||||||
```
|
|
||||||
|
|
||||||
Fatalf prints a fatal error message with formatting and exits with code 1.
|
|
||||||
|
|
||||||
<a name="Info"></a>
|
|
||||||
## func [Info](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/logger/logger.go#L41>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func Info(msg ...any)
|
|
||||||
```
|
|
||||||
|
|
||||||
Info prints an informational message.
|
|
||||||
|
|
||||||
<a name="Infof"></a>
|
|
||||||
## func [Infof](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/logger/logger.go#L46>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func Infof(format string, msg ...any)
|
|
||||||
```
|
|
||||||
|
|
||||||
Infof prints a formatted informational message.
|
|
||||||
|
|
||||||
<a name="Log"></a>
|
|
||||||
## func [Log](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/logger/logger.go#L87>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func Log(icon Icon, msg ...any)
|
|
||||||
```
|
|
||||||
|
|
||||||
Log prints a message with a custom icon.
|
|
||||||
|
|
||||||
<a name="Logf"></a>
|
|
||||||
## func [Logf](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/logger/logger.go#L92>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func Logf(icon Icon, format string, msg ...any)
|
|
||||||
```
|
|
||||||
|
|
||||||
Logf prints a formatted message with a custom icon.
|
|
||||||
|
|
||||||
<a name="Print"></a>
|
|
||||||
## func [Print](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/logger/logger.go#L31>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func Print(msg ...any)
|
|
||||||
```
|
|
||||||
|
|
||||||
Print prints a message without icon.
|
|
||||||
|
|
||||||
<a name="Printf"></a>
|
|
||||||
## func [Printf](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/logger/logger.go#L36>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func Printf(format string, msg ...any)
|
|
||||||
```
|
|
||||||
|
|
||||||
Printf prints a formatted message without icon.
|
|
||||||
|
|
||||||
<a name="Success"></a>
|
|
||||||
## func [Success](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/logger/logger.go#L63>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func Success(msg ...any)
|
|
||||||
```
|
|
||||||
|
|
||||||
Success prints a success message.
|
|
||||||
|
|
||||||
<a name="Successf"></a>
|
|
||||||
## func [Successf](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/logger/logger.go#L69>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func Successf(format string, msg ...any)
|
|
||||||
```
|
|
||||||
|
|
||||||
Successf prints a formatted success message.
|
|
||||||
|
|
||||||
<a name="Warn"></a>
|
|
||||||
## func [Warn](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/logger/logger.go#L51>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func Warn(msg ...any)
|
|
||||||
```
|
|
||||||
|
|
||||||
Warn prints a warning message.
|
|
||||||
|
|
||||||
<a name="Warnf"></a>
|
|
||||||
## func [Warnf](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/logger/logger.go#L57>)
|
|
||||||
|
|
||||||
```go
|
|
||||||
func Warnf(format string, msg ...any)
|
|
||||||
```
|
|
||||||
|
|
||||||
Warnf prints a formatted warning message.
|
|
||||||
|
|
||||||
<a name="Icon"></a>
|
|
||||||
## type [Icon](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/logger/logger.go#L10>)
|
|
||||||
|
|
||||||
Icon is a unicode icon
|
|
||||||
|
|
||||||
```go
|
|
||||||
type Icon string
|
|
||||||
```
|
|
||||||
|
|
||||||
<a name="IconSuccess"></a>Icons used in katenary.
|
|
||||||
|
|
||||||
```go
|
|
||||||
const (
|
|
||||||
IconSuccess Icon = "✅"
|
|
||||||
IconFailure Icon = "❌"
|
|
||||||
IconWarning Icon = "❕"
|
|
||||||
IconNote Icon = "📝"
|
|
||||||
IconWorld Icon = "🌐"
|
|
||||||
IconPlug Icon = "🔌"
|
|
||||||
IconPackage Icon = "📦"
|
|
||||||
IconCabinet Icon = "🗄️"
|
|
||||||
IconInfo Icon = "🔵"
|
|
||||||
IconSecret Icon = "🔒"
|
|
||||||
IconConfig Icon = "🔧"
|
|
||||||
IconDependency Icon = "🔗"
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
|
|
||||||
@@ -8,7 +8,7 @@ import "katenary.io/internal/parser"
|
|||||||
|
|
||||||
Package parser is a wrapper around compose\-go to parse compose files.
|
Package parser is a wrapper around compose\-go to parse compose files.
|
||||||
|
|
||||||
## func [Parse](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/parser/main.go#L30>)
|
## func [Parse](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/parser/main.go#L29>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func Parse(profiles []string, envFiles []string, dockerComposeFile ...string) (*types.Project, error)
|
func Parse(profiles []string, envFiles []string, dockerComposeFile ...string) (*types.Project, error)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const DirectoryPermission = 0o755
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="AsResourceName"></a>
|
<a name="AsResourceName"></a>
|
||||||
## func [AsResourceName](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L197>)
|
## func [AsResourceName](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L196>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func AsResourceName(name string) string
|
func AsResourceName(name string) string
|
||||||
@@ -26,16 +26,16 @@ func AsResourceName(name string) string
|
|||||||
AsResourceName returns a resource name with underscores to respect the kubernetes naming convention. It's the opposite of FixedResourceName.
|
AsResourceName returns a resource name with underscores to respect the kubernetes naming convention. It's the opposite of FixedResourceName.
|
||||||
|
|
||||||
<a name="Confirm"></a>
|
<a name="Confirm"></a>
|
||||||
## func [Confirm](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L165>)
|
## func [Confirm](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L164>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func Confirm(question string, icon ...logger.Icon) bool
|
func Confirm(question string, icon ...Icon) bool
|
||||||
```
|
```
|
||||||
|
|
||||||
Confirm asks a question and returns true if the answer is y.
|
Confirm asks a question and returns true if the answer is y.
|
||||||
|
|
||||||
<a name="CountStartingSpaces"></a>
|
<a name="CountStartingSpaces"></a>
|
||||||
## func [CountStartingSpaces](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L41>)
|
## func [CountStartingSpaces](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L41>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func CountStartingSpaces(line string) int
|
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.
|
CountStartingSpaces counts the number of spaces at the beginning of a string.
|
||||||
|
|
||||||
<a name="EncodeBasicYaml"></a>
|
<a name="EncodeBasicYaml"></a>
|
||||||
## func [EncodeBasicYaml](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L179>)
|
## func [EncodeBasicYaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L178>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func EncodeBasicYaml(data any) ([]byte, error)
|
func EncodeBasicYaml(data any) ([]byte, error)
|
||||||
@@ -53,7 +53,7 @@ func EncodeBasicYaml(data any) ([]byte, error)
|
|||||||
EncodeBasicYaml encodes a basic yaml from an interface.
|
EncodeBasicYaml encodes a basic yaml from an interface.
|
||||||
|
|
||||||
<a name="FixedResourceName"></a>
|
<a name="FixedResourceName"></a>
|
||||||
## func [FixedResourceName](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L191>)
|
## func [FixedResourceName](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L190>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func FixedResourceName(name string) string
|
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.
|
FixedResourceName returns a resource name without underscores to respect the kubernetes naming convention.
|
||||||
|
|
||||||
<a name="GetContainerByName"></a>
|
<a name="GetContainerByName"></a>
|
||||||
## func [GetContainerByName](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L87>)
|
## func [GetContainerByName](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L87>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func GetContainerByName(name string, containers []corev1.Container) (*corev1.Container, int)
|
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.
|
GetContainerByName returns a container by name and its index in the array. It returns nil, \-1 if not found.
|
||||||
|
|
||||||
<a name="GetKind"></a>
|
<a name="GetKind"></a>
|
||||||
## func [GetKind](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L54>)
|
## func [GetKind](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L54>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func GetKind(path string) (kind string)
|
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.
|
GetKind returns the kind of the resource from the file path.
|
||||||
|
|
||||||
<a name="GetServiceNameByPort"></a>
|
<a name="GetServiceNameByPort"></a>
|
||||||
## func [GetServiceNameByPort](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L77>)
|
## func [GetServiceNameByPort](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L77>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func GetServiceNameByPort(port int) string
|
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.
|
GetServiceNameByPort returns the service name for a port. It the service name is not found, it returns an empty string.
|
||||||
|
|
||||||
<a name="GetValuesFromLabel"></a>
|
<a name="GetValuesFromLabel"></a>
|
||||||
## func [GetValuesFromLabel](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L129>)
|
## func [GetValuesFromLabel](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L129>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func GetValuesFromLabel(service types.ServiceConfig, LabelValues string) map[string]*EnvConfig
|
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.
|
GetValuesFromLabel returns a map of values from a label.
|
||||||
|
|
||||||
<a name="HashComposefiles"></a>
|
<a name="HashComposefiles"></a>
|
||||||
## func [HashComposefiles](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/hash.go#L12>)
|
## func [HashComposefiles](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/hash.go#L12>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func HashComposefiles(files []string) (string, error)
|
func HashComposefiles(files []string) (string, error)
|
||||||
@@ -107,7 +107,7 @@ func HashComposefiles(files []string) (string, error)
|
|||||||
HashComposefiles returns a hash of the compose files.
|
HashComposefiles returns a hash of the compose files.
|
||||||
|
|
||||||
<a name="Int32Ptr"></a>
|
<a name="Int32Ptr"></a>
|
||||||
## func [Int32Ptr](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L35>)
|
## func [Int32Ptr](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L35>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func Int32Ptr(i int32) *int32
|
func Int32Ptr(i int32) *int32
|
||||||
@@ -116,7 +116,7 @@ func Int32Ptr(i int32) *int32
|
|||||||
Int32Ptr returns a pointer to an int32.
|
Int32Ptr returns a pointer to an int32.
|
||||||
|
|
||||||
<a name="PathToName"></a>
|
<a name="PathToName"></a>
|
||||||
## func [PathToName](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L106>)
|
## func [PathToName](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L106>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func PathToName(path string) string
|
func PathToName(path string) string
|
||||||
@@ -125,7 +125,7 @@ func PathToName(path string) string
|
|||||||
PathToName converts a path to a kubernetes complient name.
|
PathToName converts a path to a kubernetes complient name.
|
||||||
|
|
||||||
<a name="StrPtr"></a>
|
<a name="StrPtr"></a>
|
||||||
## func [StrPtr](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L38>)
|
## func [StrPtr](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L38>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func StrPtr(s string) *string
|
func StrPtr(s string) *string
|
||||||
@@ -134,7 +134,7 @@ func StrPtr(s string) *string
|
|||||||
StrPtr returns a pointer to a string.
|
StrPtr returns a pointer to a string.
|
||||||
|
|
||||||
<a name="TplName"></a>
|
<a name="TplName"></a>
|
||||||
## func [TplName](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L22>)
|
## func [TplName](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L22>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func TplName(serviceName, appname string, suffix ...string) string
|
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.
|
TplName returns the name of the kubernetes resource as a template string. It is used in the templates and defined in \_helper.tpl file.
|
||||||
|
|
||||||
<a name="TplValue"></a>
|
<a name="TplValue"></a>
|
||||||
## func [TplValue](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L97>)
|
## func [TplValue](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L97>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func TplValue(serviceName, variable string, pipes ...string) string
|
func TplValue(serviceName, variable string, pipes ...string) string
|
||||||
@@ -151,8 +151,17 @@ 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.
|
TplValue returns a string that can be used in a template to access a value from the values file.
|
||||||
|
|
||||||
|
<a name="Warn"></a>
|
||||||
|
## func [Warn](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/icons.go#L25>)
|
||||||
|
|
||||||
|
```go
|
||||||
|
func Warn(msg ...any)
|
||||||
|
```
|
||||||
|
|
||||||
|
Warn prints a warning message
|
||||||
|
|
||||||
<a name="WordWrap"></a>
|
<a name="WordWrap"></a>
|
||||||
## func [WordWrap](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L160>)
|
## func [WordWrap](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L159>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func WordWrap(text string, lineWidth int) string
|
func WordWrap(text string, lineWidth int) string
|
||||||
@@ -161,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.
|
WordWrap wraps a string to a given line width. Warning: it may break the string. You need to check the result.
|
||||||
|
|
||||||
<a name="Wrap"></a>
|
<a name="Wrap"></a>
|
||||||
## func [Wrap](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L71>)
|
## func [Wrap](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L71>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func Wrap(src, above, below string) string
|
func Wrap(src, above, below string) string
|
||||||
@@ -170,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.
|
Wrap wraps a string with a string above and below. It will respect the indentation of the src string.
|
||||||
|
|
||||||
<a name="EnvConfig"></a>
|
<a name="EnvConfig"></a>
|
||||||
## type [EnvConfig](<https://repo.katenary.io/Katenary/katenary/blob/feature/better-depends-on/internal/utils/utils.go#L123-L126>)
|
## type [EnvConfig](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L123-L126>)
|
||||||
|
|
||||||
EnvConfig is a struct to hold the description of an environment variable.
|
EnvConfig is a struct to hold the description of an environment variable.
|
||||||
|
|
||||||
@@ -181,4 +190,32 @@ type EnvConfig struct {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<a name="Icon"></a>
|
||||||
|
## type [Icon](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/icons.go#L6>)
|
||||||
|
|
||||||
|
Icon is a unicode icon
|
||||||
|
|
||||||
|
```go
|
||||||
|
type Icon string
|
||||||
|
```
|
||||||
|
|
||||||
|
<a name="IconSuccess"></a>Icons used in katenary.
|
||||||
|
|
||||||
|
```go
|
||||||
|
const (
|
||||||
|
IconSuccess Icon = "✅"
|
||||||
|
IconFailure Icon = "❌"
|
||||||
|
IconWarning Icon = "❕"
|
||||||
|
IconNote Icon = "📝"
|
||||||
|
IconWorld Icon = "🌐"
|
||||||
|
IconPlug Icon = "🔌"
|
||||||
|
IconPackage Icon = "📦"
|
||||||
|
IconCabinet Icon = "🗄️"
|
||||||
|
IconInfo Icon = "🔵"
|
||||||
|
IconSecret Icon = "🔒"
|
||||||
|
IconConfig Icon = "🔧"
|
||||||
|
IconDependency Icon = "🔗"
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
|
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
|
||||||
|
|||||||
@@ -97,9 +97,7 @@ Katenary transforms compose services this way:
|
|||||||
- environment variables will be stored inside a `ConfigMap`
|
- environment variables will be stored inside a `ConfigMap`
|
||||||
- image, tags, and ingresses configuration are also stored in `values.yaml` file
|
- image, tags, and ingresses configuration are also stored in `values.yaml` file
|
||||||
- if named volumes are declared, Katenary create `PersistentVolumeClaims` - not enabled in values file
|
- if named volumes are declared, Katenary create `PersistentVolumeClaims` - not enabled in values file
|
||||||
- `depends_on` uses Kubernetes API by default to check if the service endpoint is ready. No port required.
|
- `depends_on` needs that the pointed service declared a port. If not, you can use labels to inform Katenary
|
||||||
- If you need to create a Kubernetes Service for external access, add the `katenary.v3/ports` label.
|
|
||||||
Use label `katenary.v3/depends-on: legacy` to use the old netcat method (requires port).
|
|
||||||
|
|
||||||
For any other specific configuration, like binding local files as `ConfigMap`, bind variables, add values with
|
For any other specific configuration, like binding local files as `ConfigMap`, bind variables, add values with
|
||||||
documentation, etc. You'll need to use labels.
|
documentation, etc. You'll need to use labels.
|
||||||
@@ -149,8 +147,10 @@ Katenary proposes a lot of labels to configure the helm chart generation, but so
|
|||||||
|
|
||||||
### Work with Depends On?
|
### Work with Depends On?
|
||||||
|
|
||||||
Katenary creates `initContainer` to wait for dependent services to be ready. By default, it uses the Kubernetes API
|
Kubernetes does not provide service or pod starting detection from others pods. But Katenary will create `initContainer`
|
||||||
to check if the service endpoint has ready addresses - no port required.
|
to make you able to wait for a service to respond. But you'll probably need to adapt a bit the compose file.
|
||||||
|
|
||||||
|
See this compose file:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: "3"
|
version: "3"
|
||||||
@@ -167,28 +167,9 @@ services:
|
|||||||
MYSQL_ROOT_PASSWORD: foobar
|
MYSQL_ROOT_PASSWORD: foobar
|
||||||
```
|
```
|
||||||
|
|
||||||
If you need the old netcat-based method (requires port), add the `katenary.v3/depends-on: legacy` label to the dependent service:
|
In this case, `webapp` needs to know the `database` port because the `depends_on` points on it and Kubernetes has not
|
||||||
|
(yet) solution to check the database startup. Katenary wants to create a `initContainer` to hit on the related service.
|
||||||
```yaml
|
So, instead of exposing the port in the compose definition, let's declare this to Katenary with labels:
|
||||||
version: "3"
|
|
||||||
|
|
||||||
services:
|
|
||||||
webapp:
|
|
||||||
image: php:8-apache
|
|
||||||
depends_on:
|
|
||||||
- database
|
|
||||||
labels:
|
|
||||||
katenary.v3/depends-on: legacy
|
|
||||||
|
|
||||||
database:
|
|
||||||
image: mariadb
|
|
||||||
environment:
|
|
||||||
MYSQL_ROOT_PASSWORD: foobar
|
|
||||||
ports:
|
|
||||||
- 3306:3306
|
|
||||||
```
|
|
||||||
|
|
||||||
If you want to create a Kubernetes Service for external access, add the `katenary.v3/ports` label to the service:
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: "3"
|
version: "3"
|
||||||
@@ -204,7 +185,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: foobar
|
MYSQL_ROOT_PASSWORD: foobar
|
||||||
labels:
|
labels:
|
||||||
katenary.v3/ports:
|
katenary.v3/ports: |-
|
||||||
- 3306
|
- 3306
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'\" t
|
'\" t
|
||||||
.\" Automatically generated by Pandoc 3.1.11.1
|
.\" Automatically generated by Pandoc 3.1.11.1
|
||||||
.\"
|
.\"
|
||||||
.TH "Katenary" "1" "2025-09-15" "mkdocs-manpage v2.0.1" "Katenary helm chart generator"
|
.TH "Katenary" "1" "2025-08-29" "mkdocs-manpage v2.0.1" "Katenary helm chart generator"
|
||||||
.SH Basic Usage
|
.SH Basic Usage
|
||||||
Basically, you can use \f[CR]katenary\f[R] to transpose a docker\-compose file (or any compose file compatible with \f[CR]podman\-compose\f[R] and \f[CR]docker\-compose\f[R]) to a configurable Helm Chart.
|
Basically, you can use \f[CR]katenary\f[R] to transpose a docker\-compose file (or any compose file compatible with \f[CR]podman\-compose\f[R] and \f[CR]docker\-compose\f[R]) to a configurable Helm Chart.
|
||||||
This resulting helm chart can be installed with \f[CR]helm\f[R] command to your Kubernetes cluster.
|
This resulting helm chart can be installed with \f[CR]helm\f[R] command to your Kubernetes cluster.
|
||||||
@@ -107,8 +107,8 @@ image, tags, and ingresses configuration are also stored in \f[CR]values.yaml\f[
|
|||||||
.IP \[bu] 2
|
.IP \[bu] 2
|
||||||
if named volumes are declared, Katenary create \f[CR]PersistentVolumeClaims\f[R] \- not enabled in values file
|
if named volumes are declared, Katenary create \f[CR]PersistentVolumeClaims\f[R] \- not enabled in values file
|
||||||
.IP \[bu] 2
|
.IP \[bu] 2
|
||||||
\f[CR]depends_on\f[R] uses Kubernetes API to check if the service endpoint is ready. No port declaration is required.
|
\f[CR]depends_on\f[R] needs that the pointed service declared a port.
|
||||||
If you need to create a Kubernetes Service for external access, use the \f[CR]katenary.v3/ports\f[R] label.
|
If not, you can use labels to inform Katenary
|
||||||
.PP
|
.PP
|
||||||
For any other specific configuration, like binding local files as \f[CR]ConfigMap\f[R], bind variables, add values with documentation, etc.
|
For any other specific configuration, like binding local files as \f[CR]ConfigMap\f[R], bind variables, add values with documentation, etc.
|
||||||
You\[aq]ll need to use labels.
|
You\[aq]ll need to use labels.
|
||||||
@@ -414,11 +414,11 @@ The file or directory is relative to the service directory.
|
|||||||
.PP
|
.PP
|
||||||
If it is a directory, all files inside it are added to the ConfigMap.
|
If it is a directory, all files inside it are added to the ConfigMap.
|
||||||
.PP
|
.PP
|
||||||
If the directory as subdirectories, so one ConfigMap per sub\-path are created.
|
If the directory as subdirectories, so one configmap per subpath are created.
|
||||||
.PP
|
.PP
|
||||||
Warning
|
Warning
|
||||||
.PP
|
.PP
|
||||||
It is not intended to be used to store an entire project in ConfigMaps.
|
It is not intended to be used to store an entire project in configmaps.
|
||||||
It is intended to be used to store configuration files that are not managed by the application, like nginx configuration files.
|
It is intended to be used to store configuration files that are not managed by the application, like nginx configuration files.
|
||||||
Keep in mind that your project sources should be stored in an application image or in a storage.
|
Keep in mind that your project sources should be stored in an application image or in a storage.
|
||||||
.PP
|
.PP
|
||||||
@@ -438,13 +438,8 @@ Create a cronjob from the service.
|
|||||||
.PP
|
.PP
|
||||||
This adds a cronjob to the chart.
|
This adds a cronjob to the chart.
|
||||||
.PP
|
.PP
|
||||||
The label value is a YAML object with the following attributes:
|
The label value is a YAML object with the following attributes: \- command: the command to be executed \- schedule: the cron schedule (cron format or \[at]every where \[dq]every\[dq] is a duration like 1h30m, daily, hourly...)
|
||||||
.IP \[bu] 2
|
\- rbac: false (optionnal), if true, it will create a role, a rolebinding and a serviceaccount to make your cronjob able to connect the Kubernetes API
|
||||||
command: the command to be executed
|
|
||||||
.IP \[bu] 2
|
|
||||||
schedule: the cron schedule (cron format or \[at]every where \[dq]every\[dq] is a duration like 1h30m, daily, hourly...)
|
|
||||||
.IP \[bu] 2
|
|
||||||
rbac: false (optionnal), if true, it will create a role, a rolebinding and a serviceaccount to make your cronjob able to connect the Kubernetes API
|
|
||||||
.PP
|
.PP
|
||||||
\f[B]Example:\f[R]
|
\f[B]Example:\f[R]
|
||||||
.IP
|
.IP
|
||||||
@@ -537,7 +532,7 @@ service1:
|
|||||||
service2:
|
service2:
|
||||||
image: php:7.4\-fpm
|
image: php:7.4\-fpm
|
||||||
labels:
|
labels:
|
||||||
# get the congigMap from service1 where FOO is
|
# get the congigMap from service1 where FOO is
|
||||||
# defined inside this service too
|
# defined inside this service too
|
||||||
katenary.v3/env\-from: |\-
|
katenary.v3/env\-from: |\-
|
||||||
\- myservice1
|
\- myservice1
|
||||||
@@ -560,13 +555,7 @@ a \f[CR]voumeMount\f[R] in the pod for \f[B]each container\f[R]
|
|||||||
.IP \[bu] 2
|
.IP \[bu] 2
|
||||||
a \f[CR]initContainer\f[R] for each definition
|
a \f[CR]initContainer\f[R] for each definition
|
||||||
.PP
|
.PP
|
||||||
Fields:
|
Fields: \- name: the name of the volume (manadatory) \- mountPath: the path where the volume is mounted in the pod (optional, default is \f[CR]/opt\f[R]) \- init: a command to run to initialize the volume with data (optional)
|
||||||
.IP \[bu] 2
|
|
||||||
name: the name of the volume (manadatory)
|
|
||||||
.IP \[bu] 2
|
|
||||||
mountPath: the path where the volume is mounted in the pod (optional, default is \f[CR]/opt\f[R])
|
|
||||||
.IP \[bu] 2
|
|
||||||
init: a command to run to initialize the volume with data (optional)
|
|
||||||
.PP
|
.PP
|
||||||
Warning
|
Warning
|
||||||
.PP
|
.PP
|
||||||
@@ -656,7 +645,7 @@ ghost:
|
|||||||
image: ghost:1.25.5
|
image: ghost:1.25.5
|
||||||
labels:
|
labels:
|
||||||
# The chart is now named ghost, and the appVersion is 1.25.5.
|
# The chart is now named ghost, and the appVersion is 1.25.5.
|
||||||
# In Deployment, the image attribute is set to ghost:1.25.5 if
|
# In Deployment, the image attribute is set to ghost:1.25.5 if
|
||||||
# you don\[aq]t change the \[dq]tag\[dq] attribute in values.yaml
|
# you don\[aq]t change the \[dq]tag\[dq] attribute in values.yaml
|
||||||
katenary.v3/main\-app: true
|
katenary.v3/main\-app: true
|
||||||
.EE
|
.EE
|
||||||
@@ -745,7 +734,7 @@ Environment variables to be added to the values.yaml
|
|||||||
.PP
|
.PP
|
||||||
\f[B]Type\f[R]: \f[CR][]string or map[string]string\f[R]
|
\f[B]Type\f[R]: \f[CR][]string or map[string]string\f[R]
|
||||||
.PP
|
.PP
|
||||||
By default, all environment variables in the \[dq]env\[dq] and environment files are added to ConfigMaps with the static values set.
|
By default, all environment variables in the \[dq]env\[dq] and environment files are added to configmaps with the static values set.
|
||||||
This label allows adding environment variables to the values.yaml file.
|
This label allows adding environment variables to the values.yaml file.
|
||||||
.PP
|
.PP
|
||||||
Note that the value inside the configmap is \f[CR]{{ tpl vaname . }}\f[R], so you can set the value to a template that will be rendered with the values.yaml file.
|
Note that the value inside the configmap is \f[CR]{{ tpl vaname . }}\f[R], so you can set the value to a template that will be rendered with the values.yaml file.
|
||||||
@@ -767,7 +756,7 @@ labels:
|
|||||||
\- TO_CONFIGURE
|
\- TO_CONFIGURE
|
||||||
# complex values, set as a template in values.yaml with a documentation
|
# complex values, set as a template in values.yaml with a documentation
|
||||||
\- A_COMPLEX_VALUE: |\-
|
\- A_COMPLEX_VALUE: |\-
|
||||||
This is the documentation for the variable to
|
This is the documentation for the variable to
|
||||||
configure in values.yaml.
|
configure in values.yaml.
|
||||||
It can be, of course, a multiline text.
|
It can be, of course, a multiline text.
|
||||||
.EE
|
.EE
|
||||||
|
|||||||
44
go.mod
44
go.mod
@@ -1,18 +1,16 @@
|
|||||||
module katenary.io
|
module katenary.io
|
||||||
|
|
||||||
go 1.24.0
|
go 1.25
|
||||||
|
|
||||||
toolchain go1.24.7
|
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/compose-spec/compose-go/v2 v2.9.0
|
github.com/compose-spec/compose-go v1.20.2
|
||||||
github.com/invopop/jsonschema v0.13.0
|
github.com/invopop/jsonschema v0.13.0
|
||||||
github.com/mitchellh/go-wordwrap v1.0.1
|
github.com/mitchellh/go-wordwrap v1.0.1
|
||||||
github.com/spf13/cobra v1.10.1
|
github.com/spf13/cobra v1.9.1
|
||||||
github.com/thediveo/netdb v1.1.2
|
github.com/thediveo/netdb v1.1.2
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
k8s.io/api v0.34.1
|
k8s.io/api v0.33.4
|
||||||
k8s.io/apimachinery v0.34.1
|
k8s.io/apimachinery v0.33.4
|
||||||
sigs.k8s.io/yaml v1.6.0
|
sigs.k8s.io/yaml v1.6.0
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -25,33 +23,35 @@ require (
|
|||||||
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
|
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
|
||||||
github.com/go-logr/logr v1.4.3 // indirect
|
github.com/go-logr/logr v1.4.3 // indirect
|
||||||
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
|
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
|
||||||
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
|
|
||||||
github.com/gogo/protobuf v1.3.2 // indirect
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
|
github.com/imdario/mergo v0.3.16 // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/kr/text v0.2.0 // indirect
|
github.com/kr/text v0.2.0 // indirect
|
||||||
github.com/mailru/easyjson v0.9.1 // indirect
|
github.com/mailru/easyjson v0.9.0 // indirect
|
||||||
github.com/mattn/go-shellwords v1.0.12 // indirect
|
github.com/mattn/go-shellwords v1.0.12 // indirect
|
||||||
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||||
github.com/spf13/pflag v1.0.10 // indirect
|
github.com/spf13/pflag v1.0.7 // indirect
|
||||||
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
|
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
|
||||||
github.com/x448/float16 v0.8.4 // indirect
|
github.com/x448/float16 v0.8.4 // indirect
|
||||||
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
|
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||||
go.yaml.in/yaml/v2 v2.4.3 // indirect
|
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||||
golang.org/x/net v0.46.0 // indirect
|
go.yaml.in/yaml/v2 v2.4.2 // indirect
|
||||||
golang.org/x/sync v0.17.0 // indirect
|
golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 // indirect
|
||||||
golang.org/x/sys v0.37.0 // indirect
|
golang.org/x/net v0.43.0 // indirect
|
||||||
golang.org/x/text v0.30.0 // indirect
|
golang.org/x/sync v0.16.0 // indirect
|
||||||
golang.org/x/tools v0.38.0 // indirect
|
golang.org/x/sys v0.35.0 // indirect
|
||||||
|
golang.org/x/text v0.28.0 // indirect
|
||||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||||
k8s.io/klog/v2 v2.130.1 // indirect
|
k8s.io/klog/v2 v2.130.1 // indirect
|
||||||
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect
|
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect
|
||||||
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
|
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
|
||||||
sigs.k8s.io/randfill v1.0.0 // indirect
|
sigs.k8s.io/randfill v1.0.0 // indirect
|
||||||
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
|
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
91
go.sum
91
go.sum
@@ -2,8 +2,8 @@ github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPn
|
|||||||
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
|
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
|
||||||
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
|
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
|
||||||
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
||||||
github.com/compose-spec/compose-go/v2 v2.9.0 h1:UHSv/QHlo6QJtrT4igF1rdORgIUhDo1gWuyJUoiNNIM=
|
github.com/compose-spec/compose-go v1.20.2 h1:u/yfZHn4EaHGdidrZycWpxXgFffjYULlTbRfJ51ykjQ=
|
||||||
github.com/compose-spec/compose-go/v2 v2.9.0/go.mod h1:Oky9AZGTRB4E+0VbTPZTUu4Kp+oEMMuwZXZtPPVT1iE=
|
github.com/compose-spec/compose-go v1.20.2/go.mod h1:+MdqXV4RA7wdFsahh/Kb8U0pAJqkg7mr4PM9tFKU8RM=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@@ -11,8 +11,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
|||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
|
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
|
||||||
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
|
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
|
||||||
github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI=
|
|
||||||
github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
|
||||||
github.com/docker/go-connections v0.6.0 h1:LlMG9azAe1TqfR7sO+NJttz1gy6KO7VJBh+pMmjSD94=
|
github.com/docker/go-connections v0.6.0 h1:LlMG9azAe1TqfR7sO+NJttz1gy6KO7VJBh+pMmjSD94=
|
||||||
github.com/docker/go-connections v0.6.0/go.mod h1:AahvXYshr6JgfUJGdDCs2b5EZG/vmaMAntpSFH5BFKE=
|
github.com/docker/go-connections v0.6.0/go.mod h1:AahvXYshr6JgfUJGdDCs2b5EZG/vmaMAntpSFH5BFKE=
|
||||||
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
|
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
|
||||||
@@ -23,15 +21,16 @@ github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
|||||||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
|
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
|
||||||
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
|
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
|
||||||
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
|
|
||||||
github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
|
||||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||||
|
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=
|
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=
|
||||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||||
|
github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
|
||||||
|
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||||
github.com/invopop/jsonschema v0.13.0 h1:KvpoAJWEjR3uD9Kbm2HWJmqsEaHt8lBUpd0qHcIi21E=
|
github.com/invopop/jsonschema v0.13.0 h1:KvpoAJWEjR3uD9Kbm2HWJmqsEaHt8lBUpd0qHcIi21E=
|
||||||
@@ -44,38 +43,39 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
|||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8=
|
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
|
||||||
github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
||||||
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
|
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
|
||||||
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
|
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
|
||||||
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
|
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
|
||||||
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
|
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
|
||||||
|
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||||
|
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||||
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8=
|
|
||||||
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
|
||||||
github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM=
|
github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM=
|
||||||
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
|
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
|
||||||
github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
|
github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
|
||||||
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
|
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
|
||||||
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||||
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||||
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
|
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
|
||||||
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
|
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 h1:PKK9DyHxif4LZo+uQSgXNqs0jj5+xZwwfKHgph2lxBw=
|
|
||||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
|
|
||||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||||
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
|
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
|
||||||
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
|
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
|
||||||
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
|
github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M=
|
||||||
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
@@ -87,46 +87,53 @@ github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/
|
|||||||
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
|
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
|
||||||
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
|
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
|
||||||
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
|
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
|
||||||
github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc=
|
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||||
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
|
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
|
||||||
|
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||||
|
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
|
||||||
|
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
|
||||||
|
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
|
||||||
|
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
||||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
|
go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
|
||||||
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
|
go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
|
||||||
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
|
go.yaml.in/yaml/v3 v3.0.3 h1:bXOww4E/J3f66rav3pX3m8w6jDE4knZjGOw8b5Y6iNE=
|
||||||
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
|
go.yaml.in/yaml/v3 v3.0.3/go.mod h1:tBHosrYAkRZjRAOREWbDnBXUf08JOwYq++0QNwQiWzI=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 h1:SbTAbRFnd5kjQXbczszQ0hdk3ctwYf3qBNH9jIsGclE=
|
||||||
|
golang.org/x/exp v0.0.0-20250813145105-42675adae3e6/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4=
|
||||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
|
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
|
||||||
golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
|
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
|
||||||
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
|
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
||||||
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
|
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
||||||
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
|
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
|
golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg=
|
||||||
golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
|
golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
@@ -141,19 +148,21 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
|||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o=
|
gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o=
|
||||||
gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g=
|
gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g=
|
||||||
k8s.io/api v0.34.1 h1:jC+153630BMdlFukegoEL8E/yT7aLyQkIVuwhmwDgJM=
|
k8s.io/api v0.33.4 h1:oTzrFVNPXBjMu0IlpA2eDDIU49jsuEorGHB4cvKupkk=
|
||||||
k8s.io/api v0.34.1/go.mod h1:SB80FxFtXn5/gwzCoN6QCtPD7Vbu5w2n1S0J5gFfTYk=
|
k8s.io/api v0.33.4/go.mod h1:VHQZ4cuxQ9sCUMESJV5+Fe8bGnqAARZ08tSTdHWfeAc=
|
||||||
k8s.io/apimachinery v0.34.1 h1:dTlxFls/eikpJxmAC7MVE8oOeP1zryV7iRyIjB0gky4=
|
k8s.io/apimachinery v0.33.4 h1:SOf/JW33TP0eppJMkIgQ+L6atlDiP/090oaX0y9pd9s=
|
||||||
k8s.io/apimachinery v0.34.1/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw=
|
k8s.io/apimachinery v0.33.4/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
|
||||||
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
||||||
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
||||||
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck=
|
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 h1:hwvWFiBzdWw1FhfY1FooPn3kzWuJ8tmbZBHi4zVsl1Y=
|
||||||
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||||
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg=
|
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg=
|
||||||
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
|
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
|
||||||
|
sigs.k8s.io/randfill v0.0.0-20250304075658-069ef1bbf016/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
|
||||||
sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU=
|
sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU=
|
||||||
sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
|
sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
|
||||||
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco=
|
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 h1:qPeWmscJcXP0snki5IYF79Z8xrl8ETFxgMd7wez1XkI=
|
||||||
sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE=
|
sigs.k8s.io/structured-merge-diff/v4 v4.7.0/go.mod h1:dDy58f92j70zLsuZVuUX5Wp9vtxXpaZnkPGWeqDfCps=
|
||||||
|
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||||
sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs=
|
sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs=
|
||||||
sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4=
|
sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4=
|
||||||
|
|||||||
12
install.sh
12
install.sh
@@ -4,6 +4,8 @@
|
|||||||
# Can be launched with the following command:
|
# Can be launched with the following command:
|
||||||
# sh <(curl -sSL https://raw.githubusercontent.com/Katenary/katenary/master/install.sh)
|
# sh <(curl -sSL https://raw.githubusercontent.com/Katenary/katenary/master/install.sh)
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
# Detect the OS and architecture
|
# Detect the OS and architecture
|
||||||
OS=$(uname)
|
OS=$(uname)
|
||||||
ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
@@ -19,10 +21,10 @@ done
|
|||||||
# - $HOME/.local/bin
|
# - $HOME/.local/bin
|
||||||
# - $HOME/.bin
|
# - $HOME/.bin
|
||||||
# - $HOME/bin
|
# - $HOME/bin
|
||||||
COMMON_INSTALL_PATHS="$HOME/.local/bin $HOME/.bin $HOME/bin"
|
COMON_INSTALL_PATHS="$HOME/.local/bin $HOME/.bin $HOME/bin"
|
||||||
|
|
||||||
INSTALL_PATH=""
|
INSTALL_PATH=""
|
||||||
for p in $COMMON_INSTALL_PATHS; do
|
for p in $COMON_INSTALL_PATHS; do
|
||||||
if [ -d $p ]; then
|
if [ -d $p ]; then
|
||||||
INSTALL_PATH=$p
|
INSTALL_PATH=$p
|
||||||
break
|
break
|
||||||
@@ -49,16 +51,14 @@ fi
|
|||||||
|
|
||||||
# Where to download the binary
|
# Where to download the binary
|
||||||
TAG=$(curl -sLf https://repo.katenary.io/api/v1/repos/katenary/katenary/releases/latest 2>/dev/null | grep -Po '"tag_name":\s*"[^"]*"' | cut -d ":" -f2 | tr -d '"')
|
TAG=$(curl -sLf https://repo.katenary.io/api/v1/repos/katenary/katenary/releases/latest 2>/dev/null | grep -Po '"tag_name":\s*"[^"]*"' | cut -d ":" -f2 | tr -d '"')
|
||||||
TAG=${TAG#releases/}
|
TAG=3.0.0-rc7
|
||||||
|
# for compatibility with older ARM versions
|
||||||
# use the right names for the OS and architecture
|
|
||||||
if [ $ARCH = "x86_64" ]; then
|
if [ $ARCH = "x86_64" ]; then
|
||||||
ARCH="amd64"
|
ARCH="amd64"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BIN_URL="https://repo.katenary.io/api/packages/Katenary/generic/katenary/$TAG/katenary-$OS-$ARCH"
|
BIN_URL="https://repo.katenary.io/api/packages/Katenary/generic/katenary/$TAG/katenary-$OS-$ARCH"
|
||||||
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Downloading $BIN_URL"
|
echo "Downloading $BIN_URL"
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package generator
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"maps"
|
"maps"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -10,10 +11,9 @@ import (
|
|||||||
|
|
||||||
"katenary.io/internal/generator/labels"
|
"katenary.io/internal/generator/labels"
|
||||||
"katenary.io/internal/generator/labels/labelstructs"
|
"katenary.io/internal/generator/labels/labelstructs"
|
||||||
"katenary.io/internal/logger"
|
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -77,36 +77,36 @@ func (chart *HelmChart) SaveTemplates(templateDir string) {
|
|||||||
// t = addModeline(t)
|
// t = addModeline(t)
|
||||||
|
|
||||||
kind := utils.GetKind(name)
|
kind := utils.GetKind(name)
|
||||||
var icon logger.Icon
|
var icon utils.Icon
|
||||||
switch kind {
|
switch kind {
|
||||||
case "deployment":
|
case "deployment":
|
||||||
icon = logger.IconPackage
|
icon = utils.IconPackage
|
||||||
case "service":
|
case "service":
|
||||||
icon = logger.IconPlug
|
icon = utils.IconPlug
|
||||||
case "ingress":
|
case "ingress":
|
||||||
icon = logger.IconWorld
|
icon = utils.IconWorld
|
||||||
case "volumeclaim":
|
case "volumeclaim":
|
||||||
icon = logger.IconCabinet
|
icon = utils.IconCabinet
|
||||||
case "configmap":
|
case "configmap":
|
||||||
icon = logger.IconConfig
|
icon = utils.IconConfig
|
||||||
case "secret":
|
case "secret":
|
||||||
icon = logger.IconSecret
|
icon = utils.IconSecret
|
||||||
default:
|
default:
|
||||||
icon = logger.IconInfo
|
icon = utils.IconInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
servicename := template.Servicename
|
servicename := template.Servicename
|
||||||
if err := os.MkdirAll(filepath.Join(templateDir, servicename), utils.DirectoryPermission); err != nil {
|
if err := os.MkdirAll(filepath.Join(templateDir, servicename), utils.DirectoryPermission); err != nil {
|
||||||
logger.Failure(err.Error())
|
fmt.Println(utils.IconFailure, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
logger.Log(icon, "Creating ", kind, " ", name)
|
fmt.Println(icon, "Creating", kind, servicename)
|
||||||
// if the name is a path, create the directory
|
// if the name is a path, create the directory
|
||||||
if strings.Contains(name, string(filepath.Separator)) {
|
if strings.Contains(name, string(filepath.Separator)) {
|
||||||
name = filepath.Join(templateDir, name)
|
name = filepath.Join(templateDir, name)
|
||||||
err := os.MkdirAll(filepath.Dir(name), utils.DirectoryPermission)
|
err := os.MkdirAll(filepath.Dir(name), utils.DirectoryPermission)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Failure(err.Error())
|
fmt.Println(utils.IconFailure, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -116,14 +116,14 @@ func (chart *HelmChart) SaveTemplates(templateDir string) {
|
|||||||
}
|
}
|
||||||
f, err := os.Create(name)
|
f, err := os.Create(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(logger.IconFailure, err)
|
fmt.Println(utils.IconFailure, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
if _, err := f.Write(t); err != nil {
|
if _, err := f.Write(t); err != nil {
|
||||||
logger.Failure("error wrting template file: ", err.Error())
|
log.Fatal("error writing template file:", err)
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,15 +144,14 @@ func (chart *HelmChart) generateConfigMapsAndSecrets(project *types.Project) err
|
|||||||
if v, ok := s.Labels[labels.LabelSecrets]; ok {
|
if v, ok := s.Labels[labels.LabelSecrets]; ok {
|
||||||
list, err := labelstructs.SecretsFrom(v)
|
list, err := labelstructs.SecretsFrom(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Failure("error unmarshaling secrets label:", err)
|
log.Fatal("error unmarshaling secrets label:", err)
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
for _, secret := range list {
|
for _, secret := range list {
|
||||||
if secret == "" {
|
if secret == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if _, ok := s.Environment[secret]; !ok {
|
if _, ok := s.Environment[secret]; !ok {
|
||||||
fmt.Printf("%s secret %s not found in environment", logger.IconWarning, secret)
|
fmt.Printf("%s secret %s not found in environment", utils.IconWarning, secret)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
secretsVar[secret] = s.Environment[secret]
|
secretsVar[secret] = s.Environment[secret]
|
||||||
@@ -196,7 +195,7 @@ func (chart *HelmChart) generateDeployment(service types.ServiceConfig, deployme
|
|||||||
|
|
||||||
// isgnored service
|
// isgnored service
|
||||||
if isIgnored(service) {
|
if isIgnored(service) {
|
||||||
logger.Info("Ignoring service ", service.Name)
|
fmt.Printf("%s Ignoring service %s\n", utils.IconInfo, service.Name)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,7 +305,7 @@ func (chart *HelmChart) setDependencies(service types.ServiceConfig) (bool, erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, dep := range d {
|
for _, dep := range d {
|
||||||
logger.Log(logger.IconDependency, "Adding dependency to ", dep.Name)
|
fmt.Printf("%s Adding dependency to %s\n", utils.IconDependency, dep.Name)
|
||||||
chart.Dependencies = append(chart.Dependencies, dep)
|
chart.Dependencies = append(chart.Dependencies, dep)
|
||||||
name := dep.Name
|
name := dep.Name
|
||||||
if dep.Alias != "" {
|
if dep.Alias != "" {
|
||||||
@@ -330,12 +329,12 @@ func (chart *HelmChart) setSharedConf(service types.ServiceConfig, deployments m
|
|||||||
}
|
}
|
||||||
fromservices, err := labelstructs.EnvFromFrom(service.Labels[labels.LabelEnvFrom])
|
fromservices, err := labelstructs.EnvFromFrom(service.Labels[labels.LabelEnvFrom])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal("error unmarshaling env-from label:", err)
|
log.Fatal("error unmarshaling env-from label:", err)
|
||||||
}
|
}
|
||||||
// find the configmap in the chart templates
|
// find the configmap in the chart templates
|
||||||
for _, fromservice := range fromservices {
|
for _, fromservice := range fromservices {
|
||||||
if _, ok := chart.Templates[fromservice+".configmap.yaml"]; !ok {
|
if _, ok := chart.Templates[fromservice+".configmap.yaml"]; !ok {
|
||||||
logger.Warnf("configmap %s not found in chart templates", fromservice)
|
log.Printf("configmap %s not found in chart templates", fromservice)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// find the corresponding target deployment
|
// find the corresponding target deployment
|
||||||
@@ -355,7 +354,7 @@ func (chart *HelmChart) setEnvironmentValuesFrom(service types.ServiceConfig, de
|
|||||||
}
|
}
|
||||||
mapping, err := labelstructs.GetValueFrom(service.Labels[labels.LabelValuesFrom])
|
mapping, err := labelstructs.GetValueFrom(service.Labels[labels.LabelValuesFrom])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal("error unmarshaling values-from label:", err)
|
log.Fatal("error unmarshaling values-from label:", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
findDeployment := func(name string) *Deployment {
|
findDeployment := func(name string) *Deployment {
|
||||||
@@ -374,11 +373,11 @@ func (chart *HelmChart) setEnvironmentValuesFrom(service types.ServiceConfig, de
|
|||||||
dep := findDeployment(depName[0])
|
dep := findDeployment(depName[0])
|
||||||
target := findDeployment(service.Name)
|
target := findDeployment(service.Name)
|
||||||
if dep == nil || target == nil {
|
if dep == nil || target == nil {
|
||||||
logger.Fatalf("deployment %s or %s not found", depName[0], service.Name)
|
log.Fatalf("deployment %s or %s not found", depName[0], service.Name)
|
||||||
}
|
}
|
||||||
container, index := utils.GetContainerByName(target.service.ContainerName, target.Spec.Template.Spec.Containers)
|
container, index := utils.GetContainerByName(target.service.ContainerName, target.Spec.Template.Spec.Containers)
|
||||||
if container == nil {
|
if container == nil {
|
||||||
logger.Fatalf("Container %s not found", target.GetName())
|
log.Fatalf("Container %s not found", target.GetName())
|
||||||
}
|
}
|
||||||
reourceName := fmt.Sprintf(`{{ include "%s.fullname" . }}-%s`, chart.Name, depName[0])
|
reourceName := fmt.Sprintf(`{{ include "%s.fullname" . }}-%s`, chart.Name, depName[0])
|
||||||
// add environment with from
|
// add environment with from
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package generator
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
@@ -10,10 +11,9 @@ import (
|
|||||||
|
|
||||||
"katenary.io/internal/generator/labels"
|
"katenary.io/internal/generator/labels"
|
||||||
"katenary.io/internal/generator/labels/labelstructs"
|
"katenary.io/internal/generator/labels/labelstructs"
|
||||||
"katenary.io/internal/logger"
|
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
@@ -68,7 +68,7 @@ func NewConfigMap(service types.ServiceConfig, appName string, forFile bool) *Co
|
|||||||
// get the secrets from the labels
|
// get the secrets from the labels
|
||||||
secrets, err := labelstructs.SecretsFrom(service.Labels[labels.LabelSecrets])
|
secrets, err := labelstructs.SecretsFrom(service.Labels[labels.LabelSecrets])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
// drop the secrets from the environment
|
// drop the secrets from the environment
|
||||||
for _, secret := range secrets {
|
for _, secret := range secrets {
|
||||||
@@ -94,7 +94,7 @@ func NewConfigMap(service types.ServiceConfig, appName string, forFile bool) *Co
|
|||||||
if l, ok := service.Labels[labels.LabelMapEnv]; ok {
|
if l, ok := service.Labels[labels.LabelMapEnv]; ok {
|
||||||
envmap, err := labelstructs.MapEnvFrom(l)
|
envmap, err := labelstructs.MapEnvFrom(l)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal("Error parsing map-env", err)
|
log.Fatal("Error parsing map-env", err)
|
||||||
}
|
}
|
||||||
for key, value := range envmap {
|
for key, value := range envmap {
|
||||||
cm.AddData(key, strings.ReplaceAll(value, "__APP__", appName))
|
cm.AddData(key, strings.ReplaceAll(value, "__APP__", appName))
|
||||||
@@ -144,7 +144,7 @@ func NewConfigMapFromDirectory(service types.ServiceConfig, appName, path string
|
|||||||
path = filepath.Join(service.WorkingDir, path)
|
path = filepath.Join(service.WorkingDir, path)
|
||||||
path = filepath.Clean(path)
|
path = filepath.Clean(path)
|
||||||
if err := cm.AppendDir(path); err != nil {
|
if err := cm.AppendDir(path); err != nil {
|
||||||
logger.Fatal("Error adding files to configmap:", err)
|
log.Fatal("Error adding files to configmap:", err)
|
||||||
}
|
}
|
||||||
return cm
|
return cm
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,7 @@ func (c *ConfigMap) AppendDir(path string) error {
|
|||||||
}
|
}
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if file.IsDir() {
|
if file.IsDir() {
|
||||||
logger.Warn("Subdirectories are ignored for the moment, skipping", filepath.Join(path, file.Name()))
|
utils.Warn("Subdirectories are ignored for the moment, skipping", filepath.Join(path, file.Name()))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
path := filepath.Join(path, file.Name())
|
path := filepath.Join(path, file.Name())
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ import (
|
|||||||
|
|
||||||
"katenary.io/internal/generator/labels"
|
"katenary.io/internal/generator/labels"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
appv1 "k8s.io/api/apps/v1"
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
)
|
)
|
||||||
@@ -118,15 +117,9 @@ services:
|
|||||||
io.WriteString(fooFp, fooTxt)
|
io.WriteString(fooFp, fooTxt)
|
||||||
fooFp.Close()
|
fooFp.Close()
|
||||||
|
|
||||||
cmOutput := internalCompileTestForce(t, "-s", "templates/web/statics/configmap.yaml")
|
output := internalCompileTest(t, "-s", "templates/web/statics/configmap.yaml")
|
||||||
depOutput := internalCompileTestForce(t, "-s", "templates/web/deployment.yaml")
|
|
||||||
|
|
||||||
configMap := v1.ConfigMap{}
|
configMap := v1.ConfigMap{}
|
||||||
if err := yaml.Unmarshal([]byte(cmOutput), &configMap); err != nil {
|
if err := yaml.Unmarshal([]byte(output), &configMap); err != nil {
|
||||||
t.Errorf(unmarshalError, err)
|
|
||||||
}
|
|
||||||
deployment := appv1.Deployment{}
|
|
||||||
if err := yaml.Unmarshal([]byte(depOutput), &deployment); err != nil {
|
|
||||||
t.Errorf(unmarshalError, err)
|
t.Errorf(unmarshalError, err)
|
||||||
}
|
}
|
||||||
if configMap.Data == nil {
|
if configMap.Data == nil {
|
||||||
@@ -137,12 +130,4 @@ services:
|
|||||||
if !valid.MatchString(configMap.Name) {
|
if !valid.MatchString(configMap.Name) {
|
||||||
t.Errorf("ConfigMap name %s is not valid", configMap.Name)
|
t.Errorf("ConfigMap name %s is not valid", configMap.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// the volume mount should be named "configmap-<configmap name>"
|
|
||||||
if deployment.Spec.Template.Spec.Volumes[0].Name != deployment.Spec.Template.Spec.Containers[0].VolumeMounts[0].Name {
|
|
||||||
t.Errorf("Expected volume name to be %s, got %s",
|
|
||||||
deployment.Spec.Template.Spec.Containers[0].VolumeMounts[0].Name,
|
|
||||||
deployment.Spec.Template.Spec.Volumes[0].Name,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -15,11 +16,10 @@ import (
|
|||||||
"katenary.io/internal/generator/katenaryfile"
|
"katenary.io/internal/generator/katenaryfile"
|
||||||
"katenary.io/internal/generator/labels"
|
"katenary.io/internal/generator/labels"
|
||||||
"katenary.io/internal/generator/labels/labelstructs"
|
"katenary.io/internal/generator/labels/labelstructs"
|
||||||
"katenary.io/internal/logger"
|
|
||||||
"katenary.io/internal/parser"
|
"katenary.io/internal/parser"
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
const ingressClassHelp = `# Default value for ingress.class annotation
|
const ingressClassHelp = `# Default value for ingress.class annotation
|
||||||
@@ -109,44 +109,32 @@ func Convert(config ConvertOptions, dockerComposeFile ...string) error {
|
|||||||
|
|
||||||
// the current working directory is the directory
|
// the current working directory is the directory
|
||||||
currentDir, _ := os.Getwd()
|
currentDir, _ := os.Getwd()
|
||||||
// Filter to only existing files before chdir
|
|
||||||
var existingFiles []string
|
|
||||||
for _, f := range dockerComposeFile {
|
|
||||||
if _, err := os.Stat(f); err == nil {
|
|
||||||
existingFiles = append(existingFiles, f)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(existingFiles) == 0 && len(dockerComposeFile) > 0 {
|
|
||||||
return fmt.Errorf("no compose file found: %v", dockerComposeFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
// go to the root of the project
|
// go to the root of the project
|
||||||
if err := os.Chdir(filepath.Dir(existingFiles[0])); err != nil {
|
if err := os.Chdir(filepath.Dir(dockerComposeFile[0])); err != nil {
|
||||||
logger.Failure(err.Error())
|
fmt.Println(utils.IconFailure, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := os.Chdir(currentDir); err != nil { // after the generation, go back to the original directory
|
if err := os.Chdir(currentDir); err != nil { // after the generation, go back to the original directory
|
||||||
logger.Failure(err.Error())
|
log.Fatal(err)
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// repove the directory part of the docker-compose files
|
// repove the directory part of the docker-compose files
|
||||||
for i, f := range existingFiles {
|
for i, f := range dockerComposeFile {
|
||||||
existingFiles[i] = filepath.Base(f)
|
dockerComposeFile[i] = filepath.Base(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse the compose files
|
// parse the compose files
|
||||||
project, err := parser.Parse(config.Profiles, config.EnvFiles, existingFiles...)
|
project, err := parser.Parse(config.Profiles, config.EnvFiles, dockerComposeFile...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Failure("Cannot parse compose files", err.Error())
|
fmt.Println(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// check older version of labels
|
// check older version of labels
|
||||||
if err := checkOldLabels(project); err != nil {
|
if err := checkOldLabels(project); err != nil {
|
||||||
logger.Failure(err.Error())
|
fmt.Println(utils.IconFailure, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +147,7 @@ func Convert(config ConvertOptions, dockerComposeFile ...string) error {
|
|||||||
if _, err := os.Stat(config.OutputDir); err == nil {
|
if _, err := os.Stat(config.OutputDir); err == nil {
|
||||||
overwrite := utils.Confirm(
|
overwrite := utils.Confirm(
|
||||||
"The chart directory "+config.OutputDir+" already exists, do you want to overwrite it?",
|
"The chart directory "+config.OutputDir+" already exists, do you want to overwrite it?",
|
||||||
logger.IconWarning,
|
utils.IconWarning,
|
||||||
)
|
)
|
||||||
if !overwrite {
|
if !overwrite {
|
||||||
fmt.Println("Aborting")
|
fmt.Println("Aborting")
|
||||||
@@ -216,10 +204,6 @@ func Convert(config ConvertOptions, dockerComposeFile ...string) error {
|
|||||||
|
|
||||||
// call helm update if needed
|
// call helm update if needed
|
||||||
callHelmUpdate(config)
|
callHelmUpdate(config)
|
||||||
|
|
||||||
// flush warnings after all conversion is complete
|
|
||||||
logger.FlushWarnings()
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -415,7 +399,7 @@ func addMainTagAppDoc(values []byte, project *types.Project) []byte {
|
|||||||
} else if v == "false" || v == "no" || v == "0" {
|
} else if v == "false" || v == "no" || v == "0" {
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
logger.Log(logger.IconConfig, "Adding main tag app doc for service", service.Name)
|
fmt.Printf("%s Adding main tag app doc %s\n", utils.IconConfig, service.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
lines = addMainAppDoc(lines, service)
|
lines = addMainAppDoc(lines, service)
|
||||||
@@ -595,22 +579,22 @@ func buildValues(chart *HelmChart, project *types.Project, valuesPath string) {
|
|||||||
func callHelmUpdate(config ConvertOptions) {
|
func callHelmUpdate(config ConvertOptions) {
|
||||||
executeAndHandleError := func(fn func(ConvertOptions) error, config ConvertOptions, message string) {
|
executeAndHandleError := func(fn func(ConvertOptions) error, config ConvertOptions, message string) {
|
||||||
if err := fn(config); err != nil {
|
if err := fn(config); err != nil {
|
||||||
logger.Failure("Helm command failed, please check the output above", err.Error())
|
fmt.Println(utils.IconFailure, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
logger.Success(message)
|
fmt.Println(utils.IconSuccess, message)
|
||||||
}
|
}
|
||||||
if config.HelmUpdate {
|
if config.HelmUpdate {
|
||||||
executeAndHandleError(helmUpdate, config, "Helm dependencies updated")
|
executeAndHandleError(helmUpdate, config, "Helm dependencies updated")
|
||||||
executeAndHandleError(helmLint, config, "Helm chart linted")
|
executeAndHandleError(helmLint, config, "Helm chart linted")
|
||||||
logger.Success("Helm chart created successfully")
|
fmt.Println(utils.IconSuccess, "Helm chart created successfully")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeNewlinesInsideBrackets(values []byte) []byte {
|
func removeNewlinesInsideBrackets(values []byte) []byte {
|
||||||
re, err := regexp.Compile(`(?s)\{\{(.*?)\}\}`)
|
re, err := regexp.Compile(`(?s)\{\{(.*?)\}\}`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
return re.ReplaceAllFunc(values, func(b []byte) []byte {
|
return re.ReplaceAllFunc(values, func(b []byte) []byte {
|
||||||
// get the first match
|
// get the first match
|
||||||
@@ -643,23 +627,23 @@ func removeUnwantedLines(values []byte) []byte {
|
|||||||
func writeContent(path string, content []byte) {
|
func writeContent(path string, content []byte) {
|
||||||
f, err := os.Create(path)
|
f, err := os.Create(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Failure("Cannot create file "+path, err.Error())
|
fmt.Println(utils.IconFailure, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
defer func() {
|
defer func() {
|
||||||
if _, err := f.Write(content); err != nil {
|
if _, err := f.Write(content); err != nil {
|
||||||
logger.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
// helmLint runs "helm lint" on the output directory.
|
// helmLint runs "helm lint" on the output directory.
|
||||||
func helmLint(config ConvertOptions) error {
|
func helmLint(config ConvertOptions) error {
|
||||||
logger.Info("Linting...")
|
fmt.Println(utils.IconInfo, "Linting...")
|
||||||
helm, err := exec.LookPath("helm")
|
helm, err := exec.LookPath("helm")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Failure("Helm is not installed or not in your PATH", err.Error())
|
fmt.Println(utils.IconFailure, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
cmd := exec.Command(helm, "lint", config.OutputDir)
|
cmd := exec.Command(helm, "lint", config.OutputDir)
|
||||||
@@ -671,10 +655,10 @@ func helmLint(config ConvertOptions) error {
|
|||||||
// helmUpdate runs "helm dependency update" on the output directory.
|
// helmUpdate runs "helm dependency update" on the output directory.
|
||||||
func helmUpdate(config ConvertOptions) error {
|
func helmUpdate(config ConvertOptions) error {
|
||||||
// lookup for "helm" binary
|
// lookup for "helm" binary
|
||||||
logger.Info("Updating helm dependencies...")
|
fmt.Println(utils.IconInfo, "Updating helm dependencies...")
|
||||||
helm, err := exec.LookPath("helm")
|
helm, err := exec.LookPath("helm")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(logger.IconFailure, err)
|
fmt.Println(utils.IconFailure, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
// run "helm dependency update"
|
// run "helm dependency update"
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package generator
|
package generator
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"katenary.io/internal/generator/labels"
|
"katenary.io/internal/generator/labels"
|
||||||
"katenary.io/internal/generator/labels/labelstructs"
|
"katenary.io/internal/generator/labels/labelstructs"
|
||||||
"katenary.io/internal/logger"
|
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
batchv1 "k8s.io/api/batch/v1"
|
batchv1 "k8s.io/api/batch/v1"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@@ -33,7 +33,7 @@ func NewCronJob(service types.ServiceConfig, chart *HelmChart, appName string) (
|
|||||||
}
|
}
|
||||||
mapping, err := labelstructs.CronJobFrom(labels)
|
mapping, err := labelstructs.CronJobFrom(labels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatalf("Error parsing cronjob labels: %s", err)
|
log.Fatalf("Error parsing cronjob labels: %s", err)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package generator
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
@@ -10,17 +11,14 @@ import (
|
|||||||
|
|
||||||
"katenary.io/internal/generator/labels"
|
"katenary.io/internal/generator/labels"
|
||||||
"katenary.io/internal/generator/labels/labelstructs"
|
"katenary.io/internal/generator/labels/labelstructs"
|
||||||
"katenary.io/internal/logger"
|
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
const shCommand = "/bin/sh"
|
|
||||||
|
|
||||||
var _ Yaml = (*Deployment)(nil)
|
var _ Yaml = (*Deployment)(nil)
|
||||||
|
|
||||||
type mountPathConfig struct {
|
type mountPathConfig struct {
|
||||||
@@ -35,16 +33,15 @@ type ConfigMapMount struct {
|
|||||||
|
|
||||||
// Deployment is a kubernetes Deployment.
|
// Deployment is a kubernetes Deployment.
|
||||||
type Deployment struct {
|
type Deployment struct {
|
||||||
*appsv1.Deployment `yaml:",inline"`
|
*appsv1.Deployment `yaml:",inline"`
|
||||||
chart *HelmChart `yaml:"-"`
|
chart *HelmChart `yaml:"-"`
|
||||||
configMaps map[string]*ConfigMapMount `yaml:"-"`
|
configMaps map[string]*ConfigMapMount `yaml:"-"`
|
||||||
volumeMap map[string]string `yaml:"-"` // keep map of fixed named to original volume name
|
volumeMap map[string]string `yaml:"-"` // keep map of fixed named to original volume name
|
||||||
service *types.ServiceConfig `yaml:"-"`
|
service *types.ServiceConfig `yaml:"-"`
|
||||||
defaultTag string `yaml:"-"`
|
defaultTag string `yaml:"-"`
|
||||||
isMainApp bool `yaml:"-"`
|
isMainApp bool `yaml:"-"`
|
||||||
exchangesVolumes map[string]*labelstructs.ExchangeVolume `yaml:"-"`
|
exchangesVolumes map[string]*labelstructs.ExchangeVolume `yaml:"-"`
|
||||||
boundEnvVar []string `yaml:"-"` // environement to remove
|
boundEnvVar []string `yaml:"-"` // environement to remove
|
||||||
needsServiceAccount bool `yaml:"-"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDeployment creates a new Deployment from a compose service. The appName is the name of the application taken from the project name.
|
// NewDeployment creates a new Deployment from a compose service. The appName is the name of the application taken from the project name.
|
||||||
@@ -122,7 +119,7 @@ func (d *Deployment) AddContainer(service types.ServiceConfig) {
|
|||||||
for _, port := range service.Ports {
|
for _, port := range service.Ports {
|
||||||
name := utils.GetServiceNameByPort(int(port.Target))
|
name := utils.GetServiceNameByPort(int(port.Target))
|
||||||
if name == "" {
|
if name == "" {
|
||||||
logger.Warn("Port name not found for port ", port.Target, " in service ", service.Name, ". Using port number instead")
|
utils.Warn("Port name not found for port ", port.Target, " in service ", service.Name, ". Using port number instead")
|
||||||
name = fmt.Sprintf("port-%d", port.Target)
|
name = fmt.Sprintf("port-%d", port.Target)
|
||||||
}
|
}
|
||||||
ports = append(ports, corev1.ContainerPort{
|
ports = append(ports, corev1.ContainerPort{
|
||||||
@@ -168,7 +165,7 @@ func (d *Deployment) AddHealthCheck(service types.ServiceConfig, container *core
|
|||||||
if v, ok := service.Labels[labels.LabelHealthCheck]; ok {
|
if v, ok := service.Labels[labels.LabelHealthCheck]; ok {
|
||||||
probes, err := labelstructs.ProbeFrom(v)
|
probes, err := labelstructs.ProbeFrom(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
container.LivenessProbe = probes.LivenessProbe
|
container.LivenessProbe = probes.LivenessProbe
|
||||||
container.ReadinessProbe = probes.ReadinessProbe
|
container.ReadinessProbe = probes.ReadinessProbe
|
||||||
@@ -203,15 +200,22 @@ func (d *Deployment) AddVolumes(service types.ServiceConfig, appName string) {
|
|||||||
if v, ok := service.Labels[labels.LabelConfigMapFiles]; ok {
|
if v, ok := service.Labels[labels.LabelConfigMapFiles]; ok {
|
||||||
binds, err := labelstructs.ConfigMapFileFrom(v)
|
binds, err := labelstructs.ConfigMapFileFrom(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
for _, bind := range binds {
|
for _, bind := range binds {
|
||||||
tobind[bind] = true
|
tobind[bind] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isSamePod := false
|
||||||
|
if v, ok := service.Labels[labels.LabelSamePod]; !ok {
|
||||||
|
isSamePod = false
|
||||||
|
} else {
|
||||||
|
isSamePod = v != ""
|
||||||
|
}
|
||||||
|
|
||||||
for _, volume := range service.Volumes {
|
for _, volume := range service.Volumes {
|
||||||
d.bindVolumes(volume, tobind, service, appName)
|
d.bindVolumes(volume, isSamePod, tobind, service, appName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,38 +269,25 @@ func (d *Deployment) BindFrom(service types.ServiceConfig, binded *Deployment) {
|
|||||||
|
|
||||||
// DependsOn adds a initContainer to the deployment that will wait for the service to be up.
|
// DependsOn adds a initContainer to the deployment that will wait for the service to be up.
|
||||||
func (d *Deployment) DependsOn(to *Deployment, servicename string) error {
|
func (d *Deployment) DependsOn(to *Deployment, servicename string) error {
|
||||||
logger.Info("Adding dependency from ", d.service.Name, " to ", to.service.Name)
|
// Add a initContainer with busybox:latest using netcat to check if the service is up
|
||||||
|
// it will wait until the service responds to all ports
|
||||||
useLegacy := false
|
|
||||||
if label, ok := d.service.Labels[labels.LabelDependsOn]; ok {
|
|
||||||
useLegacy = strings.ToLower(label) == "legacy"
|
|
||||||
}
|
|
||||||
|
|
||||||
if useLegacy {
|
|
||||||
return d.dependsOnLegacy(to, servicename)
|
|
||||||
}
|
|
||||||
|
|
||||||
d.needsServiceAccount = true
|
|
||||||
return d.dependsOnK8sAPI(to)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Deployment) dependsOnLegacy(to *Deployment, servicename string) error {
|
|
||||||
for _, container := range to.Spec.Template.Spec.Containers {
|
for _, container := range to.Spec.Template.Spec.Containers {
|
||||||
commands := []string{}
|
commands := []string{}
|
||||||
if len(container.Ports) == 0 {
|
if len(container.Ports) == 0 {
|
||||||
logger.Fatal("No ports found for service ",
|
utils.Warn("No ports found for service ",
|
||||||
servicename,
|
servicename,
|
||||||
". You should declare a port in the service or use "+
|
". You should declare a port in the service or use "+
|
||||||
labels.LabelPorts+
|
labels.LabelPorts+
|
||||||
" label.",
|
" label.",
|
||||||
)
|
)
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
for _, port := range container.Ports {
|
for _, port := range container.Ports {
|
||||||
command := fmt.Sprintf("until nc -z %s %d; do\n sleep 1;\ndone", to.Name, port.ContainerPort)
|
command := fmt.Sprintf("until nc -z %s %d; do\n sleep 1;\ndone", to.Name, port.ContainerPort)
|
||||||
commands = append(commands, command)
|
commands = append(commands, command)
|
||||||
}
|
}
|
||||||
|
|
||||||
command := []string{shCommand, "-c", strings.Join(commands, "\n")}
|
command := []string{"/bin/sh", "-c", strings.Join(commands, "\n")}
|
||||||
d.Spec.Template.Spec.InitContainers = append(d.Spec.Template.Spec.InitContainers, corev1.Container{
|
d.Spec.Template.Spec.InitContainers = append(d.Spec.Template.Spec.InitContainers, corev1.Container{
|
||||||
Name: "wait-for-" + to.service.Name,
|
Name: "wait-for-" + to.service.Name,
|
||||||
Image: "busybox:latest",
|
Image: "busybox:latest",
|
||||||
@@ -307,39 +298,6 @@ func (d *Deployment) dependsOnLegacy(to *Deployment, servicename string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Deployment) dependsOnK8sAPI(to *Deployment) error {
|
|
||||||
script := `NAMESPACE=${NAMESPACE:-default}
|
|
||||||
DEPLOYMENT_NAME=%s
|
|
||||||
KUBERNETES_SERVICE_HOST=${KUBERNETES_SERVICE_HOST:-kubernetes.default.svc}
|
|
||||||
KUBERNETES_SERVICE_PORT=${KUBERNETES_SERVICE_PORT:-443}
|
|
||||||
|
|
||||||
until curl -s -o- --header="Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" \
|
|
||||||
--cacert=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt \
|
|
||||||
"https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}/apis/apps/v1/namespaces/${NAMESPACE}/deployments/${DEPLOYMENT_NAME}" \
|
|
||||||
| grep -q '"readyReplicas":\s*[1-9][0-9]*'; do
|
|
||||||
sleep 2
|
|
||||||
done`
|
|
||||||
|
|
||||||
command := []string{shCommand, "-c", fmt.Sprintf(script, to.Name)}
|
|
||||||
d.Spec.Template.Spec.InitContainers = append(d.Spec.Template.Spec.InitContainers, corev1.Container{
|
|
||||||
Name: "wait-for-" + to.service.Name,
|
|
||||||
Image: "quay.io/curl/curl:latest",
|
|
||||||
Command: command,
|
|
||||||
Env: []corev1.EnvVar{
|
|
||||||
{
|
|
||||||
Name: "NAMESPACE",
|
|
||||||
ValueFrom: &corev1.EnvVarSource{
|
|
||||||
FieldRef: &corev1.ObjectFieldSelector{
|
|
||||||
FieldPath: "metadata.namespace",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filename returns the filename of the deployment.
|
// Filename returns the filename of the deployment.
|
||||||
func (d *Deployment) Filename() string {
|
func (d *Deployment) Filename() string {
|
||||||
return d.service.Name + ".deployment.yaml"
|
return d.service.Name + ".deployment.yaml"
|
||||||
@@ -358,7 +316,7 @@ func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, sam
|
|||||||
defer func() {
|
defer func() {
|
||||||
c, index := d.BindMapFilesToContainer(service, secrets, appName)
|
c, index := d.BindMapFilesToContainer(service, secrets, appName)
|
||||||
if c == nil || index == -1 {
|
if c == nil || index == -1 {
|
||||||
logger.Warn("Container not found for service ", service.Name)
|
log.Println("Container not found for service ", service.Name)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
d.Spec.Template.Spec.Containers[index] = *c
|
d.Spec.Template.Spec.Containers[index] = *c
|
||||||
@@ -367,7 +325,7 @@ func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, sam
|
|||||||
// secrets from label
|
// secrets from label
|
||||||
labelSecrets, err := labelstructs.SecretsFrom(service.Labels[labels.LabelSecrets])
|
labelSecrets, err := labelstructs.SecretsFrom(service.Labels[labels.LabelSecrets])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// values from label
|
// values from label
|
||||||
@@ -382,7 +340,7 @@ func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, sam
|
|||||||
_, ok := service.Environment[secret]
|
_, ok := service.Environment[secret]
|
||||||
if !ok {
|
if !ok {
|
||||||
drop = append(drop, secret)
|
drop = append(drop, secret)
|
||||||
logger.Warn("Secret " + secret + " not found in service " + service.Name + " - skipped")
|
utils.Warn("Secret " + secret + " not found in service " + service.Name + " - skpped")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
secrets = append(secrets, secret)
|
secrets = append(secrets, secret)
|
||||||
@@ -399,7 +357,7 @@ func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, sam
|
|||||||
val, ok := service.Environment[value]
|
val, ok := service.Environment[value]
|
||||||
if !ok {
|
if !ok {
|
||||||
drop = append(drop, value)
|
drop = append(drop, value)
|
||||||
logger.Warn("Environment variable " + value + " not found in service " + service.Name + " - skipped")
|
utils.Warn("Environment variable " + value + " not found in service " + service.Name + " - skpped")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if d.chart.Values[service.Name].(*Value).Environment == nil {
|
if d.chart.Values[service.Name].(*Value).Environment == nil {
|
||||||
@@ -431,8 +389,8 @@ func (d *Deployment) BindMapFilesToContainer(service types.ServiceConfig, secret
|
|||||||
|
|
||||||
if envSize > 0 {
|
if envSize > 0 {
|
||||||
if service.Name == "db" {
|
if service.Name == "db" {
|
||||||
logger.Info("Service ", service.Name, " has environment variables")
|
log.Println("Service ", service.Name, " has environment variables")
|
||||||
logger.Info(service.Environment)
|
log.Println(service.Environment)
|
||||||
}
|
}
|
||||||
fromSources = append(fromSources, corev1.EnvFromSource{
|
fromSources = append(fromSources, corev1.EnvFromSource{
|
||||||
ConfigMapRef: &corev1.ConfigMapEnvSource{
|
ConfigMapRef: &corev1.ConfigMapEnvSource{
|
||||||
@@ -455,7 +413,7 @@ func (d *Deployment) BindMapFilesToContainer(service types.ServiceConfig, secret
|
|||||||
|
|
||||||
container, index := utils.GetContainerByName(service.ContainerName, d.Spec.Template.Spec.Containers)
|
container, index := utils.GetContainerByName(service.ContainerName, d.Spec.Template.Spec.Containers)
|
||||||
if container == nil {
|
if container == nil {
|
||||||
logger.Warn("Container not found for service " + service.Name)
|
utils.Warn("Container not found for service " + service.Name)
|
||||||
return nil, -1
|
return nil, -1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,7 +573,7 @@ func (d *Deployment) Yaml() ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// manage serviceAccount, add condition to use the serviceAccount from values.yaml
|
// manage serviceAccount, add condition to use the serviceAccount from values.yaml
|
||||||
if strings.Contains(line, "serviceAccountName:") && !d.needsServiceAccount {
|
if strings.Contains(line, "serviceAccountName:") {
|
||||||
spaces = strings.Repeat(" ", utils.CountStartingSpaces(line))
|
spaces = strings.Repeat(" ", utils.CountStartingSpaces(line))
|
||||||
pre := spaces + `{{- if ne .Values.` + serviceName + `.serviceAccount "" }}`
|
pre := spaces + `{{- if ne .Values.` + serviceName + `.serviceAccount "" }}`
|
||||||
post := spaces + "{{- end }}"
|
post := spaces + "{{- end }}"
|
||||||
@@ -651,12 +609,6 @@ func (d *Deployment) Yaml() ([]byte, error) {
|
|||||||
return []byte(strings.Join(content, "\n")), nil
|
return []byte(strings.Join(content, "\n")), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Deployment) SetServiceAccountName() {
|
|
||||||
if d.needsServiceAccount {
|
|
||||||
d.Spec.Template.Spec.ServiceAccountName = utils.TplName(d.service.Name, d.chart.Name, "dependency")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Deployment) appendDirectoryToConfigMap(service types.ServiceConfig, appName string, volume types.ServiceVolumeConfig) {
|
func (d *Deployment) appendDirectoryToConfigMap(service types.ServiceConfig, appName string, volume types.ServiceVolumeConfig) {
|
||||||
pathnme := utils.PathToName(volume.Source)
|
pathnme := utils.PathToName(volume.Source)
|
||||||
if _, ok := d.configMaps[pathnme]; !ok {
|
if _, ok := d.configMaps[pathnme]; !ok {
|
||||||
@@ -668,7 +620,7 @@ func (d *Deployment) appendDirectoryToConfigMap(service types.ServiceConfig, app
|
|||||||
// TODO: make it recursive to add all files in the directory and subdirectories
|
// TODO: make it recursive to add all files in the directory and subdirectories
|
||||||
_, err := os.ReadDir(volume.Source)
|
_, err := os.ReadDir(volume.Source)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
cm := NewConfigMapFromDirectory(service, appName, volume.Source)
|
cm := NewConfigMapFromDirectory(service, appName, volume.Source)
|
||||||
d.configMaps[pathnme] = &ConfigMapMount{
|
d.configMaps[pathnme] = &ConfigMapMount{
|
||||||
@@ -713,19 +665,19 @@ func (d *Deployment) appendFileToConfigMap(service types.ServiceConfig, appName
|
|||||||
|
|
||||||
}
|
}
|
||||||
if err := cm.AppendFile(volume.Source); err != nil {
|
if err := cm.AppendFile(volume.Source); err != nil {
|
||||||
logger.Fatal("Error adding file to configmap:", err)
|
log.Fatal("Error adding file to configmap:", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Deployment) bindVolumes(volume types.ServiceVolumeConfig, tobind map[string]bool, service types.ServiceConfig, appName string) {
|
func (d *Deployment) bindVolumes(volume types.ServiceVolumeConfig, isSamePod bool, tobind map[string]bool, service types.ServiceConfig, appName string) {
|
||||||
container, index := utils.GetContainerByName(service.ContainerName, d.Spec.Template.Spec.Containers)
|
container, index := utils.GetContainerByName(service.ContainerName, d.Spec.Template.Spec.Containers)
|
||||||
|
|
||||||
defer func(d *Deployment, container *corev1.Container, index int) {
|
defer func(d *Deployment, container *corev1.Container, index int) {
|
||||||
d.Spec.Template.Spec.Containers[index] = *container
|
d.Spec.Template.Spec.Containers[index] = *container
|
||||||
}(d, container, index)
|
}(d, container, index)
|
||||||
|
|
||||||
if _, found := tobind[volume.Source]; volume.Type == "bind" && !found {
|
if _, found := tobind[volume.Source]; !isSamePod && volume.Type == "bind" && !found {
|
||||||
logger.Warn(
|
utils.Warn(
|
||||||
"Bind volumes are not supported yet, " +
|
"Bind volumes are not supported yet, " +
|
||||||
"excepting for those declared as " +
|
"excepting for those declared as " +
|
||||||
labels.LabelConfigMapFiles +
|
labels.LabelConfigMapFiles +
|
||||||
@@ -736,7 +688,7 @@ func (d *Deployment) bindVolumes(volume types.ServiceVolumeConfig, tobind map[st
|
|||||||
}
|
}
|
||||||
|
|
||||||
if container == nil {
|
if container == nil {
|
||||||
logger.Warn("Container not found for volume", volume.Source)
|
utils.Warn("Container not found for volume", volume.Source)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -774,7 +726,7 @@ func (d *Deployment) bindVolumes(volume types.ServiceVolumeConfig, tobind map[st
|
|||||||
// Add volume to container
|
// Add volume to container
|
||||||
stat, err := os.Stat(volume.Source)
|
stat, err := os.Stat(volume.Source)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if stat.IsDir() {
|
if stat.IsDir() {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package generator
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"slices"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -12,7 +11,6 @@ import (
|
|||||||
yaml3 "gopkg.in/yaml.v3"
|
yaml3 "gopkg.in/yaml.v3"
|
||||||
v1 "k8s.io/api/apps/v1"
|
v1 "k8s.io/api/apps/v1"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
rbacv1 "k8s.io/api/rbac/v1"
|
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -144,90 +142,6 @@ services:
|
|||||||
if len(dt.Spec.Template.Spec.InitContainers) != 1 {
|
if len(dt.Spec.Template.Spec.InitContainers) != 1 {
|
||||||
t.Errorf("Expected 1 init container, got %d", len(dt.Spec.Template.Spec.InitContainers))
|
t.Errorf("Expected 1 init container, got %d", len(dt.Spec.Template.Spec.InitContainers))
|
||||||
}
|
}
|
||||||
|
|
||||||
initContainer := dt.Spec.Template.Spec.InitContainers[0]
|
|
||||||
if !strings.Contains(initContainer.Image, "quay.io/curl/curl") {
|
|
||||||
t.Errorf("Expected quay.io/curl/curl image, got %s", initContainer.Image)
|
|
||||||
}
|
|
||||||
|
|
||||||
fullCommand := strings.Join(initContainer.Command, " ")
|
|
||||||
if !strings.Contains(fullCommand, "curl") {
|
|
||||||
t.Errorf("Expected curl command (K8s API method), got %s", fullCommand)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !strings.Contains(fullCommand, "/apis/apps/v1/namespaces/") {
|
|
||||||
t.Errorf("Expected Kubernetes API call to /apis/apps/v1/namespaces/, got %s", fullCommand)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !strings.Contains(fullCommand, "/deployments/") {
|
|
||||||
t.Errorf("Expected Kubernetes API call to /deployments/, got %s", fullCommand)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !strings.Contains(fullCommand, "readyReplicas") {
|
|
||||||
t.Errorf("Expected readyReplicas check, got %s", fullCommand)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(initContainer.Env) == 0 {
|
|
||||||
t.Errorf("Expected environment variables to be set for namespace")
|
|
||||||
}
|
|
||||||
|
|
||||||
hasNamespace := false
|
|
||||||
for _, env := range initContainer.Env {
|
|
||||||
if env.Name == "NAMESPACE" && env.ValueFrom != nil && env.ValueFrom.FieldRef != nil {
|
|
||||||
if env.ValueFrom.FieldRef.FieldPath == "metadata.namespace" {
|
|
||||||
hasNamespace = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !hasNamespace {
|
|
||||||
t.Errorf("Expected NAMESPACE env var with metadata.namespace fieldRef")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestDependsOnLegacy(t *testing.T) {
|
|
||||||
composeFile := `
|
|
||||||
services:
|
|
||||||
web:
|
|
||||||
image: nginx:1.29
|
|
||||||
ports:
|
|
||||||
- 80:80
|
|
||||||
depends_on:
|
|
||||||
- database
|
|
||||||
labels:
|
|
||||||
katenary.v3/depends-on: legacy
|
|
||||||
|
|
||||||
database:
|
|
||||||
image: mariadb:10.5
|
|
||||||
ports:
|
|
||||||
- 3306:3306
|
|
||||||
`
|
|
||||||
tmpDir := setup(composeFile)
|
|
||||||
defer teardown(tmpDir)
|
|
||||||
|
|
||||||
currentDir, _ := os.Getwd()
|
|
||||||
os.Chdir(tmpDir)
|
|
||||||
defer os.Chdir(currentDir)
|
|
||||||
|
|
||||||
output := internalCompileTest(t, "-s", webTemplateOutput)
|
|
||||||
dt := v1.Deployment{}
|
|
||||||
if err := yaml.Unmarshal([]byte(output), &dt); err != nil {
|
|
||||||
t.Errorf(unmarshalError, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(dt.Spec.Template.Spec.InitContainers) != 1 {
|
|
||||||
t.Errorf("Expected 1 init container, got %d", len(dt.Spec.Template.Spec.InitContainers))
|
|
||||||
}
|
|
||||||
|
|
||||||
initContainer := dt.Spec.Template.Spec.InitContainers[0]
|
|
||||||
if !strings.Contains(initContainer.Image, "busybox") {
|
|
||||||
t.Errorf("Expected busybox image, got %s", initContainer.Image)
|
|
||||||
}
|
|
||||||
|
|
||||||
fullCommand := strings.Join(initContainer.Command, " ")
|
|
||||||
if !strings.Contains(fullCommand, "nc") {
|
|
||||||
t.Errorf("Expected nc (netcat) command for legacy method, got %s", fullCommand)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHelmDependencies(t *testing.T) {
|
func TestHelmDependencies(t *testing.T) {
|
||||||
@@ -649,195 +563,3 @@ services:
|
|||||||
t.Errorf("Expected command to be 'bar baz', got %s", strings.Join(command, " "))
|
t.Errorf("Expected command to be 'bar baz', got %s", strings.Join(command, " "))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRestrictedRBACGeneration(t *testing.T) {
|
|
||||||
composeFile := `
|
|
||||||
services:
|
|
||||||
web:
|
|
||||||
image: nginx:1.29
|
|
||||||
ports:
|
|
||||||
- 80:80
|
|
||||||
depends_on:
|
|
||||||
- database
|
|
||||||
|
|
||||||
database:
|
|
||||||
image: mariadb:10.5
|
|
||||||
ports:
|
|
||||||
- 3306:3306
|
|
||||||
`
|
|
||||||
tmpDir := setup(composeFile)
|
|
||||||
defer teardown(tmpDir)
|
|
||||||
|
|
||||||
currentDir, _ := os.Getwd()
|
|
||||||
os.Chdir(tmpDir)
|
|
||||||
defer os.Chdir(currentDir)
|
|
||||||
|
|
||||||
rbacOutput := internalCompileTest(t, "-s", "templates/web/depends-on.rbac.yaml")
|
|
||||||
|
|
||||||
docs := strings.Split(rbacOutput, "---\n")
|
|
||||||
|
|
||||||
// Filter out empty documents and strip helm template comments
|
|
||||||
var filteredDocs []string
|
|
||||||
for _, doc := range docs {
|
|
||||||
if strings.TrimSpace(doc) != "" {
|
|
||||||
// Remove '# Source:' comment lines that helm template adds
|
|
||||||
lines := strings.Split(doc, "\n")
|
|
||||||
var contentLines []string
|
|
||||||
for _, line := range lines {
|
|
||||||
if !strings.HasPrefix(strings.TrimSpace(line), "# Source:") {
|
|
||||||
contentLines = append(contentLines, line)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
filteredDocs = append(filteredDocs, strings.Join(contentLines, "\n"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(filteredDocs) != 3 {
|
|
||||||
t.Fatalf("Expected 3 YAML documents in RBAC file, got %d (filtered from %d)", len(filteredDocs), len(docs))
|
|
||||||
}
|
|
||||||
|
|
||||||
var sa corev1.ServiceAccount
|
|
||||||
if err := yaml.Unmarshal([]byte(strings.TrimSpace(filteredDocs[0])), &sa); err != nil {
|
|
||||||
t.Errorf("Failed to unmarshal ServiceAccount: %v", err)
|
|
||||||
}
|
|
||||||
if sa.Kind != "ServiceAccount" {
|
|
||||||
t.Errorf("Expected Kind=ServiceAccount, got %s", sa.Kind)
|
|
||||||
}
|
|
||||||
if !strings.Contains(sa.Name, "web") {
|
|
||||||
t.Errorf("Expected ServiceAccount name to contain 'web', got %s", sa.Name)
|
|
||||||
}
|
|
||||||
|
|
||||||
var role rbacv1.Role
|
|
||||||
if err := yaml.Unmarshal([]byte(strings.TrimSpace(filteredDocs[1])), &role); err != nil {
|
|
||||||
t.Errorf("Failed to unmarshal Role: %v", err)
|
|
||||||
}
|
|
||||||
if role.Kind != "Role" {
|
|
||||||
t.Errorf("Expected Kind=Role, got %s", role.Kind)
|
|
||||||
}
|
|
||||||
if len(role.Rules) != 1 {
|
|
||||||
t.Errorf("Expected 1 rule in Role, got %d", len(role.Rules))
|
|
||||||
}
|
|
||||||
|
|
||||||
rule := role.Rules[0]
|
|
||||||
if !contains(rule.APIGroups, "apps") {
|
|
||||||
t.Error("Expected APIGroup to include 'apps'")
|
|
||||||
}
|
|
||||||
if !contains(rule.Resources, "deployments") {
|
|
||||||
t.Errorf("Expected Resource to include 'deployments', got %v", rule.Resources)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, res := range rule.Resources {
|
|
||||||
if res == "*" {
|
|
||||||
t.Error("Role should not have wildcard (*) resource permissions")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, verb := range rule.Verbs {
|
|
||||||
if verb == "*" {
|
|
||||||
t.Error("Role should not have wildcard (*) verb permissions")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var rb rbacv1.RoleBinding
|
|
||||||
if err := yaml.Unmarshal([]byte(strings.TrimSpace(filteredDocs[2])), &rb); err != nil {
|
|
||||||
t.Errorf("Failed to unmarshal RoleBinding: %v", err)
|
|
||||||
}
|
|
||||||
if rb.Kind != "RoleBinding" {
|
|
||||||
t.Errorf("Expected Kind=RoleBinding, got %s", rb.Kind)
|
|
||||||
}
|
|
||||||
if len(rb.Subjects) != 1 {
|
|
||||||
t.Errorf("Expected 1 subject in RoleBinding, got %d", len(rb.Subjects))
|
|
||||||
}
|
|
||||||
if rb.Subjects[0].Kind != "ServiceAccount" {
|
|
||||||
t.Errorf("Expected Subject Kind=ServiceAccount, got %s", rb.Subjects[0].Kind)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helm template renders the name, so check if it contains "web"
|
|
||||||
if !strings.Contains(rb.RoleRef.Name, "web") {
|
|
||||||
t.Errorf("Expected RoleRef Name to contain 'web', got %s", rb.RoleRef.Name)
|
|
||||||
}
|
|
||||||
if rb.RoleRef.Kind != "Role" {
|
|
||||||
t.Errorf("Expected RoleRef Kind=Role, got %s", rb.RoleRef.Kind)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestDeploymentReferencesServiceAccount(t *testing.T) {
|
|
||||||
composeFile := `
|
|
||||||
services:
|
|
||||||
web:
|
|
||||||
image: nginx:1.29
|
|
||||||
ports:
|
|
||||||
- 80:80
|
|
||||||
depends_on:
|
|
||||||
- database
|
|
||||||
|
|
||||||
database:
|
|
||||||
image: mariadb:10.5
|
|
||||||
ports:
|
|
||||||
- 3306:3306
|
|
||||||
`
|
|
||||||
tmpDir := setup(composeFile)
|
|
||||||
defer teardown(tmpDir)
|
|
||||||
|
|
||||||
currentDir, _ := os.Getwd()
|
|
||||||
os.Chdir(tmpDir)
|
|
||||||
defer os.Chdir(currentDir)
|
|
||||||
|
|
||||||
output := internalCompileTest(t, "-s", "templates/web/deployment.yaml")
|
|
||||||
|
|
||||||
var dt v1.Deployment
|
|
||||||
if err := yaml.Unmarshal([]byte(output), &dt); err != nil {
|
|
||||||
t.Errorf("Failed to unmarshal Deployment: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
serviceAccountName := dt.Spec.Template.Spec.ServiceAccountName
|
|
||||||
if !strings.Contains(serviceAccountName, "web") {
|
|
||||||
t.Errorf("Expected ServiceAccountName to contain 'web', got %s", serviceAccountName)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(dt.Spec.Template.Spec.InitContainers) == 0 {
|
|
||||||
t.Fatal("Expected at least one init container for depends_on")
|
|
||||||
}
|
|
||||||
|
|
||||||
initContainer := dt.Spec.Template.Spec.InitContainers[0]
|
|
||||||
if initContainer.Name != "wait-for-database" {
|
|
||||||
t.Errorf("Expected init container name 'wait-for-database', got %s", initContainer.Name)
|
|
||||||
}
|
|
||||||
|
|
||||||
fullCommand := strings.Join(initContainer.Command, " ")
|
|
||||||
if !strings.Contains(fullCommand, "curl") {
|
|
||||||
t.Error("Expected init container to use curl for K8s API calls")
|
|
||||||
}
|
|
||||||
if !strings.Contains(fullCommand, "/apis/apps/v1/namespaces/") {
|
|
||||||
t.Error("Expected init container to call /apis/apps/v1/namespaces/ endpoint")
|
|
||||||
}
|
|
||||||
if !strings.Contains(fullCommand, "/deployments/") {
|
|
||||||
t.Error("Expected init container to access /deployments/ resource")
|
|
||||||
}
|
|
||||||
if !strings.Contains(fullCommand, "readyReplicas") {
|
|
||||||
t.Error("Expected init container to check readyReplicas")
|
|
||||||
}
|
|
||||||
|
|
||||||
hasNamespace := false
|
|
||||||
for _, env := range initContainer.Env {
|
|
||||||
if env.Name == "NAMESPACE" && env.ValueFrom != nil && env.ValueFrom.FieldRef != nil {
|
|
||||||
if env.ValueFrom.FieldRef.FieldPath == "metadata.namespace" {
|
|
||||||
hasNamespace = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !hasNamespace {
|
|
||||||
t.Error("Expected NAMESPACE env var with metadata.namespace fieldRef")
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err := os.Stat("./chart/templates/web/depends-on.rbac.yaml")
|
|
||||||
if os.IsNotExist(err) {
|
|
||||||
t.Error("RBAC file depends-on.rbac.yaml should exist for service using depends_on with K8s API")
|
|
||||||
} else if err != nil {
|
|
||||||
t.Errorf("Unexpected error checking RBAC file: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func contains(slice []string, item string) bool {
|
|
||||||
return slices.Contains(slice, item)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
_ "embed"
|
_ "embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
"katenary.io/internal/logger"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed readme.tpl
|
//go:embed readme.tpl
|
||||||
@@ -50,7 +50,7 @@ func ReadMeFile(charname, description string, values map[string]any) string {
|
|||||||
vv := map[string]any{}
|
vv := map[string]any{}
|
||||||
out, _ := yaml.Marshal(values)
|
out, _ := yaml.Marshal(values)
|
||||||
if err := yaml.Unmarshal(out, &vv); err != nil {
|
if err := yaml.Unmarshal(out, &vv); err != nil {
|
||||||
logger.Warnf("Error parsing values: %s", err)
|
log.Printf("Error parsing values: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
result := make(map[string]string)
|
result := make(map[string]string)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ func TestReadMeFile_Basic(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
result := ReadMeFile("testchart", "A test chart", values)
|
result := ReadMeFile("testchart", "A test chart", values)
|
||||||
|
t.Logf("Generated README content:\n%s", result)
|
||||||
paramerRegExp := regexp.MustCompile(`\|\s+` + "`" + `(.*?)` + "`" + `\s+\|\s+` + "`" + `(.*?)` + "`" + `\s+\|`)
|
paramerRegExp := regexp.MustCompile(`\|\s+` + "`" + `(.*?)` + "`" + `\s+\|\s+` + "`" + `(.*?)` + "`" + `\s+\|`)
|
||||||
matches := paramerRegExp.FindAllStringSubmatch(result, -1)
|
matches := paramerRegExp.FindAllStringSubmatch(result, -1)
|
||||||
if len(matches) != 3 {
|
if len(matches) != 3 {
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ package generator
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"katenary.io/internal/generator/labels"
|
"katenary.io/internal/generator/labels"
|
||||||
"katenary.io/internal/generator/labels/labelstructs"
|
"katenary.io/internal/generator/labels/labelstructs"
|
||||||
"katenary.io/internal/logger"
|
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
)
|
)
|
||||||
@@ -22,7 +22,7 @@ import (
|
|||||||
// The Generate function will create the HelmChart object this way:
|
// The Generate function will create the HelmChart object this way:
|
||||||
//
|
//
|
||||||
// - Detect the service port name or leave the port number if not found.
|
// - Detect the service port name or leave the port number if not found.
|
||||||
// - Create a deployment for each service that are not ingore.
|
// - Create a deployment for each service that are not ingnore.
|
||||||
// - Create a service and ingresses for each service that has ports and/or declared ingresses.
|
// - Create a service and ingresses for each service that has ports and/or declared ingresses.
|
||||||
// - Create a PVC or Configmap volumes for each volume.
|
// - Create a PVC or Configmap volumes for each volume.
|
||||||
// - Create init containers for each service which has dependencies to other services.
|
// - Create init containers for each service which has dependencies to other services.
|
||||||
@@ -99,7 +99,6 @@ func Generate(project *types.Project) (*HelmChart, error) {
|
|||||||
|
|
||||||
// drop all "same-pod" deployments because the containers and volumes are already
|
// drop all "same-pod" deployments because the containers and volumes are already
|
||||||
// in the target deployment
|
// in the target deployment
|
||||||
drops := []string{}
|
|
||||||
for _, service := range podToMerge {
|
for _, service := range podToMerge {
|
||||||
if samepod, ok := service.Labels[labels.LabelSamePod]; ok && samepod != "" {
|
if samepod, ok := service.Labels[labels.LabelSamePod]; ok && samepod != "" {
|
||||||
// move this deployment volumes to the target deployment
|
// move this deployment volumes to the target deployment
|
||||||
@@ -110,11 +109,9 @@ func Generate(project *types.Project) (*HelmChart, error) {
|
|||||||
// copy all init containers
|
// copy all init containers
|
||||||
initContainers := deployments[service.Name].Spec.Template.Spec.InitContainers
|
initContainers := deployments[service.Name].Spec.Template.Spec.InitContainers
|
||||||
target.Spec.Template.Spec.InitContainers = append(target.Spec.Template.Spec.InitContainers, initContainers...)
|
target.Spec.Template.Spec.InitContainers = append(target.Spec.Template.Spec.InitContainers, initContainers...)
|
||||||
drops = append(drops, service.Name)
|
delete(deployments, service.Name)
|
||||||
} else {
|
} else {
|
||||||
err := fmt.Errorf("service %s is declared as %s, but %s is not defined", service.Name, labels.LabelSamePod, samepod)
|
log.Printf("service %[1]s is declared as %[2]s, but %[2]s is not defined", service.Name, labels.LabelSamePod)
|
||||||
logger.Failure(err.Error())
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,48 +122,21 @@ func Generate(project *types.Project) (*HelmChart, error) {
|
|||||||
if dep, ok := deployments[d]; ok {
|
if dep, ok := deployments[d]; ok {
|
||||||
err := deployments[s.Name].DependsOn(dep, d)
|
err := deployments[s.Name].DependsOn(dep, d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Info(fmt.Sprintf("error creating init container for service %[1]s: %[2]s", s.Name, err))
|
log.Printf("error creating init container for service %[1]s: %[2]s", s.Name, err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err := fmt.Errorf("service %[1]s depends on %[2]s, but %[2]s is not defined", s.Name, d)
|
log.Printf("service %[1]s depends on %[2]s, but %[2]s is not defined", s.Name, d)
|
||||||
logger.Failure(err.Error())
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// warn users if dependent service has no ports
|
|
||||||
for _, s := range project.Services {
|
|
||||||
for _, d := range s.GetDependencies() {
|
|
||||||
if dep, ok := deployments[d]; ok {
|
|
||||||
if len(dep.service.Ports) == 0 {
|
|
||||||
logger.Warnf("Service %s is used in depends_on but has no ports declared. No Kubernetes Service will be created for it. Add katenary.v3/ports label if you need to create a Service.", d)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set ServiceAccountName for deployments that need it
|
|
||||||
for _, d := range deployments {
|
|
||||||
d.SetServiceAccountName()
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, name := range drops {
|
|
||||||
delete(deployments, name)
|
|
||||||
}
|
|
||||||
// it's now time to get "value-from", before makeing the secrets and configmaps!
|
// it's now time to get "value-from", before makeing the secrets and configmaps!
|
||||||
for _, s := range project.Services {
|
for _, s := range project.Services {
|
||||||
chart.setEnvironmentValuesFrom(s, deployments)
|
chart.setEnvironmentValuesFrom(s, deployments)
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate RBAC resources for services that need K8s API access (non-legacy depends_on)
|
|
||||||
if err := chart.generateRBAC(deployments); err != nil {
|
|
||||||
logger.Fatalf("error generating RBAC: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// generate configmaps with environment variables
|
// generate configmaps with environment variables
|
||||||
if err := chart.generateConfigMapsAndSecrets(project); err != nil {
|
if err := chart.generateConfigMapsAndSecrets(project); err != nil {
|
||||||
logger.Fatalf("error generating configmaps and secrets: %s", err)
|
log.Fatalf("error generating configmaps and secrets: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the env-from label is set, we need to add the env vars from the configmap
|
// if the env-from label is set, we need to add the env vars from the configmap
|
||||||
@@ -237,9 +207,9 @@ func Generate(project *types.Project) (*HelmChart, error) {
|
|||||||
|
|
||||||
// dropIngoredServices removes all services with the "ignore" label set to true (or yes).
|
// dropIngoredServices removes all services with the "ignore" label set to true (or yes).
|
||||||
func dropIngoredServices(project *types.Project) {
|
func dropIngoredServices(project *types.Project) {
|
||||||
for name, service := range project.Services {
|
for i, service := range project.Services {
|
||||||
if isIgnored(service) {
|
if isIgnored(service) {
|
||||||
delete(project.Services, name)
|
project.Services = append(project.Services[:i], project.Services[i+1:]...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -256,7 +226,6 @@ func fixResourceNames(project *types.Project) error {
|
|||||||
s.Labels[labels.LabelSamePod] = fixed
|
s.Labels[labels.LabelSamePod] = fixed
|
||||||
project.Services[j] = s
|
project.Services[j] = s
|
||||||
}
|
}
|
||||||
|
|
||||||
// also, the value-from label should be updated
|
// also, the value-from label should be updated
|
||||||
if valuefrom, ok := s.Labels[labels.LabelValuesFrom]; ok {
|
if valuefrom, ok := s.Labels[labels.LabelValuesFrom]; ok {
|
||||||
vf, err := labelstructs.GetValueFrom(valuefrom)
|
vf, err := labelstructs.GetValueFrom(valuefrom)
|
||||||
@@ -264,6 +233,7 @@ func fixResourceNames(project *types.Project) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for varname, bind := range *vf {
|
for varname, bind := range *vf {
|
||||||
|
log.Printf("service %s, varname %s, bind %s", service.Name, varname, bind)
|
||||||
bind := strings.ReplaceAll(bind, service.Name, fixed)
|
bind := strings.ReplaceAll(bind, service.Name, fixed)
|
||||||
(*vf)[varname] = bind
|
(*vf)[varname] = bind
|
||||||
}
|
}
|
||||||
@@ -275,15 +245,8 @@ func fixResourceNames(project *types.Project) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
service.Name = fixed
|
service.Name = fixed
|
||||||
|
project.Services[i] = service
|
||||||
}
|
}
|
||||||
// rename depends_on
|
|
||||||
for _, d := range service.GetDependencies() {
|
|
||||||
depname := utils.AsResourceName(d)
|
|
||||||
dep := service.DependsOn[d]
|
|
||||||
delete(service.DependsOn, d)
|
|
||||||
service.DependsOn[depname] = dep
|
|
||||||
}
|
|
||||||
project.Services[i] = service
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -301,7 +264,7 @@ func addStaticVolumes(deployments map[string]*Deployment, service types.ServiceC
|
|||||||
var d *Deployment
|
var d *Deployment
|
||||||
var ok bool
|
var ok bool
|
||||||
if d, ok = deployments[service.Name]; !ok {
|
if d, ok = deployments[service.Name]; !ok {
|
||||||
logger.Warnf("service %s not found in deployments", service.Name)
|
log.Printf("service %s not found in deployments", service.Name)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,9 +276,8 @@ func addStaticVolumes(deployments map[string]*Deployment, service types.ServiceC
|
|||||||
var y []byte
|
var y []byte
|
||||||
var err error
|
var err error
|
||||||
if y, err = config.configMap.Yaml(); err != nil {
|
if y, err = config.configMap.Yaml(); err != nil {
|
||||||
logger.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the configmap to the chart
|
// add the configmap to the chart
|
||||||
d.chart.Templates[config.configMap.Filename()] = &ChartTemplate{
|
d.chart.Templates[config.configMap.Filename()] = &ChartTemplate{
|
||||||
Content: y,
|
Content: y,
|
||||||
@@ -323,10 +285,6 @@ func addStaticVolumes(deployments map[string]*Deployment, service types.ServiceC
|
|||||||
}
|
}
|
||||||
// add the moint path to the container
|
// add the moint path to the container
|
||||||
for _, m := range config.mountPath {
|
for _, m := range config.mountPath {
|
||||||
// volumeName can be empty, in this case we generate a name
|
|
||||||
if volumeName == "" {
|
|
||||||
volumeName = utils.PathToName(m.subPath)
|
|
||||||
}
|
|
||||||
container.VolumeMounts = append(container.VolumeMounts, corev1.VolumeMount{
|
container.VolumeMounts = append(container.VolumeMounts, corev1.VolumeMount{
|
||||||
Name: utils.PathToName(volumeName),
|
Name: utils.PathToName(volumeName),
|
||||||
MountPath: m.mountPath,
|
MountPath: m.mountPath,
|
||||||
@@ -455,65 +413,13 @@ func samePodVolume(service types.ServiceConfig, v types.ServiceVolumeConfig, dep
|
|||||||
// check if it has the same volume
|
// check if it has the same volume
|
||||||
for _, tv := range target.Spec.Template.Spec.Volumes {
|
for _, tv := range target.Spec.Template.Spec.Volumes {
|
||||||
if tv.Name == v.Source {
|
if tv.Name == v.Source {
|
||||||
logger.Warnf("found same pod volume %s in deployment %s and %s", tv.Name, service.Name, targetDeployment)
|
log.Printf("found same pod volume %s in deployment %s and %s", tv.Name, service.Name, targetDeployment)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// generateRBAC creates RBAC resources (ServiceAccount, Role, RoleBinding) for services that need K8s API access.
|
|
||||||
// A service needs RBAC if it has non-legacy depends_on relationships.
|
|
||||||
func (chart *HelmChart) generateRBAC(deployments map[string]*Deployment) error {
|
|
||||||
serviceMap := make(map[string]bool)
|
|
||||||
|
|
||||||
for _, d := range deployments {
|
|
||||||
if !d.needsServiceAccount {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
sa := NewServiceAccount(*d.service, chart.Name)
|
|
||||||
role := NewRestrictedRole(*d.service, chart.Name)
|
|
||||||
rb := NewRestrictedRoleBinding(*d.service, chart.Name)
|
|
||||||
|
|
||||||
var buf bytes.Buffer
|
|
||||||
|
|
||||||
saYaml, err := yaml.Marshal(sa.ServiceAccount)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("error marshaling ServiceAccount for %s: %w", d.service.Name, err)
|
|
||||||
}
|
|
||||||
buf.Write(saYaml)
|
|
||||||
buf.WriteString("---\n")
|
|
||||||
|
|
||||||
roleYaml, err := yaml.Marshal(role.Role)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("error marshaling Role for %s: %w", d.service.Name, err)
|
|
||||||
}
|
|
||||||
buf.Write(roleYaml)
|
|
||||||
buf.WriteString("---\n")
|
|
||||||
|
|
||||||
rbYaml, err := yaml.Marshal(rb.RoleBinding)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("error marshaling RoleBinding for %s: %w", d.service.Name, err)
|
|
||||||
}
|
|
||||||
buf.Write(rbYaml)
|
|
||||||
|
|
||||||
filename := d.service.Name + "/depends-on.rbac.yaml"
|
|
||||||
chart.Templates[filename] = &ChartTemplate{
|
|
||||||
Content: buf.Bytes(),
|
|
||||||
Servicename: d.service.Name,
|
|
||||||
}
|
|
||||||
|
|
||||||
serviceMap[d.service.Name] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
for svcName := range serviceMap {
|
|
||||||
logger.Log(logger.IconPackage, "Creating RBAC", svcName)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func fixContainerNames(project *types.Project) {
|
func fixContainerNames(project *types.Project) {
|
||||||
// fix container names to be unique
|
// fix container names to be unique
|
||||||
for i, service := range project.Services {
|
for i, service := range project.Services {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package generator
|
package generator
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"katenary.io/internal/generator/labels"
|
"katenary.io/internal/generator/labels"
|
||||||
"katenary.io/internal/generator/labels/labelstructs"
|
"katenary.io/internal/generator/labels/labelstructs"
|
||||||
"katenary.io/internal/logger"
|
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
networkv1 "k8s.io/api/networking/v1"
|
networkv1 "k8s.io/api/networking/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
@@ -36,7 +36,7 @@ func NewIngress(service types.ServiceConfig, Chart *HelmChart) *Ingress {
|
|||||||
|
|
||||||
mapping, err := labelstructs.IngressFrom(label)
|
mapping, err := labelstructs.IngressFrom(label)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatalf("Failed to parse ingress label: %s\n", err)
|
log.Fatalf("Failed to parse ingress label: %s\n", err)
|
||||||
}
|
}
|
||||||
if mapping.Hostname == "" {
|
if mapping.Hostname == "" {
|
||||||
mapping.Hostname = service.Name + ".tld"
|
mapping.Hostname = service.Name + ".tld"
|
||||||
|
|||||||
@@ -3,15 +3,17 @@ package katenaryfile
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"katenary.io/internal/generator/labels"
|
"katenary.io/internal/generator/labels"
|
||||||
"katenary.io/internal/generator/labels/labelstructs"
|
"katenary.io/internal/generator/labels/labelstructs"
|
||||||
"katenary.io/internal/logger"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
"github.com/invopop/jsonschema"
|
"github.com/invopop/jsonschema"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
@@ -58,7 +60,7 @@ func OverrideWithConfig(project *types.Project) {
|
|||||||
// no katenary file found
|
// no katenary file found
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
logger.Info("Using katenary file", yamlFile)
|
fmt.Println(utils.IconInfo, "Using katenary file", yamlFile)
|
||||||
|
|
||||||
services := make(map[string]Service)
|
services := make(map[string]Service)
|
||||||
fp, err := os.Open(yamlFile)
|
fp, err := os.Open(yamlFile)
|
||||||
@@ -66,43 +68,41 @@ func OverrideWithConfig(project *types.Project) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := yaml.NewDecoder(fp).Decode(&services); err != nil {
|
if err := yaml.NewDecoder(fp).Decode(&services); err != nil {
|
||||||
logger.Fatal(err)
|
log.Fatal(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, p := range project.Services {
|
for i, p := range project.Services {
|
||||||
name := p.Name
|
name := p.Name
|
||||||
mustGetLabelContent := func(o any, labelName string) {
|
if project.Services[i].Labels == nil {
|
||||||
s, ok := project.Services[name]
|
project.Services[i].Labels = make(map[string]string)
|
||||||
if !ok {
|
}
|
||||||
return
|
mustGetLabelContent := func(o any, s *types.ServiceConfig, labelName string) {
|
||||||
}
|
err := getLabelContent(o, s, labelName)
|
||||||
err := getLabelContent(o, &s, labelName)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
project.Services[name] = s
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if s, ok := services[name]; ok {
|
if s, ok := services[name]; ok {
|
||||||
mustGetLabelContent(s.MainApp, labels.LabelMainApp)
|
mustGetLabelContent(s.MainApp, &project.Services[i], labels.LabelMainApp)
|
||||||
mustGetLabelContent(s.Values, labels.LabelValues)
|
mustGetLabelContent(s.Values, &project.Services[i], labels.LabelValues)
|
||||||
mustGetLabelContent(s.Secrets, labels.LabelSecrets)
|
mustGetLabelContent(s.Secrets, &project.Services[i], labels.LabelSecrets)
|
||||||
mustGetLabelContent(s.Ports, labels.LabelPorts)
|
mustGetLabelContent(s.Ports, &project.Services[i], labels.LabelPorts)
|
||||||
mustGetLabelContent(s.Ingress, labels.LabelIngress)
|
mustGetLabelContent(s.Ingress, &project.Services[i], labels.LabelIngress)
|
||||||
mustGetLabelContent(s.HealthCheck, labels.LabelHealthCheck)
|
mustGetLabelContent(s.HealthCheck, &project.Services[i], labels.LabelHealthCheck)
|
||||||
mustGetLabelContent(s.SamePod, labels.LabelSamePod)
|
mustGetLabelContent(s.SamePod, &project.Services[i], labels.LabelSamePod)
|
||||||
mustGetLabelContent(s.Description, labels.LabelDescription)
|
mustGetLabelContent(s.Description, &project.Services[i], labels.LabelDescription)
|
||||||
mustGetLabelContent(s.Ignore, labels.LabelIgnore)
|
mustGetLabelContent(s.Ignore, &project.Services[i], labels.LabelIgnore)
|
||||||
mustGetLabelContent(s.Dependencies, labels.LabelDependencies)
|
mustGetLabelContent(s.Dependencies, &project.Services[i], labels.LabelDependencies)
|
||||||
mustGetLabelContent(s.ConfigMapFiles, labels.LabelConfigMapFiles)
|
mustGetLabelContent(s.ConfigMapFiles, &project.Services[i], labels.LabelConfigMapFiles)
|
||||||
mustGetLabelContent(s.MapEnv, labels.LabelMapEnv)
|
mustGetLabelContent(s.MapEnv, &project.Services[i], labels.LabelMapEnv)
|
||||||
mustGetLabelContent(s.CronJob, labels.LabelCronJob)
|
mustGetLabelContent(s.CronJob, &project.Services[i], labels.LabelCronJob)
|
||||||
mustGetLabelContent(s.EnvFrom, labels.LabelEnvFrom)
|
mustGetLabelContent(s.EnvFrom, &project.Services[i], labels.LabelEnvFrom)
|
||||||
mustGetLabelContent(s.ExchangeVolumes, labels.LabelExchangeVolume)
|
mustGetLabelContent(s.ExchangeVolumes, &project.Services[i], labels.LabelExchangeVolume)
|
||||||
mustGetLabelContent(s.ValuesFrom, labels.LabelValuesFrom)
|
mustGetLabelContent(s.ValuesFrom, &project.Services[i], labels.LabelValuesFrom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.Info("Katenary file loaded successfully, the services are now configured.")
|
fmt.Println(utils.IconInfo, "Katenary file loaded successfully, the services are now configured.")
|
||||||
}
|
}
|
||||||
|
|
||||||
func getLabelContent(o any, service *types.ServiceConfig, labelName string) error {
|
func getLabelContent(o any, service *types.ServiceConfig, labelName string) error {
|
||||||
@@ -112,7 +112,7 @@ func getLabelContent(o any, service *types.ServiceConfig, labelName string) erro
|
|||||||
|
|
||||||
c, err := yaml.Marshal(o)
|
c, err := yaml.Marshal(o)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Failure(err.Error())
|
log.Println(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
val := strings.TrimSpace(string(c))
|
val := strings.TrimSpace(string(c))
|
||||||
@@ -120,7 +120,7 @@ func getLabelContent(o any, service *types.ServiceConfig, labelName string) erro
|
|||||||
// special case, values must be set from some defaults
|
// special case, values must be set from some defaults
|
||||||
ing, err := labelstructs.IngressFrom(val)
|
ing, err := labelstructs.IngressFrom(val)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal(err)
|
log.Fatal(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
c, err := yaml.Marshal(ing)
|
c, err := yaml.Marshal(ing)
|
||||||
@@ -130,9 +130,6 @@ func getLabelContent(o any, service *types.ServiceConfig, labelName string) erro
|
|||||||
val = strings.TrimSpace(string(c))
|
val = strings.TrimSpace(string(c))
|
||||||
}
|
}
|
||||||
|
|
||||||
if service.Labels == nil {
|
|
||||||
service.Labels = types.Labels{}
|
|
||||||
}
|
|
||||||
service.Labels[labelName] = val
|
service.Labels[labelName] = val
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package katenaryfile
|
package katenaryfile
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"katenary.io/internal/generator/labels"
|
"katenary.io/internal/generator/labels"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/cli"
|
"github.com/compose-spec/compose-go/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuildSchema(t *testing.T) {
|
func TestBuildSchema(t *testing.T) {
|
||||||
@@ -39,28 +39,31 @@ webapp:
|
|||||||
composeFile := filepath.Join(tmpDir, "compose.yaml")
|
composeFile := filepath.Join(tmpDir, "compose.yaml")
|
||||||
katenaryFile := filepath.Join(tmpDir, "katenary.yaml")
|
katenaryFile := filepath.Join(tmpDir, "katenary.yaml")
|
||||||
|
|
||||||
os.MkdirAll(tmpDir, 0o755)
|
os.MkdirAll(tmpDir, 0755)
|
||||||
if err := os.WriteFile(composeFile, []byte(composeContent), 0o644); err != nil {
|
if err := os.WriteFile(composeFile, []byte(composeContent), 0644); err != nil {
|
||||||
t.Log(err)
|
t.Log(err)
|
||||||
}
|
}
|
||||||
if err := os.WriteFile(katenaryFile, []byte(katenaryfileContent), 0o644); err != nil {
|
if err := os.WriteFile(katenaryFile, []byte(katenaryfileContent), 0644); err != nil {
|
||||||
t.Log(err)
|
t.Log(err)
|
||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
|
c, _ := os.ReadFile(composeFile)
|
||||||
|
log.Println(string(c))
|
||||||
|
|
||||||
// chand dir to this directory
|
// chand dir to this directory
|
||||||
os.Chdir(tmpDir)
|
os.Chdir(tmpDir)
|
||||||
options, _ := cli.NewProjectOptions(nil,
|
options, _ := cli.NewProjectOptions(nil,
|
||||||
cli.WithWorkingDirectory(tmpDir),
|
cli.WithWorkingDirectory(tmpDir),
|
||||||
cli.WithDefaultConfigPath,
|
cli.WithDefaultConfigPath,
|
||||||
)
|
)
|
||||||
project, err := cli.ProjectFromOptions(context.TODO(), options)
|
project, err := cli.ProjectFromOptions(options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to create project from options: %s", err.Error())
|
t.Fatalf("Failed to create project from options: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
OverrideWithConfig(project)
|
OverrideWithConfig(project)
|
||||||
w := project.Services["webapp"].Labels
|
w := project.Services[0].Labels
|
||||||
if v, ok := w[labels.LabelPorts]; !ok {
|
if v, ok := w[labels.LabelPorts]; !ok {
|
||||||
t.Fatal("Expected ports to be defined", v)
|
t.Fatal("Expected ports to be defined", v)
|
||||||
}
|
}
|
||||||
@@ -89,28 +92,31 @@ webapp:
|
|||||||
composeFile := filepath.Join(tmpDir, "compose.yaml")
|
composeFile := filepath.Join(tmpDir, "compose.yaml")
|
||||||
katenaryFile := filepath.Join(tmpDir, "katenary.yaml")
|
katenaryFile := filepath.Join(tmpDir, "katenary.yaml")
|
||||||
|
|
||||||
os.MkdirAll(tmpDir, 0o755)
|
os.MkdirAll(tmpDir, 0755)
|
||||||
if err := os.WriteFile(composeFile, []byte(composeContent), 0o644); err != nil {
|
if err := os.WriteFile(composeFile, []byte(composeContent), 0644); err != nil {
|
||||||
t.Log(err)
|
t.Log(err)
|
||||||
}
|
}
|
||||||
if err := os.WriteFile(katenaryFile, []byte(katenaryfileContent), 0o644); err != nil {
|
if err := os.WriteFile(katenaryFile, []byte(katenaryfileContent), 0644); err != nil {
|
||||||
t.Log(err)
|
t.Log(err)
|
||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
|
c, _ := os.ReadFile(composeFile)
|
||||||
|
log.Println(string(c))
|
||||||
|
|
||||||
// chand dir to this directory
|
// chand dir to this directory
|
||||||
os.Chdir(tmpDir)
|
os.Chdir(tmpDir)
|
||||||
options, _ := cli.NewProjectOptions(nil,
|
options, _ := cli.NewProjectOptions(nil,
|
||||||
cli.WithWorkingDirectory(tmpDir),
|
cli.WithWorkingDirectory(tmpDir),
|
||||||
cli.WithDefaultConfigPath,
|
cli.WithDefaultConfigPath,
|
||||||
)
|
)
|
||||||
project, err := cli.ProjectFromOptions(context.TODO(), options)
|
project, err := cli.ProjectFromOptions(options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to create project from options: %s", err.Error())
|
t.Fatalf("Failed to create project from options: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
OverrideWithConfig(project)
|
OverrideWithConfig(project)
|
||||||
w := project.Services["webapp"].Labels
|
w := project.Services[0].Labels
|
||||||
if v, ok := w[labels.LabelPorts]; !ok {
|
if v, ok := w[labels.LabelPorts]; !ok {
|
||||||
t.Fatal("Expected ports to be defined", v)
|
t.Fatal("Expected ports to be defined", v)
|
||||||
}
|
}
|
||||||
@@ -144,28 +150,31 @@ webapp:
|
|||||||
composeFile := filepath.Join(tmpDir, "compose.yaml")
|
composeFile := filepath.Join(tmpDir, "compose.yaml")
|
||||||
katenaryFile := filepath.Join(tmpDir, "katenary.yaml")
|
katenaryFile := filepath.Join(tmpDir, "katenary.yaml")
|
||||||
|
|
||||||
os.MkdirAll(tmpDir, 0o755)
|
os.MkdirAll(tmpDir, 0755)
|
||||||
if err := os.WriteFile(composeFile, []byte(composeContent), 0o644); err != nil {
|
if err := os.WriteFile(composeFile, []byte(composeContent), 0644); err != nil {
|
||||||
t.Log(err)
|
t.Log(err)
|
||||||
}
|
}
|
||||||
if err := os.WriteFile(katenaryFile, []byte(katenaryfileContent), 0o644); err != nil {
|
if err := os.WriteFile(katenaryFile, []byte(katenaryfileContent), 0644); err != nil {
|
||||||
t.Log(err)
|
t.Log(err)
|
||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
|
c, _ := os.ReadFile(composeFile)
|
||||||
|
log.Println(string(c))
|
||||||
|
|
||||||
// chand dir to this directory
|
// chand dir to this directory
|
||||||
os.Chdir(tmpDir)
|
os.Chdir(tmpDir)
|
||||||
options, _ := cli.NewProjectOptions(nil,
|
options, _ := cli.NewProjectOptions(nil,
|
||||||
cli.WithWorkingDirectory(tmpDir),
|
cli.WithWorkingDirectory(tmpDir),
|
||||||
cli.WithDefaultConfigPath,
|
cli.WithDefaultConfigPath,
|
||||||
)
|
)
|
||||||
project, err := cli.ProjectFromOptions(context.TODO(), options)
|
project, err := cli.ProjectFromOptions(options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to create project from options: %s", err.Error())
|
t.Fatalf("Failed to create project from options: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
OverrideWithConfig(project)
|
OverrideWithConfig(project)
|
||||||
w := project.Services["webapp"].Labels
|
w := project.Services[0].Labels
|
||||||
if v, ok := w[labels.LabelConfigMapFiles]; !ok {
|
if v, ok := w[labels.LabelConfigMapFiles]; !ok {
|
||||||
t.Fatal("Expected configmap-files to be defined", v)
|
t.Fatal("Expected configmap-files to be defined", v)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
_ "embed"
|
_ "embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"katenary.io/internal/logger"
|
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
@@ -36,7 +36,6 @@ const (
|
|||||||
LabelEnvFrom Label = KatenaryLabelPrefix + "/env-from"
|
LabelEnvFrom Label = KatenaryLabelPrefix + "/env-from"
|
||||||
LabelExchangeVolume Label = KatenaryLabelPrefix + "/exchange-volumes"
|
LabelExchangeVolume Label = KatenaryLabelPrefix + "/exchange-volumes"
|
||||||
LabelValuesFrom Label = KatenaryLabelPrefix + "/values-from"
|
LabelValuesFrom Label = KatenaryLabelPrefix + "/values-from"
|
||||||
LabelDependsOn Label = KatenaryLabelPrefix + "/depends-on"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -135,7 +134,7 @@ func GetLabelHelpFor(labelname string, asMarkdown bool) string {
|
|||||||
KatenaryPrefix: KatenaryLabelPrefix,
|
KatenaryPrefix: KatenaryLabelPrefix,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatalf("Error executing template: %v", err)
|
log.Fatalf("Error executing template: %v", err)
|
||||||
}
|
}
|
||||||
help.Long = buf.String()
|
help.Long = buf.String()
|
||||||
buf.Reset()
|
buf.Reset()
|
||||||
@@ -146,7 +145,7 @@ func GetLabelHelpFor(labelname string, asMarkdown bool) string {
|
|||||||
KatenaryPrefix: KatenaryLabelPrefix,
|
KatenaryPrefix: KatenaryLabelPrefix,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatalf("Error executing template: %v", err)
|
log.Fatalf("Error executing template: %v", err)
|
||||||
}
|
}
|
||||||
help.Example = buf.String()
|
help.Example = buf.String()
|
||||||
buf.Reset()
|
buf.Reset()
|
||||||
@@ -161,7 +160,7 @@ func GetLabelHelpFor(labelname string, asMarkdown bool) string {
|
|||||||
KatenaryPrefix: KatenaryLabelPrefix,
|
KatenaryPrefix: KatenaryLabelPrefix,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatalf("Error executing template: %v", err)
|
log.Fatalf("Error executing template: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return buf.String()
|
return buf.String()
|
||||||
|
|||||||
@@ -92,12 +92,7 @@
|
|||||||
short: "Ports to be added to the service."
|
short: "Ports to be added to the service."
|
||||||
long: |-
|
long: |-
|
||||||
Only useful for services without exposed port. It is mandatory if the
|
Only useful for services without exposed port. It is mandatory if the
|
||||||
service is a dependency of another service AND you want to create a
|
service is a dependency of another service.
|
||||||
Kubernetes Service for external access.
|
|
||||||
|
|
||||||
If you only need to check if the service is ready (using depends_on),
|
|
||||||
you don't need to declare ports. The service will not be created automatically
|
|
||||||
unless you add this label.
|
|
||||||
example: |-
|
example: |-
|
||||||
labels:
|
labels:
|
||||||
{{ .KatenaryPrefix }}/ports: |-
|
{{ .KatenaryPrefix }}/ports: |-
|
||||||
@@ -360,36 +355,4 @@
|
|||||||
DB_USER: database.MARIADB_USER
|
DB_USER: database.MARIADB_USER
|
||||||
DB_PASSWORD: database.MARIADB_PASSWORD
|
DB_PASSWORD: database.MARIADB_PASSWORD
|
||||||
|
|
||||||
"depends-on":
|
|
||||||
short: "Method to check if a service is ready (for depends_on)."
|
|
||||||
long: |-
|
|
||||||
When a service uses `depends_on`, Katenary creates an initContainer to wait
|
|
||||||
for the dependent service to be ready.
|
|
||||||
|
|
||||||
By default, Katenary uses the Kubernetes API to check if the deployment's
|
|
||||||
`readyReplicas` status is greater than 0. This method does not require the
|
|
||||||
service to expose a port and does not create a Kubernetes Service automatically.
|
|
||||||
|
|
||||||
If you need to create a Kubernetes Service for external access, use the
|
|
||||||
`katenary.v3/ports` label instead.
|
|
||||||
|
|
||||||
Set this label to `legacy` to use the old netcat method that requires a port
|
|
||||||
to be defined for the dependent service.
|
|
||||||
example: |-
|
|
||||||
web:
|
|
||||||
image: nginx
|
|
||||||
depends_on:
|
|
||||||
- database
|
|
||||||
labels:
|
|
||||||
# Use legacy netcat method (requires port)
|
|
||||||
{{ .KatenaryPrefix }}/depends-on: legacy
|
|
||||||
|
|
||||||
database:
|
|
||||||
image: mysql
|
|
||||||
labels:
|
|
||||||
# Create a Kubernetes Service for external access
|
|
||||||
{{ .KatenaryPrefix }}/ports:
|
|
||||||
- 3306
|
|
||||||
type: "string"
|
|
||||||
|
|
||||||
# vim: ft=gotmpl.yaml
|
# vim: ft=gotmpl.yaml
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package labelstructs
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"log"
|
||||||
|
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"katenary.io/internal/logger"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type HealthCheck struct {
|
type HealthCheck struct {
|
||||||
@@ -24,13 +24,13 @@ func ProbeFrom(data string) (*HealthCheck, error) {
|
|||||||
if livenessProbe, ok := tmp["livenessProbe"]; ok {
|
if livenessProbe, ok := tmp["livenessProbe"]; ok {
|
||||||
livenessProbeBytes, err := json.Marshal(livenessProbe)
|
livenessProbeBytes, err := json.Marshal(livenessProbe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Warnf("Error marshalling livenessProbe: %v", err)
|
log.Printf("Error marshalling livenessProbe: %v", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
livenessProbe := &corev1.Probe{}
|
livenessProbe := &corev1.Probe{}
|
||||||
err = json.Unmarshal(livenessProbeBytes, livenessProbe)
|
err = json.Unmarshal(livenessProbeBytes, livenessProbe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Warnf("Error unmarshalling livenessProbe: %v", err)
|
log.Printf("Error unmarshalling livenessProbe: %v", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
mapping.LivenessProbe = livenessProbe
|
mapping.LivenessProbe = livenessProbe
|
||||||
@@ -39,13 +39,13 @@ func ProbeFrom(data string) (*HealthCheck, error) {
|
|||||||
if readinessProbe, ok := tmp["readinessProbe"]; ok {
|
if readinessProbe, ok := tmp["readinessProbe"]; ok {
|
||||||
readinessProbeBytes, err := json.Marshal(readinessProbe)
|
readinessProbeBytes, err := json.Marshal(readinessProbe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Warnf("Error marshalling readinessProbe: %v", err)
|
log.Printf("Error marshalling readinessProbe: %v", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
readinessProbe := &corev1.Probe{}
|
readinessProbe := &corev1.Probe{}
|
||||||
err = json.Unmarshal(readinessProbeBytes, readinessProbe)
|
err = json.Unmarshal(readinessProbeBytes, readinessProbe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Warnf("Error unmarshalling readinessProbe: %v", err)
|
log.Printf("Error unmarshalling readinessProbe: %v", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
mapping.ReadinessProbe = readinessProbe
|
mapping.ReadinessProbe = readinessProbe
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package generator
|
|||||||
import (
|
import (
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
rbacv1 "k8s.io/api/rbac/v1"
|
rbacv1 "k8s.io/api/rbac/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@@ -32,7 +32,7 @@ func NewRBAC(service types.ServiceConfig, appName string) *RBAC {
|
|||||||
APIVersion: "rbac.authorization.k8s.io/v1",
|
APIVersion: "rbac.authorization.k8s.io/v1",
|
||||||
},
|
},
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: utils.TplName(service.Name, appName, "dependency"),
|
Name: utils.TplName(service.Name, appName),
|
||||||
Labels: GetLabels(service.Name, appName),
|
Labels: GetLabels(service.Name, appName),
|
||||||
Annotations: Annotations,
|
Annotations: Annotations,
|
||||||
},
|
},
|
||||||
@@ -128,79 +128,6 @@ func (r *Role) Yaml() ([]byte, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewServiceAccount creates a new ServiceAccount from a compose service.
|
|
||||||
func NewServiceAccount(service types.ServiceConfig, appName string) *ServiceAccount {
|
|
||||||
return &ServiceAccount{
|
|
||||||
ServiceAccount: &corev1.ServiceAccount{
|
|
||||||
TypeMeta: metav1.TypeMeta{
|
|
||||||
Kind: "ServiceAccount",
|
|
||||||
APIVersion: "v1",
|
|
||||||
},
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: utils.TplName(service.Name, appName, "dependency"),
|
|
||||||
Labels: GetLabels(service.Name, appName),
|
|
||||||
Annotations: Annotations,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
service: &service,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewRestrictedRole creates a Role with minimal permissions for init containers.
|
|
||||||
func NewRestrictedRole(service types.ServiceConfig, appName string) *Role {
|
|
||||||
return &Role{
|
|
||||||
Role: &rbacv1.Role{
|
|
||||||
TypeMeta: metav1.TypeMeta{
|
|
||||||
Kind: "Role",
|
|
||||||
APIVersion: "rbac.authorization.k8s.io/v1",
|
|
||||||
},
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: utils.TplName(service.Name, appName, "dependency"),
|
|
||||||
Labels: GetLabels(service.Name, appName),
|
|
||||||
Annotations: Annotations,
|
|
||||||
},
|
|
||||||
Rules: []rbacv1.PolicyRule{
|
|
||||||
{
|
|
||||||
APIGroups: []string{"apps"},
|
|
||||||
Resources: []string{"deployments"},
|
|
||||||
Verbs: []string{"get"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
service: &service,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewRestrictedRoleBinding creates a RoleBinding that binds the restricted role to the ServiceAccount.
|
|
||||||
func NewRestrictedRoleBinding(service types.ServiceConfig, appName string) *RoleBinding {
|
|
||||||
return &RoleBinding{
|
|
||||||
RoleBinding: &rbacv1.RoleBinding{
|
|
||||||
TypeMeta: metav1.TypeMeta{
|
|
||||||
Kind: "RoleBinding",
|
|
||||||
APIVersion: "rbac.authorization.k8s.io/v1",
|
|
||||||
},
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: utils.TplName(service.Name, appName, "dependency"),
|
|
||||||
Labels: GetLabels(service.Name, appName),
|
|
||||||
Annotations: Annotations,
|
|
||||||
},
|
|
||||||
Subjects: []rbacv1.Subject{
|
|
||||||
{
|
|
||||||
Kind: "ServiceAccount",
|
|
||||||
Name: utils.TplName(service.Name, appName, "dependency"),
|
|
||||||
Namespace: "{{ .Release.Namespace }}",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
RoleRef: rbacv1.RoleRef{
|
|
||||||
Kind: "Role",
|
|
||||||
Name: utils.TplName(service.Name, appName, "dependency"),
|
|
||||||
APIGroup: "rbac.authorization.k8s.io",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
service: &service,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ServiceAccount is a kubernetes ServiceAccount.
|
// ServiceAccount is a kubernetes ServiceAccount.
|
||||||
type ServiceAccount struct {
|
type ServiceAccount struct {
|
||||||
*corev1.ServiceAccount
|
*corev1.ServiceAccount
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"katenary.io/internal/generator/labels"
|
"katenary.io/internal/generator/labels"
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
"k8s.io/apimachinery/pkg/util/intstr"
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package generator
|
package generator
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"katenary.io/internal/logger"
|
|
||||||
"katenary.io/internal/parser"
|
"katenary.io/internal/parser"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -23,28 +23,19 @@ func setup(content string) string {
|
|||||||
|
|
||||||
func teardown(tmpDir string) {
|
func teardown(tmpDir string) {
|
||||||
// remove the temporary directory
|
// remove the temporary directory
|
||||||
logger.Info("Removing temporary directory: ", tmpDir)
|
log.Println("Removing temporary directory: ", tmpDir)
|
||||||
if err := os.RemoveAll(tmpDir); err != nil {
|
if err := os.RemoveAll(tmpDir); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// internalCompileTestForce is like internalCompileTest but with the force option enabled to rewrite the chart.
|
|
||||||
func internalCompileTestForce(t *testing.T, options ...string) string {
|
|
||||||
return compileTest(t, true, options...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// internalCompileTest is like compileTest but without the force option enabled to rewrite the chart.
|
|
||||||
func internalCompileTest(t *testing.T, options ...string) string {
|
func internalCompileTest(t *testing.T, options ...string) string {
|
||||||
return compileTest(t, false, options...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func compileTest(t *testing.T, force bool, options ...string) string {
|
|
||||||
_, err := parser.Parse(nil, nil, "compose.yml")
|
_, err := parser.Parse(nil, nil, "compose.yml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to parse the project: %s", err)
|
t.Fatalf("Failed to parse the project: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
force := false
|
||||||
outputDir := "./chart"
|
outputDir := "./chart"
|
||||||
profiles := make([]string, 0)
|
profiles := make([]string, 0)
|
||||||
helmdepUpdate := true
|
helmdepUpdate := true
|
||||||
@@ -59,7 +50,7 @@ func compileTest(t *testing.T, force bool, options ...string) string {
|
|||||||
ChartVersion: chartVersion,
|
ChartVersion: chartVersion,
|
||||||
}
|
}
|
||||||
if err := Convert(convertOptions, "compose.yml"); err != nil {
|
if err := Convert(convertOptions, "compose.yml"); err != nil {
|
||||||
logger.Warnf("Failed to convert: %s", err)
|
log.Printf("Failed to convert: %s", err)
|
||||||
return err.Error()
|
return err.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"katenary.io/internal/generator/labels/labelstructs"
|
"katenary.io/internal/generator/labels/labelstructs"
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package generator
|
package generator
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -10,7 +9,7 @@ import (
|
|||||||
"katenary.io/internal/generator/labels"
|
"katenary.io/internal/generator/labels"
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/cli"
|
"github.com/compose-spec/compose-go/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSplitPorts(t *testing.T) {
|
func TestSplitPorts(t *testing.T) {
|
||||||
@@ -29,7 +28,7 @@ services:
|
|||||||
composeFile := filepath.Join(tmpDir, "compose.yaml")
|
composeFile := filepath.Join(tmpDir, "compose.yaml")
|
||||||
|
|
||||||
os.MkdirAll(tmpDir, utils.DirectoryPermission)
|
os.MkdirAll(tmpDir, utils.DirectoryPermission)
|
||||||
if err := os.WriteFile(composeFile, []byte(composeFileContent), 0o644); err != nil {
|
if err := os.WriteFile(composeFile, []byte(composeFileContent), 0644); err != nil {
|
||||||
t.Log(err)
|
t.Log(err)
|
||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
@@ -40,17 +39,15 @@ services:
|
|||||||
cli.WithWorkingDirectory(tmpDir),
|
cli.WithWorkingDirectory(tmpDir),
|
||||||
cli.WithDefaultConfigPath,
|
cli.WithDefaultConfigPath,
|
||||||
)
|
)
|
||||||
project, err := cli.ProjectFromOptions(context.TODO(), options)
|
project, err := cli.ProjectFromOptions(options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
s := project.Services["foo"]
|
if err := fixPorts(&project.Services[0]); err != nil {
|
||||||
if err := fixPorts(&s); err != nil {
|
|
||||||
t.Errorf("Expected no error, got %s", err)
|
t.Errorf("Expected no error, got %s", err)
|
||||||
}
|
}
|
||||||
project.Services["foo"] = s
|
|
||||||
found := 0
|
found := 0
|
||||||
for _, p := range project.Services["foo"].Ports {
|
for _, p := range project.Services[0].Ports {
|
||||||
switch p.Target {
|
switch p.Target {
|
||||||
case 80, 443:
|
case 80, 443:
|
||||||
found++
|
found++
|
||||||
@@ -79,7 +76,7 @@ services:
|
|||||||
composeFile := filepath.Join(tmpDir, "compose.yaml")
|
composeFile := filepath.Join(tmpDir, "compose.yaml")
|
||||||
|
|
||||||
os.MkdirAll(tmpDir, utils.DirectoryPermission)
|
os.MkdirAll(tmpDir, utils.DirectoryPermission)
|
||||||
if err := os.WriteFile(composeFile, []byte(composeFileContent), 0o644); err != nil {
|
if err := os.WriteFile(composeFile, []byte(composeFileContent), 0644); err != nil {
|
||||||
t.Log(err)
|
t.Log(err)
|
||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
@@ -90,17 +87,15 @@ services:
|
|||||||
cli.WithWorkingDirectory(tmpDir),
|
cli.WithWorkingDirectory(tmpDir),
|
||||||
cli.WithDefaultConfigPath,
|
cli.WithDefaultConfigPath,
|
||||||
)
|
)
|
||||||
project, err := cli.ProjectFromOptions(context.TODO(), options)
|
project, err := cli.ProjectFromOptions(options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
s := project.Services["foo"]
|
if err := fixPorts(&project.Services[0]); err != nil {
|
||||||
if err := fixPorts(&s); err != nil {
|
|
||||||
t.Errorf("Expected no error, got %s", err)
|
t.Errorf("Expected no error, got %s", err)
|
||||||
}
|
}
|
||||||
project.Services["foo"] = s
|
|
||||||
found := 0
|
found := 0
|
||||||
for _, p := range project.Services["foo"].Ports {
|
for _, p := range project.Services[0].Ports {
|
||||||
switch p.Target {
|
switch p.Target {
|
||||||
case 80, 443, 8080:
|
case 80, 443, 8080:
|
||||||
found++
|
found++
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package generator
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RepositoryValue is a docker repository image and tag that will be saved in values.yaml.
|
// RepositoryValue is a docker repository image and tag that will be saved in values.yaml.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
"image/png"
|
"image/png"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -172,6 +173,7 @@ services:
|
|||||||
`
|
`
|
||||||
composeFile = fmt.Sprintf(composeFile, labels.KatenaryLabelPrefix)
|
composeFile = fmt.Sprintf(composeFile, labels.KatenaryLabelPrefix)
|
||||||
tmpDir := setup(composeFile)
|
tmpDir := setup(composeFile)
|
||||||
|
log.Println(tmpDir)
|
||||||
defer teardown(tmpDir)
|
defer teardown(tmpDir)
|
||||||
|
|
||||||
os.Mkdir(filepath.Join(tmpDir, "images"), utils.DirectoryPermission)
|
os.Mkdir(filepath.Join(tmpDir, "images"), utils.DirectoryPermission)
|
||||||
@@ -241,6 +243,7 @@ services:
|
|||||||
`
|
`
|
||||||
composeFile = fmt.Sprintf(composeFile, labels.KatenaryLabelPrefix)
|
composeFile = fmt.Sprintf(composeFile, labels.KatenaryLabelPrefix)
|
||||||
tmpDir := setup(composeFile)
|
tmpDir := setup(composeFile)
|
||||||
|
log.Println(tmpDir)
|
||||||
defer teardown(tmpDir)
|
defer teardown(tmpDir)
|
||||||
|
|
||||||
os.Mkdir(filepath.Join(tmpDir, "images"), utils.DirectoryPermission)
|
os.Mkdir(filepath.Join(tmpDir, "images"), utils.DirectoryPermission)
|
||||||
|
|||||||
@@ -1,144 +0,0 @@
|
|||||||
// Package logger provides simple logging functions with icons and colors.
|
|
||||||
package logger
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Icon is a unicode icon
|
|
||||||
type Icon string
|
|
||||||
|
|
||||||
// Icons used in katenary.
|
|
||||||
const (
|
|
||||||
IconSuccess Icon = "✅"
|
|
||||||
IconFailure Icon = "❌"
|
|
||||||
IconWarning Icon = "❕"
|
|
||||||
IconNote Icon = "📝"
|
|
||||||
IconWorld Icon = "🌐"
|
|
||||||
IconPlug Icon = "🔌"
|
|
||||||
IconPackage Icon = "📦"
|
|
||||||
IconCabinet Icon = "🗄️"
|
|
||||||
IconInfo Icon = "🔵"
|
|
||||||
IconSecret Icon = "🔒"
|
|
||||||
IconConfig Icon = "🔧"
|
|
||||||
IconDependency Icon = "🔗"
|
|
||||||
)
|
|
||||||
|
|
||||||
const reset = "\033[0m"
|
|
||||||
|
|
||||||
const (
|
|
||||||
ColorGreen = "\033[38;5;34m"
|
|
||||||
ColorRed = "\033[38;5;196m"
|
|
||||||
ColorOrange = "\033[38;5;214m"
|
|
||||||
ColorWarning = "\033[38;5;214m"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
warnings []string
|
|
||||||
mu sync.Mutex
|
|
||||||
)
|
|
||||||
|
|
||||||
// Print prints a message without icon.
|
|
||||||
func Print(msg ...any) {
|
|
||||||
fmt.Print(msg...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Printf prints a formatted message without icon.
|
|
||||||
func Printf(format string, msg ...any) {
|
|
||||||
fmt.Printf(format, msg...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Info prints an informational message.
|
|
||||||
func Info(msg ...any) {
|
|
||||||
message("", IconInfo, msg...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Infof prints a formatted informational message.
|
|
||||||
func Infof(format string, msg ...any) {
|
|
||||||
message("", IconInfo, fmt.Sprintf(format, msg...))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Warn prints a warning message.
|
|
||||||
func Warn(msg ...any) {
|
|
||||||
mu.Lock()
|
|
||||||
defer mu.Unlock()
|
|
||||||
warning := fmt.Sprint(msg...)
|
|
||||||
warnings = append(warnings, warning)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Warnf prints a formatted warning message.
|
|
||||||
func Warnf(format string, msg ...any) {
|
|
||||||
mu.Lock()
|
|
||||||
defer mu.Unlock()
|
|
||||||
warning := fmt.Sprintf(format, msg...)
|
|
||||||
warnings = append(warnings, warning)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Success prints a success message.
|
|
||||||
func Success(msg ...any) {
|
|
||||||
message(ColorGreen, IconSuccess, msg...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Successf prints a formatted success message.
|
|
||||||
func Successf(format string, msg ...any) {
|
|
||||||
message(ColorGreen, IconSuccess, fmt.Sprintf(format, msg...))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Failure prints a failure message.
|
|
||||||
func Failure(msg ...any) {
|
|
||||||
message(ColorRed, IconFailure, msg...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Failuref prints a formatted failure message.
|
|
||||||
func Failuref(format string, msg ...any) {
|
|
||||||
message(ColorRed, IconFailure, fmt.Sprintf(format, msg...))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log prints a message with a custom icon.
|
|
||||||
func Log(icon Icon, msg ...any) {
|
|
||||||
message("", icon, msg...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logf prints a formatted message with a custom icon.
|
|
||||||
func Logf(icon Icon, format string, msg ...any) {
|
|
||||||
message("", icon, fmt.Sprintf(format, msg...))
|
|
||||||
}
|
|
||||||
|
|
||||||
func fatal(red string, icon Icon, msg ...any) {
|
|
||||||
fmt.Print(icon, " ", red)
|
|
||||||
fmt.Print(msg...)
|
|
||||||
fmt.Println(reset)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
func fatalf(red string, icon Icon, format string, msg ...any) {
|
|
||||||
fatal(red, icon, fmt.Sprintf(format, msg...))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fatal prints a fatal error message and exits with code 1.
|
|
||||||
func Fatal(msg ...any) {
|
|
||||||
fatal(ColorRed, IconFailure, msg...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fatalf prints a fatal error message with formatting and exits with code 1.
|
|
||||||
func Fatalf(format string, msg ...any) {
|
|
||||||
fatalf(ColorRed, IconFailure, format, msg...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FlushWarnings prints all collected warnings at the end of the conversion.
|
|
||||||
func FlushWarnings() {
|
|
||||||
mu.Lock()
|
|
||||||
defer mu.Unlock()
|
|
||||||
if len(warnings) > 0 {
|
|
||||||
fmt.Println()
|
|
||||||
fmt.Print(ColorWarning, IconWarning, " The following issues may need attention:", reset)
|
|
||||||
fmt.Println()
|
|
||||||
for _, warning := range warnings {
|
|
||||||
fmt.Println(" •", warning)
|
|
||||||
}
|
|
||||||
fmt.Println()
|
|
||||||
warnings = nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
package logger
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestIcons(t *testing.T) {
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
got Icon
|
|
||||||
expected Icon
|
|
||||||
}{
|
|
||||||
{"IconSuccess", IconSuccess, "✅"},
|
|
||||||
{"IconFailure", IconFailure, "❌"},
|
|
||||||
{"IconWarning", IconWarning, "❕"},
|
|
||||||
{"IconNote", IconNote, "📝"},
|
|
||||||
{"IconWorld", IconWorld, "🌐"},
|
|
||||||
{"IconPlug", IconPlug, "🔌"},
|
|
||||||
{"IconPackage", IconPackage, "📦"},
|
|
||||||
{"IconCabinet", IconCabinet, "🗄️"},
|
|
||||||
{"IconInfo", IconInfo, "🔵"},
|
|
||||||
{"IconSecret", IconSecret, "🔒"},
|
|
||||||
{"IconConfig", IconConfig, "🔧"},
|
|
||||||
{"IconDependency", IconDependency, "🔗"},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
if tt.got != tt.expected {
|
|
||||||
t.Errorf("got %q, want %q", tt.got, tt.expected)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestInfo(t *testing.T) {
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
t.Errorf("Info panicked: %v", r)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
Info("test message")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestWarn(t *testing.T) {
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
t.Errorf("Warn panicked: %v", r)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
Warn("test warning")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestSuccess(t *testing.T) {
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
t.Errorf("Success panicked: %v", r)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
Success("test success")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestFailure(t *testing.T) {
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
t.Errorf("Failure panicked: %v", r)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
Failure("test failure")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestLog(t *testing.T) {
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
t.Errorf("Log panicked: %v", r)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
Log(IconInfo, "test log")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestWarningsCollection(t *testing.T) {
|
|
||||||
// Clear any existing warnings
|
|
||||||
warnings = nil
|
|
||||||
|
|
||||||
// Add some warnings
|
|
||||||
Warn("test warning 1")
|
|
||||||
Warnf("test warning 2: %s", "value")
|
|
||||||
|
|
||||||
// Check that warnings were collected
|
|
||||||
if len(warnings) != 2 {
|
|
||||||
t.Errorf("expected 2 warnings, got %d", len(warnings))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check the content of warnings
|
|
||||||
if warnings[0] != "test warning 1" {
|
|
||||||
t.Errorf("expected 'test warning 1', got '%s'", warnings[0])
|
|
||||||
}
|
|
||||||
if warnings[1] != "test warning 2: value" {
|
|
||||||
t.Errorf("expected 'test warning 2: value', got '%s'", warnings[1])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
//go:build !ci
|
|
||||||
// +build !ci
|
|
||||||
|
|
||||||
package logger
|
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
func message(color string, icon Icon, msg ...any) {
|
|
||||||
fmt.Print(icon, " ", color)
|
|
||||||
fmt.Print(msg...)
|
|
||||||
fmt.Println(reset)
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
//go:build ci
|
|
||||||
// +build ci
|
|
||||||
|
|
||||||
package logger
|
|
||||||
|
|
||||||
// CI should be no-op
|
|
||||||
func message(color string, icon Icon, msg ...any) {
|
|
||||||
// no-op
|
|
||||||
}
|
|
||||||
@@ -2,12 +2,11 @@
|
|||||||
package parser
|
package parser
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"log"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/cli"
|
"github.com/compose-spec/compose-go/cli"
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
"katenary.io/internal/logger"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -37,28 +36,22 @@ func Parse(profiles []string, envFiles []string, dockerComposeFile ...string) (*
|
|||||||
var err error
|
var err error
|
||||||
envFiles[i], err = filepath.Abs(envFiles[i])
|
envFiles[i], err = filepath.Abs(envFiles[i])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
opts := []cli.ProjectOptionsFn{
|
options, err := cli.NewProjectOptions(nil,
|
||||||
cli.WithProfiles(profiles),
|
cli.WithProfiles(profiles),
|
||||||
cli.WithInterpolation(true),
|
cli.WithInterpolation(true),
|
||||||
|
cli.WithDefaultConfigPath,
|
||||||
cli.WithEnvFiles(envFiles...),
|
cli.WithEnvFiles(envFiles...),
|
||||||
cli.WithOsEnv,
|
cli.WithOsEnv,
|
||||||
cli.WithDotEnv,
|
cli.WithDotEnv,
|
||||||
cli.WithNormalization(true),
|
cli.WithNormalization(true),
|
||||||
cli.WithResolvedPaths(false),
|
cli.WithResolvedPaths(false),
|
||||||
}
|
)
|
||||||
|
|
||||||
if len(dockerComposeFile) == 0 {
|
|
||||||
opts = append(opts, cli.WithDefaultConfigPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
options, err := cli.NewProjectOptions(dockerComposeFile, opts...)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ctx := context.TODO()
|
return cli.ProjectFromOptions(options)
|
||||||
return cli.ProjectFromOptions(ctx, options)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package parser
|
package parser
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"katenary.io/internal/logger"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const composeFile = `
|
const composeFile = `
|
||||||
@@ -28,7 +27,7 @@ func setupTest() (string, error) {
|
|||||||
func tearDownTest(tmpDir string) {
|
func tearDownTest(tmpDir string) {
|
||||||
if tmpDir != "" {
|
if tmpDir != "" {
|
||||||
if err := os.RemoveAll(tmpDir); err != nil {
|
if err := os.RemoveAll(tmpDir); err != nil {
|
||||||
logger.Fatalf("Failed to remove temporary directory %s: %s", tmpDir, err.Error())
|
log.Fatalf("Failed to remove temporary directory %s: %s", tmpDir, err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
31
internal/utils/icons.go
Normal file
31
internal/utils/icons.go
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// Icon is a unicode icon
|
||||||
|
type Icon string
|
||||||
|
|
||||||
|
// Icons used in katenary.
|
||||||
|
const (
|
||||||
|
IconSuccess Icon = "✅"
|
||||||
|
IconFailure Icon = "❌"
|
||||||
|
IconWarning Icon = "❕"
|
||||||
|
IconNote Icon = "📝"
|
||||||
|
IconWorld Icon = "🌐"
|
||||||
|
IconPlug Icon = "🔌"
|
||||||
|
IconPackage Icon = "📦"
|
||||||
|
IconCabinet Icon = "🗄️"
|
||||||
|
IconInfo Icon = "🔵"
|
||||||
|
IconSecret Icon = "🔒"
|
||||||
|
IconConfig Icon = "🔧"
|
||||||
|
IconDependency Icon = "🔗"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Warn prints a warning message
|
||||||
|
func Warn(msg ...any) {
|
||||||
|
orange := "\033[38;5;214m"
|
||||||
|
reset := "\033[0m"
|
||||||
|
fmt.Print(IconWarning, orange, " ")
|
||||||
|
fmt.Print(msg...)
|
||||||
|
fmt.Println(reset)
|
||||||
|
}
|
||||||
@@ -3,15 +3,15 @@ package utils
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/v2/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
"github.com/mitchellh/go-wordwrap"
|
"github.com/mitchellh/go-wordwrap"
|
||||||
"github.com/thediveo/netdb"
|
"github.com/thediveo/netdb"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"katenary.io/internal/logger"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// DirectoryPermission is the default values for permissions apply to created directories.
|
// DirectoryPermission is the default values for permissions apply to created directories.
|
||||||
@@ -64,7 +64,7 @@ func GetKind(path string) (kind string) {
|
|||||||
} else {
|
} else {
|
||||||
kind = strings.Split(path, ".")[1]
|
kind = strings.Split(path, ".")[1]
|
||||||
}
|
}
|
||||||
return kind
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrap wraps a string with a string above and below. It will respect the indentation of the src string.
|
// Wrap wraps a string with a string above and below. It will respect the indentation of the src string.
|
||||||
@@ -132,24 +132,23 @@ func GetValuesFromLabel(service types.ServiceConfig, LabelValues string) map[str
|
|||||||
labelContent := []any{}
|
labelContent := []any{}
|
||||||
err := yaml.Unmarshal([]byte(v), &labelContent)
|
err := yaml.Unmarshal([]byte(v), &labelContent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Warnf("Error parsing label %s: %s", v, err)
|
log.Printf("Error parsing label %s: %s", v, err)
|
||||||
logger.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, value := range labelContent {
|
for _, value := range labelContent {
|
||||||
switch value := value.(type) {
|
switch val := value.(type) {
|
||||||
case string:
|
case string:
|
||||||
descriptions[value] = nil
|
descriptions[val] = nil
|
||||||
case map[string]any:
|
case map[string]any:
|
||||||
for k, v := range value {
|
for k, v := range value.(map[string]any) {
|
||||||
descriptions[k] = &EnvConfig{Service: service, Description: v.(string)}
|
descriptions[k] = &EnvConfig{Service: service, Description: v.(string)}
|
||||||
}
|
}
|
||||||
case map[any]any:
|
case map[any]any:
|
||||||
for k, v := range value {
|
for k, v := range value.(map[any]any) {
|
||||||
descriptions[k.(string)] = &EnvConfig{Service: service, Description: v.(string)}
|
descriptions[k.(string)] = &EnvConfig{Service: service, Description: v.(string)}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
logger.Fatalf("Unknown type in label: %s %T", LabelValues, value)
|
log.Fatalf("Unknown type in label: %s %T", LabelValues, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,7 +161,7 @@ func WordWrap(text string, lineWidth int) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Confirm asks a question and returns true if the answer is y.
|
// Confirm asks a question and returns true if the answer is y.
|
||||||
func Confirm(question string, icon ...logger.Icon) bool {
|
func Confirm(question string, icon ...Icon) bool {
|
||||||
if len(icon) > 0 {
|
if len(icon) > 0 {
|
||||||
fmt.Printf("%s %s [y/N] ", icon[0], question)
|
fmt.Printf("%s %s [y/N] ", icon[0], question)
|
||||||
} else {
|
} else {
|
||||||
@@ -170,7 +169,7 @@ func Confirm(question string, icon ...logger.Icon) bool {
|
|||||||
}
|
}
|
||||||
var response string
|
var response string
|
||||||
if _, err := fmt.Scanln(&response); err != nil {
|
if _, err := fmt.Scanln(&response); err != nil {
|
||||||
logger.Fatalf("Error parsing response: %s", err.Error())
|
log.Fatalf("Error parsing response: %s", err.Error())
|
||||||
}
|
}
|
||||||
return strings.ToLower(response) == "y"
|
return strings.ToLower(response) == "y"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user