Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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

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

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

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,23 @@ spec:
volumeMounts:
- mountPath: /var/log/openshift-oauth-apiserver
name: work-logs
initContainers:
- args:
- -c
- |
#!/bin/sh
while ! nslookup etcd-client.$(POD_NAMESPACE).svc; do sleep 1; done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the goal to check for DNS resolution or actual connectivity to the endpoint?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

DNS resolution, not connectivity. The failure mode is that oauth-apiserver tries to connect to etcd-client before the Service has a backing Endpoints object (DNS returns NXDOMAIN), then exits with "context deadline exceeded" after 20s. Once DNS resolves, kube-proxy rules handle L4 connectivity. This mirrors the existing kube-apiserver wait-for-etcd init container which uses the same nslookup check.

Also merged the duplicate Unmanaged condition checks in deployment.go per a coderabbit nit.


AI-assisted response via Claude Code

command:
- /bin/bash
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
image: cli
imagePullPolicy: IfNotPresent
name: wait-for-etcd
terminationGracePeriodSeconds: 120
volumes:
- emptyDir: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ func adaptDeployment(cpContext component.WorkloadContext, deployment *appsv1.Dep
if err != nil {
return err
}
podspec.RemoveInitContainer("wait-for-etcd", &deployment.Spec.Template.Spec)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The placement works, but KAS keeps init container removal in its own self-documenting block with an explanatory comment (kas/deployment.go:105-110). Nesting it inside the hostname-resolution block makes it look like a side-effect of URL parsing rather than an intentional design decision.

Consider:

// With managed etcd, we should wait for the known etcd client service name to
// at least resolve before starting up to avoid futile connection attempts and
// pod crashing. For unmanaged, make no assumptions.
if cpContext.HCP.Spec.Etcd.ManagementType == hyperv1.Unmanaged {
    podspec.RemoveInitContainer("wait-for-etcd", &deployment.Spec.Template.Spec)
}

Nit, not blocking — just consistency with KAS.

}

noProxy := []string{
manifests.KubeAPIServerService("").Name,
etcdHostname,
Expand Down