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

Need to add secret read perms to plural sa #1334

Merged
merged 1 commit into from
Aug 9, 2024
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
9 changes: 8 additions & 1 deletion apps/core/lib/core/clients/console.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ defmodule Core.Clients.Console do
"""

def new(url, token) do
Req.new(base_url: url, auth: "Token #{token}")
Req.new(base_url: with_gql(url), auth: "Token #{token}")
|> AbsintheClient.attach()
end

Expand Down Expand Up @@ -93,4 +93,11 @@ defmodule Core.Clients.Console do
Logger.error "failed to fetch from console: #{inspect(resp)}"
{:error, "console error"}
end

defp with_gql(url) do
case String.ends_with?(url, "/gql") do
true -> url
_ -> "#{url}/gql"
end
end
end
12 changes: 9 additions & 3 deletions apps/core/lib/core/services/cloud/poller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ defmodule Core.Services.Cloud.Poller do
alias Core.Clients.Console
alias Core.Services.Cloud
alias Kazan.Apis.Core.V1, as: CoreV1
require Logger

@poll :timer.minutes(5)

Expand All @@ -28,7 +29,9 @@ defmodule Core.Services.Cloud.Poller do
def handle_info(:repo, %{client: client} = state) do
case Console.repo(client, Core.conf(:mgmt_repo)) do
{:ok, id} -> {:noreply, %{state | repo: id}}
_ -> {:noreply, state}
err ->
Logger.warn "failed to find mgmt repo: #{inspect(err)}"
{:noreply, state}
end
end

Expand All @@ -41,8 +44,11 @@ defmodule Core.Services.Cloud.Poller do
end

def handle_info(:roaches, state) do
with {:ok, roaches} <- read_secret() do
Enum.each(roaches, &upsert_roach/1)
case read_secret() do
{:ok, roaches} ->
Enum.each(roaches, &upsert_roach/1)
err ->
Logger.warn "failed to fetch available cockroach clusters: #{inspect(err)}"
end
{:noreply, state}
end
Expand Down
3 changes: 3 additions & 0 deletions plural/helm/plural/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ rules:
- apiGroups: [""]
resources: ["endpoints", "pods"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list", "watch"]
- apiGroups: ["batch", "extensions"]
resources: ["jobs"]
verbs: ["get", "list", "watch"]
Expand Down
Loading