Skip to content
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

Added helm chart renderer #17

Merged
merged 2 commits into from
Mar 30, 2023
Merged

Conversation

mfaizanse
Copy link
Member

Description

Changes proposed in this pull request:

  • Added Helm chart renderer.
  • Update Dockerfile to include nats chart.
  • Update makefile to have go fmt and go imports.
  • Fixed kustomize files.

Related issue(s)

#11

@mfaizanse mfaizanse requested a review from a team as a code owner March 29, 2023 07:54
@kyma-bot kyma-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Mar 29, 2023
@mfaizanse mfaizanse linked an issue Mar 29, 2023 that may be closed by this pull request
4 tasks
Comment on lines +115 to +119
sampleObj := &unstructured.Unstructured{
Object: map[string]interface{}{
"kind": "Deployment",
},
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this in the test? Isn't the StatefulSet construct enough?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetStatefulSets() internally filters the k8s objects and only returns statefulsets, to test this, I added a non-statefulset set objects.

Comment on lines 12 to 13
// RenderManifestAsUnStructured of the given chart as unstructured objects.
RenderManifestAsUnStructured(*ReleaseInstance) (*ManifestResources, error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UnStructured -> Unstructured

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

clientGetter := genericclioptions.NewConfigFlags(false)
clientGetter.Namespace = &namespace
cfg := new(action.Configuration)
if err := cfg.Init(clientGetter, namespace, "secrets", c.logger.Debugf); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does secrets mean in this context?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the definition of this method, it seems that its uses secret based client for some internal store.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw different options like (secrets, configmaps, memory, ...etc), do you know what does it mean to use one over the other?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly, I re-used the configurations as used by the kyma-reconciler.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +80 to +89
tplAction := action.NewInstall(cfg)
tplAction.ReleaseName = releaseInstance.Name
tplAction.Namespace = releaseInstance.Namespace
tplAction.Atomic = true
tplAction.Wait = true
tplAction.CreateNamespace = true
tplAction.DryRun = true
tplAction.Replace = true // Skip the name check
tplAction.IncludeCRDs = true // include CRDs in the templated output
tplAction.ClientOnly = true // if false, it will validate the manifests against the Kubernetes cluster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in a follow-up ticket, we should think about making some parts of the installation behaviour to be configurable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a task here for it.


import "os"

func DirExists(file string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file string -> path string

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Comment on lines +21 to +24
Name string
Namespace string
Configuration map[string]interface{}
RenderedManifests ManifestResources
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this information exported?
IMO, it is dangerous to allow those fields to be modifiable by any entity that has access to the release instance.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only used the struct to pass data among methods. But yes, valid point. I will do it in later PR, as it may fail some things in the parent PR. I have added a task here for it.

Comment on lines +18 to +19
Items []*unstructured.Unstructured
Blobs [][]byte
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only used the struct to pass data among methods. But yes, valid point. I will do it in later PR, as it may fail some things in the parent PR. I have added a task here for it.

@mfaizanse mfaizanse mentioned this pull request Mar 30, 2023
14 tasks
@kyma-bot kyma-bot added the lgtm Looks good to me! label Mar 30, 2023
@kyma-bot kyma-bot merged commit 0f16c1a into kyma-project:main Mar 30, 2023
@k15r k15r mentioned this pull request Aug 3, 2023
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Looks good to me! size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle external charts provided by nats_io
3 participants