Skip to content

Commit 64b444d

Browse files
committed
DEPLOY-401 Make it possible to fully replace services without checking if a working replacement is actually available
1 parent b126428 commit 64b444d

4 files changed

Lines changed: 29 additions & 3 deletions

File tree

charts/tailscale-outbound-proxy/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ kubeVersion: ">= 1.30.0-0"
99
name: tailscale-outbound-proxy-operator
1010
sources:
1111
- https://github.com/digizuite/tailscale-outbound-proxy
12-
version: 0.0.8
12+
version: 0.0.9
1313
icon: https://github.com/digizuite/tailscale-outbound-proxy/raw/master/tailscale-logo-black.png

charts/tailscale-outbound-proxy/templates/crds.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ spec:
7474
proxyStateSecretName:
7575
description: The secret to use for storing tailscales state. You do not have to create this secret yourself.
7676
type: string
77+
replaceType:
78+
description: How to replace the service.
79+
enum:
80+
- dynamic
81+
- full
82+
nullable: true
83+
type: string
7784
replacedServiceTailscaleImage:
7885
description: A custom image to use for the tailscale proxy
7986
nullable: true

src/replace_service_reconciler.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::finalizers::{ensure_finalizer, remove_finalizer};
2-
use crate::replaced_service::{ReplacedService, ReplacedServiceResourceStatus, TestProtocol};
2+
use crate::replaced_service::{ReplacedService, ReplacedServiceResourceStatus, TestProtocol, ReplaceType};
33
use crate::{ContextData, Error};
44
use anyhow::{anyhow, Result};
55
use k8s_openapi::api::apps::v1::{Deployment, DeploymentSpec, DeploymentStrategy, ReplicaSet};
@@ -604,6 +604,11 @@ async fn test_if_proxy_service_works(
604604
context: Arc<ContextData>,
605605
test_proxy_service_name: &str,
606606
) -> Result<()> {
607+
if resource.spec.replace_type == Some(ReplaceType::Full) {
608+
debug!("Skipping proxy service test for full replace type");
609+
return Ok(());
610+
}
611+
607612
debug!("Testing is proxy service for {test_proxy_service_name} works");
608613
let namespace = resource.namespace().unwrap();
609614

src/replaced_service.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ pub struct ReplacedServiceSpec {
5858
/// A pull secret to use for the custom image. Do note proxies are started in the same
5959
/// namespace as this CRD instance, meaning the pull secret should be in the same
6060
/// namespace as this CRD instance.
61-
pub replaced_service_tailscale_image_pull_secret: Option<String>
61+
pub replaced_service_tailscale_image_pull_secret: Option<String>,
62+
63+
/// How to replace the service.
64+
pub replace_type: Option<ReplaceType>
6265
}
6366

6467
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone, JsonSchema, Default)]
@@ -91,4 +94,15 @@ pub struct ReplacedServiceResourceStatus {
9194

9295
/// If this is actually working yet.
9396
pub active: Option<bool>,
97+
}
98+
99+
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone, JsonSchema, Default)]
100+
#[serde(rename_all = "camelCase")]
101+
pub enum ReplaceType {
102+
/// The service is only replaced if an alternative service is detected that can handle requests.
103+
#[default]
104+
Dynamic,
105+
/// The existing service is completely stopped and replaced with a tailscale proxy.
106+
/// WARNING: This will cause downtime for the service.
107+
Full
94108
}

0 commit comments

Comments
 (0)