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

[RFE] collect kubernetes informations for kubeadm installs #3628

Closed
champtar opened this issue Apr 29, 2024 · 2 comments · Fixed by #3630
Closed

[RFE] collect kubernetes informations for kubeadm installs #3628

champtar opened this issue Apr 29, 2024 · 2 comments · Fixed by #3630

Comments

@champtar
Copy link
Contributor

Currently RedHatKubernetes is specific to OpenShift (only older versions ?)
I would like to have it run for classic kubeadm installs on top of RHEL family OS (also Ubuntu as a bonus),
but I don't have access to OpenShift to move the OpenShift bits in openshift.py and to make sure either openshift plugin runs or kubernetes plugin runs, but not both (a bit of a waste to collect kubelet logs twice)

To collect kubeadm installs we would need

files = (
    "/etc/kubernetes/admin.conf",
)
services = (
    "kubelet",
)

Would something like

def check_enabled(self):
    return not self.path_exists('/etc/origin/') and super().check_enabled()

be ok ?

@TurboTurtle
Copy link
Member

Currently RedHatKubernetes is specific to OpenShift (only older versions ?)

It isn't - that's what the openshift plugin is for. The kubernetes plugin is for community k8s, regardless of the distro. I believe, however, that the RH bits in that plugin were last updated back in the days of RHEL Atomic Host, when RH still supported "base" kubernetes installs, and we needed to account for both setups. When the focus from RH turned entirely to Openshift (and RHEL Atomic Host was discontinued), the openshift plugin was updated to allow the sos project to serve both use cases without having to juggle a bunch of conflicting logic and configuration setups in a single plugin. The lingering OCP bits in the kubernetes plugin would only be relevant for extremely old versions of OCP, but wouldn't affect installs of community k8s.

I would like to have it run for classic kubeadm installs on top of RHEL family OS (also Ubuntu as a bonus), but I don't have access to OpenShift to move the OpenShift bits in openshift.py and to make sure either openshift plugin runs or kubernetes plugin runs, but not both (a bit of a waste to collect kubelet logs twice)

The plugins shouldn't be both activating at once today anyway. They have different enablement triggers, e.g.:

class RedHatKubernetes(Kubernetes, RedHatPlugin):

    # OpenShift Container Platform uses the atomic-openshift-master package
    # to provide kubernetes
    packages = ('kubernetes', 'kubernetes-master', 'atomic-openshift-master')

    files = (
        '/etc/origin/master/admin.kubeconfig',
        '/etc/origin/node/pods/master-config.yaml',
    )

vs.

class Openshift(Plugin, RedHatPlugin):
[...]
    plugin_name = "openshift"
    plugin_timeout = 900
    profiles = ('openshift',)
    packages = ('openshift-hyperkube',)

The note in the kubernetes plugin is from a long-ago version, but at present , AFAIK, OCP doesn't install the kuberentes package at all. If this is not the case, then we simply need to override check_enabled() in the kubernetes plugin to avoid enabling is the openshift-hyperkube plugin is installed.

@champtar
Copy link
Contributor Author

Currently RedHatKubernetes is specific to OpenShift (only older versions ?)

It isn't

  • Fedora has a kubernetes packages, but the upstream repo pkgs.k8s.io doesn't, and some projects like kubespray just install the binaries + unit files without using packages at all.
  • check_is_master() look at self.files, which currently is openshift specific for RedHatKubernetes.
  • finally, RedHatKubernetes unconditionally adds openshift specific ressources

I'll put together a draft PR shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants