Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude schema registry and HTTP proxy config from 22.2.X deployment #544

Conversation

RafalKorepta
Copy link
Contributor

As version 22.2.X does not provide basic auth configuration option in both schema registry and panda proxy the client configuration for both services needs SASL credentails to be explicitly set in Redpanda configuration. That Redpanda configuration is generated in helm and sotred as config map which should not hold any credentails.

Newer version can take HTTP basic auth header to impersonate user and authenticate against Redpanda Kafka listener.

Additionally HTTP proxy and schema registry tests now are run when SASL is enabled

@RafalKorepta RafalKorepta changed the title Exclude schema registry and HTTP proxy from 22.2.X deployment Exclude schema registry and HTTP proxy config from 22.2.X deployment Jun 14, 2023
@RafalKorepta RafalKorepta force-pushed the rk/fix-22-2-x-schema-registry-and-panda-proxy-clients branch from 3bc4d35 to c8871b8 Compare June 14, 2023 15:54
RafalKorepta pushed a commit to RafalKorepta/helm-charts-1 that referenced this pull request Jun 15, 2023
The PR redpanda-data#544 does not pass
tests due to bug in Redpanda. The pandaproxy fix will be backported eventually
redpanda-data/redpanda#11425, but to unblock the
nightly build the test SASL mechanism should be change from `SCRAM-SHA-512`
to `SCRAM-SHA-256`.
@RafalKorepta
Copy link
Contributor Author

Tests are blocked by #547

@RafalKorepta RafalKorepta force-pushed the rk/fix-22-2-x-schema-registry-and-panda-proxy-clients branch 2 times, most recently from cdbfccd to aaf206a Compare June 15, 2023 20:20
@RafalKorepta
Copy link
Contributor Author

Test 05 was adjusted to use not default settings #550. I hope upgrade tests will pass now.

@@ -538,6 +538,10 @@ than 1 core.
{{- toJson (dict "bool" (or (not (eq .Values.image.repository "docker.redpanda.com/redpandadata/redpanda")) (include "redpanda.semver" . | semverCompare ">=22.2.10-0,<22.3"))) -}}
{{- end -}}

{{- define "redpanda-22-2-x-without-sasl" -}}
{{- toJson (dict "bool" (or (not (or (include "sasl-enabled" . | fromJson).bool .Values.listeners.kafka.authenticationMethod)) (include "redpanda-atleast-22-3-0" . | fromJson).bool)) -}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is accurate, I'd suggest this. The nested logic is way to hard to parse in my head.

Suggested change
{{- toJson (dict "bool" (or (not (or (include "sasl-enabled" . | fromJson).bool .Values.listeners.kafka.authenticationMethod)) (include "redpanda-atleast-22-3-0" . | fromJson).bool)) -}}
{{- $result := (include "redpanda-atleast-22-3-0" . | fromJson).bool -}}
{{- if or (include "sasl-enabled" . | fromJson).bool .Values.listeners.kafka.authenticationMethod)) -}}
{{- $result := false -}}
{{- end -}}
{{- toJson (dict "bool" $result -}}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not that proficient in templating langue. If I could code this in go :)

Comment included into next push

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It IS go! 😁

Comment on lines +65 to +74
{{- if or (include "sasl-enabled" .|fromJson).bool .Values.listeners.schemaRegistry.authenticationMethod }}
-u $USERNAME:$PASSWORD \
{{- end }}
{{- if $cert.caEnabled }}
--cacert /etc/tls/certs/{{ $service.tls.cert }}/ca.crt \
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is repeated for each command. What do you think about putting it in a function?

schemaCurl () {
          {{- if or (include "sasl-enabled" .|fromJson).bool .Values.listeners.schemaRegistry.authenticationMethod }}
          -u $USERNAME:$PASSWORD \
          {{- end }}
          {{- if $cert.caEnabled }}
          --cacert /etc/tls/certs/{{ $service.tls.cert }}/ca.crt \
          {{- end }} $1
}
schemaCurl https://{{ include "redpanda.internal.domain" . }}:{{ .Values.listeners.schemaRegistry.port }}/subjects/sensor-value/versions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great suggestion

Comment on lines 56 to 66
curl -svm3 --fail --retry "120" --retry-max-time "120" --retry-all-errors \
-X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" \
-d '{"schema": "{\"type\":\"record\",\"name\":\"sensor_sample\",\"fields\":[{\"name\":\"timestamp\",\"type\":\"long\",\"logicalType\":\"timestamp-millis\"},{\"name\":\"identifier\",\"type\":\"string\",\"logicalType\":\"uuid\"},{\"name\":\"value\",\"type\":\"long\"}]}"}' \
{{- if or (include "sasl-enabled" .|fromJson).bool .Values.listeners.schemaRegistry.authenticationMethod }}
-u $USERNAME:$PASSWORD \
{{- end }}
http://{{ include "redpanda.internal.domain" . }}:{{ .Values.listeners.schemaRegistry.port }}/subjects/sensor-value/versions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar to above, could this be made a little more DRY?

Copy link
Contributor

@joejulian joejulian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only change I'd like to see for sure is the breaking up of the compound logic. The other suggestions are just nice-to-haves.

@RafalKorepta RafalKorepta force-pushed the rk/fix-22-2-x-schema-registry-and-panda-proxy-clients branch from aaf206a to f962c4c Compare June 15, 2023 23:41
As version 22.2.X does not provide basic auth configuration option in both
schema registry and panda proxy the client configuration for both services
needs SASL credentails to be explicitly set in Redpanda configuration. That
Redpanda configuration is generated in helm and sotred as config map which
should not hold any credentails.

Newer version can take HTTP basic auth header to impersonate user and
authenticate against Redpanda Kafka listener.

Additionally HTTP proxy and schema registry tests now are run when SASL is enabled
@RafalKorepta RafalKorepta force-pushed the rk/fix-22-2-x-schema-registry-and-panda-proxy-clients branch from f962c4c to 640adec Compare June 16, 2023 12:40
@joejulian joejulian merged commit b166304 into redpanda-data:main Jun 16, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants