mirror of
https://github.com/openappsec/openappsec.git
synced 2025-06-28 16:41:02 +03:00
Merge branch 'main' of https://github.com/openappsec/openappsec into main
This commit is contained in:
commit
10bf82bcc0
@ -103,12 +103,15 @@ spec:
|
|||||||
- {{ .Values.appsec.proxy }}
|
- {{ .Values.appsec.proxy }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
imagePullPolicy: {{ .Values.appsec.image.pullPolicy }}
|
imagePullPolicy: {{ .Values.appsec.image.pullPolicy }}
|
||||||
{{- if eq .Values.appsec.playground false }}
|
|
||||||
env:
|
env:
|
||||||
|
{{- if eq .Values.appsec.playground false }}
|
||||||
- name: SHARED_STORAGE_HOST
|
- name: SHARED_STORAGE_HOST
|
||||||
value: {{ .Values.appsec.storage.name }}-svc
|
value: {{ .Values.appsec.storage.name }}-svc
|
||||||
- name: LEARNING_HOST
|
- name: LEARNING_HOST
|
||||||
value: {{ .Values.appsec.learning.name }}-svc
|
value: {{ .Values.appsec.learning.name }}-svc
|
||||||
|
{{- else }}
|
||||||
|
- name: PLAYGROUND
|
||||||
|
value: "true"
|
||||||
{{- end }}
|
{{- end }}
|
||||||
resources:
|
resources:
|
||||||
{{ toYaml .Values.resources | nindent 12 }}
|
{{ toYaml .Values.resources | nindent 12 }}
|
||||||
|
@ -13,9 +13,12 @@
|
|||||||
|
|
||||||
#include "local_policy_mgmt_gen.h"
|
#include "local_policy_mgmt_gen.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cctype>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
#include <cereal/types/vector.hpp>
|
#include <cereal/types/vector.hpp>
|
||||||
@ -1215,9 +1218,28 @@ private:
|
|||||||
LocalPolicyEnv env_type;
|
LocalPolicyEnv env_type;
|
||||||
map<string, string> practice_name_to_id_map;
|
map<string, string> practice_name_to_id_map;
|
||||||
|
|
||||||
|
bool
|
||||||
|
isPlaygroundEnv()
|
||||||
|
{
|
||||||
|
string playground_variable = "PLAYGROUND";
|
||||||
|
const char* env_string = getenv(playground_variable.c_str());
|
||||||
|
|
||||||
|
if (env_string)
|
||||||
|
{
|
||||||
|
string env_value = env_string;
|
||||||
|
std::transform(env_value.begin(), env_value.end(), env_value.begin(),
|
||||||
|
[](unsigned char c){ return std::tolower(c); });
|
||||||
|
return env_value == "true";
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
getClusterId()
|
getClusterId()
|
||||||
{
|
{
|
||||||
|
string playground_uid = isPlaygroundEnv() ? "playground-" : "";
|
||||||
|
|
||||||
dbgTrace(D_K8S_POLICY) << "Getting cluster UID";
|
dbgTrace(D_K8S_POLICY) << "Getting cluster UID";
|
||||||
auto maybe_namespaces_data = getObjectFromCluster<NamespaceData>("/api/v1/namespaces/");
|
auto maybe_namespaces_data = getObjectFromCluster<NamespaceData>("/api/v1/namespaces/");
|
||||||
|
|
||||||
@ -1241,7 +1263,7 @@ private:
|
|||||||
uid,
|
uid,
|
||||||
EnvKeyAttr::LogSection::SOURCE
|
EnvKeyAttr::LogSection::SOURCE
|
||||||
);
|
);
|
||||||
Singleton::Consume<I_AgentDetails>::by<LocalPolicyMgmtGenerator::Impl>()->setClusterId(uid);
|
Singleton::Consume<I_AgentDetails>::by<LocalPolicyMgmtGenerator::Impl>()->setClusterId(playground_uid + uid);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user