Skip to content

Commit

Permalink
Merge pull request #60 from ulucinar/xp-upjet
Browse files Browse the repository at this point in the history
Replace github.com/upbound/upjet Go module dependency with github.com/crossplane/upjet
  • Loading branch information
jeanduplessis authored Nov 13, 2023
2 parents 6ddd380 + a2869fa commit 64563d5
Show file tree
Hide file tree
Showing 28 changed files with 417 additions and 684 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Provider Template

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

Expand Down
2 changes: 1 addition & 1 deletion apis/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Copyright 2021 Upbound Inc.
//go:generate rm -rf ../examples-generated

// Generate documentation from Terraform docs.
//go:generate go run github.com/upbound/upjet/cmd/scraper -n ${TERRAFORM_PROVIDER_SOURCE} -r ../.work/${TERRAFORM_PROVIDER_SOURCE}/${TERRAFORM_DOCS_PATH} -o ../config/provider-metadata.yaml
//go:generate go run github.com/crossplane/upjet/cmd/scraper -n ${TERRAFORM_PROVIDER_SOURCE} -r ../.work/${TERRAFORM_PROVIDER_SOURCE}/${TERRAFORM_DOCS_PATH} -o ../config/provider-metadata.yaml

// Run Upjet generator
//go:generate go run ../cmd/generator/main.go ..
Expand Down
39 changes: 36 additions & 3 deletions apis/null/v1alpha1/zz_generated.deepcopy.go

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

28 changes: 6 additions & 22 deletions apis/null/v1alpha1/zz_generated.managed.go

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

18 changes: 16 additions & 2 deletions apis/null/v1alpha1/zz_generated_terraformed.go

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

4 changes: 4 additions & 0 deletions apis/null/v1alpha1/zz_groupversion_info.go

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

23 changes: 22 additions & 1 deletion apis/null/v1alpha1/zz_resource_types.go

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

1 change: 0 additions & 1 deletion apis/v1alpha1/zz_generated.deepcopy.go

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

1 change: 0 additions & 1 deletion apis/v1beta1/zz_generated.deepcopy.go

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

4 changes: 4 additions & 0 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 @@ -9,7 +9,7 @@ import (
"os"
"path/filepath"

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

"github.com/upbound/upjet-provider-template/config"
)
Expand Down
19 changes: 11 additions & 8 deletions cmd/provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/crossplane/crossplane-runtime/pkg/ratelimiter"
"github.com/crossplane/crossplane-runtime/pkg/resource"
tjcontroller "github.com/upbound/upjet/pkg/controller"
"github.com/upbound/upjet/pkg/terraform"
tjcontroller "github.com/crossplane/upjet/pkg/controller"
"github.com/crossplane/upjet/pkg/terraform"
"gopkg.in/alecthomas/kingpin.v2"
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/tools/leaderelection/resourcelock"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

"github.com/upbound/upjet-provider-template/apis"
Expand All @@ -48,7 +49,7 @@ func main() {

namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String()
enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool()
enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool()
enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("true").Envar("ENABLE_MANAGEMENT_POLICIES").Bool()
)

kingpin.MustParse(app.Parse(os.Args[1:]))
Expand All @@ -68,9 +69,11 @@ func main() {
kingpin.FatalIfError(err, "Cannot get API server rest config")

mgr, err := ctrl.NewManager(cfg, ctrl.Options{
LeaderElection: *leaderElection,
LeaderElectionID: "crossplane-leader-election-upjet-provider-template",
SyncPeriod: syncPeriod,
LeaderElection: *leaderElection,
LeaderElectionID: "crossplane-leader-election-upjet-provider-template",
Cache: cache.Options{
SyncPeriod: syncPeriod,
},
LeaderElectionResourceLock: resourcelock.LeasesResourceLock,
LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(),
RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(),
Expand Down Expand Up @@ -112,8 +115,8 @@ func main() {
}

if *enableManagementPolicies {
o.Features.Enable(features.EnableAlphaManagementPolicies)
log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies)
o.Features.Enable(features.EnableBetaManagementPolicies)
log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies)
}

kingpin.FatalIfError(controller.Setup(mgr, o), "Cannot setup Template controllers")
Expand Down
2 changes: 1 addition & 1 deletion config/external_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Copyright 2022 Upbound Inc.

package config

import "github.com/upbound/upjet/pkg/config"
import "github.com/crossplane/upjet/pkg/config"

// ExternalNameConfigs contains all external name configurations for this
// provider.
Expand Down
2 changes: 1 addition & 1 deletion config/null/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Copyright 2021 Upbound Inc.
package null

import (
ujconfig "github.com/upbound/upjet/pkg/config"
ujconfig "github.com/crossplane/upjet/pkg/config"
)

// Configure configures the null group
Expand Down
31 changes: 29 additions & 2 deletions config/provider-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,36 @@
name: hashicorp/null
resources:
null_resource Resource - terraform-provider-null:
null_resource:
subCategory: ""
description: The null_resource resource implements the standard resource lifecycle but takes no further action. The triggers argument allows specifying an arbitrary set of values that, when changed, will cause the resource to be replaced.
name: null_resource Resource - terraform-provider-null
name: null_resource
title: null_resource Resource - terraform-provider-null
examples:
- name: cluster
manifest: |-
{
"connection": [
{
"host": "${element(aws_instance.cluster.*.public_ip, 0)}"
}
],
"provisioner": {
"remote-exec": [
{
"inline": [
"bootstrap-cluster.sh ${join(\" \", aws_instance.cluster.*.private_ip)}"
]
}
]
},
"triggers": {
"cluster_instance_ids": "${join(\",\", aws_instance.cluster.*.id)}"
}
}
dependencies:
aws_instance.cluster: |-
{
"count": 3
}
argumentDocs: {}
importStatements: []
2 changes: 1 addition & 1 deletion config/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
// Note(turkenh): we are importing this to embed provider schema document
_ "embed"

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

"github.com/upbound/upjet-provider-template/config/null"
)
Expand Down
Loading

0 comments on commit 64563d5

Please sign in to comment.