-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a2d576c
Add hint
sjmiller609 5f761e8
[COR-155] 'coredb install' to install operator
sjmiller609 7d398b6
Try adding target
sjmiller609 a29158e
Set platform for local building
sjmiller609 d8e07be
full path
sjmiller609 1d9a431
Add workflow name
sjmiller609 7811207
Fix tag
sjmiller609 4781a06
Add comment
sjmiller609 d4cb887
Fix caps
sjmiller609 f88eb50
Remove testing configuration
sjmiller609 80be0eb
Add services permission
sjmiller609 4acb156
Fix
sjmiller609 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: CoreDB operator image build and upload | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'coredb-operator/**' | ||
|
||
jobs: | ||
# TODO: replace with push to CoreDB Quay, and versioned pushes. | ||
# This is to enable demo 'coredb install' on the CLI. | ||
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: sjmiller609/coredb-operator:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
target/** | ||
target | ||
Dockerfile | ||
.dockerignore | ||
.git | ||
.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,21 @@ | ||
FROM gcr.io/distroless/static:nonroot | ||
COPY --chown=nonroot:nonroot ./controller /app/ | ||
# This does not build on M1 | ||
|
||
FROM --platform=linux/amd64 clux/muslrust:stable AS builder | ||
|
||
WORKDIR /build | ||
|
||
COPY . . | ||
|
||
RUN cargo build --release --target=x86_64-unknown-linux-musl | ||
|
||
FROM --platform=linux/amd64 alpine:latest | ||
|
||
RUN adduser -D nonroot | ||
|
||
COPY --chown=nonroot:nonroot --from=builder /build/target/x86_64-unknown-linux-musl/release/controller /app/controller | ||
COPY --chown=nonroot:nonroot --from=builder /build/target/x86_64-unknown-linux-musl/release/crdgen /app/crdgen | ||
|
||
USER nonroot | ||
|
||
EXPOSE 8080 | ||
ENTRYPOINT ["/app/controller"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,9 @@ rules: | |
- apiGroups: ["apps"] | ||
resources: ["statefulsets"] | ||
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
||
- apiGroups: [""] | ||
resources: ["services"] | ||
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
--- | ||
# Binding the role to the account in default | ||
kind: ClusterRoleBinding | ||
|
@@ -86,7 +88,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: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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