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

helm mapkubeapis plugin - also in offline packages #600

Merged
merged 1 commit into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions nix/overlay.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
self: super: {
self:
let helm-mapkubeapis = self.callPackage ./pkgs/helm-mapkubeapis.nix { };
Copy link
Contributor

Choose a reason for hiding this comment

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

I was a bit surprised seeing this expression here.

Have you tried to move it closer to its usage? E.g. to line 16?

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 did. But then it gave me "variable helm-mapkubeapis unknown" or something similar. When I moved it up here it worked.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not that bad. So, never mind 🤷 😄

in
super: {
pythonForAnsible = (self.python3.withPackages (_: self.ansible.requiredPythonModules ++ [
super.python3Packages.boto
super.python3Packages.boto3
Expand All @@ -11,7 +14,7 @@ self: super: {

kubectl = self.callPackage ./pkgs/kubectl.nix { };
kubernetes-helm = super.wrapHelm super.kubernetes-helm {
plugins = with super.kubernetes-helmPlugins; [ helm-s3 helm-secrets helm-diff ];
plugins = with super.kubernetes-helmPlugins; [ helm-s3 helm-secrets helm-diff helm-mapkubeapis ];
};

kubeadm = self.runCommandNoCC "kubeadm" { } "install -Dm0775 ${self.wire-binaries}/kubeadm $out/bin/kubeadm";
Expand Down
40 changes: 40 additions & 0 deletions nix/pkgs/helm-mapkubeapis.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{ buildGoModule, fetchFromGitHub, lib }:

buildGoModule rec {
pname = "helm-mapkubeapis";
# in case you change this version, ensure to set sha256 to empty string, as it will
# otherwise recompile but not actually update the version. Nix is not intuitive
# at all, this sucks! But you've been warned. :)
version = "0.1.0";

src = fetchFromGitHub {
owner = "helm";
repo = pname;
rev = "v${version}";
sha256 = "sha256-OIom+fMjLkbYXbxCsISuihdr3CWjUnkucTnDfoix9B0=";
};

vendorSha256 = "sha256-jqVzBRlGFhDHaiSF9AArJdt4KRCiUqUuo0CnJUTbSfE=";

# NOTE: Remove the install and upgrade hooks.
postPatch = ''
sed -i '/^hooks:/,+2 d' plugin.yaml
'';

checkPhase = ''
'';

postInstall = ''
install -dm755 $out/${pname}
mv $out/bin $out/${pname}/
install -m644 -Dt $out/${pname}/config/ config/Map.yaml
install -m644 -Dt $out/${pname} plugin.yaml
'';

meta = with lib; {
description = "A Helm plugin to map helm release deprecated Kubernetes APIs in-place";
homepage = "https://github.com/helm/helm-mapkubeapis";
license = licenses.asl20;
maintainers = with maintainers; [ ];
};
}