Skip to content

Commit

Permalink
Merge pull request #197 from DataWorkflowServices/release-v0.1.1
Browse files Browse the repository at this point in the history
Release v0.1.1
  • Loading branch information
roehrich-hpe committed May 1, 2024
2 parents 302bebe + 8aa4833 commit 25c9400
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 28 deletions.
15 changes: 14 additions & 1 deletion api/v1alpha1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ func (src *ClientMount) ConvertTo(dstRaw conversion.Hub) error {
dst.Status.Error.Severity = dwsv1alpha2.SeverityFatal
}

// v1alpha2 added a rollup of all the mounts' ready flags
if hasAnno {
dst.Status.AllReady = restored.Status.AllReady
} else {
dst.Status.AllReady = true
for _, mount := range src.Status.Mounts {
if !mount.Ready {
dst.Status.AllReady = false
break
}
}
}

return nil
}

Expand Down Expand Up @@ -398,7 +411,7 @@ func (dst *SystemConfiguration) ConvertFrom(srcRaw conversion.Hub) error {
dst.Spec.ComputeNodes = computes

// Preserve Hub data on down-conversion except for metadata.
return utilconversion.MarshalData(src, dst)
return nil // utilconversion.MarshalData(src, dst)
}

func (src *Workflow) ConvertTo(dstRaw conversion.Hub) error {
Expand Down
13 changes: 7 additions & 6 deletions api/v1alpha1/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import (

fuzz "github.com/google/gofuzz"
. "github.com/onsi/ginkgo/v2"
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"

//"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"

dwsv1alpha2 "github.com/DataWorkflowServices/dws/api/v1alpha2"
Expand Down Expand Up @@ -68,11 +69,11 @@ func TestFuzzyConversion(t *testing.T) {
Spoke: &Storage{},
}))

t.Run("for SystemConfiguration", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
Hub: &dwsv1alpha2.SystemConfiguration{},
Spoke: &SystemConfiguration{},
FuzzerFuncs: []fuzzer.FuzzerFuncs{SystemConfigurationFuzzFunc},
}))
//t.Run("for SystemConfiguration", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
// Hub: &dwsv1alpha2.SystemConfiguration{},
// Spoke: &SystemConfiguration{},
// FuzzerFuncs: []fuzzer.FuzzerFuncs{SystemConfigurationFuzzFunc},
//}))

t.Run("for Workflow", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
Hub: &dwsv1alpha2.Workflow{},
Expand Down
8 changes: 5 additions & 3 deletions api/v1alpha2/clientmount_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,18 @@ type ClientMountStatus struct {
// List of mount statuses
Mounts []ClientMountInfoStatus `json:"mounts"`

// Rollup of each mounts ready status
AllReady bool `json:"allReady"`

// Error information
ResourceError `json:",inline"`
}

//+kubebuilder:object:root=true
//+kubebuilder:storageversion
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="DESIREDSTATE",type="string",JSONPath=".status.desiredState",description="mounted/unmounted"
//+kubebuilder:printcolumn:name="STATE",type="string",JSONPath=".status.state",description="mounted/unmounted"
//+kubebuilder:printcolumn:name="READY",type="boolean",JSONPath=".status.ready",description="True if current state is achieved"
//+kubebuilder:printcolumn:name="DESIREDSTATE",type="string",JSONPath=".spec.desiredState",description="The desired state"
//+kubebuilder:printcolumn:name="READY",type="boolean",JSONPath=".status.allReady",description="True if desired state is achieved"
//+kubebuilder:printcolumn:name="ERROR",type="string",JSONPath=".status.error.severity"
//+kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,12 @@ spec:
subresources:
status: {}
- additionalPrinterColumns:
- description: mounted/unmounted
jsonPath: .status.desiredState
- description: The desired state
jsonPath: .spec.desiredState
name: DESIREDSTATE
type: string
- description: mounted/unmounted
jsonPath: .status.state
name: STATE
type: string
- description: True if current state is achieved
jsonPath: .status.ready
- description: True if desired state is achieved
jsonPath: .status.allReady
name: READY
type: boolean
- jsonPath: .status.error.severity
Expand Down Expand Up @@ -513,6 +509,9 @@ spec:
status:
description: ClientMountStatus defines the observed state of ClientMount
properties:
allReady:
description: Rollup of each mounts ready status
type: boolean
error:
description: Error information
properties:
Expand Down Expand Up @@ -564,6 +563,7 @@ spec:
type: object
type: array
required:
- allReady
- mounts
type: object
type: object
Expand Down
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ kind: Kustomization
images:
- name: controller
newName: ghcr.io/dataworkflowservices/dws
newTag: 0.1.0
newTag: 0.1.1
1 change: 1 addition & 0 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ resources:
- leader_election_role_binding.yaml
- webhook_role.yaml
- webhook_role_binding.yaml
- workload_manager_role.yaml
# Comment the following 4 lines if you want to disable
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
# which protects your /metrics endpoint.
Expand Down
1 change: 1 addition & 0 deletions controllers/clientmount_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func (r *ClientMountReconciler) Reconcile(ctx context.Context, req ctrl.Request)
for i := range clientMount.Spec.Mounts {
clientMount.Status.Mounts[i].Ready = true
}
clientMount.Status.AllReady = true

clientMount.Status.Error = nil

Expand Down
18 changes: 9 additions & 9 deletions internal/controller/conversion_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Hewlett Packard Enterprise Development LP
* Copyright 2023-2024 Hewlett Packard Enterprise Development LP
* Other additional copyright holders may be indicated within.
*
* The entirety of this work is licensed under the Apache License,
Expand Down Expand Up @@ -365,14 +365,14 @@ var _ = Describe("Conversion Webhook Test", func() {
})

It("reads SystemConfiguration resource via hub and via spoke", func() {
// Spoke should have annotation.
resSpoke := &dwsv1alpha1.SystemConfiguration{}
Eventually(func(g Gomega) {
g.Expect(k8sClient.Get(context.TODO(), client.ObjectKeyFromObject(resHub), resSpoke)).To(Succeed())
anno := resSpoke.GetAnnotations()
g.Expect(anno).To(HaveLen(1))
g.Expect(anno).Should(HaveKey(utilconversion.DataAnnotation))
}).Should(Succeed())
//// Spoke should have annotation.
//resSpoke := &dwsv1alpha1.SystemConfiguration{}
//Eventually(func(g Gomega) {
// g.Expect(k8sClient.Get(context.TODO(), client.ObjectKeyFromObject(resHub), resSpoke)).To(Succeed())
// anno := resSpoke.GetAnnotations()
// g.Expect(anno).To(HaveLen(1))
// g.Expect(anno).Should(HaveKey(utilconversion.DataAnnotation))
//}).Should(Succeed())

// Hub should not have annotation.
Eventually(func(g Gomega) {
Expand Down

0 comments on commit 25c9400

Please sign in to comment.