Skip to content

Commit

Permalink
Revert deprecation of useInsecureCookies in #310
Browse files Browse the repository at this point in the history
  • Loading branch information
sgburtsev committed Jul 30, 2024
1 parent 8092e2c commit d0c6e3f
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 24 deletions.
4 changes: 2 additions & 2 deletions api/v1/ytsaurus_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,9 @@ type UISpec struct {
ServiceType corev1.ServiceType `json:"serviceType,omitempty"`
HttpNodePort *int32 `json:"httpNodePort,omitempty"`
// If defined allows insecure (over http) authentication.
// Deprecated: use `secure` instead.
//+kubebuilder:default:=true
//+optional
UseInsecureCookies *bool `json:"useInsecureCookies"`
UseInsecureCookies bool `json:"useInsecureCookies"`
// Use secure connection to the cluster's http-proxies.
//+kubebuilder:default:=false
//+optional
Expand Down
25 changes: 10 additions & 15 deletions api/v1/ytsaurus_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,22 +401,17 @@ func (r *Ytsaurus) validateYQLAgents(*Ytsaurus) field.ErrorList {
func (r *Ytsaurus) validateUi(*Ytsaurus) field.ErrorList {
var allErrors field.ErrorList

if r.Spec.UI != nil {
if r.Spec.UI.UseInsecureCookies != nil && !*r.Spec.UI.UseInsecureCookies && !r.Spec.UI.Secure {
allErrors = append(allErrors, field.Invalid(field.NewPath("spec", "ui", "useInsecureCookies"), r.Spec.UI.UseInsecureCookies, "useInsecureCookies is deprecated, use secure instead"))
}
if r.Spec.UI.Secure {
for i, hp := range r.Spec.HTTPProxies {
if hp.Role != consts.DefaultHTTPProxyRole {
continue
}
if hp.Transport.HTTPSSecret == nil {
allErrors = append(allErrors, field.Required(
field.NewPath("spec", "httpProxies").Index(i).Child("transport", "httpsSecret"),
fmt.Sprintf("configured HTTPS for proxy with `%s` role is required for ui.secure", consts.DefaultHTTPProxyRole)))
}
break
if r.Spec.UI != nil && r.Spec.UI.Secure {
for i, hp := range r.Spec.HTTPProxies {
if hp.Role != consts.DefaultHTTPProxyRole {
continue
}
if hp.Transport.HTTPSSecret == nil {
allErrors = append(allErrors, field.Required(
field.NewPath("spec", "httpProxies").Index(i).Child("transport", "httpsSecret"),
fmt.Sprintf("configured HTTPS for proxy with `%s` role is required for ui.secure", consts.DefaultHTTPProxyRole)))
}
break
}
}

Expand Down
5 changes: 0 additions & 5 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/crd/bases/cluster.ytsaurus.tech_ytsaurus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34566,6 +34566,7 @@ spec:
default: lavander
type: string
useInsecureCookies:
default: true
description: If defined allows insecure (over http) authentication.
type: boolean
type: object
Expand Down
2 changes: 1 addition & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ _Appears in:_
| `image` _string_ | | | |
| `serviceType` _[ServiceType](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#servicetype-v1-core)_ | | NodePort | |
| `httpNodePort` _integer_ | | | |
| `useInsecureCookies` _boolean_ | If defined allows insecure (over http) authentication.<br />Deprecated: use `secure` instead. | | |
| `useInsecureCookies` _boolean_ | If defined allows insecure (over http) authentication. | true | |
| `secure` _boolean_ | Use secure connection to the cluster's http-proxies. | false | |
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#resourcerequirements-v1-core)_ | | | |
| `instanceCount` _integer_ | | | |
Expand Down
2 changes: 1 addition & 1 deletion pkg/components/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (u *UI) syncComponents(ctx context.Context) (err error) {
},
}

if !ytsaurusResource.Spec.UI.Secure {
if ytsaurusResource.Spec.UI.UseInsecureCookies {
env = append(env, corev1.EnvVar{
Name: "YT_AUTH_ALLOW_INSECURE",
Value: "1",
Expand Down
1 change: 1 addition & 0 deletions ytop-chart/templates/ytsaurus-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34353,6 +34353,7 @@ spec:
default: lavander
type: string
useInsecureCookies:
default: true
description: If defined allows insecure (over http) authentication.
type: boolean
type: object
Expand Down

0 comments on commit d0c6e3f

Please sign in to comment.