Merge branch 'main' into 5048-CSI-snapshot-timeout-configurable

This commit is contained in:
Xun Jiang/Bruce Jiang
2022-08-08 17:18:44 +08:00
committed by GitHub
137 changed files with 4459 additions and 3293 deletions
+13
View File
@@ -17,9 +17,11 @@ limitations under the License.
package builder
import (
"encoding/json"
"strings"
corev1api "k8s.io/api/core/v1"
apimachineryRuntime "k8s.io/apimachinery/pkg/runtime"
)
// ContainerBuilder builds Container objects
@@ -89,6 +91,17 @@ func (b *ContainerBuilder) Result() *corev1api.Container {
return b.object
}
// ResultRawExtension returns the Container as runtime.RawExtension.
func (b *ContainerBuilder) ResultRawExtension() apimachineryRuntime.RawExtension {
result, err := json.Marshal(b.object)
if err != nil {
return apimachineryRuntime.RawExtension{}
}
return apimachineryRuntime.RawExtension{
Raw: result,
}
}
// Args sets the container's Args.
func (b *ContainerBuilder) Args(args ...string) *ContainerBuilder {
b.object.Args = append(b.object.Args, args...)