Documentation ¶
Overview ¶
* Copyright (c) 2024. Devtron Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
* Copyright (c) 2024. Devtron Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- Variables
- func BuildResourceRef(gvk schema.GroupVersionKind, manifest unstructured.Unstructured, ...) *bean.ResourceRef
- type BuildNodeResponse
- type BuildNodesConfig
- type BuildNodesRequest
- type ChildObjects
- type ClusterConfig
- type CommonHelmService
- type CommonHelmServiceImpl
- func (impl *CommonHelmServiceImpl) BuildNodes(request *BuildNodesConfig) (*BuildNodeResponse, error)
- func (impl *CommonHelmServiceImpl) BuildResourceTree(appDetailRequest *client.AppDetailRequest, release *release.Release) (*bean.ResourceTreeResponse, error)
- func (impl *CommonHelmServiceImpl) GetHelmRelease(clusterConfig *client.ClusterConfig, namespace string, releaseName string) (*release.Release, error)
- func (impl *CommonHelmServiceImpl) GetResourceTreeForExternalResources(req *client.ExternalResourceTreeRequest) (*bean.ResourceTreeResponse, error)
- type GetNodeFromManifestRequest
- type GetNodeFromManifestResponse
- func (resp *GetNodeFromManifestResponse) WithDesiredOrLiveManifests(desiredOrLiveManifests ...*bean.DesiredOrLiveManifest) *GetNodeFromManifestResponse
- func (resp *GetNodeFromManifestResponse) WithHealthStatus(healthStatus *bean.HealthStatus) *GetNodeFromManifestResponse
- func (resp *GetNodeFromManifestResponse) WithNode(node *bean.ResourceNode) *GetNodeFromManifestResponse
- func (resp *GetNodeFromManifestResponse) WithParentResourceRef(resourceRef *bean.ResourceRef) *GetNodeFromManifestResponse
- type HelmReleaseStatusConfig
- type K8sService
- type K8sServiceImpl
- func (impl K8sServiceImpl) CanHaveChild(gvk schema.GroupVersionKind) bool
- func (impl K8sServiceImpl) GetChildGvrFromParentGvk(parentGvk schema.GroupVersionKind) ([]*k8sCommonBean.GvrAndScope, bool)
- func (impl K8sServiceImpl) GetChildObjects(restConfig *rest.Config, namespace string, parentGvk schema.GroupVersionKind, ...) ([]*unstructured.Unstructured, error)
- func (impl K8sServiceImpl) GetLiveManifest(restConfig *rest.Config, namespace string, gvk *schema.GroupVersionKind, ...) (*unstructured.Unstructured, *schema.GroupVersionResource, error)
- func (impl K8sServiceImpl) PatchResource(ctx context.Context, restConfig *rest.Config, ...) error
- type ParentChildGvkMapping
Constants ¶
This section is empty.
Variables ¶
var (
ErrorReleaseNotFoundOnCluster = errors.New("release not found")
)
Functions ¶
func BuildResourceRef ¶
func BuildResourceRef(gvk schema.GroupVersionKind, manifest unstructured.Unstructured, namespace string) *bean.ResourceRef
Types ¶
type BuildNodeResponse ¶
type BuildNodeResponse struct { Nodes []*bean.ResourceNode HealthStatusArray []*bean.HealthStatus }
func NewBuildNodeResponse ¶
func NewBuildNodeResponse() *BuildNodeResponse
func (*BuildNodeResponse) WithHealthStatusArray ¶
func (resp *BuildNodeResponse) WithHealthStatusArray(healthStatusArray []*bean.HealthStatus) *BuildNodeResponse
func (*BuildNodeResponse) WithNodes ¶
func (resp *BuildNodeResponse) WithNodes(nodes []*bean.ResourceNode) *BuildNodeResponse
type BuildNodesConfig ¶
type BuildNodesConfig struct { DesiredOrLiveManifests []*bean.DesiredOrLiveManifest BuildNodesRequest // contains filtered or unexported fields }
func NewBuildNodesRequest ¶
func NewBuildNodesRequest(buildNodesConfig *BuildNodesRequest) *BuildNodesConfig
func (*BuildNodesConfig) WithBatchWorker ¶
func (req *BuildNodesConfig) WithBatchWorker(buildNodesBatchSize int, logger *zap.SugaredLogger) *BuildNodesConfig
func (*BuildNodesConfig) WithDesiredOrLiveManifests ¶
func (req *BuildNodesConfig) WithDesiredOrLiveManifests(desiredOrLiveManifests ...*bean.DesiredOrLiveManifest) *BuildNodesConfig
type BuildNodesRequest ¶
type BuildNodesRequest struct { RestConfig *rest.Config ReleaseNamespace string ParentResourceRef *bean.ResourceRef }
func NewBuildNodesConfig ¶
func NewBuildNodesConfig(restConfig *rest.Config) *BuildNodesRequest
func (*BuildNodesRequest) WithParentResourceRef ¶
func (req *BuildNodesRequest) WithParentResourceRef(parentResourceRef *bean.ResourceRef) *BuildNodesRequest
func (*BuildNodesRequest) WithReleaseNamespace ¶
func (req *BuildNodesRequest) WithReleaseNamespace(releaseNamespace string) *BuildNodesRequest
type ChildObjects ¶
type ChildObjects struct { Group string `json:"group"` Version string `json:"version"` Resource string `json:"resource"` Scope meta.RESTScopeName `json:"scope"` }
func (ChildObjects) GetGvrAndScopeForChildObject ¶
func (r ChildObjects) GetGvrAndScopeForChildObject() *commonBean.GvrAndScope
type ClusterConfig ¶
type CommonHelmService ¶
type CommonHelmService interface { GetHelmRelease(clusterConfig *client.ClusterConfig, namespace string, releaseName string) (*release.Release, error) BuildResourceTree(appDetailRequest *client.AppDetailRequest, release *release.Release) (*bean.ResourceTreeResponse, error) BuildNodes(request *BuildNodesConfig) (*BuildNodeResponse, error) GetResourceTreeForExternalResources(req *client.ExternalResourceTreeRequest) (*bean.ResourceTreeResponse, error) }
type CommonHelmServiceImpl ¶
type CommonHelmServiceImpl struct {
// contains filtered or unexported fields
}
func NewCommonHelmServiceImpl ¶
func NewCommonHelmServiceImpl(logger *zap.SugaredLogger, k8sUtil k8sUtils.K8sService, converter converter.ClusterBeanConverter, k8sService K8sService, helmReleaseConfig *globalConfig.HelmReleaseConfig) *CommonHelmServiceImpl
func (*CommonHelmServiceImpl) BuildNodes ¶
func (impl *CommonHelmServiceImpl) BuildNodes(request *BuildNodesConfig) (*BuildNodeResponse, error)
BuildNodes builds Nodes from desired or live manifest.
- It uses recursive approach to build child Nodes.
- It uses batch worker to build child Nodes in parallel.
- Batch workers configuration is provided in BuildNodesConfig.
- NOTE: To avoid creating batch worker recursively, it does not use batch worker for child Nodes.
func (*CommonHelmServiceImpl) BuildResourceTree ¶
func (impl *CommonHelmServiceImpl) BuildResourceTree(appDetailRequest *client.AppDetailRequest, release *release.Release) (*bean.ResourceTreeResponse, error)
func (*CommonHelmServiceImpl) GetHelmRelease ¶
func (impl *CommonHelmServiceImpl) GetHelmRelease(clusterConfig *client.ClusterConfig, namespace string, releaseName string) (*release.Release, error)
func (*CommonHelmServiceImpl) GetResourceTreeForExternalResources ¶
func (impl *CommonHelmServiceImpl) GetResourceTreeForExternalResources(req *client.ExternalResourceTreeRequest) (*bean.ResourceTreeResponse, error)
type GetNodeFromManifestRequest ¶
type GetNodeFromManifestRequest struct { DesiredOrLiveManifest *bean.DesiredOrLiveManifest BuildNodesRequest }
func NewGetNodesFromManifest ¶
func NewGetNodesFromManifest(buildNodesConfig *BuildNodesRequest) *GetNodeFromManifestRequest
func (*GetNodeFromManifestRequest) WithDesiredOrLiveManifest ¶
func (req *GetNodeFromManifestRequest) WithDesiredOrLiveManifest(desiredOrLiveManifest *bean.DesiredOrLiveManifest) *GetNodeFromManifestRequest
type GetNodeFromManifestResponse ¶
type GetNodeFromManifestResponse struct { Node *bean.ResourceNode HealthStatus *bean.HealthStatus ResourceRef *bean.ResourceRef DesiredOrLiveChildrenManifests []*bean.DesiredOrLiveManifest }
func NewGetNodesFromManifestResponse ¶
func NewGetNodesFromManifestResponse() *GetNodeFromManifestResponse
func (*GetNodeFromManifestResponse) WithDesiredOrLiveManifests ¶
func (resp *GetNodeFromManifestResponse) WithDesiredOrLiveManifests(desiredOrLiveManifests ...*bean.DesiredOrLiveManifest) *GetNodeFromManifestResponse
func (*GetNodeFromManifestResponse) WithHealthStatus ¶
func (resp *GetNodeFromManifestResponse) WithHealthStatus(healthStatus *bean.HealthStatus) *GetNodeFromManifestResponse
func (*GetNodeFromManifestResponse) WithNode ¶
func (resp *GetNodeFromManifestResponse) WithNode(node *bean.ResourceNode) *GetNodeFromManifestResponse
func (*GetNodeFromManifestResponse) WithParentResourceRef ¶
func (resp *GetNodeFromManifestResponse) WithParentResourceRef(resourceRef *bean.ResourceRef) *GetNodeFromManifestResponse
type HelmReleaseStatusConfig ¶
type K8sService ¶
type K8sService interface { CanHaveChild(gvk schema.GroupVersionKind) bool GetLiveManifest(restConfig *rest.Config, namespace string, gvk *schema.GroupVersionKind, name string) (*unstructured.Unstructured, *schema.GroupVersionResource, error) GetChildObjects(restConfig *rest.Config, namespace string, parentGvk schema.GroupVersionKind, parentName string, parentApiVersion string) ([]*unstructured.Unstructured, error) PatchResource(ctx context.Context, restConfig *rest.Config, r *bean.KubernetesResourcePatchRequest) error }
type K8sServiceImpl ¶
type K8sServiceImpl struct {
// contains filtered or unexported fields
}
func NewK8sServiceImpl ¶
func NewK8sServiceImpl(logger *zap.SugaredLogger, helmReleaseConfig *globalConfig.HelmReleaseConfig) (*K8sServiceImpl, error)
func (K8sServiceImpl) CanHaveChild ¶
func (impl K8sServiceImpl) CanHaveChild(gvk schema.GroupVersionKind) bool
func (K8sServiceImpl) GetChildGvrFromParentGvk ¶
func (impl K8sServiceImpl) GetChildGvrFromParentGvk(parentGvk schema.GroupVersionKind) ([]*k8sCommonBean.GvrAndScope, bool)
func (K8sServiceImpl) GetChildObjects ¶
func (impl K8sServiceImpl) GetChildObjects(restConfig *rest.Config, namespace string, parentGvk schema.GroupVersionKind, parentName string, parentApiVersion string) ([]*unstructured.Unstructured, error)
func (K8sServiceImpl) GetLiveManifest ¶
func (impl K8sServiceImpl) GetLiveManifest(restConfig *rest.Config, namespace string, gvk *schema.GroupVersionKind, name string) (*unstructured.Unstructured, *schema.GroupVersionResource, error)
func (K8sServiceImpl) PatchResource ¶
func (impl K8sServiceImpl) PatchResource(ctx context.Context, restConfig *rest.Config, r *bean.KubernetesResourcePatchRequest) error
type ParentChildGvkMapping ¶
type ParentChildGvkMapping struct { Group string `json:"group"` Version string `json:"version"` Kind string `json:"kind"` ChildObjects []ChildObjects `json:"childObjects"` }
func (ParentChildGvkMapping) GetParentGvk ¶
func (r ParentChildGvkMapping) GetParentGvk() schema.GroupVersionKind