Skip to content

Problems with reading oec config from private github repository #62

@Nurik-K

Description

@Nurik-K

Hi, getting a couple of errors:

1:

INFO[2024-02-22T03:40:24.021287702Z] OEC version is 1.1.4                         
INFO[2024-02-22T03:40:24.022777905Z] OEC commit version is 48760aef56f137e950e38f278f53f156bd8ffba9 
FATAL[2024-02-22T03:40:24.141241201Z] Could not read configuration: ssh: handshake failed: knownhosts: key is unknown 

But if I run manually git clone it works fine, and it fills out the known_hosts file.

2:

INFO[2024-02-22T03:53:56.458653756Z] OEC version is 1.1.4                         
INFO[2024-02-22T03:53:56.459643949Z] OEC commit version is 48760aef56f137e950e38f278f53f156bd8ffba9 
FATAL[2024-02-22T03:53:56.901484778Z] Could not read configuration: couldn't find remote ref "refs/heads/master" 

After a manual fix for the known_hosts file, tried to run the oec command and got this error. It tries to read from master branch, but our branch name is main. Is there a way to update it without modifying a code?

DOCKERFILE:

FROM golang:1.19
COPY ./alert_automation/volumeresize /go/oec/volresize
ARG OEC_VERSION=1.1.4
RUN apt-get update && \
    apt-get install -y --no-install-recommends unzip && \
    apt-get install -y --no-install-recommends curl && \
    apt-get install -y --no-install-recommends python3 python3-pip && \
    apt-get clean && rm -rf /var/cache/apt
RUN curl -L https://github.com/opsgenie/oec/releases/download/${OEC_VERSION}/oec-linux-amd64-${OEC_VERSION}.zip -o /tmp/oec.zip && \
    unzip /tmp/oec.zip -d /usr/local/bin && \
    rm /tmp/oec.zip && \
    mkdir -p /var/log/opsgenie && \
    mkdir -p /root/.ssh && \
    touch /root/.ssh/known_hosts
ENTRYPOINT [ "OpsgenieEdgeConnector" ]

DEPLOYMENT:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: oec-deployment
  namespace: oec
  labels:
    app: oec
spec:
  replicas: 1
  selector:
    matchLabels:
      app: oec
  template:
    metadata:
      labels:
        app: oec
    spec:
      nodeSelector:
        app: alert-automation
      containers:
      - name: oec
        image: <IMAGE>
        imagePullPolicy: Always 
        command: ["OpsgenieEdgeConnector"]
        env:
        - name: OEC_CONF_SOURCE_TYPE
          value: "git"
        - name: OEC_CONF_GIT_URL
          value: "[email protected]:some/path.git"
        - name: OEC_CONF_GIT_FILEPATH
          value: "/alert_automation/config/oec_conf.yaml"
        - name: OEC_CONF_GIT_PRIVATE_KEY_FILEPATH
          value: "/root/.ssh/id_ed25519"
        - name: SSH_KNOWN_HOSTS
          value: "/root/.ssh/known_hosts"
        - name: OEC_API_KEY
          valueFrom:
            secretKeyRef:
              name: oec-api-key
              key: OEC_API_KEY
        resources:
          limits:
            memory: "1000Mi"
            cpu: "500m"
          requests:
            memory: "300Mi"
            cpu: "100m"
        volumeMounts:
        - name: git-ssh-private-key
          readOnly: true
          mountPath: "/root/.ssh/id_ed25519"
          subPath: id_ed25519
      volumes:
      - name: git-ssh-private-key
        secret:
          secretName: git-ssh-private-key
          defaultMode: 0400

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions