- New port: sysutils/eksctl

eksctl is a simple CLI tool for creating clusters on EKS - Amazon's
new managed Kubernetes service for EC2. It is written in Go,
and based on Amazon's official CloudFormation templates.
This commit is contained in:
Danilo Egea Gondolfo 2018-08-17 21:43:38 +00:00
parent 071682e2de
commit 03ac5dc93a
6 changed files with 104 additions and 0 deletions

View File

@ -300,6 +300,7 @@
SUBDIR += ec2-scripts
SUBDIR += edid-decode
SUBDIR += eject
SUBDIR += eksctl
SUBDIR += endian
SUBDIR += enteruser
SUBDIR += entr

39
sysutils/eksctl/Makefile Normal file
View File

@ -0,0 +1,39 @@
# Created by: Danilo Egea Gondolfo <danilo@FreeBSD.org>
# $FreeBSD$
PORTNAME= eksctl
PORTVERSION= 0.1.0
CATEGORIES= sysutils
MAINTAINER= danilo@FreeBSD.org
COMMENT= CLI for Amazon EKS
LICENSE= APACHE20
RUN_DEPENDS= kubectl:sysutils/kubectl \
aws-iam-authenticator:security/aws-iam-authenticator
USES= go
USE_GITHUB= yes
GH_ACCOUNT= weaveworks
PLIST_FILES= bin/${PORTNAME}
post-patch:
${LN} -s ${WRKSRC}/vendor ${WRKSRC}/src
${MKDIR} ${WRKSRC}/src/github.com/weaveworks/eksctl
${LN} -s ${WRKSRC}/pkg ${WRKSRC}/src/github.com/weaveworks/eksctl/pkg
do-build:
cd ${WRKSRC}/cmd/${PORTNAME} && \
GOPATH=${WRKSRC} go build \
-ldflags="-X main.gitCommit=${PORTVERSION} \
-X main.builtAt=$$(date +'%s')"
do-install:
${INSTALL_PROGRAM} \
${WRKSRC}/cmd/${PORTNAME}/${PORTNAME} \
${STAGEDIR}${PREFIX}/bin/${PORTNAME}
.include <bsd.port.mk>

3
sysutils/eksctl/distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1534530868
SHA256 (weaveworks-eksctl-0.1.0_GH0.tar.gz) = 81ed110dcb67df9105034243453debba42aaf013d4dfe72ce292a52076bad023
SIZE (weaveworks-eksctl-0.1.0_GH0.tar.gz) = 15217839

View File

@ -0,0 +1,11 @@
--- pkg/eks/auth.go.orig 2018-08-17 20:19:48 UTC
+++ pkg/eks/auth.go
@@ -192,7 +192,7 @@ func (c *ClientConfig) WithExecHeptioAuthenticator() *
x := clientConfigCopy.Client.AuthInfos[c.ContextName]
x.Exec = &clientcmdapi.ExecConfig{
APIVersion: "client.authentication.k8s.io/v1alpha1",
- Command: "heptio-authenticator-aws",
+ Command: "aws-iam-authenticator",
Args: []string{"token", "-i", c.Cluster.ClusterName},
/*
Args: []string{"token", "-i", c.Cluster.ClusterName, "-r", c.roleARN},

View File

@ -0,0 +1,45 @@
--- pkg/utils/kubectl.go.orig 2018-08-17 19:52:51 UTC
+++ pkg/utils/kubectl.go
@@ -46,22 +46,12 @@ func CheckKubectlVersion(env []string) error {
return nil
}
-func CheckHeptioAuthenticatorAWS() error {
- path, err := exec.LookPath("heptio-authenticator-aws")
- if err == nil {
- logger.Debug("heptio-authenticator-aws: %q", path)
- } else {
- return fmt.Errorf("heptio-authenticator-aws not installed")
- }
- return nil
-}
-
func CheckAllCommands(kubeconfigPath string, isContextSet bool, contextName string, env []string) error {
if err := CheckKubectlVersion(env); err != nil {
return err
}
- if err := CheckHeptioAuthenticatorAWS(); err != nil {
+ if err := checkAuthenticator(); err != nil {
return err
}
@@ -97,4 +87,18 @@ func CheckAllCommands(kubeconfigPath string, isContext
}
return nil
+}
+
+// checkAuthenticator checks for the authenticator binary existence.
+func checkAuthenticator() error {
+ binaries := []string{"heptio-authenticator-aws", "aws-iam-authenticator"}
+ for _, bin := range binaries {
+ path, err := exec.LookPath(bin)
+ if err == nil {
+ // binary was found
+ logger.Debug("%s: %q", bin, path)
+ return nil
+ }
+ }
+ return fmt.Errorf("neither aws-iam-authenticator nor heptio-authenticator-aws are installed")
}

View File

@ -0,0 +1,5 @@
eksctl is a simple CLI tool for creating clusters on EKS - Amazon's
new managed Kubernetes service for EC2. It is written in Go,
and based on Amazon's official CloudFormation templates.
WWW: https://eksctl.io/