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
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,20 @@ export async function updateConfig(event: AuthServiceEvent) {
export function buildConfig(config: AuthserviceConfig, event: AuthServiceEvent) {
let chains: Chain[];

if (event.action == Action.AddClient) {
if (event.action === Action.AddClient) {
// Add the new chain to the existing authservice config
chains = config.chains.filter(chain => chain.name !== event.name);
chains = chains.concat(buildChain(event));
// Sort the chains by their name before returning. Note that the accuracy of
// sorting here is not relevant, only the consistency.
const sortByName = R.sortBy(R.prop("name"));
chains = sortByName(chains);
} else if (event.action == Action.RemoveClient) {
} else if (event.action === Action.RemoveClient) {
// Search in the existing chains for the chain to remove by name.
// Filtering here should preserve the order, so there is no need to re-sort.
chains = config.chains.filter(chain => chain.name !== event.name);
// Handle global config updates
} else if (event.action == Action.UpdateGlobalConfig) {
} else if (event.action === Action.UpdateGlobalConfig) {
if (!event.redisUri) {
// Remove the redis session store config if a URI is not provided
delete config.default_oidc_config.redis_session_store_config;
Expand Down
2 changes: 1 addition & 1 deletion src/pepr/operator/crd/validators/exempt-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const kindToPolicyMap = new Map<MatcherKind, Policy[]>([
[
MatcherKind.Pod,
Object.values(Policy).filter(
p => p != Policy.DisallowNodePortServices && p != Policy.RestrictExternalNames,
p => p !== Policy.DisallowNodePortServices && p !== Policy.RestrictExternalNames,
),
],
[MatcherKind.Service, [Policy.RestrictExternalNames, Policy.DisallowNodePortServices]],
Expand Down
4 changes: 2 additions & 2 deletions src/pepr/operator/reconcilers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ export function getReadinessConditions(ready: boolean = true) {
return [
{
type: "Ready",
status: ready == true ? StatusEnum.True : StatusEnum.False,
status: ready === true ? StatusEnum.True : StatusEnum.False,
lastTransitionTime: new Date(),
message:
ready == true ? "The package is ready for use." : "The package is not ready for use.",
ready === true ? "The package is ready for use." : "The package is not ready for use.",
reason: "ReconciliationComplete",
},
];
Expand Down
2 changes: 1 addition & 1 deletion src/pepr/policies/exemptions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function isExempt<T extends KubernetesObject>(
const resourceName = request.Raw.metadata?.name || request.Raw.metadata?.generateName;
const resourceNamespace = request.Raw.metadata?.namespace;

if (exemptList.length != 0) {
if (exemptList.length !== 0) {
// Debug log to provide current exemptions for policy
log.debug(
`Checking ${resourceName} against ${policy} exemptions: ${JSON.stringify(exemptList)}`,
Expand Down
6 changes: 3 additions & 3 deletions src/pepr/prometheus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const { When } = prometheus;
When(PrometheusServiceMonitor)
.IsCreatedOrUpdated()
.Mutate(async sm => {
if (sm.Raw.spec === undefined || sm.Raw.spec.scrapeClass != undefined) {
if (sm.Raw.spec === undefined || sm.Raw.spec.scrapeClass !== undefined) {
// Support the legacy (Prometheus 2.x fallback) until upstream applications properly handle protocol
if (sm.Raw.spec && !sm.Raw.spec.fallbackScrapeProtocol) {
sm.Raw.spec.fallbackScrapeProtocol = FallbackScrapeProtocol.PrometheusText004;
Expand Down Expand Up @@ -82,7 +82,7 @@ When(PrometheusServiceMonitor)
When(PrometheusPodMonitor)
.IsCreatedOrUpdated()
.Mutate(async pm => {
if (pm.Raw.spec === undefined || pm.Raw.spec.scrapeClass != undefined) {
if (pm.Raw.spec === undefined || pm.Raw.spec.scrapeClass !== undefined) {
// Support the legacy (Prometheus 2.x fallback) until upstream applications properly handle protocol
if (pm.Raw.spec && !pm.Raw.spec.fallbackScrapeProtocol) {
pm.Raw.spec.fallbackScrapeProtocol = FallbackScrapeProtocol.PrometheusText004;
Expand Down Expand Up @@ -116,7 +116,7 @@ When(PrometheusPodMonitor)
}
});

// This assumes istio-injection == strict mTLS due to complexity around mTLS lookup
// This assumes istio-injection === strict mTLS due to complexity around mTLS lookup
async function isIstioInjected(monitor: PrometheusServiceMonitor | PrometheusPodMonitor) {
// If monitor allows any namespace assume istio injection
if (monitor.Raw.spec?.namespaceSelector?.any) {
Expand Down