Where are the charm hooks files on github

charming

#1

Hi,

I want to make my own charm based on the charm-kubernetes-master repo on github , but there is no hooks folder or some other folders (bin, wheelhouse) that are present in the charm store page. Where do these come from when the charm is published?

Thank you


#2

The charm in your link is not directly usable. After writing the charm you have to build it with charm build. That command will wire everything up and ensure your charm can be deployed.

You can kind of compare it to compiling a C/go program. You only keep the source files in the git repo which are necessary to build. The “binary” here is the fully build charm which is available in the store and prevents juju users of having to build locally.


#3

The kubernetes-master charm is a layered and reactive charm, so it needs to be built with charm build. The rest of the Charm Writing docs will be helpful, as well.

One nice aspect of the charms being layered is that, if you want to build a customized version of kubernetes-master based on the upstream charm, instead of creating a fork of the charm and having to keep that in sync, you can create a charm layer which includes kubernetes-master as a base layer and can then extend or override it with only the pieces that need to be different. You would do this by checking out a copy of the kubernetes-master charm into your $CHARM_LAYERS_PATH directory (as kubernetes-master) and then having your layer.yaml file look like this:

repo: https://github.com/my-org/charm-my-k8s-master
includes:
  - 'layer:kubernetes-master'

At a minimum, you would want to override the charm name in your metadata.yaml, so that you don’t conflict with the upstream charm:

name: my-k8s-master

#4

Thank you for the replies! I get it now. I will look into using the kubernetes-master layer.