Skip to content

Commit

Permalink
Fix Terraform compatibility (#524)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced dynamic registration capabilities for internal API versions
of `Application` and `ApplicationList`.
- Added configuration management for server options, allowing users to
specify a resource configuration path via command line.
  
- **Bug Fixes**
	- Improved error handling for loading resource configurations.

- **Documentation**
- Updated OpenAPI specification handling by removing certain definitions
post-processing.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
  • Loading branch information
kvaps authored Dec 10, 2024
1 parent 898374b commit ebe9a1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/apis/apps/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ func RegisterDynamicTypes(scheme *runtime.Scheme, cfg *config.ResourceConfig) er
scheme.AddKnownTypeWithName(gvk, &Application{})
scheme.AddKnownTypeWithName(gvk.GroupVersion().WithKind(kind+"List"), &ApplicationList{})

gvkInternal := schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}.WithKind(kind)
scheme.AddKnownTypeWithName(gvkInternal, &Application{})
scheme.AddKnownTypeWithName(gvkInternal.GroupVersion().WithKind(kind+"List"), &ApplicationList{})

klog.V(1).Infof("Registered kind: %s\n", kind)
RegisteredGVKs = append(RegisteredGVKs, gvk)
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/cmd/server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ func (o *AppsServerOptions) Config() (*apiserver.Config, error) {
klog.V(6).Infof("PostProcessSpec: Added OpenAPI definition for %s\n", listResourceName)
}

delete(defs, "com.github.aenix.io.cozystack.pkg.apis.apps.v1alpha1.Application")
delete(defs, "com.github.aenix.io.cozystack.pkg.apis.apps.v1alpha1.ApplicationList")

swagger.Definitions = defs
return swagger, nil
}
Expand Down

0 comments on commit ebe9a1b

Please sign in to comment.