-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Do not use default values in the Kubernetes yamls #941
Changes from 2 commits
ca54e2c
f266295
cb60c01
238daa7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ spec: | |
config: | ||
outputPath: "deploy/yamls" | ||
ingressName: "{{ .ProjectName }}" | ||
useDefaultValuesInK8sYamls: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,8 +33,9 @@ import ( | |
) | ||
|
||
const ( | ||
outputPathTemplateName = "OutputPath" | ||
defaultK8sYamlsOutputPath = common.DeployDir + string(os.PathSeparator) + "yamls" | ||
outputPathTemplateName = "OutputPath" | ||
defaultK8sYamlsOutputPath = common.DeployDir + string(os.PathSeparator) + "yamls" | ||
useDefaultValuesInK8sYamls = false | ||
) | ||
|
||
// Kubernetes implements Transformer interface | ||
|
@@ -46,8 +47,9 @@ type Kubernetes struct { | |
|
||
// KubernetesYamlConfig stores the k8s related information | ||
type KubernetesYamlConfig struct { | ||
IngressName string `yaml:"ingressName"` | ||
OutputPath string `yaml:"outputPath"` | ||
IngressName string `yaml:"ingressName"` | ||
OutputPath string `yaml:"outputPath"` | ||
UseDefaultValuesInK8sYamls bool `yaml:"useDefaultValuesInK8sYamls"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be better to use the same name in all configs? like say There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes sure There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
} | ||
|
||
// KubernetesPathTemplateConfig implements Kubernetes template config interface | ||
|
@@ -72,6 +74,9 @@ func (t *Kubernetes) Init(tc transformertypes.Transformer, e *environment.Enviro | |
if t.KubernetesConfig.OutputPath == "" { | ||
t.KubernetesConfig.OutputPath = defaultK8sYamlsOutputPath | ||
} | ||
if !t.KubernetesConfig.UseDefaultValuesInK8sYamls { | ||
t.KubernetesConfig.UseDefaultValuesInK8sYamls = useDefaultValuesInK8sYamls | ||
} | ||
return nil | ||
} | ||
|
||
|
@@ -139,7 +144,7 @@ func (t *Kubernetes) Transform(newArtifacts []transformertypes.Artifact, already | |
new(apiresource.ImageStream), | ||
new(apiresource.NetworkPolicy), | ||
} | ||
files, err := apiresource.TransformIRAndPersist(irtypes.NewEnhancedIRFromIR(ir), tempDest, apis, clusterConfig) | ||
files, err := apiresource.TransformIRAndPersist(irtypes.NewEnhancedIRFromIR(ir), tempDest, apis, clusterConfig, t.KubernetesConfig.UseDefaultValuesInK8sYamls) | ||
if err != nil { | ||
return nil, nil, fmt.Errorf("failed to transform and persist the IR. Error: %w", err) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would
setDefaultValuesInYamls
be a better name?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.