-
Notifications
You must be signed in to change notification settings - Fork 32
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
[COR-155] 'coredb install' to install operator #57
Changes from 2 commits
a2d576c
5f761e8
7d398b6
a29158e
d8e07be
1d9a431
7811207
4781a06
d4cb887
f88eb50
80be0eb
4acb156
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# TODO: replace with push to CoreDB Quay, and versioned pushes. | ||
# This is to enable demo 'coredb install' on the CLI. | ||
# | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- cli | ||
sjmiller609 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
paths: | ||
- 'coredb-operator/**' | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: sjmiller609 | ||
password: ${{ secrets.STEVEN_DOCKERHUB_PAT }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./coredb-operator | ||
push: true | ||
tags: latest |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use super::SubCommand; | ||
use clap::Args; | ||
use std::process::Command; | ||
|
||
#[derive(Args)] | ||
pub struct InstallCommand {} | ||
|
||
impl SubCommand for InstallCommand { | ||
fn execute(&self) { | ||
let output = Command::new("kubectl") | ||
.arg("apply") | ||
.arg("-f") | ||
.arg("https://raw.githubusercontent.com/CoreDB-io/coredb/main/coredb-operator/yaml/crd.yaml") | ||
.output() | ||
.expect("Failed to execute 'kubectl' command."); | ||
println!("{}", String::from_utf8_lossy(&output.stdout)); | ||
let output = Command::new("kubectl") | ||
.arg("apply") | ||
.arg("-f") | ||
.arg("https://raw.githubusercontent.com/CoreDB-io/coredb/main/coredb-operator/yaml/install.yaml") | ||
.output() | ||
.expect("Failed to execute 'kubectl' command."); | ||
println!("{}", String::from_utf8_lossy(&output.stdout)); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub mod create; | ||
pub mod get; | ||
pub mod install; | ||
use clap::ValueEnum; | ||
|
||
#[derive(ValueEnum, Clone)] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
target/** | ||
target | ||
Dockerfile | ||
.dockerignore | ||
.git | ||
.gitignore |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,17 @@ | ||
FROM gcr.io/distroless/static:nonroot | ||
COPY --chown=nonroot:nonroot ./controller /app/ | ||
FROM clux/muslrust:stable AS builder | ||
|
||
COPY . . | ||
|
||
RUN cargo build --release | ||
|
||
FROM alpine:latest | ||
|
||
RUN adduser -D nonroot | ||
|
||
COPY --chown=nonroot:nonroot --from=builder target/x86_64-unknown-linux-musl/release/controller /app/controller | ||
COPY --chown=nonroot:nonroot --from=builder target/x86_64-unknown-linux-musl/release/crdgen /app/crdgen | ||
|
||
USER nonroot | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although rust compiles to a binary, by default that binary has dependencies in the system like openssl and libc. If we build with MUSL we can avoid that - like clux did in the controller example. |
||
EXPOSE 8080 | ||
ENTRYPOINT ["/app/controller"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,7 @@ spec: | |
serviceAccountName: coredb-controller | ||
containers: | ||
- name: coredb-controller | ||
image: localhost:5001/controller:ac593af6da990c911652c6e35fb777f36498d6dc | ||
image: sjmiller609/coredb-operator:latest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace this with quay when ian is back |
||
imagePullPolicy: Always | ||
resources: | ||
limits: | ||
|
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 part will fail if CRD definition is changed but yaml directory not updated