Skip to content

Commit

Permalink
rename to litellm
Browse files Browse the repository at this point in the history
  • Loading branch information
ishaan-jaff committed Oct 21, 2024
1 parent 5364e83 commit 0777a16
Show file tree
Hide file tree
Showing 21 changed files with 66 additions and 66 deletions.
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ====================================================================================
# Setup Project
PROJECT_NAME := provider-template
PROJECT_NAME := provider-litellm
PROJECT_REPO := github.com/crossplane/$(PROJECT_NAME)

PLATFORMS ?= linux_amd64 linux_arm64
Expand Down Expand Up @@ -30,7 +30,7 @@ GO111MODULE = on
# ====================================================================================
# Setup Images

IMAGES = provider-template
IMAGES = provider-litellm
-include build/makelib/imagelight.mk

# ====================================================================================
Expand All @@ -40,12 +40,12 @@ XPKG_REG_ORGS ?= xpkg.upbound.io/crossplane
# NOTE(hasheddan): skip promoting on xpkg.upbound.io as channel tags are
# inferred.
XPKG_REG_ORGS_NO_PROMOTE ?= xpkg.upbound.io/crossplane
XPKGS = provider-template
XPKGS = provider-litellm
-include build/makelib/xpkg.mk

# NOTE(hasheddan): we force image building to happen prior to xpkg build so that
# we ensure image is present in daemon.
xpkg.build.provider-template: do.build.images
xpkg.build.provider-litellm: do.build.images

fallthrough: submodules
@echo Initial setup complete. Running make again . . .
Expand Down Expand Up @@ -93,9 +93,9 @@ dev: $(KIND) $(KUBECTL)
@$(KUBECTL) cluster-info --context kind-$(PROJECT_NAME)-dev
@$(INFO) Installing Crossplane CRDs
@$(KUBECTL) apply --server-side -k https://github.com/crossplane/crossplane//cluster?ref=master
@$(INFO) Installing Provider Template CRDs
@$(INFO) Installing Provider Litellm CRDs
@$(KUBECTL) apply -R -f package/crds
@$(INFO) Starting Provider Template controllers
@$(INFO) Starting Provider Litellm controllers
@$(GO) run cmd/provider/main.go --debug

dev-clean: $(KIND) $(KUBECTL)
Expand All @@ -120,7 +120,7 @@ $(GOMPLATE):

export GOMPLATE

# This target prepares repo for your provider by replacing all "template"
# This target prepares repo for your provider by replacing all "litellm"
# occurrences with your provider name.
# This target can only be run once, if you want to rerun for some reason,
# consider stashing/resetting your git state.
Expand Down
24 changes: 12 additions & 12 deletions PROVIDER_CHECKLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ Generally projects are named `provider-<name>`, with `name` being the API being
managed. Example project names are `provider-aws`, `provider-kubernetes`,
and `provider-github`.

The [provider-template](https://github.com/crossplane/provider-template) repository can be
The [provider-litellm](https://github.com/crossplane/provider-litellm) repository can be
used as a starting point for new providers. For [terrajet](https://github.com/crossplane/terrajet)-based providers, the
[provider-jet-template](https://github.com/crossplane-contrib/provider-jet-template) is
[provider-jet-litellm](https://github.com/crossplane-contrib/provider-jet-litellm) is
available.

## Files
Expand All @@ -43,17 +43,17 @@ Most Crossplane providers include the following files:
[provider-gcp/README.md](https://github.com/crossplane/provider-gcp/blob/master/README.md)
as an example)
- [ ] Code is licensed under the [Apache 2.0
License](https://github.com/crossplane/provider-template/blob/main/LICENSE)
License](https://github.com/crossplane/provider-litellm/blob/main/LICENSE)
- [ ] Include a “Developer Certificate of Origin”. Example:
[DCO](https://github.com/upbound/build/blob/master/DCO)
- [ ] Include the CNCF [Code of
Conduct](https://github.com/crossplane/crossplane/blob/master/CODE_OF_CONDUCT.md)
- [ ] Update
[OWNERS.md](https://github.com/crossplane/provider-template/blob/main/OWNERS.md)
[OWNERS.md](https://github.com/crossplane/provider-litellm/blob/main/OWNERS.md)
with contacts for project Owners
- [ ] Ensure `hack/boilerplate.go.txt` (used in Code generation) includes
Crossplane Authors, Apache license and any other Copyright statements:
[https://github.com/crossplane/provider-template/blob/main/hack/boilerplate.go.txt](https://github.com/crossplane/provider-template/blob/main/hack/boilerplate.go.txt)
[https://github.com/crossplane/provider-litellm/blob/main/hack/boilerplate.go.txt](https://github.com/crossplane/provider-litellm/blob/main/hack/boilerplate.go.txt)
- [ ] Include Documentation on how to:
- [ ] Install Provider
- [ ] Contribute to Development
Expand All @@ -68,7 +68,7 @@ There are a number of build tools and processes that are common across the
Crossplane ecosystem. Using these ensures a consistent development environment
across projects.

The [provider-template](https://github.com/crossplane/provider-template)
The [provider-litellm](https://github.com/crossplane/provider-litellm)
repository contains most of these settings.

- [ ] Use the [Upbound build](https://github.com/upbound/build) submodule. (see
Expand All @@ -81,7 +81,7 @@ repository contains most of these settings.
- [ ] Create a [Crossplane
Package](https://crossplane.io/docs/master/concepts/packages.html)
configuration (see
[package/crossplane.yaml)](https://github.com/crossplane/provider-template/blob/main/package/crossplane.yaml)
[package/crossplane.yaml)](https://github.com/crossplane/provider-litellm/blob/main/package/crossplane.yaml)

## Deployment of Artifacts

Expand All @@ -96,7 +96,7 @@ the publish and promotion workflows.
In general, providers should:

- [ ] Utilize GitHub workflows from
<https://github.com/crossplane/provider-template/tree/main/.github/workflows>
<https://github.com/crossplane/provider-litellm/tree/main/.github/workflows>
- [ ] Create OCI image repos to push Package and Controller images.
- [ ] Automatically push Provider images and packages via CI
- [ ] Add GitHub Secrets to push to Docker repository. (To be performed by
Expand All @@ -112,7 +112,7 @@ to grant your project access to the GitHub org scoped secrets.

- [ ] Follow recommendations at
[https://github.com/crossplane/crossplane/blob/master/GOVERNANCE.md#repository-governance](https://github.com/crossplane/crossplane/blob/master/GOVERNANCE.md#repository-governance)
- [ ] Enable Issues on your project and configure Issue templates (examples at:
[.github/ISSUE_TEMPLATE](https://github.com/crossplane/provider-template/tree/master/.github/ISSUE_TEMPLATE))
- [ ] Create Pull Request Templates: (example:
[PULL_REQUEST_TEMPLATE.md](https://github.com/crossplane/provider-template/blob/master/.github/PULL_REQUEST_TEMPLATE.md))
- [ ] Enable Issues on your project and configure Issue litellms (examples at:
[.github/ISSUE_TEMPLATE](https://github.com/crossplane/provider-litellm/tree/master/.github/ISSUE_TEMPLATE))
- [ ] Create Pull Request Litellms: (example:
[PULL_REQUEST_TEMPLATE.md](https://github.com/crossplane/provider-litellm/blob/master/.github/PULL_REQUEST_TEMPLATE.md))
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# provider-template
# provider-litellm

`provider-template` is a minimal [Crossplane](https://crossplane.io/) Provider
that is meant to be used as a template for implementing new Providers. It comes
`provider-litellm` is a minimal [Crossplane](https://crossplane.io/) Provider
that is meant to be used as a litellm for implementing new Providers. It comes
with the following features that are meant to be refactored:

- A `ProviderConfig` type that only points to a credentials `Secret`.
Expand All @@ -11,7 +11,7 @@ with the following features that are meant to be refactored:

## Developing

1. Use this repository as a template to create a new one.
1. Use this repository as a litellm to create a new one.
1. Run `make submodules` to initialize the "build" Make submodule we use for CI/CD.
1. Rename the provider by running the following command:
```shell
Expand Down
8 changes: 4 additions & 4 deletions apis/litellm.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Package apis contains Kubernetes API for the Template provider.
// Package apis contains Kubernetes API for the Litellm provider.
package apis

import (
"k8s.io/apimachinery/pkg/runtime"

samplev1alpha1 "github.com/crossplane/provider-template/apis/sample/v1alpha1"
templatev1alpha1 "github.com/crossplane/provider-template/apis/v1alpha1"
samplev1alpha1 "github.com/crossplane/provider-litellm/apis/sample/v1alpha1"
litellmv1alpha1 "github.com/crossplane/provider-litellm/apis/v1alpha1"
)

func init() {
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
AddToSchemes = append(AddToSchemes,
templatev1alpha1.SchemeBuilder.AddToScheme,
litellmv1alpha1.SchemeBuilder.AddToScheme,
samplev1alpha1.SchemeBuilder.AddToScheme,
)
}
Expand Down
6 changes: 3 additions & 3 deletions apis/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Package v1alpha1 contains the core resources of the Template provider.
// Package v1alpha1 contains the core resources of the Litellm provider.
// +kubebuilder:object:generate=true
// +groupName=template.crossplane.io
// +groupName=litellm.crossplane.io
// +versionName=v1alpha1
package v1alpha1

Expand All @@ -27,7 +27,7 @@ import (

// Package type metadata.
const (
Group = "template.crossplane.io"
Group = "litellm.crossplane.io"
Version = "v1alpha1"
)

Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha1/providerconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type ProviderConfigStatus struct {

// +kubebuilder:object:root=true

// A ProviderConfig configures a Template provider.
// A ProviderConfig configures a Litellm provider.
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:printcolumn:name="SECRET-NAME",type="string",JSONPath=".spec.credentials.secretRef.name",priority=1
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha1/providerconfigusage_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
// +kubebuilder:printcolumn:name="CONFIG-NAME",type="string",JSONPath=".providerConfigRef.name"
// +kubebuilder:printcolumn:name="RESOURCE-KIND",type="string",JSONPath=".resourceRef.kind"
// +kubebuilder:printcolumn:name="RESOURCE-NAME",type="string",JSONPath=".resourceRef.name"
// +kubebuilder:resource:scope=Cluster,categories={crossplane,provider,template}
// +kubebuilder:resource:scope=Cluster,categories={crossplane,provider,litellm}
type ProviderConfigUsage struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions cluster/images/provider-litellm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM gcr.io/distroless/static@sha256:41972110a1c1a5c0b6adb283e8aa092c43c31f7c5d7
ARG TARGETOS
ARG TARGETARCH

ADD bin/$TARGETOS\_$TARGETARCH/provider /usr/local/bin/crossplane-template-provider
ADD bin/$TARGETOS\_$TARGETARCH/provider /usr/local/bin/crossplane-litellm-provider

USER 65532
ENTRYPOINT ["crossplane-template-provider"]
ENTRYPOINT ["crossplane-litellm-provider"]
2 changes: 1 addition & 1 deletion cluster/local/integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ echo_error(){


# The name of your provider. Many provider Makefiles override this value.
PACKAGE_NAME="provider-template"
PACKAGE_NAME="provider-litellm"


# ------------------------------
Expand Down
18 changes: 9 additions & 9 deletions cmd/provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/ratelimiter"
"github.com/crossplane/crossplane-runtime/pkg/resource"

"github.com/crossplane/provider-template/apis"
"github.com/crossplane/provider-template/apis/v1alpha1"
template "github.com/crossplane/provider-template/internal/controller"
"github.com/crossplane/provider-template/internal/features"
"github.com/crossplane/provider-litellm/apis"
"github.com/crossplane/provider-litellm/apis/v1alpha1"
litellm "github.com/crossplane/provider-litellm/internal/controller"
"github.com/crossplane/provider-litellm/internal/features"
)

func main() {
var (
app = kingpin.New(filepath.Base(os.Args[0]), "Template support for Crossplane.").DefaultEnvars()
app = kingpin.New(filepath.Base(os.Args[0]), "Litellm support for Crossplane.").DefaultEnvars()
debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool()
leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool()

Expand All @@ -60,7 +60,7 @@ func main() {
kingpin.MustParse(app.Parse(os.Args[1:]))

zl := zap.New(zap.UseDevMode(*debug))
log := logging.NewLogrLogger(zl.WithName("provider-template"))
log := logging.NewLogrLogger(zl.WithName("provider-litellm"))
if *debug {
// The controller-runtime runs with a no-op logger by default. It is
// *very* verbose even at info level, so we only provide it a real
Expand All @@ -86,13 +86,13 @@ func main() {
// server. Switching to Leases only and longer leases appears to
// alleviate this.
LeaderElection: *leaderElection,
LeaderElectionID: "crossplane-leader-election-provider-template",
LeaderElectionID: "crossplane-leader-election-provider-litellm",
LeaderElectionResourceLock: resourcelock.LeasesResourceLock,
LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(),
RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(),
})
kingpin.FatalIfError(err, "Cannot create controller manager")
kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add Template APIs to scheme")
kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add Litellm APIs to scheme")

o := controller.Options{
Logger: log,
Expand Down Expand Up @@ -126,6 +126,6 @@ func main() {
log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies)
}

kingpin.FatalIfError(template.Setup(mgr, o), "Cannot setup Template controllers")
kingpin.FatalIfError(litellm.Setup(mgr, o), "Cannot setup Litellm controllers")
kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager")
}
2 changes: 1 addition & 1 deletion examples/provider/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type: Opaque
data:
# credentials: BASE64ENCODED_PROVIDER_CREDS
---
apiVersion: template.crossplane.io/v1alpha1
apiVersion: litellm.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
name: example
Expand Down
2 changes: 1 addition & 1 deletion examples/sample/mytype.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: sample.template.crossplane.io/v1alpha1
apiVersion: sample.litellm.crossplane.io/v1alpha1
kind: MyType
metadata:
name: example
Expand Down
2 changes: 1 addition & 1 deletion examples/storeconfig/vault.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: template.crossplane.io/v1alpha1
apiVersion: litellm.crossplane.io/v1alpha1
kind: StoreConfig
metadata:
name: vault
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/crossplane/provider-template
module github.com/crossplane/provider-litellm

go 1.21

Expand Down
2 changes: 1 addition & 1 deletion internal/controller/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/resource"
ctrl "sigs.k8s.io/controller-runtime"

"github.com/crossplane/provider-template/apis/v1alpha1"
"github.com/crossplane/provider-litellm/apis/v1alpha1"
)

// Setup adds a controller that reconciles ProviderConfigs by accounting for
Expand Down
6 changes: 3 additions & 3 deletions internal/controller/litellm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/controller"
ctrl "sigs.k8s.io/controller-runtime"

"github.com/crossplane/provider-template/internal/controller/config"
"github.com/crossplane/provider-template/internal/controller/mytype"
"github.com/crossplane/provider-litellm/internal/controller/config"
"github.com/crossplane/provider-litellm/internal/controller/mytype"
)

// Setup creates all Template controllers with the supplied logger and adds them to
// Setup creates all Litellm controllers with the supplied logger and adds them to
// the supplied manager.
func Setup(mgr ctrl.Manager, o controller.Options) error {
for _, setup := range []func(ctrl.Manager, controller.Options) error{
Expand Down
6 changes: 3 additions & 3 deletions package/crds/sample.template.crossplane.io_mytypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: mytypes.sample.template.crossplane.io
name: mytypes.sample.litellm.crossplane.io
spec:
group: sample.template.crossplane.io
group: sample.litellm.crossplane.io
names:
categories:
- crossplane
- managed
- template
- litellm
kind: MyType
listKind: MyTypeList
plural: mytypes
Expand Down
6 changes: 3 additions & 3 deletions package/crds/template.crossplane.io_providerconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: providerconfigs.template.crossplane.io
name: providerconfigs.litellm.crossplane.io
spec:
group: template.crossplane.io
group: litellm.crossplane.io
names:
kind: ProviderConfig
listKind: ProviderConfigList
Expand All @@ -25,7 +25,7 @@ spec:
name: v1alpha1
schema:
openAPIV3Schema:
description: A ProviderConfig configures a Template provider.
description: A ProviderConfig configures a Litellm provider.
properties:
apiVersion:
description: |-
Expand Down
6 changes: 3 additions & 3 deletions package/crds/template.crossplane.io_providerconfigusages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: providerconfigusages.template.crossplane.io
name: providerconfigusages.litellm.crossplane.io
spec:
group: template.crossplane.io
group: litellm.crossplane.io
names:
categories:
- crossplane
- provider
- template
- litellm
kind: ProviderConfigUsage
listKind: ProviderConfigUsageList
plural: providerconfigusages
Expand Down
Loading

0 comments on commit 0777a16

Please sign in to comment.