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

Invalid syntax for new emissary-apiext init container #5683

Open
Shadowssong opened this issue May 10, 2024 · 2 comments
Open

Invalid syntax for new emissary-apiext init container #5683

Shadowssong opened this issue May 10, 2024 · 2 comments
Labels
t:bug Something isn't working

Comments

@Shadowssong
Copy link
Contributor

Describe the bug

While attempting to upgrade to v8.9.1 of the emissary-ingress helm chart I noticed an error regarding the shell script syntax on the newly added init container. I verified this with multiple restarts of the emissary-ingress pods

$ kubectl logs -l=helm.sh/chart=emissary-ingress-8.9.1 -c wait-for-apiext 
checking if deployment/emissary-apiext in namespace: ingress-system exists.
emissary-apiext.ingress-system exists.
checking if emissary-apiext.ingress-system is fully available...
deployment.apps/emissary-apiext condition met
emissary-apiext.ingress-system is available
/bin/sh: 14: [[: not found
emissary-apiext.ingress-system is fully ready and not currently restarting.  Have: 3, want 3

Side note: I did have to add

waitForApiext:
  deploymentNamespace: "ingress-system"

to my helm values as emissary-apiext is deployed to our ingress-system namespace instead of the emissary-system namespace.

This behavior was introduced here: https://github.com/emissary-ingress/emissary/pull/5241/files#diff-b89fbcdd0118bbc0f11053f2b0afb3725ab8b1830b39025303097249567c1f20R138

I am not sure if this is affecting the evaluation of the results of the query and whether or not the script proceeds, it seems to report things are healthy (which they were), but just wanted to bring this to the teams attention.

Here is the entire init container configuration pulled from the pod directly:

Init Containers:
  wait-for-apiext:
    Container ID:  containerd://-
    Image:         istio/kubectl:1.5.10
    Image ID:      docker.io/istio/kubectl@sha256:dbb7726d1bf0229053ebeaf62be3a07025d61b5f4ccc9cef94e0bd9416ddd4cd
    Port:          <none>
    Host Port:     <none>
    Command:
      /bin/sh
      -c
    Args:
      deployment_name="emissary-apiext"
      deployment_namespace="ingress-system"
      while true; do
        echo "checking if deployment/$deployment_name in namespace: $deployment_namespace exists."
        if kubectl get deployment "$deployment_name" -n $deployment_namespace > /dev/null 2>&1; then
          echo "$deployment_name.$deployment_namespace exists."
          echo "checking if $deployment_name.$deployment_namespace is fully available..."
          kubectl wait --for=condition=available deployment/"$deployment_name" -n $deployment_namespace --timeout=5m
          if [ $? -eq 0 ]; then
            echo "$deployment_name.$deployment_namespace is available"
            while true; do
            desired_replicas=$(kubectl get deployment $deployment_name -n $deployment_namespace -o jsonpath='{.spec.replicas}')
            current_replicas=$(kubectl get deployment $deployment_name -n $deployment_namespace -o jsonpath='{.status.replicas}')
            if [[ $current_replicas != $desired_replicas ]]; then
              echo "$deployment_name.$deployment_namespace is in the process of restarting. Have: $current_replicas, want $desired_replicas"
              sleep 3
            else
              echo "$deployment_name.$deployment_namespace is fully ready and not currently restarting.  Have: $current_replicas, want $desired_replicas"
              break
            fi
            done
            break
          else
            echo "$deployment_name.$deployment_namespace did not become available within the timeout"
          fi
        else
          echo "$deployment_name.$deployment_namespace does not exist yet. Waiting..."
          sleep 3
        fi
      done

    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Fri, 10 May 2024 11:58:31 -0400
      Finished:     Fri, 10 May 2024 11:58:33 -0400
    Ready:          True
    Restart Count:  0
    Limits:
      memory:  256Mi
    Requests:
      cpu:        100m
      memory:     128Mi
    Environment:  <none>

To Reproduce
Steps to reproduce the behavior:

  1. Install emissary-apiext helm chart v8.9.1
  2. Verify logs on emissary-ingress init container logs

Expected behavior

There should be no shell script errors from the script run by the init container

Versions (please complete the following information):

  • Ambassador: [e.g. 0.32.1] chart v8.9.1
  • Kubernetes environment [e.g. Minikube, bare metal, Google Kubernetes Engine]: AWS EKS
  • Version [e.g. 1.8.1] 1.25

Additional context

cc @AliceProxy @tenshinhigashi

@cindymullins-dw cindymullins-dw added the t:bug Something isn't working label May 20, 2024
@cindymullins-dw
Copy link
Contributor

Hi @Shadowssong , if the emissary-apiext deployment is not installed in the emissary-system namespace (or has a different name for whatever reason), users will be able to configure this accordingly and there are a few fields within waitForApiext.enabled for users:

waitForApiext:
  enabled: false
  deploymentName: emissary-apiext
  deploymentNamespace: emissary-system
  securityContext:
    runAsUser: 8888
  createRoles: true

Note: if users are installing the emissary-apiext from our CRDs, it will default to emissary-apiext.emissary-system.

So it seems in this case things are technically working but the shell script message "/bin/sh: 14: [[: not found" is causing confusion?

@Shadowssong
Copy link
Contributor Author

hey @cindymullins-dw Yea sorry if my original message was unclear, the override for the namespace worked fine I just included it incase that was potentially related. Mainly it's the shell syntax error that I noticed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants