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
[importer] Run in cluster #1882
Changes from 2 commits
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,28 @@ | ||
ARG BUILDER_IMAGE | ||
ARG BASE_IMAGE | ||
# Build the manager binary | ||
FROM --platform=${BUILDPLATFORM} ${BUILDER_IMAGE} as builder | ||
|
||
ARG CGO_ENABLED | ||
ARG TARGETARCH | ||
|
||
WORKDIR /workspace | ||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
# cache deps before building and copying source so that we don't need to re-download as much | ||
# and so that source changes don't invalidate our downloaded layer | ||
RUN go mod download | ||
|
||
# Copy the go source | ||
COPY . . | ||
|
||
# Build | ||
RUN make importer-build GO_BUILD_ENV='CGO_ENABLED=${CGO_ENABLED} GOOS=linux GOARCH=${TARGETARCH}' | ||
|
||
FROM --platform=${BUILDPLATFORM} ${BASE_IMAGE} | ||
WORKDIR / | ||
COPY --from=builder /workspace/bin/importer . | ||
USER 65532:65532 | ||
|
||
ENTRYPOINT ["/importer"] |
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. nit: Is this autogenerated? If not, could it be using kubebuilder tags? 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. I guess we could do it .... but it might be overkill. my initial intent was to just use the kueue-controller-manager's SA. 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. could we just reference that or use a 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. maybe yes but it will be too hacky. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
|
||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: kueue-importer | ||
rules: | ||
- verbs: | ||
- get | ||
- list | ||
- patch | ||
- update | ||
apiGroups: | ||
- '' | ||
resources: | ||
- pods | ||
- verbs: | ||
- get | ||
apiGroups: | ||
- '' | ||
resources: | ||
- pods/status | ||
- verbs: | ||
- get | ||
- list | ||
apiGroups: | ||
- kueue.x-k8s.io | ||
resources: | ||
- clusterqueues | ||
- verbs: | ||
- get | ||
apiGroups: | ||
- kueue.x-k8s.io | ||
resources: | ||
- clusterqueues/status | ||
- verbs: | ||
- get | ||
- list | ||
apiGroups: | ||
- kueue.x-k8s.io | ||
resources: | ||
- localqueues | ||
- verbs: | ||
- get | ||
apiGroups: | ||
- kueue.x-k8s.io | ||
resources: | ||
- localqueues/status | ||
- verbs: | ||
- get | ||
- list | ||
apiGroups: | ||
- kueue.x-k8s.io | ||
resources: | ||
- resourceflavors | ||
- verbs: | ||
- create | ||
- get | ||
- list | ||
- patch | ||
- update | ||
apiGroups: | ||
- kueue.x-k8s.io | ||
resources: | ||
- workloads | ||
- verbs: | ||
- update | ||
apiGroups: | ||
- kueue.x-k8s.io | ||
resources: | ||
- workloads/finalizers | ||
- verbs: | ||
- get | ||
- patch | ||
- update | ||
apiGroups: | ||
- kueue.x-k8s.io | ||
resources: | ||
- workloads/status | ||
- verbs: | ||
- get | ||
- list | ||
apiGroups: | ||
- scheduling.k8s.io | ||
resources: | ||
- priorityclasses | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: kueue-importer | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: kueue-importer | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: kueue-importer | ||
subjects: | ||
- kind: ServiceAccount | ||
name: kueue-importer | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: kueue-importer |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
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. Use a kubernetes Job instead, because it provides retries 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. The pod will most likely fail due to a bad mapping, I don't see a value in retrying it. |
||
metadata: | ||
name: kueue-importer | ||
spec: | ||
containers: | ||
- name: importer | ||
image: importer | ||
imagePullPolicy: IfNotPresent | ||
args: | ||
- import | ||
- -n=ns1,ns2 | ||
- --queuemapping-file=/mapping.yaml | ||
- --dry-run=false | ||
- -v | ||
trasc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
volumeMounts: | ||
- name: config | ||
mountPath: /mapping.yaml | ||
subPath: mapping.yaml | ||
restartPolicy: Never | ||
volumes: | ||
- name: config | ||
configMap: | ||
name: importer-config | ||
serviceAccountName: kueue-importer |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
resources: | ||
- importer.yaml | ||
- deps.yaml | ||
|
||
generatorOptions: | ||
disableNameSuffixHash: true | ||
|
||
configMapGenerator: | ||
- files: | ||
- mapping.yaml | ||
name: importer-config | ||
|
||
images: | ||
- name: importer | ||
newName: gcr.io/k8s-staging-kueue/importer | ||
|
||
namespace: kueue-importer |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- match: | ||
labels: | ||
src.lbl: src-val | ||
toLocalQueue: user-queue | ||
- skip: true |
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.
As a follow up, can you add this target to the
build
presubmit?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.
we could