-
Notifications
You must be signed in to change notification settings - Fork 21
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
fix: add generated target for all node IPs #1119
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
docs/reference/configuration/custom-resources/exemptions-v1alpha1-cr.md
Outdated
Show resolved
Hide resolved
if (isReady) { | ||
const ip = getNodeInternalIP(node); | ||
if (ip) nodeSet.add(ip); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's an edge case we might be missing here where a node has an Update
that results in it being not-ready, but we have it in our set and need to remove it?
Maybe that's unnecessary (and could cause some churn if there's a broken node) but I think if we want to strictly track Ready nodes it might make sense to add?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 I didn't consider that. It might cause churn but I added a delete()
call to the set if the node is not ready. We can adjust it later if needed.
Thinking though, the target is KubeNodes
, and not guaranteed to be ready nodes I suppose? Even if right now we're trying to only include the ready ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, especially in this case of metrics I suppose there could be an argument that a slightly unhealthy node is the exact type of node that you'd want to get metrics from (if they were reachable). Now I'm wondering if we should just ignore health altogether...worst case a pod has an extra egress permission to a node that is unhealthy, or partially unhealthy 🤔
if (UDSConfig.kubeApiCidr) { | ||
message += | ||
", ensure that the KUBEAPI_CIDR override configured for the operator is correct."; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error message addition is irrelevant in the context of the KubeNodes
policies, although it does bring up a potential question around this - we may want to add a manual "override" similar to the UDSConfig.kubeApiCidr
override to allow people to opt out of auto-updates. The usage/explanation of that is documented here. It doesn't require too many code changes to support if we wanted to add it (should be able to copy most of what was done for KubeAPI).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(If we do end up adding this manual config override let's make sure we also add to that same doc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Support for this was added in 15e6235 , I believe
/** | ||
* Copyright 2024 Defense Unicorns | ||
* SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General comment on this added file - would be great to add jest testing around these functions. We encountered a number of issues with the kubeAPI policy and added testing to cover those functions as a result, would be great to do similar here. You should be able to model after what was done for KubeAPI with Jest mocks to avoid any k8s calls, and most of that should be relatively easy to generate as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests were added in 6921d23
Co-authored-by: Micah Nagel <micah.nagel@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
## Description The generated docs were moved, but it seems the script to generate them was not updated to reflect the new location. This PR fixes that. ## Related Issue Relates to #1119 because at the moment it has docs that shouldn't be generated in it. ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Other (security config, docs update, etc) - [ ] ## Checklist before merging - [ ] Test, docs, adr added or updated as needed - [x] [Contributor Guide](https://github.com/defenseunicorns/uds-template-capability/blob/main/CONTRIBUTING.md) followed Signed-off-by: catsby <clint@defenseunicorns.com> Co-authored-by: Micah Nagel <micah.nagel@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
Signed-off-by: catsby <clint@defenseunicorns.com>
* origin/main: chore: allow separate configuration of admin domain name (#1114)
Description
Adds a new generator / target called
KubeNodes
that contains the internal IP addresses of nodes in the cluster.NOTE:
I have no idea (yet) wher theThey appear to be missing ondocs/reference/
file changes came from.main
.Related Issue
Relates to #970 .
Steps to Validate
include steps to verify 970 gets fixed.Type of change
Steps to Validate
Setup and verify behavior of the target
Create a k3d cluster named
uds
(we use names later for adding nodes):Deploy slim-dev:
Create and deploy monitoring layer:
Create and deploy metrics-server layer:
Inspect the network policy for scraping of kube nodes:
The
spec:
part is the relevant part, and should contain the IPs of the nodes:Add a node:
Verify the internal IP of the new node:
kubectl get nodes -o custom-columns="NAME:.metadata.name,INTERNAL-IP:.status.addresses[?(@.type=='InternalIP')].address"
Re-get the netpol to verify the new ip is in the
spec:
block:Should now be something like this:
Verify Prometheus can read things
Connect directly to prometheus:
Visit http://localhost:9090/
Execute this expression to see all node/cpu data:
To see just info from the
extra1
node:Add a new node:
Verify the netpol updates:
Re-execute the Prometheus query from above. It make take a few minutes for
extra2
to show up though. Not sure why.Delete a node and verify the spec updates again:
kubectl delete node k3d-extra1-0 && k3d node delete k3d-extra1-0
Re-reading the netpol should should the removal of that IP
Checklist before merging