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

DEPLOY-157 Fix not being able to delete namespaces while a proxied service exists #3

Merged
merged 5 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@ name: Docker build + push

on:
push:
branches:
- "master"
tags:
- "v*.*.*"
paths:
- "crds/**"
- "src/**"
- "Dockerfile"
- "Cargo.*"
- ".github/workflows/docker-image.yml"
pull_request:
branches:
- "master"
paths:
- "crds/**"
- "src/**"
Expand Down Expand Up @@ -42,7 +36,6 @@ jobs:
uses: docker/setup-buildx-action@v2

- name: Login to Docker
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
Expand Down Expand Up @@ -70,8 +63,9 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
17 changes: 13 additions & 4 deletions src/replace_service_reconciler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ async fn generate_port_map(
let proxy_port = resource.spec.ports[0].proxy_port;
debug!("Found proxy port {} for service port {}", proxy_port, service_port);
port_map.insert(service_port, proxy_port);
},
}
_ => return Err(add_warning_and_requeue(resource, resource_api, "ReplacedService has multiple ports, while the service itself only has 1 port defined").await)
}
}
Expand Down Expand Up @@ -881,7 +881,7 @@ async fn change_deployment_scale(
)
.await?;
} else {
info!("deployment {name} is not configured with keda it seems");
info!("deployment {name} is not configured with keda");
if let Some(mut deployment) = api.get_opt(name).await? {
if let Some(ref mut spec) = deployment.spec {
spec.replicas = Some(replicas);
Expand Down Expand Up @@ -923,6 +923,15 @@ async fn change_keda_replicas(
});

let patch = Patch::Merge(&scaled_object_patch);
api.patch(name, &PatchParams::default(), &patch).await?;
Ok(())
match api.patch(name, &PatchParams::default(), &patch).await {
Ok(_) => Ok(()),
Err(kube::Error::Api(api_error)) => {
if api_error.code == 404 {
Ok(())
} else {
Err(api_error.into())
}
zlepper marked this conversation as resolved.
Show resolved Hide resolved
}
Err(e) => Err(e.into())
}
}
Loading