Skip to content

Commit

Permalink
Bump APIs to v1beta1
Browse files Browse the repository at this point in the history
Signed-off-by: Hasan Turken <turkenh@gmail.com>
  • Loading branch information
turkenh committed Nov 22, 2022
1 parent d757a1f commit a9b46d5
Show file tree
Hide file tree
Showing 32 changed files with 209 additions and 209 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ represents a Terraform workspace. The configuration of each workspace may be
either fetched from a remote source (e.g. git), or simply specified inline.

```yaml
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: Workspace
metadata:
name: example-inline
Expand Down Expand Up @@ -51,7 +51,7 @@ spec:
```
```yaml
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: Workspace
metadata:
name: example-remote
Expand Down
4 changes: 2 additions & 2 deletions apis/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ package apis
import (
"k8s.io/apimachinery/pkg/runtime"

"github.com/upbound/provider-terraform/apis/v1alpha1"
"github.com/upbound/provider-terraform/apis/v1beta1"
)

func init() {
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
AddToSchemes = append(AddToSchemes,
v1alpha1.SchemeBuilder.AddToScheme,
v1beta1.SchemeBuilder.AddToScheme,
)
}

Expand Down
6 changes: 3 additions & 3 deletions apis/v1alpha1/doc.go → apis/v1beta1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Package v1alpha1 contains the core resources of the Terraform provider.
// Package v1beta1 contains the core resources of the Terraform provider.
// +kubebuilder:object:generate=true
// +groupName=tf.crossplane.io
// +versionName=v1alpha1
package v1alpha1
// +versionName=v1beta1
package v1beta1
4 changes: 2 additions & 2 deletions apis/v1alpha1/register.go → apis/v1beta1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1beta1

import (
"reflect"
Expand All @@ -26,7 +26,7 @@ import (
// Package type metadata.
const (
Group = "tf.crossplane.io"
Version = "v1alpha1"
Version = "v1beta1"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1beta1

import (
"reflect"
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha1/types.go → apis/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1beta1

import (
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
Expand Down

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

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

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

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

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

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

6 changes: 3 additions & 3 deletions cmd/provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/resource"

"github.com/upbound/provider-terraform/apis"
"github.com/upbound/provider-terraform/apis/v1alpha1"
"github.com/upbound/provider-terraform/apis/v1beta1"
workspace "github.com/upbound/provider-terraform/internal/controller"
"github.com/upbound/provider-terraform/internal/controller/features"
)
Expand Down Expand Up @@ -106,11 +106,11 @@ func main() {
log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores)

// Ensure default store config exists.
kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{
kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1beta1.StoreConfig{
ObjectMeta: metav1.ObjectMeta{
Name: "default",
},
Spec: v1alpha1.StoreConfigSpec{
Spec: v1beta1.StoreConfigSpec{
// NOTE(turkenh): We only set required spec and expect optional
// ones to properly be initialized with CRD level default values.
SecretStoreConfig: xpv1.SecretStoreConfig{
Expand Down
12 changes: 6 additions & 6 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ kubectl create secret generic git-credentials --from-file=.git-credentials
Reference it in ProviderConfig.

```yaml
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
name: default
Expand Down Expand Up @@ -103,7 +103,7 @@ the planArgs, applyArgs and destroyArgs options.
For example:
```yaml
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: Workspace
metadata:
name: example-args
Expand Down Expand Up @@ -151,7 +151,7 @@ To enable it, the `Workspace` spec has an **optional** `Entrypoint` field.
Consider this example:

```yml
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: Workspace
metadata:
name: relative-path-test
Expand Down Expand Up @@ -187,7 +187,7 @@ In case you need to disable it, set optional `pluginCache` to `false` in
`ProviderConfig`:

```console
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
name: default
Expand Down Expand Up @@ -223,7 +223,7 @@ spec:

Prepare a `StoreConfig` for Vault:
```yaml
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: StoreConfig
metadata:
name: vault
Expand Down Expand Up @@ -257,7 +257,7 @@ spec:
resources:
- name: foo
base:
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: Workspace
metadata:
name: foo
Expand Down
8 changes: 4 additions & 4 deletions docs/Quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Create a `ProviderConfig` Kubernetes configuration file to attach the GCP creden
**Note:** the `ProviderConfig` must contain the correct GCP project ID. The project ID must match the `project_id` from the JSON key file.

```yaml
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
name: default
Expand Down Expand Up @@ -168,7 +168,7 @@ Verify the `ProviderConfig` with `kubectl describe providerconfigs`.
$ kubectl describe providerconfigs
Name: default
Namespace:
API Version: tf.crossplane.io/v1alpha1
API Version: tf.crossplane.io/v1beta1
Kind: ProviderConfig
# Output truncated
Spec:
Expand Down Expand Up @@ -201,12 +201,12 @@ Create a managed resource of type `Workspace` to verify the provider is function
This example creates a GCP storage bucket with a globally unique name.

```yaml
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: Workspace
metadata:
name: example-inline
annotations:
meta.upbound.io/example-id: tf/v1alpha1/repository
meta.upbound.io/example-id: tf/v1beta1/workspace
# The terraform workspace will be named 'coolbucket'. If you omit this
# annotation it would be derived from metadata.name - e.g. 'example-inline'.
crossplane.io/external-name: coolbucket
Expand Down
2 changes: 1 addition & 1 deletion examples/aws-eks-irsa-seup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
controllerConfigRef:
name: terraform-config
---
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
annotations: {}
Expand Down
2 changes: 1 addition & 1 deletion examples/observe-only-composition/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
resources:
- name: observe-only-vpc
base:
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: Workspace
metadata:
name: observe-only-vpc
Expand Down
2 changes: 1 addition & 1 deletion examples/providerconfig-aws.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
name: aws-eu-west-1
Expand Down
2 changes: 1 addition & 1 deletion examples/providerconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
name: default
Expand Down
4 changes: 2 additions & 2 deletions examples/workspace-inline.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: Workspace
metadata:
name: example-inline
annotations:
meta.upbound.io/example-id: tf/v1alpha1/repository
meta.upbound.io/example-id: tf/v1beta1/workspace
# The terraform workspace will be named 'coolbucket'. If you omit this
# annotation it would be derived from metadata.name - e.g. 'example-inline'.
crossplane.io/external-name: coolbucket
Expand Down
4 changes: 2 additions & 2 deletions examples/workspace-remote.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: tf.crossplane.io/v1alpha1
apiVersion: tf.crossplane.io/v1beta1
kind: Workspace
metadata:
name: example-remote
annotations:
meta.upbound.io/example-id: tf/v1alpha1/repository
meta.upbound.io/example-id: tf/v1beta1/workspace
# The terraform workspace will be named 'myworkspace'. If you omit this
# annotation it would be derived from metadata.name - e.g. 'example-remote'.
crossplane.io/external-name: myworkspace
Expand Down
12 changes: 6 additions & 6 deletions internal/controller/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/reconciler/providerconfig"
"github.com/crossplane/crossplane-runtime/pkg/resource"

"github.com/upbound/provider-terraform/apis/v1alpha1"
"github.com/upbound/provider-terraform/apis/v1beta1"
)

// Setup adds a controller that reconciles ProviderConfigs by accounting for
// their current usage.
func Setup(mgr ctrl.Manager, o controller.Options, timeout time.Duration) error {
name := providerconfig.ControllerName(v1alpha1.ProviderConfigGroupKind)
name := providerconfig.ControllerName(v1beta1.ProviderConfigGroupKind)

of := resource.ProviderConfigKinds{
Config: v1alpha1.ProviderConfigGroupVersionKind,
UsageList: v1alpha1.ProviderConfigUsageListGroupVersionKind,
Config: v1beta1.ProviderConfigGroupVersionKind,
UsageList: v1beta1.ProviderConfigUsageListGroupVersionKind,
}

r := providerconfig.NewReconciler(mgr, of,
Expand All @@ -48,7 +48,7 @@ func Setup(mgr ctrl.Manager, o controller.Options, timeout time.Duration) error
return ctrl.NewControllerManagedBy(mgr).
Named(name).
WithOptions(o.ForControllerRuntime()).
For(&v1alpha1.ProviderConfig{}).
Watches(&source.Kind{Type: &v1alpha1.ProviderConfigUsage{}}, &resource.EnqueueRequestForProviderConfig{}).
For(&v1beta1.ProviderConfig{}).
Watches(&source.Kind{Type: &v1beta1.ProviderConfigUsage{}}, &resource.EnqueueRequestForProviderConfig{}).
Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter))
}
Loading

0 comments on commit a9b46d5

Please sign in to comment.