Skip to content

Commit

Permalink
Reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
docandrew committed Oct 21, 2024
1 parent a0d6cf8 commit 62d81fa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 34 deletions.
8 changes: 2 additions & 6 deletions src/pepr/operator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,15 @@ When(UDSPackage)
.WithName("keycloak")
.Watch(() => {
// todo: wait for keycloak and authservice to be running?
log.info(
"Identity and Authorization layer deployed, operator configured to handle SSO.",
);
log.info("Identity and Authorization layer deployed, operator configured to handle SSO.");
UDSConfig.isIdentityDeployed = true;
});
When(UDSPackage)
.IsDeleted()
.InNamespace("keycloak")
.WithName("keycloak")
.Watch(() => {
log.info(
"Identity and Authorization layer removed, operator will NOT handle SSO.",
);
log.info("Identity and Authorization layer removed, operator will NOT handle SSO.");
UDSConfig.isIdentityDeployed = false;
});

Expand Down
10 changes: 2 additions & 8 deletions src/pepr/operator/secrets.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,7 @@ describe("test secret copy", () => {
});
};

return K8s(kind.Secret)
.Apply(destinationSecret)
.then(failIfReached)
.catch(expected);
return K8s(kind.Secret).Apply(destinationSecret).then(failIfReached).catch(expected);
});

it("should error when missing source secret and onMissingSource=Deny", async () => {
Expand All @@ -154,10 +151,7 @@ describe("test secret copy", () => {
});
};

return K8s(kind.Secret)
.Apply(destinationSecret)
.then(failIfReached)
.catch(expected);
return K8s(kind.Secret).Apply(destinationSecret).then(failIfReached).catch(expected);
});

it("should create empty secret when missing source secret and onMissingSource=LeaveEmpty", async () => {
Expand Down
24 changes: 4 additions & 20 deletions src/pepr/operator/secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial
*/

import {
a,
K8s,
kind,
Log,
PeprMutateRequest,
PeprValidateRequest,
} from "pepr";
import { a, K8s, kind, Log, PeprMutateRequest, PeprValidateRequest } from "pepr";
import { ValidateActionResponse } from "pepr/dist/lib/types";

export const labelCopySecret = "secrets.uds.dev/copy";
Expand Down Expand Up @@ -134,12 +127,7 @@ export async function copySecret(request: PeprMutateRequest<a.Secret>) {
return;
}

Log.info(
"Attempting to copy secret %s from namespace %s to %s",
fromName,
fromNS,
toNS,
);
Log.info("Attempting to copy secret %s from namespace %s to %s", fromName, fromNS, toNS);

let sourceSecret = null;

Expand Down Expand Up @@ -186,9 +174,7 @@ export async function copySecret(request: PeprMutateRequest<a.Secret>) {
* @param request
* @returns Approve, or Deny w/ message
*/
export function validateSecret(
request: PeprValidateRequest<a.Secret>,
): ValidateActionResponse {
export function validateSecret(request: PeprValidateRequest<a.Secret>): ValidateActionResponse {
const result = checkAnnotationsAndMetadata(request.Raw);

console.log("**** VALIDATE REQUEST *****: ", JSON.stringify(request.Raw));
Expand All @@ -205,9 +191,7 @@ export function validateSecret(
);
}

if (
checkAnnotationsAndMetadata(request.Raw) === FailReason.MISSING_METADATA
) {
if (checkAnnotationsAndMetadata(request.Raw) === FailReason.MISSING_METADATA) {
return request.Deny("Source secret not found, denying the request");
}

Expand Down

0 comments on commit 62d81fa

Please sign in to comment.