git: db9dab9d84dd - main - net/kube-apiserver: Add new port

From: Mikael Urankar <mikael_at_FreeBSD.org>
Date: Fri, 20 Jan 2023 11:50:36 UTC
The branch main has been updated by mikael:

URL: https://cgit.FreeBSD.org/ports/commit/?id=db9dab9d84dd2470d070b9b6e2b387185f132f1e

commit db9dab9d84dd2470d070b9b6e2b387185f132f1e
Author:     Loic Blot <loic.blot@unix-experience.fr>
AuthorDate: 2023-01-17 19:32:43 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2023-01-20 11:50:24 +0000

    net/kube-apiserver: Add new port
    
    The Kubernetes API server validates and configures data for the api
    objects which include pods, services, replicationcontrollers,
    and others. The API Server services REST operations and provides
    the frontend to the cluster's shared state through which all other
    components interact.
    
    Note: while testing this as a replacement of a Linux based on my lab,
    I only saw Webhooks not working due to Kubernetes network mesh not implemented.
    I added a notice about this for people who want to test it.
    
    PR:             267308
---
 net/Makefile                               |  1 +
 net/kube-apiserver/Makefile                | 45 ++++++++++++++++++++++++++++++
 net/kube-apiserver/distinfo                |  3 ++
 net/kube-apiserver/files/kube-apiserver.in | 24 ++++++++++++++++
 net/kube-apiserver/pkg-descr               |  5 ++++
 net/kube-apiserver/pkg-message             | 12 ++++++++
 6 files changed, 90 insertions(+)

diff --git a/net/Makefile b/net/Makefile
index bacf08db86c3..3cab3a106599 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -339,6 +339,7 @@
     SUBDIR += krill
     SUBDIR += ksmtp
     SUBDIR += ktnef
+    SUBDIR += kube-apiserver
     SUBDIR += kube-controller-manager
     SUBDIR += kube-scheduler
     SUBDIR += l2tpd
diff --git a/net/kube-apiserver/Makefile b/net/kube-apiserver/Makefile
new file mode 100644
index 000000000000..34bd6be54ca7
--- /dev/null
+++ b/net/kube-apiserver/Makefile
@@ -0,0 +1,45 @@
+PORTNAME=	kube-apiserver
+PORTVERSION=	1.26.0
+DISTVERSIONPREFIX=	v
+CATEGORIES=	net
+
+MAINTAINER=	loic.blot@unix-experience.fr
+COMMENT=	Kubernetes API service
+WWW=		https://github.com/kubernetes/kubernetes
+
+LICENSE=	APACHE20
+
+USES=		cpe go
+CPE_VENDOR=	jenkins
+CPE_PRODUCT=	kubernetes
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	kubernetes
+GH_PROJECT=	kubernetes
+
+BUILD_DATE=	$$(date +'%Y-%m-%dT%H:%M:%SZ')
+
+GO_PKGNAME=	k8s.io/kubernetes
+GO_TARGET=	${GO_PKGNAME}/cmd/kube-apiserver
+GO_BUILDFLAGS=	-ldflags="-X k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.buildDate=${BUILD_DATE} \
+      		-X k8s.io/kubernetes/vendor/k8s.io/component-base/version.buildDate=${BUILD_DATE} \
+      		-X k8s.io/client-go/pkg/version.buildDate=${BUILD_DATE} \
+      		-X k8s.io/component-base/version.buildDate=${BUILD_DATE} \
+		-X k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.gitMinor=${PORTVERSION:R:E} \
+      		-X k8s.io/kubernetes/vendor/k8s.io/component-base/version.gitMinor=${PORTVERSION:R:E} \
+      		-X k8s.io/client-go/pkg/version.gitMinor=${PORTVERSION:R:E} \
+      		-X k8s.io/component-base/version.gitMinor=${PORTVERSION:R:E} \
+		-X k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.gitMajor=${PORTVERSION:R:R} \
+      		-X k8s.io/kubernetes/vendor/k8s.io/component-base/version.gitMajor=${PORTVERSION:R:R} \
+      		-X k8s.io/client-go/pkg/version.gitMajor=${PORTVERSION:R:R} \
+      		-X k8s.io/component-base/version.gitMajor=${PORTVERSION:R:R} \
+		-X k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.gitVersion=${DISTVERSIONPREFIX}${PORTVERSION} \
+      		-X k8s.io/kubernetes/vendor/k8s.io/component-base/version.gitVersion=${DISTVERSIONPREFIX}${PORTVERSION} \
+      		-X k8s.io/client-go/pkg/version.gitVersion=${DISTVERSIONPREFIX}${PORTVERSION} \
+      		-X k8s.io/component-base/version.gitVersion=${DISTVERSIONPREFIX}${PORTVERSION}"
+
+USE_RC_SUBR=	kube-apiserver
+
+PLIST_FILES=	bin/${PORTNAME}
+
+.include <bsd.port.mk>
diff --git a/net/kube-apiserver/distinfo b/net/kube-apiserver/distinfo
new file mode 100644
index 000000000000..73ca67366738
--- /dev/null
+++ b/net/kube-apiserver/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1670573676
+SHA256 (kubernetes-kubernetes-v1.26.0_GH0.tar.gz) = a0de781db6d09d91f39306740420f150c5912606f52e4c9a859649f4313fe508
+SIZE (kubernetes-kubernetes-v1.26.0_GH0.tar.gz) = 40269668
diff --git a/net/kube-apiserver/files/kube-apiserver.in b/net/kube-apiserver/files/kube-apiserver.in
new file mode 100755
index 000000000000..06acf8c90d6a
--- /dev/null
+++ b/net/kube-apiserver/files/kube-apiserver.in
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# PROVIDE: kube-apiserver
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+
+# Add the following lines to /etc/rc.conf to enable kube-apiserver:
+#
+# kube-apiserver_enable="YES"
+
+. /etc/rc.subr
+
+name="kube_apiserver"
+rcvar="kube_apiserver_enable"
+
+load_rc_config $name
+: ${kube_apiserver_enable:=no}
+: ${kube_apiserver_args:="--bind-address=0.0.0.0 --v=2"}
+
+pidfile="/var/run/${name}.pid"
+command="/usr/sbin/daemon"
+command_args="-P ${pidfile} -r -S -t ${name} -T ${name} /usr/local/bin/kube-apiserver ${kube_apiserver_args}"
+
+run_rc_command "$1"
diff --git a/net/kube-apiserver/pkg-descr b/net/kube-apiserver/pkg-descr
new file mode 100644
index 000000000000..dc49c218d62a
--- /dev/null
+++ b/net/kube-apiserver/pkg-descr
@@ -0,0 +1,5 @@
+The Kubernetes API server validates and configures data for the api
+objects which include pods, services, replicationcontrollers,
+and others. The API Server services REST operations and provides
+the frontend to the cluster's shared state through which all other
+components interact.
diff --git a/net/kube-apiserver/pkg-message b/net/kube-apiserver/pkg-message
new file mode 100644
index 000000000000..c7f597251f49
--- /dev/null
+++ b/net/kube-apiserver/pkg-message
@@ -0,0 +1,12 @@
+[
+{ type: install
+  message: <<EOM
+----------------------------------------------------------------------
+Thanks for installing Kubernetes API server on FreeBSD.
+There is a known limitation on kube-apiserver currently:
+* Webhooks cannot work as they require CNI network mesh in most of the
+  deployment. Currently Kubelet hasn't be ported to FreeBSD.
+----------------------------------------------------------------------
+EOM
+}
+]