Skip to content

Commit

Permalink
Remove tf cli from the image and set group name azapi
Browse files Browse the repository at this point in the history
Signed-off-by: Fatih Türken <[email protected]>
  • Loading branch information
turkenf committed Oct 16, 2024
1 parent 8821bee commit 06d1a7a
Show file tree
Hide file tree
Showing 44 changed files with 101 additions and 145 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ====================================================================================
# Setup Project

PROJECT_NAME ?= provider-upjet-azapi
PROJECT_NAME ?= provider-azapi
PROJECT_REPO ?= github.com/upbound/$(PROJECT_NAME)

export TERRAFORM_VERSION ?= 1.5.7
Expand Down Expand Up @@ -92,7 +92,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.provider-upjet-azapi: do.build.images
xpkg.build.provider-azapi: 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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Provider AzAPI

`provider-upjet-azapi` is a [Crossplane](https://crossplane.io/) provider that
Provider Upjet-AzAPI 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
AzAPI 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/provider-upjet-azapi):
to the [latest release](https://marketplace.upbound.io/providers/upbound/provider-azapi):
```
up ctp provider install upbound/provider-upjet-azapi:v0.1.0
up ctp provider install upbound/provider-azapi: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: provider-upjet-azapi
name: provider-azapi
spec:
package: upbound/provider-upjet-azapi:v0.1.0
package: upbound/provider-azapi: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/upbound/provider-upjet-azapi).
You can see the API reference [here](https://doc.crds.dev/github.com/upbound/provider-azapi).

## Developing

Expand Down
2 changes: 1 addition & 1 deletion apis/resource/v1alpha1/zz_dataplaneresource_types.go

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

4 changes: 2 additions & 2 deletions apis/resource/v1alpha1/zz_groupversion_info.go

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

2 changes: 1 addition & 1 deletion apis/resource/v1alpha1/zz_resource_types.go

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

2 changes: 1 addition & 1 deletion apis/resource/v1alpha1/zz_resourceaction_types.go

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

2 changes: 1 addition & 1 deletion apis/resource/v1alpha1/zz_updateresource_types.go

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

4 changes: 2 additions & 2 deletions apis/v1alpha1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Copyright 2021 Upbound Inc.
*/

// Package v1alpha1 contains the core resources of the upjet-azapi jet provider.
// Package v1alpha1 contains the core resources of the azapi upjet provider.
// +kubebuilder:object:generate=true
// +groupName=upjet-azapi.upbound.io
// +groupName=azapi.upbound.io
// +versionName=v1alpha1
package v1alpha1
2 changes: 1 addition & 1 deletion apis/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

// Package type metadata.
const (
Group = "upjet-azapi.upbound.io"
Group = "azapi.upbound.io"
Version = "v1alpha1"
)

Expand Down
4 changes: 2 additions & 2 deletions apis/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ type StoreConfigStatus struct {

// +kubebuilder:object:root=true

// A StoreConfig configures how upjet-azapi controller should store connection details.
// A StoreConfig configures how azapi controller should store connection details.
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:printcolumn:name="TYPE",type="string",JSONPath=".spec.type"
// +kubebuilder:printcolumn:name="DEFAULT-SCOPE",type="string",JSONPath=".spec.defaultScope"
// +kubebuilder:resource:scope=Cluster,categories={crossplane,store,upjet-azapi}
// +kubebuilder:resource:scope=Cluster,categories={crossplane,store,azapi}
// +kubebuilder:subresource:status
type StoreConfig struct {
metav1.TypeMeta `json:",inline"`
Expand Down
4 changes: 2 additions & 2 deletions apis/v1beta1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Copyright 2022 Upbound Inc.
*/

// Package v1beta1 contains the core resources of the upjet-azapi upjet provider.
// Package v1beta1 contains the core resources of the azapi upjet provider.
// +kubebuilder:object:generate=true
// +groupName=upjet-azapi.upbound.io
// +groupName=azapi.upbound.io
// +versionName=v1beta1
package v1beta1
2 changes: 1 addition & 1 deletion apis/v1beta1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

// Package type metadata.
const (
Group = "upjet-azapi.upbound.io"
Group = "azapi.upbound.io"
Version = "v1beta1"
)

Expand Down
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.

14 changes: 14 additions & 0 deletions cluster/images/provider-azapi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM alpine:3.20.3
RUN apk --no-cache add ca-certificates bash

ARG TARGETOS
ARG TARGETARCH

ENV USER_ID=65532

USER ${USER_ID}
EXPOSE 8080

ADD "bin/${TARGETOS}_${TARGETARCH}/provider" /usr/local/bin/provider

ENTRYPOINT ["provider"]
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ include ../../../build/makelib/imagelight.mk

img.build:
@$(INFO) docker build $(IMAGE)
@$(MAKE) BUILD_ARGS="--load" img.build.shared
@$(MAKE) BUILD_ARGS="--load ${BUILD_ARGS}" img.build.shared
@$(OK) docker build $(IMAGE)

img.publish:
Expand All @@ -23,16 +23,9 @@ img.publish:

img.build.shared:
@cp Dockerfile $(IMAGE_TEMP_DIR) || $(FAIL)
@cp terraformrc.hcl $(IMAGE_TEMP_DIR) || $(FAIL)
@cp -r $(OUTPUT_DIR)/bin/ $(IMAGE_TEMP_DIR)/bin || $(FAIL)
@docker buildx build $(BUILD_ARGS) \
--platform $(IMAGE_PLATFORMS) \
--build-arg TERRAFORM_VERSION=$(TERRAFORM_VERSION) \
--build-arg TERRAFORM_PROVIDER_SOURCE=$(TERRAFORM_PROVIDER_SOURCE) \
--build-arg TERRAFORM_PROVIDER_VERSION=$(TERRAFORM_PROVIDER_VERSION) \
--build-arg TERRAFORM_PROVIDER_DOWNLOAD_NAME=$(TERRAFORM_PROVIDER_DOWNLOAD_NAME) \
--build-arg TERRAFORM_PROVIDER_DOWNLOAD_URL_PREFIX=$(TERRAFORM_PROVIDER_DOWNLOAD_URL_PREFIX) \
--build-arg TERRAFORM_NATIVE_PROVIDER_BINARY=$(TERRAFORM_NATIVE_PROVIDER_BINARY) \
-t $(IMAGE) \
$(IMAGE_TEMP_DIR) || $(FAIL)

Expand Down
51 changes: 0 additions & 51 deletions cluster/images/provider-upjet-azapi/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion cluster/test/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ${KUBECTL} -n upbound-system wait --for=condition=Available deployment --all --t

echo "Creating a default provider config..."
cat <<EOF | ${KUBECTL} apply -f -
apiVersion: upjet-azapi.upbound.io/v1beta1
apiVersion: azapi.upbound.io/v1beta1
kind: ProviderConfig
metadata:
name: default
Expand Down
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/upbound/provider-upjet-azapi/config"
"github.com/upbound/provider-azapi/config"
)

func main() {
Expand Down
18 changes: 9 additions & 9 deletions cmd/provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ import (
"sigs.k8s.io/controller-runtime/pkg/metrics"
"sigs.k8s.io/controller-runtime/pkg/webhook"

"github.com/upbound/provider-upjet-azapi/apis"
"github.com/upbound/provider-upjet-azapi/apis/v1alpha1"
"github.com/upbound/provider-upjet-azapi/config"
resolverapis "github.com/upbound/provider-upjet-azapi/internal/apis"
"github.com/upbound/provider-upjet-azapi/internal/clients"
"github.com/upbound/provider-upjet-azapi/internal/controller"
"github.com/upbound/provider-upjet-azapi/internal/features"
"github.com/upbound/provider-azapi/apis"
"github.com/upbound/provider-azapi/apis/v1alpha1"
"github.com/upbound/provider-azapi/config"
resolverapis "github.com/upbound/provider-azapi/internal/apis"
"github.com/upbound/provider-azapi/internal/clients"
"github.com/upbound/provider-azapi/internal/controller"
"github.com/upbound/provider-azapi/internal/features"
)

const (
Expand Down Expand Up @@ -92,7 +92,7 @@ func main() {
ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard)))

zl := zap.New(zap.UseDevMode(*debug))
logr := logging.NewLogrLogger(zl.WithName("provider-upjet-azapi"))
logr := logging.NewLogrLogger(zl.WithName("provider-azapi"))
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 Down Expand Up @@ -132,7 +132,7 @@ func main() {

mgr, err := ctrl.NewManager(cfg, ctrl.Options{
LeaderElection: *leaderElection,
LeaderElectionID: "crossplane-leader-election-provider-upjet-azapi",
LeaderElectionID: "crossplane-leader-election-provider-azapi",
Cache: cache.Options{
SyncPeriod: syncPeriod,
},
Expand Down
8 changes: 4 additions & 4 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/upbound/provider-upjet-azapi/config/resource"
"github.com/upbound/provider-azapi/config/resource"
)

const (
resourcePrefix = "upjet-azapi"
modulePath = "github.com/upbound/provider-upjet-azapi"
resourcePrefix = "azapi"
modulePath = "github.com/upbound/provider-azapi"
)

//go:embed schema.json
Expand All @@ -27,7 +27,7 @@ var providerMetadata string
// GetProvider returns provider configuration
func GetProvider() *ujconfig.Provider {
pc := ujconfig.NewProvider([]byte(providerSchema), resourcePrefix, modulePath, []byte(providerMetadata),
ujconfig.WithRootGroup("upbound.io"),
ujconfig.WithRootGroup("azapi.upbound.io"),
ujconfig.WithIncludeList(ExternalNameConfigured()),
ujconfig.WithFeaturesPackage("internal/features"),
ujconfig.WithDefaultResourceOptions(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: resource.upbound.io/v1alpha1
apiVersion: resource.azapi.upbound.io/v1alpha1
kind: DataPlaneResource
metadata:
annotations:
Expand Down
2 changes: 1 addition & 1 deletion examples-generated/resource/v1alpha1/resource.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: resource.upbound.io/v1alpha1
apiVersion: resource.azapi.upbound.io/v1alpha1
kind: Resource
metadata:
annotations:
Expand Down
2 changes: 1 addition & 1 deletion examples-generated/resource/v1alpha1/resourceaction.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: resource.upbound.io/v1alpha1
apiVersion: resource.azapi.upbound.io/v1alpha1
kind: ResourceAction
metadata:
annotations:
Expand Down
2 changes: 1 addition & 1 deletion examples-generated/resource/v1alpha1/updateresource.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: resource.upbound.io/v1alpha1
apiVersion: resource.azapi.upbound.io/v1alpha1
kind: UpdateResource
metadata:
annotations:
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: provider-upjet-azapi
name: provider-azapi
spec:
package: upbound/provider-upjet-azapi:v0.1.0
package: upbound/provider-azapi:v0.1.0
2 changes: 1 addition & 1 deletion examples/providerconfig/providerconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: upjet-azapi.upbound.io/v1beta1
apiVersion: azapi.upbound.io/v1beta1
kind: ProviderConfig
metadata:
name: default
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: upjet-azapi.upbound.io/v1alpha1
apiVersion: azapi.upbound.io/v1alpha1
kind: StoreConfig
metadata:
name: vault
Expand Down
Loading

0 comments on commit 06d1a7a

Please sign in to comment.