Commit Graph

13 Commits

Author SHA1 Message Date
Priyashetty17 be92b15979 add support for public api users 2025-10-09 12:51:13 -04:00
Priyashetty17 ad3a844395 generate 'ext.cattle.io' controller 2025-08-04 13:49:16 -04:00
Jonathan Crowther 3c0e43c5f9 Update pkg/apis. Run go generate. Update user test to use backing namespace if it exists 2025-04-10 09:56:34 -04:00
caliskanugur d3471575e7 Add rbac, cluster.cattle.io and batch controllers and to the new
context, add missing sessions for controllers
2025-02-21 10:58:09 -05:00
Venkata Krishna Rohit Sakala ca7c853c85
Remove catalog,mca crds 2024-11-26 11:14:38 -08:00
Jonathan Crowther 1338e51b48
Update pkg/apis with new generated controllers (#343)
* Update pkg/apis
2024-11-13 09:28:45 -05:00
caliskanugur 37a76fad29 Replace to fork's pkg/apis version, update to K8s 1.31 support, bump
wrangler to v3.0.1-rc3, go generate controllers
2024-10-21 13:32:31 -04:00
Daniel Newman b858dcea51 Add go fmt command to generator.go
The update includes a go fmt command in the generator.go file. This command automatically formats the code according to Go conventions, thereby improving the readability and maintainability of the codebase.

Remove redundant return statement in codegen

The change eliminates a redundant return statement from the main codegen function. This simplifies the function control flow and makes the code cleaner.

Refactor imports and improve test session handling in controllers

The commit addresses two core areas: First, it improves the import structure of the generated controllers throughout various packages, particularly in relation to specific wrangler package types. Secondly, it unifies test session handling for all dynamically generated controller paths, replacing individual controller-based processing functions with a universal implementation for added consistency and reduced redundancy.

Added documentation

Refactor test session related functions in codegen

The code has been refactored to generalize the function of adding test sessions to different controllers. The functions for importing test session in each controller were renamed and refactored into a unified function, which is now called inside each controller-specific function. This approach aims to reduce code repetition and complexity.

Add session to struct and function in generated files

Expanded the appendSessionToStructInFile function to appendNewlineToBlockInFile, which generalizes line additions to the end of any struct or function block. This update improves code reusability. Utilized this function to add a session to multiple generated interface files.

Add session to struct in management controllers

A new function has been implemented to append a session to a struct in the management controllers. The function reads a file, locates a given struct, and then adds a new session prior to the closing brace of the struct. This change will be beneficial for the management of sessions within the struct.

Refactor import addition function for error handling

Updated the addImport function in codegen/main.go to handle and return errors instead of triggering panic. This change also includes verification of the import path and logic adjustments for adding a new import to the parsed file. These updates ensure more robust and error-resistant code execution.

Add 'session' import to controller files

This commit introduces additional functions to automatically add 'session' imports into controller files. Functions have been added to process and add this import into management, apps, and core controller files specifically. The new functions will walk the respective directory's file-paths and add the specified import to all 'interface.go' files.

Refactor factory method parameter replacement in codegen

The factory methods in the code generator have been refactored. The parameters passed into these methods have been modified to include the timestamp (TS) option. Also, excess white space in the code has been removed to adhere to clean coding principles.
2024-07-23 19:43:19 -05:00
vardhaman22 3b57b936cc Update dependencies, fix generation issues, and clean up Go modules
- Skip setpodsecuritypolicytemplate resource action
- Upgrade wrangler from v2 to v3
- Update rancher/pkg/apis with custom fork
- Fix generation issues
- Run go generate
- Perform go mod tidy
2024-06-21 22:24:41 +05:30
Daniel Newman bc4c88e032 Added Apps interface to Wrangler context
Replace imports with shepherd packages and added test session

Generate k8s Apps/v1 controller

Fixed missing argument

Refactor package import paths and remove unused variable

The import paths for "controllers/core" and "controllers/core/v1" have been changed from "github.com/rancher/wrangler/v2/pkg/generated" to "github.com/rancher/shepherd/pkg/generated". Also, the unused variable `opt` has been removed from the file, and factory creation logic has been modified to use `opts` instead of the removed `opt`.

Add LimitRange and ResourceQuota interfaces and controllers

This commit introduced interfaces and controllers for LimitRange and ResourceQuota. It also updated the generated controllers for core API types including Event, Node, Namespace, Pod, Service, Secret, and more. The change is part of expanding the capability of the Dynamic REST Mapper by integrating these core Kubernetes resource types.

Generated core/v1 controllers

Added corev1 controller code generation

Temporarily commented out client generation code.
2024-06-12 21:34:08 -05:00
caliskanugur 3bba42a4e3 Bump dependencies, controllers codegen, fix codegen cleanup, comment PSP
related schema items, update to VolumeResourceRequirements
2024-05-29 16:49:28 -04:00
Daniel Newman 949d293edb Refactor schema BaseType to a constant
A constant `authConfig` has been defined and used to replace the hardcoded "authConfig" string. This refactor can improve code maintainability and readability by centralizing the control of the string value, which is used multiple times throughout the code.

Update dependencies and refine schemas

Updated several software dependencies to enhance functionality and security. This includes dependencies like github.com/aws/aws-sdk-go and github.com/go-logr/logr. Additionally, certain schema definitions in authnTypes and globalRole of the management API have been refined for more precision in handling user data.

israel temp commit

Remove ClusterProxyConfig from management.cattle.io/v3

This commit deletes the ClusterProxyConfig file and its related function ClusterProxyConfig(), as well as relevant interfaces. Purging these components reduces complexity and enhances maintainability, presumably because they're no longer used or needed.

Update rancher package version in dependencies

The version of the pkg/apis package from github.com/rancher/rancher has been updated. This modifies both the go.mod and go.sum files, reflecting the new dependency version.

Remove unused 'noopMCM' struct from context

The 'noopMCM' struct and its associated methods in the context.go file were unused, leading to unnecessary code complexity. This commit removes this struct to streamline the code and maintain cleanliness.

Remove settings.go and its dependencies

The settings.go file and its associated dependencies were deleted, including the function "WithAgent" in context.go. After it was determined that they were not needed, they were completely removed from the codebase, notably from package 'settings' and package 'wrangler'.

Reorder import statements in factory.go and controller.go

The import statements in factory.go and controller.go have been rearranged. This rearrangement helps in improving code readability, making it easier to find and manage dependencies. No changes in the functionality of the code have been made as a part of this reordering.

Remove deprecated Clients in wrangler

The 'clients' package in the 'wrangler' directory was deleted as it had become redundant. Changes were also made in the 'wrangler' context to no longer require 'clientcmd.ClientConfig' in 'NewContext' function which simplified its use. Corresponding updates were made in the Rancher client to reflect these changes.

Add Wrangler context to rancher client

A new Wrangler context has been implemented in the rancher client. This context is meant to access management.cattle.io v3 API resources. It was instantiated within the client constructor function which will provide greater access to API resources in subsequent actions.

Fix linting issues

Update go.mod dependencies

Removed direct dependency on eks-operator and gke-operator, marking them as indirect dependencies instead. This ensures that these packages are no longer directly tied to our application's main module.

Generated controllers after schema change

Update rancher/pkg/apis version to the latest in Rancher and management.cattle.io schema

Remove unused kubernetes client and related dependencies

This commit eliminates the instantiation of the kubernetes client along with the memory cache and the restmapper, which were unnecessarily present in the code. The related dependencies in the 'import' section were also removed. This is done to simplify the code and improve maintainability.

Remove unnecessary dynamic and K8s clients

This commit removes the Dynamic client from the Clients struct and the K8s client from the wrangler context. These clients were not being used, leading to unnecessary complexity and potential performance issues. This cleanup will streamline the code and improve maintainability.

Remove incompatible Rancher package, update imports, and enable code generation

The incompatible Rancher package was removed from go.mod, which necessitated changes in import statements in context.go and main.go. The 'management.cattle.io/v3' controllers and 'factory'-prefixed methods have been uncommented in main.go, enabling their code generation. A new settings.go file was added to the pkg/settings package.

Update go dependencies

This commit updates the versions of multiple dependencies in the go.mod and go.sum files. These changes are necessary to keep the project dependency versions up to date, resolving any potential issues from outdated dependencies or improving performance by

Add Wrangler generic controller, client, cache and associated resources

Added generic implementations for Wrangler Controllers, Clients, and Caches along with associated resources including Factory and options. Extracted methods to Get, List resources and manage indexes for non-namespaced and namespaced caches. Implemented methods to manage a Wrangler Context with functionalities like resource retrieval, cache management, and transaction handling. Created APIs to manage cloud credentials and cluster catalogs along with their caches. Start methods were introduced to initiate processes and register controllers. Other functionalities include agent management and handling the environment variable synchronization state.
2024-04-15 17:21:17 -05:00
igomez06 d6be7b6578 Moved the entire framework to the shepherd repo. Updated depencies, and moved packages that were in rancher/rancher into shepherd that are needed in the framework. 2023-12-06 14:19:32 -07:00