Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
daanvinken committed Sep 27, 2024
1 parent 3d2e9b8 commit 616422e
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ fallthrough: submodules

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

# NOTE(hasheddan): we ensure up is installed prior to running platform-specific
# build steps in parallel to avoid encountering an installation race condition.
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Provider Template

`consul-provider` is a [Crossplane](https://crossplane.io/) provider that
`provider-consul` is a [Crossplane](https://crossplane.io/) provider that
is built using [Upjet](https://github.com/crossplane/upjet) code
generation tools and exposes XRM-conformant managed resources for the
Template API.

## Getting Started

Install the provider by using the following command after changing the image tag
to the [latest release](https://marketplace.upbound.io/providers/upbound/consul-provider):
to the [latest release](https://marketplace.upbound.io/providers/upbound/provider-consul):
```
up ctp provider install upbound/consul-provider:v0.1.0
up ctp provider install upbound/provider-consul:v0.1.0
```

Alternatively, you can use declarative installation:
Expand All @@ -19,15 +19,15 @@ cat <<EOF | kubectl apply -f -
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: consul-provider
name: provider-consul
spec:
package: upbound/consul-provider:v0.1.0
package: upbound/provider-consul:v0.1.0
EOF
```

Notice that in this example Provider resource is referencing ControllerConfig with debug enabled.

You can see the API reference [here](https://doc.crds.dev/github.com/daanvinken/consul-provider).
You can see the API reference [here](https://doc.crds.dev/github.com/daanvinken/provider-consul).

## Developing

Expand Down Expand Up @@ -57,4 +57,4 @@ make build
## Report a Bug

For filing bugs, suggesting improvements, or requesting new features, please
open an [issue](https://github.com/daanvinken/consul-provider/issues).
open an [issue](https://github.com/daanvinken/provider-consul/issues).
6 changes: 3 additions & 3 deletions apis/zz_register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/crossplane/upjet/pkg/pipeline"

"github.com/daanvinken/consul-provider/config"
"github.com/daanvinken/provider-consul/config"
)

func main() {
Expand Down
16 changes: 8 additions & 8 deletions cmd/provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/metrics"

"github.com/daanvinken/consul-provider/apis"
"github.com/daanvinken/consul-provider/apis/v1alpha1"
"github.com/daanvinken/consul-provider/config"
"github.com/daanvinken/consul-provider/internal/clients"
"github.com/daanvinken/consul-provider/internal/controller"
"github.com/daanvinken/consul-provider/internal/features"
"github.com/daanvinken/provider-consul/apis"
"github.com/daanvinken/provider-consul/apis/v1alpha1"
"github.com/daanvinken/provider-consul/config"
"github.com/daanvinken/provider-consul/internal/clients"
"github.com/daanvinken/provider-consul/internal/controller"
"github.com/daanvinken/provider-consul/internal/features"
)

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

zl := zap.New(zap.UseDevMode(*debug))
log := logging.NewLogrLogger(zl.WithName("consul-provider"))
log := logging.NewLogrLogger(zl.WithName("provider-consul"))
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 @@ -73,7 +73,7 @@ func main() {

mgr, err := ctrl.NewManager(cfg, ctrl.Options{
LeaderElection: *leaderElection,
LeaderElectionID: "crossplane-leader-election-consul-provider",
LeaderElectionID: "crossplane-leader-election-provider-consul",
Cache: cache.Options{
SyncPeriod: syncPeriod,
},
Expand Down
4 changes: 2 additions & 2 deletions config/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (

ujconfig "github.com/crossplane/upjet/pkg/config"

"github.com/daanvinken/consul-provider/config/null"
"github.com/daanvinken/provider-consul/config/null"
)

const (
resourcePrefix = "template"
modulePath = "github.com/daanvinken/consul-provider"
modulePath = "github.com/daanvinken/provider-consul"
)

//go:embed schema.json
Expand Down
4 changes: 2 additions & 2 deletions examples/install.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: consul-provider
name: provider-consul
spec:
package: upbound/consul-provider:v0.1.0
package: upbound/provider-consul:v0.1.0
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/daanvinken/consul-provider
module github.com/daanvinken/provider-consul

go 1.21

Expand Down
8 changes: 4 additions & 4 deletions hack/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ read -r -p "CRD rootGroup (ex. upbound.io, crossplane.io): " CRD_ROOT_GROUP

REPLACE_FILES='./* ./.github :!build/** :!go.* :!hack/prepare.sh'
# shellcheck disable=SC2086
git grep -l 'template' -- ${REPLACE_FILES} | xargs sed -i.bak "s/consul-provider/provider-${PROVIDER_NAME_LOWER}/g"
git grep -l 'template' -- ${REPLACE_FILES} | xargs sed -i.bak "s/provider-consul/provider-${PROVIDER_NAME_LOWER}/g"
# shellcheck disable=SC2086
git grep -l 'template' -- ${REPLACE_FILES} | xargs sed -i.bak "s/template/${PROVIDER_NAME_LOWER}/g"
# shellcheck disable=SC2086
Expand All @@ -22,19 +22,19 @@ git grep -l "ujconfig\.WithRootGroup(\"${PROVIDER_NAME_LOWER}.upbound\.io\")" --

# We need to be careful while replacing "template" keyword in go.mod as it could tamper
# some imported packages under require section.
sed -i.bak "s|upbound/consul-provider|${ORGANIZATION_NAME}/provider-${PROVIDER_NAME_LOWER}|g" go.mod
sed -i.bak "s|upbound/provider-consul|${ORGANIZATION_NAME}/provider-${PROVIDER_NAME_LOWER}|g" go.mod
sed -i.bak -e "s|PROJECT_REPO ?= github.com/upbound/|PROJECT_REPO ?= github.com/${ORGANIZATION_NAME}/|g" -e "s|\(blob/main/internal/\)${PROVIDER_NAME_LOWER}s|\1templates|g" Makefile
sed -i.bak "s/\[YEAR\]/$(date +%Y)/g" LICENSE

# Clean up the .bak files created by sed
git clean -fd

git mv "internal/clients/template.go" "internal/clients/${PROVIDER_NAME_LOWER}.go"
git mv "cluster/images/consul-provider" "cluster/images/provider-${PROVIDER_NAME_LOWER}"
git mv "cluster/images/provider-consul" "cluster/images/provider-${PROVIDER_NAME_LOWER}"

# We need to remove this api folder otherwise first `make generate` fails with
# the following error probably due to some optimizations in go generate with v1.17:
# generate: open /Users/hasanturken/Workspace/crossplane-contrib/consul-provider/apis/null/v1alpha1/zz_generated.deepcopy.go: no such file or directory
# generate: open /Users/hasanturken/Workspace/crossplane-contrib/provider-consul/apis/null/v1alpha1/zz_generated.deepcopy.go: no such file or directory
rm -rf apis/null
# remove the sample directory which was a configuration in the template
rm -rf config/null
2 changes: 1 addition & 1 deletion internal/clients/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/crossplane/upjet/pkg/terraform"

"github.com/daanvinken/consul-provider/apis/v1beta1"
"github.com/daanvinken/provider-consul/apis/v1beta1"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/null/resource/zz_controller.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

"github.com/daanvinken/consul-provider/apis/v1beta1"
"github.com/daanvinken/provider-consul/apis/v1beta1"
)

// Setup adds a controller that reconciles ProviderConfigs by accounting for
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/zz_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/crossplane/upjet/pkg/controller"

resource "github.com/daanvinken/consul-provider/internal/controller/null/resource"
providerconfig "github.com/daanvinken/consul-provider/internal/controller/providerconfig"
resource "github.com/daanvinken/provider-consul/internal/controller/null/resource"
providerconfig "github.com/daanvinken/provider-consul/internal/controller/providerconfig"
)

// Setup creates all controllers with the supplied logger and adds them to
Expand Down
2 changes: 1 addition & 1 deletion package/crossplane.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: meta.pkg.crossplane.io/v1
kind: Provider
metadata:
name: consul-provider
name: provider-consul

0 comments on commit 616422e

Please sign in to comment.