Skip to content

Commit

Permalink
kubectl container image added
Browse files Browse the repository at this point in the history
  • Loading branch information
rcmadhankumar committed Dec 11, 2024
1 parent 9b8a099 commit 1df2fc4
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/bci_build/package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,7 @@ def generate_disk_size_constraints(size_gb: int) -> str:
from .golang import GOLANG_CONTAINERS # noqa: E402
from .kea import KEA_DHCP_CONTAINERS # noqa: E402
from .kiwi import KIWI_CONTAINERS # noqa: E402
from .kubectl import KUBECTL_CONTAINERS # noqa: E402
from .mariadb import MARIADB_CLIENT_CONTAINERS # noqa: E402
from .mariadb import MARIADB_CONTAINERS # noqa: E402
from .node import NODE_CONTAINERS # noqa: E402
Expand Down Expand Up @@ -1526,6 +1527,7 @@ def generate_disk_size_constraints(size_gb: int) -> str:
*GCC_CONTAINERS,
*SPACK_CONTAINERS,
*KEA_DHCP_CONTAINERS,
*KUBECTL_CONTAINERS,
)
}

Expand Down
60 changes: 60 additions & 0 deletions src/bci_build/package/kubectl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
"""Kubectl BCI container"""

from bci_build.container_attributes import SupportLevel
from bci_build.os_version import CAN_BE_LATEST_OS_VERSION
from bci_build.os_version import OsVersion
from bci_build.package import ApplicationStackContainer
from bci_build.package import ParseVersion
from bci_build.package import Replacement
from bci_build.package.helpers import generate_from_image_tag
from bci_build.package.versions import format_version

KUBECTL_CONTAINERS = []

KUBECTL_CONTAINERS = [
ApplicationStackContainer(
name="kubectl",
pretty_name="kubectl",
custom_description="Kubernetes CLI for communicating with a Kubernetes cluster's control plane, using the Kubernetes API.",
os_version=os_version,
is_latest=os_version in CAN_BE_LATEST_OS_VERSION,
version="%%kubectl_version%%",
from_target_image=generate_from_image_tag(os_version, "bci-micro"),
tag_version=ver,
version_in_uid=False,
additional_versions=[format_version(ver, ParseVersion.MAJOR)],
replacements_via_service=[
Replacement(
regex_in_build_description="%%kubectl_version%%",
package_name=f"kubernetes{ver}-client",
parse_version=ParseVersion.PATCH,
)
],
package_list=[f"kubernetes{ver}-client"],
entrypoint=["kubectl"],
license="Apache-2.0",
support_level=SupportLevel.L3,
logo_url="https://raw.githubusercontent.com/kubernetes/kubernetes/master/logo/logo.png",
_min_release_counter=0,
)
for ver, os_version in (
("1.28", OsVersion.TUMBLEWEED),
("1.29", OsVersion.TUMBLEWEED),
("1.30", OsVersion.TUMBLEWEED),
("1.31", OsVersion.TUMBLEWEED),
("1.18", OsVersion.SP6),
("1.23", OsVersion.SP6),
("1.24", OsVersion.SP6),
("1.25", OsVersion.SP6),
("1.26", OsVersion.SP6),
("1.27", OsVersion.SP6),
("1.28", OsVersion.SP6),
("1.18", OsVersion.SP7),
("1.23", OsVersion.SP7),
("1.24", OsVersion.SP7),
("1.25", OsVersion.SP7),
("1.26", OsVersion.SP7),
("1.27", OsVersion.SP7),
("1.28", OsVersion.SP7),
)
]
24 changes: 24 additions & 0 deletions src/bci_build/package/kubectl/README.md.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# {{ image.pretty_name }} Container Image

{% include 'badges.j2' %}

Kubectl is a command line tool for communicating with a Kubernetes cluster's control plane, using the Kubernetes API.

## How to use this Container Image

To run commands inside the container for the current cluster for which the kubeconfig is available in `/root/.kube.config`:

```ShellSession
podman run --rm --name kubectl\
{{ image.pretty_reference }} get nodes
```

To pass configuration of a remote cluster to the container:

```ShellSession
podman run --rm --name kubectl\
-v /localpath/to/kubeconfig:/root/.kube/config:Z
{{ image.pretty_reference }} get nodes
```

{% include 'licensing_and_eula.j2' %}
8 changes: 4 additions & 4 deletions src/bci_build/package/package_versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"version_format": "minor"
},
"helm": {
"5": "3.13",
"6": "3.13",
"7": "3.13",
"5": "3.16",
"6": "3.16",
"7": "3.16",
"Tumbleweed": "3.16",
"version_format": "minor"
},
Expand Down Expand Up @@ -50,7 +50,7 @@
"5": "9.24.43",
"6": "9.24.43",
"7": "9.24.43",
"Tumbleweed": "10.1.18"
"Tumbleweed": "10.2.3"
},
"spack": {
"6": "0.21.3",
Expand Down

0 comments on commit 1df2fc4

Please sign in to comment.