Skip to content
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

Task/NVPE-10: Create NIM Account controller #289

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2c18ef8
feat: added nim account controller
TomerFi Nov 4, 2024
d7b2d07
test: added tests for the new nim account controller
TomerFi Nov 7, 2024
0158e82
chore: fixed change request, owned resources are deleted by k8s gc
TomerFi Nov 7, 2024
8d7b462
chore: fixed change request, rearrange status conditions reporting
TomerFi Nov 7, 2024
8eab67f
chore: fixed change request, use server side apply where applicable
TomerFi Nov 8, 2024
0ed4967
docs: clarified code docs
TomerFi Nov 8, 2024
7cf4a5b
chore: switched to utility func for gvk fetch
TomerFi Nov 8, 2024
ff4f982
chore: added count to utility script
TomerFi Nov 8, 2024
d250bee
fix: cleanup resources if failed to validate the api key
TomerFi Nov 9, 2024
85c9c8b
test: fixed failing ci test (worked locally)
TomerFi Nov 9, 2024
d93ee30
fix: added pagesize to catalog query
TomerFi Nov 9, 2024
58c0d41
fix: added missing rbac for account status
TomerFi Nov 10, 2024
ad4804e
chore: fixed change request, clarify variable name
TomerFi Nov 11, 2024
84855cd
fix: intial account stauts should be unknown
TomerFi Nov 11, 2024
33a822e
chore: fixed various small change request
TomerFi Nov 12, 2024
b1f2aab
fix: several fixes and requests
TomerFi Nov 12, 2024
c78583b
test: fixed flaky test
TomerFi Nov 12, 2024
eb06f7d
fix: missing finalizer permissions
TomerFi Nov 12, 2024
e11013c
fix: missing create perms for templates
TomerFi Nov 12, 2024
c6d0853
test: made test more reliable
TomerFi Nov 13, 2024
7100903
test: fixed flaky test by increasing timeout
TomerFi Nov 13, 2024
82eefad
fix: wrong type of pull secret
TomerFi Nov 14, 2024
2377baf
test: nim account should be created in seperated namespace per testcases
TomerFi Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/crd/external/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ resources:
- maistra.io_servicemeshmembers.yaml
- telemetry.istio.io_telemetries.yaml
# - route.openshift.io_routes.yaml #minikube
# - template.openshift.io_templates.yaml (used for tests, not required for deployment)
117 changes: 117 additions & 0 deletions config/crd/external/template.openshift.io_templates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
name: templates.template.openshift.io
spec:
conversion:
strategy: None
group: template.openshift.io
names:
kind: Template
listKind: TemplateList
plural: templates
singular: template
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: |-
Template contains the inputs needed to produce a Config.

Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
labels:
additionalProperties:
type: string
description: labels is a optional set of labels that are applied to every
object during the Template to Config transformation.
type: object
message:
description: message is an optional instructional message that will be
displayed when this template is instantiated. This field should inform
the user how to utilize the newly created resources. Parameter substitution
will be performed on the message before being displayed so that generated
credentials and other parameters can be included in the output.
type: string
metadata:
type: object
objects:
description: objects is an array of resources to include in this template.
If a namespace value is hardcoded in the object, it will be removed
during template instantiation, however if the namespace value is, or
contains, a ${PARAMETER_REFERENCE}, the resolved value after parameter
substitution will be respected and the object will be created in that
namespace.
items:
type: object
type: array
parameters:
description: parameters is an optional array of Parameters used during
the Template to Config transformation.
items:
description: Parameter defines a name/value variable that is to be processed
during the Template to Config transformation.
properties:
description:
description: Description of a parameter. Optional.
type: string
displayName:
description: 'Optional: The name that will show in UI instead of
parameter ''Name'''
type: string
from:
description: From is an input value for the generator. Optional.
type: string
generate:
description: |-
generate specifies the generator to be used to generate random string from an input value specified by From field. The result string is stored into Value field. If empty, no generator is being used, leaving the result Value untouched. Optional.

The only supported generator is "expression", which accepts a "from" value in the form of a simple regular expression containing the range expression "[a-zA-Z0-9]", and the length expression "a{length}".

Examples:

from | value ----------------------------- "test[0-9]{1}x" | "test7x" "[0-1]{8}" | "01001100" "0x[A-F0-9]{4}" | "0xB3AF" "[a-zA-Z0-9]{8}" | "hW4yQU5i"
type: string
name:
description: Name must be set and it can be referenced in Template
Items using ${PARAMETER_NAME}. Required.
type: string
required:
description: 'Optional: Indicates the parameter must have a value. Defaults
to false.'
type: boolean
value:
description: Value holds the Parameter data. If specified, the generator
will be ignored. The value replaces all occurrences of the Parameter
${Name} expression during the Template to Config transformation.
Optional.
type: string
required:
- name
type: object
type: array
required:
- objects
type: object
served: true
storage: true
subresources: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: null
storedVersions:
- v1
35 changes: 35 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,30 @@ rules:
- patch
- update
- watch
- apiGroups:
- nim.opendatahub.io
resources:
- accounts
verbs:
- get
- list
- update
- watch
- apiGroups:
- nim.opendatahub.io
resources:
- accounts/finalizers
verbs:
- update
- apiGroups:
- nim.opendatahub.io
resources:
- accounts/status
verbs:
- get
- list
- update
- watch
- apiGroups:
- rbac.authorization.k8s.io
resources:
Expand Down Expand Up @@ -278,3 +302,14 @@ rules:
- patch
- update
- watch
- apiGroups:
- template.openshift.io
resources:
- templates
verbs:
- create
- delete
- get
- list
- update
- watch
8 changes: 8 additions & 0 deletions controllers/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,11 @@ const (
const (
NoSuitableRuntimeError = "not found error: no suitable runtime found."
)

// NIM
const (
NimApplyConfigFieldManager = "nim-account-controller"
NimDataConfigMapName = "nvidia-nim-data"
NimRuntimeTemplateName = "nvidia-nim-serving-template"
NimPullSecretName = "nvidia-nim-image-pull"
TomerFi marked this conversation as resolved.
Show resolved Hide resolved
)
Loading