feat/static-pod-initialization (#125)#142
feat/static-pod-initialization (#125)#142GGh41th wants to merge 1 commit intokubernetes-sigs:mainfrom
Conversation
|
|
✅ Deploy Preview for node-readiness-controller ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: GGh41th The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @GGh41th. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Seems like my local git config is messed , I'll fix it. |
8b44391 to
e0463ce
Compare
|
@ajaysundark I didn't go with the StaticPodsSynced condition name because NPD sets the status to False when the script is successful (0 exit code) , so i felt that i should go with a negative polarity condition (StaticPodsMissing,StaticPodsNotSynced,MirrorPodsMissing etc........). |
|
Thanks for the PR, @GGh41th , I'll get to it this week. |
| # Exit code constants | ||
| readonly OK=0 | ||
| readonly NONOK=1 | ||
| readonly UNKOWN=2 |
There was a problem hiding this comment.
| readonly UNKOWN=2 | |
| readonly UNKNOWN=2 |
|
|
||
| ### Standalone Mode | ||
|
|
||
| In this example, and since I have a 1-node Kind cluster, I will go the standalone way. Note that this is the default shipping method in GKE and AKS. |
There was a problem hiding this comment.
| In this example, and since I have a 1-node Kind cluster, I will go the standalone way. Note that this is the default shipping method in GKE and AKS. | |
| In this example, and since we have a 1-node Kind cluster, we will go the standalone way. Note that this is the default shipping method in GKE and AKS. |
|
|
||
| ### Standalone Mode | ||
|
|
||
| In this example, and since I have a 1-node Kind cluster, I will go the standalone way. Note that this is the default shipping method in GKE and AKS. |
There was a problem hiding this comment.
Note that this is the default shipping method in GKE and AKS.
Little confused here, do we know why this is a default method for GKE and AKS and why not Helm? Just out of curiosity
There was a problem hiding this comment.
It's not explicitly stated, but from my understanding they deploy it that way because you'll need to bake whatever dependencies your problem daemons might need into the npd image, which is inconvenient for a program you intend to ship as a default add on. So instead they deploy it as a systemd service and it's up to users to install whatever they need on the node.
If you feel that the comment is unecessary I can remove it.
| if [ ! -f "$YQ_PATH" ]; then | ||
|
|
||
| echo "yq not found at $YQ_PATH, downloading..." | ||
| OS=$(uname -s | tr [:upper:] [:lower:]) |
There was a problem hiding this comment.
this part looks redundant; can we make a common function and pass arguments to get similar behavior
| parse_yaml_manifest() { | ||
|
|
||
| NAME=$($YQ_PATH -r '.metadata.name' $1 | head -1) | ||
| NAMESPACE=$($YQ_PATH -r '.metadata.namespace // "default"' $1 | head -1) |
There was a problem hiding this comment.
| NAMESPACE=$($YQ_PATH -r '.metadata.namespace // "default"' $1 | head -1) | |
| NAMESPACE=$($YQ_PATH -r '.metadata.namespace // "kube-system"' $1 | head -1) |
There was a problem hiding this comment.
Here I'm just parsing the static pods manifests, if a namespace wasn't specified then the pod will be created in the default namespace, that's why m defaulting to that.
| # The yaml file might be a multi-document yaml , but given that kubelet | ||
| # only reads the first document we will skip the rest. | ||
| NAME=$($JQ_PATH -r '.metadata.name' $1) | ||
| NAMESPACE=$($JQ_PATH -r '.metadata.namespace // "default"' $1) |
There was a problem hiding this comment.
| NAMESPACE=$($JQ_PATH -r '.metadata.namespace // "default"' $1) | |
| NAMESPACE=$($JQ_PATH -r '.metadata.namespace // "kube-system"' $1) |
| { | ||
| "type": "StaticPodsMissing", | ||
| "reason": "mirrorpodsfound", | ||
| "message": "all mirros pods were created" |
There was a problem hiding this comment.
| "message": "all mirros pods were created" | |
| "message": "all mirror pods were created" |
| { | ||
| "type": "StaticPodsMissing", | ||
| "reason": "mirrorpodsfound", | ||
| "message": "all mirros pods were created" |
There was a problem hiding this comment.
| "message": "all mirros pods were created" | |
| "message": "all mirror pods were created" |
Priyankasaggu11929
left a comment
There was a problem hiding this comment.
Thanks for the PR @GGh41th.
I have left a few in-line suggestions to make the example a bit more easy to test and consume (more like automating the many manual steps we have right now).
I was trying to test the PR locally, and was playing around with what I suggested in my comments. I've pushed them here (if you want to reference)- Priyankasaggu11929@6f0e788
| helm install --generate-name deliveryhero/node-problem-detector -f values.yaml | ||
| ``` | ||
|
|
||
| > **Note:** For a more robust and reliable version of the shell script, you can check this [standalone binary](https://github.com/GGh41th/NPD-staticpods-syncer). No newline at end of file |
There was a problem hiding this comment.
I suggest that we deploy NPD as a daemonset.
And store - (i) the NPD custom plugin (staticpods-syncer.json) content and (ii) the script with your actual logic for checking static/mirror pods, both inside a configmap maybe.
Right now, I see in the README documentation, you have suggested 2 ways of deploying NPD - IMO, we leave that to the NPD project documentation itself, and we can just include the above 2 "ready-to-use" yaml files in our example (will make it easier for the user)
|
|
||
|
|
||
| # This script will check that all static pods are mirrored in the | ||
| # API server. |
There was a problem hiding this comment.
Similar to what I suggest here - https://github.com/kubernetes-sigs/node-readiness-controller/pull/142/changes#r2912619130, much of the logic of this script can go in the configmap yaml
And whatever extra tools (like from your example - kubectl, yq, jq) we need on top of the NPD container image, let's install them in an init container inside the daemonset.
| settings: | ||
| custom_monitor_definitions: | ||
| staticpods-syncer.json: | |
There was a problem hiding this comment.
This looks like repetitive to your changes here - https://github.com/GGh41th/node-readiness-controller/blob/e0463ce0bce4dab8499e48e4f8e65eb9c55f5de2/examples/staticpods-readiness/staticpods-syncer.json
same suggestion - https://github.com/kubernetes-sigs/node-readiness-controller/pull/142/changes#r2912619130
this can go in the configmap yaml
There was a problem hiding this comment.
Thanks for the suggestions, we surely can automate a lot of this stuff, I'll use your commit as a reference.
|
/ok-to-test |
|
Thanks for the comments everyone, I will try to make the changes as soon as I can. |
Integrate with npd using a custom problem daemon to ensure that static pods are mirrored before scheduling on the node.
e0463ce to
02900fb
Compare
|
cc @Priyankasaggu11929, I tried to automate the process a bit, I wanted to use NPD's helm chart for that, but since I couldn't override the initContainers via the Values.yaml I followed your suggestion. |
Description
Integrate with npd using a custom problem daemon to ensure that static pods are mirrored before scheduling on the node.
Related Issue
Fixes #125
Type of Change
/kind feature
Testing
Checklist
make testpassesmake lintpassesDoes this PR introduce a user-facing change?
Doc #(issue)