Skip to content

Commit

Permalink
fix kubernetes job agent
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Sep 10, 2024
1 parent 8c933d5 commit 5608a87
Show file tree
Hide file tree
Showing 9 changed files with 326 additions and 225 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/providers-kubernetes-job-agent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Providers / Kubernetes Job Agent

on:
pull_request:
branches: ["*"]
paths:
- providers/kubernetes-job-agent/**
- .github/workflows/providers-kubernetes-job-agent.yaml
- pnpm-lock.yaml
push:
branches: ["main"]
paths:
- providers/kubernetes-job-agent/**
- .github/workflows/providers-kubernetes-job-agent.yaml
- pnpm-lock.yaml

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ctrlplane/kubernetes-job-agent
tags: |
type=sha,format=short,prefix=
- name: Build
uses: docker/build-push-action@v6
if: github.ref != 'refs/heads/main'
with:
push: false
file: providers/kubernetes-job-agent/Dockerfile
tags: ${{ steps.meta.outputs.tags }}

- name: Build and Push
uses: docker/build-push-action@v6
if: github.ref == 'refs/heads/main'
with:
push: true
file: providers/kubernetes-job-agent/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
18 changes: 6 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions providers/kubernetes-job-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,22 @@
"@ctrlplane/logger": "workspace:*",
"@ctrlplane/node-sdk": "workspace:*",
"@ctrlplane/validators": "workspace:*",
"@google-cloud/container": "^5.16.0",
"@kubernetes/client-node": "^0.21.0",
"@t3-oss/env-core": "^0.10.1",
"cron": "^3.1.7",
"dotenv": "^16.4.5",
"google-auth-library": "^9.13.0",
"handlebars": "^4.7.8",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"p-retry": "^6.2.0",
"semver": "^7.6.2",
"zod": "catalog:"
},
"devDependencies": {
"@ctrlplane/eslint-config": "workspace:*",
"@ctrlplane/prettier-config": "workspace:*",
"@ctrlplane/tsconfig": "workspace:*",
"@types/js-yaml": "^4.0.9",
"@types/lodash": "^4.17.5",
"@types/semver": "^7.5.8",
"eslint": "catalog:",
"prettier": "catalog:",
"typescript": "^5.4.5"
Expand Down
14 changes: 4 additions & 10 deletions providers/kubernetes-job-agent/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,13 @@ export const env = createEnv({
CTRLPLANE_API_URL: z.string().default("http://localhost:3000"),
CTRLPLANE_API_KEY: z.string(),
CTRLPLANE_WORKSPACE: z.string(),
CTRLPLANE_SCANNER_NAME: z.string().default("offical-google-scanner"),
CTRLPLANE_GKE_TARGET_NAME: z
.string()
.default("gke-{{ projectId }}-{{ cluster.name }}"),
CTRLPLANE_COMPUTE_TARGET_NAME: z
.string()
.default("gc-{{ projectId }}-{{ vm.name }}"),
CTRLPLANE_AGENT_NAME: z.string().default("kubernetes-job-agent"),

KUBE_CONFIG_PATH: z.string().optional(),
KUBE_NAMESPACE: z.string().default("default"),

CRON_ENABLED: z.boolean().default(true),
CRON_TIME: z.string().default("* * * * *"),

GOOGLE_PROJECT_ID: z.string().min(1),
GOOGLE_SCAN_GKE: z.boolean().default(true),
},
runtimeEnv: process.env,

Expand Down
43 changes: 0 additions & 43 deletions providers/kubernetes-job-agent/src/gke-connect.ts

This file was deleted.

121 changes: 0 additions & 121 deletions providers/kubernetes-job-agent/src/gke.ts

This file was deleted.

Loading

0 comments on commit 5608a87

Please sign in to comment.