Skip to content

Commit 65d9ce4

Browse files
adleonghawkw
andauthored
Split repo into workspace (#95)
We convert this project into a Rust workspace and move the failover controller into a member. This is to prepare for adding the CLI as a separate member from the controller. Co-authored-by: Eliza Weisman <[email protected]>
1 parent 3966837 commit 65d9ce4

File tree

10 files changed

+66
-62
lines changed

10 files changed

+66
-62
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
701701
checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
702702

703703
[[package]]
704-
name = "linkerd-failover"
704+
name = "linkerd-failover-controller"
705705
version = "0.1.0"
706706
dependencies = [
707707
"anyhow",
@@ -1094,9 +1094,9 @@ dependencies = [
10941094

10951095
[[package]]
10961096
name = "regex"
1097-
version = "1.5.4"
1097+
version = "1.5.5"
10981098
source = "registry+https://github.com/rust-lang/crates.io-index"
1099-
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
1099+
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
11001100
dependencies = [
11011101
"regex-syntax",
11021102
]

Cargo.toml

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,4 @@
1-
[package]
2-
name = "linkerd-failover"
3-
version = "0.1.0"
4-
authors = ["Linkerd authors <[email protected]>"]
5-
edition = "2018"
6-
license = "Apache-2.0"
7-
8-
[dependencies]
9-
anyhow = "1"
10-
clap = { version = "3", default-features = false, features = ["derive", "env", "std"] }
11-
futures = "0.3"
12-
k8s-openapi = { version = "0.14", default-features = false, features = ["v1_20"] }
13-
schemars = "0.8"
14-
serde = { version = "1", features = ["derive"] }
15-
serde_json = "1"
16-
tokio-stream = "0.1"
17-
tracing = "0.1"
18-
19-
[dependencies.kube]
20-
version = "0.69.1"
21-
default-features = false
22-
features = [
23-
"client",
24-
"derive",
25-
"native-tls",
26-
"runtime",
1+
[workspace]
2+
members = [
3+
"controller",
274
]
28-
29-
[dependencies.kubert]
30-
version = "0.3.3"
31-
default-features = false
32-
features = [
33-
"clap",
34-
"runtime",
35-
]
36-
37-
[dependencies.tokio]
38-
version = "1"
39-
features = ["macros", "parking_lot", "rt", "rt-multi-thread"]
40-
41-
[dev-dependencies]
42-
tokio-stream = "0.1"
43-
tokio-test = "0.4"
44-
tracing-subscriber = "0.3"

amd64.dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ FROM $RUST_IMAGE as build
77
ARG TARGETARCH
88
WORKDIR /build
99
COPY Cargo.toml Cargo.lock .
10-
COPY src /build/src
10+
COPY controller /build/
1111
RUN --mount=type=cache,target=target \
1212
--mount=type=cache,from=rust:1.59.0,source=/usr/local/cargo,target=/usr/local/cargo \
1313
cargo fetch --locked
1414
RUN --mount=type=cache,target=target \
1515
--mount=type=cache,from=rust:1.59.0,source=/usr/local/cargo,target=/usr/local/cargo \
16-
cargo build --frozen --target=x86_64-unknown-linux-gnu --release --package=linkerd-failover && \
17-
mv target/x86_64-unknown-linux-gnu/release/linkerd-failover /tmp/
16+
cargo build --frozen --target=x86_64-unknown-linux-gnu --release --package=linkerd-failover-controller && \
17+
mv target/x86_64-unknown-linux-gnu/release/linkerd-failover-controller /tmp/
1818

1919
# Creates a minimal runtime image with the operator binary.
2020
FROM $RUNTIME_IMAGE
21-
COPY --from=build /tmp/linkerd-failover /bin/
22-
ENTRYPOINT ["/bin/linkerd-failover"]
21+
COPY --from=build /tmp/linkerd-failover-controller /bin/
22+
ENTRYPOINT ["/bin/linkerd-failover-controller"]

arm.dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ RUN apt-get update && \
1111
ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
1212
WORKDIR /build
1313
COPY Cargo.toml Cargo.lock .
14-
COPY src /build/src
14+
COPY controller /build/
1515
RUN --mount=type=cache,target=target \
1616
--mount=type=cache,from=rust:1.59.0,source=/usr/local/cargo,target=/usr/local/cargo \
1717
cargo fetch --locked
1818
# XXX(ver) we can't easily cross-compile against openssl, so use rustls on arm.
1919
RUN --mount=type=cache,target=target \
2020
--mount=type=cache,from=rust:1.59.0,source=/usr/local/cargo,target=/usr/local/cargo \
2121
cargo build --frozen --release --target=armv7-unknown-linux-gnueabihf \
22-
--package=linkerd-failover --no-default-features --features="rustls" && \
23-
mv target/armv7-unknown-linux-gnueabihf/release/linkerd-failover /tmp/
22+
--package=linkerd-failover-controller --no-default-features --features="rustls" && \
23+
mv target/armv7-unknown-linux-gnueabihf/release/linkerd-failover-controller /tmp/
2424

2525
# Creates a minimal runtime image with the operator binary.
2626
FROM --platform=linux/arm $RUNTIME_IMAGE
27-
COPY --from=build /tmp/linkerd-failover /bin/
28-
ENTRYPOINT ["/bin/linkerd-failover"]
27+
COPY --from=build /tmp/linkerd-failover-controller /bin/
28+
ENTRYPOINT ["/bin/linkerd-failover-controller"]

arm64.dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ RUN apt-get update && \
1111
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
1212
WORKDIR /build
1313
COPY Cargo.toml Cargo.lock .
14-
COPY src /build/src
14+
COPY controller /build/
1515
RUN --mount=type=cache,target=target \
1616
--mount=type=cache,from=rust:1.59.0,source=/usr/local/cargo,target=/usr/local/cargo \
1717
cargo fetch --locked
1818
# XXX(ver) we can't easily cross-compile against openssl, so use rustls on arm.
1919
RUN --mount=type=cache,target=target \
2020
--mount=type=cache,from=rust:1.59.0,source=/usr/local/cargo,target=/usr/local/cargo \
2121
cargo build --frozen --release --target=aarch64-unknown-linux-gnu \
22-
--package=linkerd-failover --no-default-features --features="rustls-tls" && \
23-
mv target/aarch64-unknown-linux-gnu/release/linkerd-failover /tmp/
22+
--package=linkerd-failover-controller --no-default-features --features="rustls-tls" && \
23+
mv target/aarch64-unknown-linux-gnu/release/linkerd-failover-controller /tmp/
2424

2525
# Creates a minimal runtime image with the operator binary.
2626
FROM --platform=linux/arm64 $RUNTIME_IMAGE
27-
COPY --from=build /tmp/linkerd-failover /bin/
28-
ENTRYPOINT ["/bin/linkerd-failover"]
27+
COPY --from=build /tmp/linkerd-failover-controller /bin/
28+
ENTRYPOINT ["/bin/linkerd-failover-controller"]

controller/Cargo.toml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[package]
2+
name = "linkerd-failover-controller"
3+
version = "0.1.0"
4+
authors = ["Linkerd Authors <[email protected]>"]
5+
edition = "2018"
6+
license = "Apache-2.0"
7+
8+
[dependencies]
9+
anyhow = "1"
10+
clap = { version = "3", default-features = false, features = ["derive", "env", "std"] }
11+
futures = "0.3"
12+
k8s-openapi = { version = "0.14", default-features = false, features = ["v1_20"] }
13+
schemars = "0.8"
14+
serde = { version = "1", features = ["derive"] }
15+
serde_json = "1"
16+
tokio-stream = "0.1"
17+
tracing = "0.1"
18+
19+
[dependencies.kube]
20+
version = "0.69.1"
21+
default-features = false
22+
features = [
23+
"client",
24+
"derive",
25+
"native-tls",
26+
"runtime",
27+
]
28+
29+
[dependencies.kubert]
30+
version = "0.3.3"
31+
default-features = false
32+
features = [
33+
"clap",
34+
"runtime",
35+
]
36+
37+
[dependencies.tokio]
38+
version = "1"
39+
features = ["macros", "parking_lot", "rt", "rt-multi-thread"]
40+
41+
[dev-dependencies]
42+
tokio-stream = "0.1"
43+
tokio-test = "0.4"
44+
tracing-subscriber = "0.3"
File renamed without changes.
File renamed without changes.

src/main.rs renamed to controller/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use anyhow::{bail, Result};
55
use clap::Parser;
66
use kube::api::ListParams;
7-
use linkerd_failover::{endpoints, traffic_split, Ctx};
7+
use linkerd_failover_controller::{endpoints, traffic_split, Ctx};
88
use tokio::{sync::mpsc, time};
99
use tracing::Instrument;
1010

File renamed without changes.

0 commit comments

Comments
 (0)