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

Cluster Validation using Canonical K8s #35

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

addyess
Copy link
Member

@addyess addyess commented Dec 9, 2024

Overview

  • relate over the kube-control relation upgraded to v2 schema in order to communicate with the k8s control-plane

Details

  • minor CI updates
  • docs updates
  • adjustments to use kube-control v2 relation schema

Comment on lines +114 to +116
if self.kube_control.get_ca_certificate():
logger.info("CA Certificate is available from kube-control.")
return True
Copy link
Member

Choose a reason for hiding this comment

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

If we get a CA certificate from the kube-control relation, we don’t need to write the CA cert from the TLS relation, right? However, I notice we are using CA_CERT_PATH to create the kubeconfig (L112,L115). Am I missing something here? Could you clarify if I’m misunderstanding this?

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 hope I can. The CA cert CAN come from kube-control over the v2 schema. In v1 schema the CA cert won't be there. So, to maintain backwards API here the caller must provide a path where the CA certs will be if they aren't in the relation data.

Realistically:
kubernetes-control-plane doesn't provide the CA cert
k8s does provide the CA cert

when the ca cert is in the relation, this path CA_CERT_PATH is ignored.

Copy link
Member Author

Choose a reason for hiding this comment

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

details from the library:

    def create_kubeconfig(
        self, ca: PathLike, kubeconfig: PathLike, user: str, k8s_user: str
    ):
        ... Skipped ...
        if ca_content := self.get_ca_certificate():
            ca_b64 = base64.b64encode(ca_content).decode("utf-8")
        elif Path(ca).exists():
            ca_b64 = base64.b64encode(Path(ca).read_bytes()).decode("utf-8")
        else:
            log.error("No CA certificate found")
            raise FileNotFoundError("No CA certificate found")

@addyess
Copy link
Member Author

addyess commented Dec 11, 2024

@mateoflorido @HomayoonAlimohammadi anything else here?

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

Successfully merging this pull request may close these issues.

3 participants