Skip to content

Commit

Permalink
Merge pull request #8 from weaveworks/2107-profile-path-support
Browse files Browse the repository at this point in the history
Add path support for profiles in templates
  • Loading branch information
ranatrk authored Jan 19, 2023
2 parents a21effc + 7fca399 commit 4d021bc
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 11 deletions.
17 changes: 14 additions & 3 deletions apis/core/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ type TemplateParam struct {

type ChartsSpec struct {
Items []Chart `json:"items,omitempty"`
// Template for the HelmRepository.
// Shortcut to template.content.spec.chart.spec.helmRepositoryTemplate
HelmRepositoryTemplate HelmRepositoryTemplateSpec `json:"helmRepositoryTemplate,omitempty"`
}

// Chart is the set of values that control the default and required values
Expand All @@ -96,14 +99,22 @@ type Chart struct {
Editable bool `json:"editable,omitempty"`
// Shortcut to template.content.spec.values
Values *HelmReleaseValues `json:"values,omitempty"`
// Template for the HelmRelease, merged with the default template
// Template for the HelmRelease, merged with the default template.
HelmReleaseTemplate HelmReleaseTemplateSpec `json:"template,omitempty"`
}

// HelmReleaseTemplateSpec is a future proof way to define a template with a path
// path is not yet used, but will be used in the near future
// HelmRepositoryTemplateSpec is a way to define a repository template path
// +kubebuilder:object:generate=true
type HelmRepositoryTemplateSpec struct {
Path string `json:"path,omitempty"`
}

// HelmReleaseTemplateSpec is a way to define a template with a path
// content is not yet used, but will be used in the near future
// +kubebuilder:object:generate=true
type HelmReleaseTemplateSpec struct {
// Path of the template
Path string `json:"path,omitempty"`
// Content of the template
Content *HelmReleaseTemplate `json:"content,omitempty"`
}
Expand Down
16 changes: 16 additions & 0 deletions apis/core/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 20 additions & 4 deletions config/crd/bases/capi.weave.works_capitemplates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ spec:
charts:
description: Charts is the set of charts that are used in this template.
properties:
helmRepositoryTemplate:
description: Template for the HelmRepository. Shortcut to template.content.spec.chart.spec.helmRepositoryTemplate
properties:
path:
type: string
type: object
items:
items:
description: Chart is the set of values that control the default
Expand All @@ -64,12 +70,15 @@ spec:
type: string
template:
description: Template for the HelmRelease, merged with the
default template
default template.
properties:
content:
description: Content of the template
type: object
x-kubernetes-preserve-unknown-fields: true
path:
description: Path of the template
type: string
type: object
values:
description: Shortcut to template.content.spec.values
Expand Down Expand Up @@ -159,6 +168,12 @@ spec:
charts:
description: Charts is the set of charts that are used in this template.
properties:
helmRepositoryTemplate:
description: Template for the HelmRepository. Shortcut to template.content.spec.chart.spec.helmRepositoryTemplate
properties:
path:
type: string
type: object
items:
items:
description: Chart is the set of values that control the default
Expand All @@ -184,12 +199,15 @@ spec:
type: string
template:
description: Template for the HelmRelease, merged with the
default template
default template.
properties:
content:
description: Content of the template
type: object
x-kubernetes-preserve-unknown-fields: true
path:
description: Path of the template
type: string
type: object
values:
description: Shortcut to template.content.spec.values
Expand Down Expand Up @@ -259,8 +277,6 @@ spec:
type: array
path:
type: string
required:
- content
type: object
type: array
type: object
Expand Down
24 changes: 20 additions & 4 deletions config/crd/bases/templates.weave.works_gitopstemplates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ spec:
charts:
description: Charts is the set of charts that are used in this template.
properties:
helmRepositoryTemplate:
description: Template for the HelmRepository. Shortcut to template.content.spec.chart.spec.helmRepositoryTemplate
properties:
path:
type: string
type: object
items:
items:
description: Chart is the set of values that control the default
Expand All @@ -64,12 +70,15 @@ spec:
type: string
template:
description: Template for the HelmRelease, merged with the
default template
default template.
properties:
content:
description: Content of the template
type: object
x-kubernetes-preserve-unknown-fields: true
path:
description: Path of the template
type: string
type: object
values:
description: Shortcut to template.content.spec.values
Expand Down Expand Up @@ -161,6 +170,12 @@ spec:
charts:
description: Charts is the set of charts that are used in this template.
properties:
helmRepositoryTemplate:
description: Template for the HelmRepository. Shortcut to template.content.spec.chart.spec.helmRepositoryTemplate
properties:
path:
type: string
type: object
items:
items:
description: Chart is the set of values that control the default
Expand All @@ -186,12 +201,15 @@ spec:
type: string
template:
description: Template for the HelmRelease, merged with the
default template
default template.
properties:
content:
description: Content of the template
type: object
x-kubernetes-preserve-unknown-fields: true
path:
description: Path of the template
type: string
type: object
values:
description: Shortcut to template.content.spec.values
Expand Down Expand Up @@ -261,8 +279,6 @@ spec:
type: array
path:
type: string
required:
- content
type: object
type: array
type: object
Expand Down

0 comments on commit 4d021bc

Please sign in to comment.