Skip to content

Commit

Permalink
feat: ensure rbac permission and add some secret
Browse files Browse the repository at this point in the history
Signed-off-by: YouXam <[email protected]>
  • Loading branch information
YouXam committed Jul 13, 2024
1 parent da70be0 commit b37a71c
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 6 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified

.PHONY: deploy
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -

.PHONY: undeploy
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/aimodel_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type AIModelSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Type of the AIModel, could be "local" or "remote"
// The Type of the AIModel could be "local" or "remote"
Type string `json:"type"`

// Model is the name of the model
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/model.youxam.com_aimodels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ spec:
format: int32
type: integer
type:
description: Type of the AIModel, could be "local" or "remote"
description: The Type of the AIModel could be "local" or "remote"
type: string
required:
- image
Expand Down
5 changes: 5 additions & 0 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ images:
- name: controller
newName: youxam/uplion-aimodel-operator
newTag: latest
secretGenerator:
- literals:
- PULSAR_ADMIN_URL="http://pulsar-local-broker.pulsar.svc.cluster.local:8080"
- PULSAR_URL="pulsar://pulsar-local-broker.pulsar.svc.cluster.local:6650"
name: manager-secret
5 changes: 3 additions & 2 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ spec:
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
# TODO(user): Configure the resources accordingly based on the project requirements.
# More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
envFrom:
- secretRef:
name: manager-secret
resources:
limits:
cpu: 500m
Expand Down
12 changes: 12 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ rules:
- patch
- update
- watch
- apiGroups:
- keda.sh
resources:
- scaledobjects
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- model.youxam.com
resources:
Expand Down
1 change: 1 addition & 0 deletions internal/controller/aimodel_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ type AIModelReconciler struct {
//+kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=rolebindings,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=core,resources=events,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=core,resources=pods,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=keda.sh,resources=scaledobjects,verbs=get;list;watch;create;update;patch;delete

// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
Expand Down
3 changes: 2 additions & 1 deletion worker/demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ metadata:
spec:
type: local
model: TinyLlama-1.1B
replicas: 4
msgBacklogThreshold: 2
replicas: 3
image: youxam/uplion-aimodel-operator-test-worker:latest
---
# Service
Expand Down

0 comments on commit b37a71c

Please sign in to comment.