Merge branch 'main' into pr-kube-yamls
This commit is contained in:
commit
876b568a54
3 changed files with 26 additions and 6 deletions
21
.forgejo/workflows/build.yaml
Normal file
21
.forgejo/workflows/build.yaml
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: [ nix ]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Nix build
|
||||||
|
run: nix build --extra-experimental-features "flakes nix-command" .#docker-image
|
||||||
|
- name: Setup skopeo
|
||||||
|
run: curl -o /etc/containers/policy.json --create-dirs https://raw.githubusercontent.com/containers/skopeo/refs/heads/main/default-policy.json
|
||||||
|
- name: Push Image
|
||||||
|
run: |
|
||||||
|
skopeo copy --dest-password "$UPLOAD_TOKEN" --dest-username "$USERNAME" "docker-archive://$(realpath result)" "docker://$IMG_URL:${{ github.sha }}" && \
|
||||||
|
skopeo copy --dest-password "$UPLOAD_TOKEN" --dest-username "$USERNAME" "docker-archive://$(realpath result)" "docker://$IMG_URL"
|
||||||
|
env:
|
||||||
|
USERNAME: tamipes
|
||||||
|
UPLOAD_TOKEN: ${{ secrets.UPLOAD_TOKEN }}
|
||||||
|
IMG_URL: git.tami.moe/tamipes/minecraft-ingress
|
||||||
|
|
@ -29,9 +29,8 @@ pub struct KubeCache {
|
||||||
impl KubeCache {
|
impl KubeCache {
|
||||||
/// This initializes the creation of a "kubernetes client"
|
/// This initializes the creation of a "kubernetes client"
|
||||||
/// and if it is not possible returns a None.
|
/// and if it is not possible returns a None.
|
||||||
pub fn create() -> Option<KubeCache> {
|
pub async fn create() -> Option<KubeCache> {
|
||||||
let kubeconfig = kube::config::Kubeconfig::read().unwrap();
|
let client = Client::try_default().await.unwrap();
|
||||||
let client = Client::try_from(kubeconfig).unwrap();
|
|
||||||
|
|
||||||
let deployments: Api<Deployment> = Api::default_namespaced(client.clone());
|
let deployments: Api<Deployment> = Api::default_namespaced(client.clone());
|
||||||
let services: Api<Service> = Api::default_namespaced(client);
|
let services: Api<Service> = Api::default_namespaced(client);
|
||||||
|
|
@ -209,9 +208,9 @@ impl MinecraftAPI<Server> for McApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl McApi {
|
impl McApi {
|
||||||
pub fn create() -> Option<Self> {
|
pub async fn create() -> Option<Self> {
|
||||||
Some(Self {
|
Some(Self {
|
||||||
cache: KubeCache::create()?,
|
cache: KubeCache::create().await?,
|
||||||
map: Arc::new(tokio::sync::Mutex::new(HashMap::new())),
|
map: Arc::new(tokio::sync::Mutex::new(HashMap::new())),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ async fn main() {
|
||||||
let revision: &'static str = env!("COMMIT_HASH");
|
let revision: &'static str = env!("COMMIT_HASH");
|
||||||
tracing::info!(revision);
|
tracing::info!(revision);
|
||||||
|
|
||||||
let api = kube_cache::McApi::create().unwrap();
|
let api = kube_cache::McApi::create().await.unwrap();
|
||||||
tracing::info!("initialized kube api");
|
tracing::info!("initialized kube api");
|
||||||
|
|
||||||
let config: Config = Default::default();
|
let config: Config = Default::default();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue