Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"codersdk",
"codertemplate",
"codertemplates",
"aibridge",
"coderaiprovider",
"coderaiproviders",
"codertemplatetest",
"codertemplatetests",
"codertemplateversion",
Expand Down
17 changes: 1 addition & 16 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
- 'internal/app/apiserverapp/**'
- 'api/v1alpha1/**'
- 'internal/controller/codertemplatetest*'
- 'internal/controller/coderaiprovider*'
# Shared Coder access that CoderTemplateTest and later pool controllers call.
- 'internal/controller/controlplane_access.go'
- 'internal/controller/coder_access.go'
Expand Down Expand Up @@ -155,22 +156,6 @@ jobs:
exit 1
fi

- name: Verify the dormant CoderAIProvider CRD is not installed
# Remove this step when the CoderAIProvider controller ships (#154).
run: |
# grep exits 1 when nothing matches. Any other status (for example a missing file) fails the step.
status=0
# The third pattern matches the CRD path entry in config/default/kustomization.yaml.
grep -n -E '^[[:space:]]+kind: CoderAIProvider$|coderaiproviders\.coder\.com|coder\.com_coderaiproviders\.yaml' \
dist/install.yaml config/default/kustomization.yaml config/crd/bases/*.yaml || status=$?
if [[ "${status}" -eq 0 ]]; then
echo "assertion failed: the CoderAIProvider CRD must not ship before its controller" >&2
exit 1
elif [[ "${status}" -ne 1 ]]; then
echo "assertion failed: the CoderAIProvider CRD guard could not read the install manifests (grep exit ${status})" >&2
exit 1
fi

- name: Verify the dormant CoderAIGatewayKey CRD is not installed
# Remove this step when the CoderAIGatewayKey controller ships (#156).
run: |
Expand Down
1 change: 1 addition & 0 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace-coder-system.yaml
- ../crd/bases/coder.com_coderaiproviders.yaml
- ../crd/bases/coder.com_codercontrolplanes.yaml
- ../crd/bases/coder.com_coderprovisioners.yaml
- ../crd/bases/coder.com_codertemplatetests.yaml
Expand Down
30 changes: 23 additions & 7 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,33 +85,49 @@ rules:
- coder.com
resources:
- coderaigatewaykeys
- coderaiproviders
- codermcpservers
verbs:
- list
- apiGroups:
- coder.com
resources:
- codercontrolplanes
- coderprovisioners
- coderworkspaceproxies
- coderaiproviders
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- coder.com
resources:
- coderaiproviders/finalizers
- codercontrolplanes/finalizers
- coderprovisioners/finalizers
- codertemplatetests/finalizers
- coderworkspaceproxies/finalizers
verbs:
- update
- apiGroups:
- coder.com
resources:
- coderaiproviders/status
verbs:
- get
- update
- apiGroups:
- coder.com
resources:
- codercontrolplanes
- coderprovisioners
- coderworkspaceproxies
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- coder.com
resources:
Expand Down
25 changes: 25 additions & 0 deletions config/samples/coder_v1alpha1_coderaiprovider.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Manages one AI provider in Coder. The object name is the Coder provider
# name. See docs/how-to/manage-ai-providers.md.
#
# Prerequisites:
# - CoderControlPlane codercontrolplane-sample with status.operatorAccessReady
# true.
# - Secret openai-api-key in the same namespace, with the label
# coder.com/credential=true and the annotation
# coder.com/credential-destinations=https://api.openai.com.
apiVersion: coder.com/v1alpha1
kind: CoderAIProvider
metadata:
name: openai
namespace: coder
spec:
controlPlaneRef:
name: codercontrolplane-sample
# Immutable: Coder cannot change the type after create.
type: openai
baseURL: https://api.openai.com/v1
displayName: OpenAI
enabled: true
apiKeySecretRef:
name: openai-api-key
key: api-key
Loading
Loading