feat: upgrade to DWO 0.22.0 (#1736)
* feat: upgrade to DWO 0.22.0 Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com> * chore: run go mod vendor Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com> --------- Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>pull/1738/head
parent
0128427329
commit
923972e91e
2
go.mod
2
go.mod
|
|
@ -5,7 +5,7 @@ go 1.18
|
|||
require (
|
||||
github.com/che-incubator/kubernetes-image-puller-operator v0.0.0-20210929175054-0128446f5af7
|
||||
github.com/devfile/api/v2 v2.2.1-alpha.0.20230413012049-a6c32fca0dbd
|
||||
github.com/devfile/devworkspace-operator v0.21.0
|
||||
github.com/devfile/devworkspace-operator v0.22.0
|
||||
github.com/go-logr/logr v1.2.3
|
||||
github.com/golang/mock v1.5.0
|
||||
github.com/google/go-cmp v0.5.9
|
||||
|
|
|
|||
4
go.sum
4
go.sum
|
|
@ -102,8 +102,8 @@ github.com/deislabs/oras v0.8.1/go.mod h1:Mx0rMSbBNaNfY9hjpccEnxkOqJL6KGjtxNHPLC
|
|||
github.com/denisenkom/go-mssqldb v0.0.0-20190204142019-df6d76eb9289/go.mod h1:xN/JuLBIz4bjkxNmByTiV1IbhfnYb6oo99phBn4Eqhc=
|
||||
github.com/devfile/api/v2 v2.2.1-alpha.0.20230413012049-a6c32fca0dbd h1:HpGR728CfB6BB9ZuFtQb0UeTIYNFgpuGsuoMOJNMUTM=
|
||||
github.com/devfile/api/v2 v2.2.1-alpha.0.20230413012049-a6c32fca0dbd/go.mod h1:qp8jcw12y1JdCsxjK/7LJ7uWaJOxcY1s2LUk5PhbkbM=
|
||||
github.com/devfile/devworkspace-operator v0.21.0 h1:AiN2HEBpBkYoOcKClFZsOut46zKhsMIlHwmjI+OB2Oc=
|
||||
github.com/devfile/devworkspace-operator v0.21.0/go.mod h1:42cQKSbE+Zdqez8X5IqlEfdeeA0a/LkOTe2kkekJX6c=
|
||||
github.com/devfile/devworkspace-operator v0.22.0 h1:Q2w419Y4E5yOYxIY6LI4u4fHi5YewKQsRIN1J4Jlh3Q=
|
||||
github.com/devfile/devworkspace-operator v0.22.0/go.mod h1:42cQKSbE+Zdqez8X5IqlEfdeeA0a/LkOTe2kkekJX6c=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/dhui/dktest v0.3.2/go.mod h1:l1/ib23a/CmxAe7yixtrYPc8Iy90Zy2udyaHINM5p58=
|
||||
github.com/docker/cli v0.0.0-20200130152716-5d0cf8839492 h1:FwssHbCDJD025h+BchanCwE1Q8fyMgqDr2mOQAWOLGw=
|
||||
|
|
|
|||
|
|
@ -98,6 +98,9 @@ type WorkspaceConfig struct {
|
|||
// DefaultStorageSize defines an optional struct with fields to specify the sizes of Persistent Volume Claims for storage
|
||||
// classes used by DevWorkspaces.
|
||||
DefaultStorageSize *StorageSizes `json:"defaultStorageSize,omitempty"`
|
||||
// PersistUserHome defines configuration options for persisting the `/home/user/`
|
||||
// directory in workspaces.
|
||||
PersistUserHome *PersistentHomeConfig `json:"persistUserHome,omitempty"`
|
||||
// IdleTimeout determines how long a workspace should sit idle before being
|
||||
// automatically scaled down. Proper functionality of this configuration property
|
||||
// requires support in the workspace being started. If not specified, the default
|
||||
|
|
@ -135,6 +138,19 @@ type WorkspaceConfig struct {
|
|||
// SchedulerName is the name of the pod scheduler for DevWorkspace pods.
|
||||
// If not specified, the pod scheduler is set to the default scheduler on the cluster.
|
||||
SchedulerName string `json:"schedulerName,omitempty"`
|
||||
// DefaultContainerResources defines the resource requirements (memory/cpu limit/request) used for
|
||||
// container components that do not define limits or requests. In order to not set a field by default,
|
||||
// the value "0" should be used. By default, the memory limit is 128Mi and the memory request is 64Mi.
|
||||
// No CPU limit or request is added by default.
|
||||
DefaultContainerResources *corev1.ResourceRequirements `json:"defaultContainerResources,omitempty"`
|
||||
}
|
||||
|
||||
type PersistentHomeConfig struct {
|
||||
// Determines whether the `/home/user/` directory in workspaces should persist between
|
||||
// workspace shutdown and startup.
|
||||
// Must be used with the 'per-user'/'common' or 'per-workspace' storage class in order to take effect.
|
||||
// Disabled by default.
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
}
|
||||
|
||||
type Proxy struct {
|
||||
|
|
|
|||
|
|
@ -375,6 +375,26 @@ func (in *OperatorConfiguration) DeepCopy() *OperatorConfiguration {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PersistentHomeConfig) DeepCopyInto(out *PersistentHomeConfig) {
|
||||
*out = *in
|
||||
if in.Enabled != nil {
|
||||
in, out := &in.Enabled, &out.Enabled
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersistentHomeConfig.
|
||||
func (in *PersistentHomeConfig) DeepCopy() *PersistentHomeConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PersistentHomeConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PodAdditions) DeepCopyInto(out *PodAdditions) {
|
||||
*out = *in
|
||||
|
|
@ -594,6 +614,11 @@ func (in *WorkspaceConfig) DeepCopyInto(out *WorkspaceConfig) {
|
|||
*out = new(StorageSizes)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.PersistUserHome != nil {
|
||||
in, out := &in.PersistUserHome, &out.PersistUserHome
|
||||
*out = new(PersistentHomeConfig)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.IgnoredUnrecoverableEvents != nil {
|
||||
in, out := &in.IgnoredUnrecoverableEvents, &out.IgnoredUnrecoverableEvents
|
||||
*out = make([]string, len(*in))
|
||||
|
|
@ -619,6 +644,11 @@ func (in *WorkspaceConfig) DeepCopyInto(out *WorkspaceConfig) {
|
|||
*out = new(v1alpha2.DevWorkspaceTemplateSpecContent)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.DefaultContainerResources != nil {
|
||||
in, out := &in.DefaultContainerResources, &out.DefaultContainerResources
|
||||
*out = new(v1.ResourceRequirements)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceConfig.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ var routeAnnotations = func(endpointName string) map[string]string {
|
|||
|
||||
var nginxIngressAnnotations = func(endpointName string) map[string]string {
|
||||
return map[string]string{
|
||||
"kubernetes.io/ingress.class": "nginx",
|
||||
"nginx.ingress.kubernetes.io/rewrite-target": "/",
|
||||
"nginx.ingress.kubernetes.io/ssl-redirect": "false",
|
||||
constants.DevWorkspaceEndpointNameAnnotation: endpointName,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import (
|
|||
networkingv1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/utils/pointer"
|
||||
)
|
||||
|
||||
type DevWorkspaceMetadata struct {
|
||||
|
|
@ -223,6 +224,7 @@ func getIngressForEndpoint(routingSuffix string, endpoint controllerv1alpha1.End
|
|||
Annotations: nginxIngressAnnotations(endpoint.Name),
|
||||
},
|
||||
Spec: networkingv1.IngressSpec{
|
||||
IngressClassName: pointer.String("nginx"),
|
||||
Rules: []networkingv1.IngressRule{
|
||||
{
|
||||
Host: hostname,
|
||||
|
|
|
|||
|
|
@ -43,9 +43,12 @@ var defaultConfig = &v1alpha1.OperatorConfiguration{
|
|||
Common: &commonStorageSize,
|
||||
PerWorkspace: &perWorkspaceStorageSize,
|
||||
},
|
||||
PersistUserHome: &v1alpha1.PersistentHomeConfig{
|
||||
Enabled: pointer.Bool(false),
|
||||
},
|
||||
IdleTimeout: "15m",
|
||||
ProgressTimeout: "5m",
|
||||
CleanupOnStop: pointer.BoolPtr(false),
|
||||
CleanupOnStop: pointer.Bool(false),
|
||||
PodSecurityContext: nil,
|
||||
ContainerSecurityContext: &corev1.SecurityContext{},
|
||||
DefaultTemplate: nil,
|
||||
|
|
@ -61,6 +64,14 @@ var defaultConfig = &v1alpha1.OperatorConfiguration{
|
|||
},
|
||||
},
|
||||
},
|
||||
DefaultContainerResources: &corev1.ResourceRequirements{
|
||||
Limits: corev1.ResourceList{
|
||||
corev1.ResourceMemory: resource.MustParse("128Mi"),
|
||||
},
|
||||
Requests: corev1.ResourceList{
|
||||
corev1.ResourceMemory: resource.MustParse("64Mi"),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ func mergeConfig(from, to *controller.OperatorConfiguration) {
|
|||
to.Workspace.ServiceAccount.ServiceAccountName = from.Workspace.ServiceAccount.ServiceAccountName
|
||||
}
|
||||
if from.Workspace.ServiceAccount.DisableCreation != nil {
|
||||
to.Workspace.ServiceAccount.DisableCreation = pointer.BoolPtr(*from.Workspace.ServiceAccount.DisableCreation)
|
||||
to.Workspace.ServiceAccount.DisableCreation = pointer.Bool(*from.Workspace.ServiceAccount.DisableCreation)
|
||||
}
|
||||
if from.Workspace.ServiceAccount.ServiceAccountTokens != nil {
|
||||
to.Workspace.ServiceAccount.ServiceAccountTokens = from.Workspace.ServiceAccount.ServiceAccountTokens
|
||||
|
|
@ -327,6 +327,14 @@ func mergeConfig(from, to *controller.OperatorConfiguration) {
|
|||
to.Workspace.DefaultStorageSize.PerWorkspace = &perWorkspaceSizeCopy
|
||||
}
|
||||
}
|
||||
if from.Workspace.PersistUserHome != nil {
|
||||
if to.Workspace.PersistUserHome == nil {
|
||||
to.Workspace.PersistUserHome = &controller.PersistentHomeConfig{}
|
||||
}
|
||||
if from.Workspace.PersistUserHome.Enabled != nil {
|
||||
to.Workspace.PersistUserHome.Enabled = from.Workspace.PersistUserHome.Enabled
|
||||
}
|
||||
}
|
||||
if from.Workspace.DefaultTemplate != nil {
|
||||
templateSpecContentCopy := from.Workspace.DefaultTemplate.DeepCopy()
|
||||
to.Workspace.DefaultTemplate = templateSpecContentCopy
|
||||
|
|
@ -357,6 +365,12 @@ func mergeConfig(from, to *controller.OperatorConfiguration) {
|
|||
to.Workspace.ProjectCloneConfig.Env = from.Workspace.ProjectCloneConfig.Env
|
||||
}
|
||||
}
|
||||
if from.Workspace.DefaultContainerResources != nil {
|
||||
if to.Workspace.DefaultContainerResources == nil {
|
||||
to.Workspace.DefaultContainerResources = &corev1.ResourceRequirements{}
|
||||
}
|
||||
to.Workspace.DefaultContainerResources = mergeResources(from.Workspace.DefaultContainerResources, to.Workspace.DefaultContainerResources)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -500,6 +514,11 @@ func GetCurrentConfigString(currConfig *controller.OperatorConfiguration) string
|
|||
config = append(config, fmt.Sprintf("workspace.defaultStorageSize.perWorkspace=%s", workspace.DefaultStorageSize.PerWorkspace.String()))
|
||||
}
|
||||
}
|
||||
if workspace.PersistUserHome != nil {
|
||||
if workspace.PersistUserHome.Enabled != nil && *workspace.PersistUserHome.Enabled != *defaultConfig.Workspace.PersistUserHome.Enabled {
|
||||
config = append(config, fmt.Sprintf("workspace.persistUserHome.enabled=%t", *workspace.PersistUserHome.Enabled))
|
||||
}
|
||||
}
|
||||
if !reflect.DeepEqual(workspace.PodSecurityContext, defaultConfig.Workspace.PodSecurityContext) {
|
||||
config = append(config, "workspace.podSecurityContext is set")
|
||||
}
|
||||
|
|
@ -526,6 +545,9 @@ func GetCurrentConfigString(currConfig *controller.OperatorConfiguration) string
|
|||
config = append(config, "workspace.projectClone.resources is set")
|
||||
}
|
||||
}
|
||||
if !reflect.DeepEqual(workspace.DefaultContainerResources, defaultConfig.Workspace.DefaultContainerResources) {
|
||||
config = append(config, "workspace.defaultContainerResources is set")
|
||||
}
|
||||
}
|
||||
if currConfig.EnableExperimentalFeatures != nil && *currConfig.EnableExperimentalFeatures {
|
||||
config = append(config, "enableExperimentalFeatures=true")
|
||||
|
|
|
|||
|
|
@ -141,4 +141,8 @@ const (
|
|||
// container:
|
||||
// image: ...
|
||||
ContainerOverridesAttribute = "container-overrides"
|
||||
|
||||
// StarterProjectAttribute is an attribute applied to the top-level attributes in a DevWorkspace to specify which
|
||||
// starterProject in the workspace should be cloned.
|
||||
StarterProjectAttribute = "controller.devfile.io/use-starter-project"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -37,14 +37,12 @@ var (
|
|||
const (
|
||||
DefaultProjectsSourcesRoot = "/projects"
|
||||
|
||||
HomeUserDirectory = "/home/user/"
|
||||
|
||||
HomeVolumeName = "persistentHome"
|
||||
|
||||
ServiceAccount = "devworkspace"
|
||||
|
||||
SidecarDefaultMemoryLimit = "128M"
|
||||
SidecarDefaultMemoryRequest = "64M"
|
||||
|
||||
SidecarDefaultCpuLimit = "" // do not provide any value
|
||||
SidecarDefaultCpuRequest = "" // do not provide any value
|
||||
|
||||
PVCStorageSize = "10Gi"
|
||||
|
||||
// DevWorkspaceIDLoggerKey is the key used to log workspace ID in the reconcile
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ github.com/davecgh/go-spew/spew
|
|||
github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2
|
||||
github.com/devfile/api/v2/pkg/attributes
|
||||
github.com/devfile/api/v2/pkg/devfile
|
||||
# github.com/devfile/devworkspace-operator v0.21.0
|
||||
# github.com/devfile/devworkspace-operator v0.22.0
|
||||
## explicit; go 1.18
|
||||
github.com/devfile/devworkspace-operator/apis/controller/v1alpha1
|
||||
github.com/devfile/devworkspace-operator/controllers/controller/devworkspacerouting
|
||||
|
|
|
|||
Loading…
Reference in New Issue