Skip to content

Commit

Permalink
chore: print logs
Browse files Browse the repository at this point in the history
Signed-off-by: AlexsJones <[email protected]>
  • Loading branch information
AlexsJones committed Jan 16, 2025
1 parent f73ad42 commit 9b81360
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions api/v1alpha1/mutation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ type MutationStatus struct {
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// Display in wide format
// +kubebuilder:printcolumn:name="Resource",type="string",JSONPath=".spec.resource.name",description="The resource to mutate"
// Display in wide format the autoremediationphase status
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="The phase of the autoremediation"
// Mutation is the Schema for the mutations API.
type Mutation struct {
metav1.TypeMeta `json:",inline"`
Expand Down
8 changes: 4 additions & 4 deletions config/crd/bases/core.k8sgpt.ai_mutations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ spec:
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: The resource to mutate
jsonPath: .spec.resource.name
name: Resource
- description: The phase of the autoremediation
jsonPath: .status.phase
name: Phase
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: |-
Display in wide format
Display in wide format the autoremediationphase status
Mutation is the Schema for the mutations API.
properties:
apiVersion:
Expand Down
3 changes: 2 additions & 1 deletion internal/controller/mutation/mutation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (r *MutationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
obj := &unstructured.Unstructured{}
obj.SetGroupVersionKind(gvk)

fmt.Println(mutation.Spec.TargetConfiguration)
mutationControllerLog.Info(mutation.Spec.TargetConfiguration)

// 3. Decode the targetConfiguration into the unstructured object
decoder := yaml.NewYAMLOrJSONDecoder(strings.NewReader(mutation.Spec.TargetConfiguration), 1000)
Expand Down Expand Up @@ -163,6 +163,7 @@ func (r *MutationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
break
case corev1alpha1.AutoRemediationPhaseCompleted:
// this is when the execute/apply is completed
mutationControllerLog.Info("Mutation has been completed", "mutation", mutation.Name)
break
case corev1alpha1.AutoRemediationPhaseFailed:
// This phase will occur when a result does not expire after phase completed
Expand Down

0 comments on commit 9b81360

Please sign in to comment.