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

Upgrade operator-sdk to 1.38.0 #1040

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Upgrade operator-sdk to 1.38.0 #1040

wants to merge 14 commits into from

Conversation

cchen-vertica
Copy link
Collaborator

This PR upgraded operator-sdk from 1.28.0 to 1.38.0. Refer to this page for the operator side changes: https://sdk.operatorframework.io/docs/upgrading-sdk-version/v1.38.0/. Refer to this page for the controller-runtime API changes: https://github.com/kubernetes-sigs/controller-runtime/tree/v0.18.4.

@cchen-vertica
Copy link
Collaborator Author

Now I am still fixing the option "prometheus.expose=EnableWithAuthProxy", I cannot provide a custom tlsSecret to the manager. There aren't any logs from controller-runtime. After that issue is fixed, I will test rbac role authentication and then mark this PR to be ready.

@roypaulin
Copy link
Collaborator

You did not need any library upgrades?

# using the proxy (see https://github.com/brancz/kube-rbac-proxy). The
# metrics endpoint will use the https scheme.
# EnableWithoutAuth: Like EnableWithAuthProxy, this will create a service
# EnableWithAuth: A new service object will be created that exposes the
Copy link
Collaborator

Choose a reason for hiding this comment

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

does EnableWithAuth also a tls secret?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, EnableWithAuth could not provide tls certs when accessing the metrics url.

Comment on lines +291 to +292
secureMetrics := strings.EqualFold(opcfg.GetMetricsExposeMode(), "EnableWithAuth")
secureByTLS := strings.EqualFold(opcfg.GetMetricsExposeMode(), "EnableWithTLS")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's move these to opcfg package: add 2 methods that will do the comparison there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, I can add that.

secureMetrics := strings.EqualFold(opcfg.GetMetricsExposeMode(), "EnableWithAuth")
secureByTLS := strings.EqualFold(opcfg.GetMetricsExposeMode(), "EnableWithTLS")
var metricCertDir string
if opcfg.GetMetricsTLSSecret() != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't it better to complain if EnableWithTLS but no secret is passed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is fine. Normally, the token is good enough to verify the user's identity. No need to use tls secret for "EnableWithTLS".

Comment on lines +326 to +327
// TLSOpts is used to allow configuring the TLS config used for the server. If certificates are
// not provided, self-signed certificates will be generated by default. This option is not recommended for
Copy link
Collaborator

Choose a reason for hiding this comment

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

Who is going to generate self-signed certs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The controller-runtime will generate it.

# Set this to true if you want to create a ServiceMonitor. This object is a
# CR provided by the prometheus operator to allow for easy service discovery.
# https://github.com/prometheus-operator/prometheus-operator
createServiceMonitor: false
Copy link
Collaborator

Choose a reason for hiding this comment

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

You removed this but still kept monitor.yaml in config/prometheus

Copy link
Collaborator Author

@cchen-vertica cchen-vertica Feb 3, 2025

Choose a reason for hiding this comment

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

monitor.yaml in config/prometheus is generated by new operator-sdk. I leave it there in case we want to put service monitor back. In kustomization.yaml, we can uncomment the line contains "prometheus" to generate the monitor manifest.

@@ -6,7 +6,7 @@ generatorOptions:

configMapGenerator:
- envs:
- operator-envs
- operator-envs-with-value
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where is operator-envs-with-value file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's an internal file which is ignored by .gitignore.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't update this instead of removing it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will put this test back.

set:
prometheus:
expose: EnableWithoutAuth
asserts:
- equal:
path: data.METRICS_ADDR
value: :8443
- it: should include proxy sidecar if expose is with auth
- it: should cotain ip if expose is with auth
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- it: should cotain ip if expose is with auth
- it: should contain ip if expose is with auth

@@ -38,7 +38,15 @@ func GetIsWebhookEnabled() bool {

// GetBroadcasterBurstSize returns the customizable burst size for broadcaster.
func GetBroadcasterBurstSize() int {
burstSize := lookupIntEnvVar("BROADCASTER_BURST_SIZE", envCanNotExist)
envName := "BROADCASTER_BURST_SIZE"
burstSizeStr := lookupStringEnvVar(envName, envCanNotExist)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason why this is now a string?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This variable is an optional one. If the variable is not set, the old code cannot convert it to an integer so the operator will fail to start.

Comment on lines +313 to +341
name: verticadb-sample
fieldPaths:
- spec.sidecars.[name=vlogger].image
- select:
kind: VerticaDB
name: v-k-safety-0-scaling
fieldPaths:
- spec.sidecars.[name=vlogger].image
- select:
kind: VerticaDB
name: v-scale-up-and-down
fieldPaths:
- spec.sidecars.[name=vlogger].image
- select:
kind: VerticaDB
name: v-kill
fieldPaths:
- spec.sidecars.[name=vlogger].image
- select:
kind: VerticaDB
name: v-auto-restart-vertica
fieldPaths:
- spec.sidecars.[name=vlogger].image
- select:
kind: VerticaDB
name: v-client-proxy-upgrade
fieldPaths:
- spec.sidecars.[name=vlogger].image
- select:
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do we need this for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is for the tests that need vlogger sidecar. The new operator-sdk is using new kustomize binary which is more strict than before. Without these changes, kustomization will fail.

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