Skip to content

Instantly share code, notes, and snippets.

@muvaf
Last active May 15, 2020 01:43
Show Gist options
  • Save muvaf/78c704c75fafd74979a79d9558916da6 to your computer and use it in GitHub Desktop.
Save muvaf/78c704c75fafd74979a79d9558916da6 to your computer and use it in GitHub Desktop.
How to do kubectl apply to a github folder
# This feature is provided by kustomize that is embedded into kubectl.
# So, you have to have a kustomization.yaml in the folder that has a list of files and folders under `resources:` array.
# Here is the folder we'll deploy: https://github.com/muvaf/crossplane/tree/kapp-coredef/cluster/composition/clusterroles
# Assuming you got that right:
# With git commit hash
kubectl apply -k 'github.com/muvaf/crossplane/cluster/composition/clusterroles?ref=2d2c011'
# With branch name
kubectl apply -k 'github.com/muvaf/crossplane/cluster/composition/clusterroles?ref=kapp-coredef'
# You see that the path is specified right after the repository name without any branch information.
# However, in order to find right snapshot, you have to include either the git commit or the release tag or the branch name.
# It is similar to Golang dependencies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment