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

policy: Detect when a server's protocol changes #6856

Merged
merged 1 commit into from Sep 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion policy-controller/k8s/index/src/server.rs
Expand Up @@ -178,6 +178,7 @@ impl SrvIndex {

/// Update the index with a server instance.
fn apply(&mut self, srv: policy::Server, ns_authzs: &AuthzIndex) {
trace!(?srv, "Applying server");
olix0r marked this conversation as resolved.
Show resolved Hide resolved
let srv_name = srv.name();
let port = srv.spec.port;
let protocol = Self::mk_protocol(srv.spec.proxy_protocol.as_ref());
Expand Down Expand Up @@ -209,6 +210,8 @@ impl SrvIndex {
}

HashEntry::Occupied(mut entry) => {
trace!(srv = ?entry.get(), "Updating existing server");

// If something about the server changed, we need to update the config to reflect
// the change.
let new_labels = if entry.get().labels != srv.metadata.labels {
Expand All @@ -217,7 +220,7 @@ impl SrvIndex {
None
};

let new_protocol = if entry.get().protocol == protocol {
let new_protocol = if entry.get().protocol != protocol {
Some(protocol)
} else {
None
Expand Down