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

Remove dependency on sigstore-ocp #387

Merged
merged 1 commit into from
May 23, 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
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ jobs:
sleep 1
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.25.0/olm.yaml

kubectl create --kustomize https://github.com/securesign/sigstore-ocp/keycloak/operator/overlay/kind
kubectl create --kustomize ci/keycloak/operator/overlay/kind
until [ ! -z "$(kubectl get pod -l name=keycloak-operator -n keycloak-system 2>/dev/null)" ]
do
echo "Waiting for keycloak operator. Pods in keycloak-system namespace:"
kubectl get pods -n keycloak-system
sleep 10
done
kubectl create --kustomize https://github.com/securesign/sigstore-ocp/keycloak/resources/overlay/kind
kubectl create --kustomize ci/keycloak/resources/overlay/kind
until [[ $( oc get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system 2>/dev/null) == "true" ]]
do
printf "Waiting for keycloak deployment. \n Keycloak ready: %s\n" $(oc get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ jobs:
sleep 1
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.25.0/olm.yaml

kubectl create --kustomize https://github.com/securesign/sigstore-ocp/keycloak/operator/overlay/kind
kubectl create --kustomize ci/keycloak/operator/overlay/kind
until [ ! -z "$(kubectl get pod -l name=keycloak-operator -n keycloak-system 2>/dev/null)" ]
do
echo "Waiting for keycloak operator. Pods in keycloak-system namespace:"
kubectl get pods -n keycloak-system
sleep 10
done
kubectl create --kustomize https://github.com/securesign/sigstore-ocp/keycloak/resources/overlay/kind
kubectl create --kustomize ci/keycloak/resources/overlay/kind
until [[ $( oc get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system 2>/dev/null) == "true" ]]
do
printf "Waiting for keycloak deployment. \n Keycloak ready: %s\n" $(oc get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system)
Expand Down
8 changes: 8 additions & 0 deletions ci/keycloak/operator/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- namespace.yaml
- subscription.yaml

namespace: keycloak-system
4 changes: 4 additions & 0 deletions ci/keycloak/operator/base/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: keycloak-system
20 changes: 20 additions & 0 deletions ci/keycloak/operator/base/subscription.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: rhsso-operator
spec:
channel: stable
installPlanApproval: Automatic
name: rhsso-operator
source: redhat-operators
sourceNamespace: openshift-marketplace
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: keycloak-system-trusted-artifact-signer
spec:
targetNamespaces:
- keycloak-system
upgradeStrategy: Default
10 changes: 10 additions & 0 deletions ci/keycloak/operator/overlay/kind/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../base

patches:
- path: patch.yaml


9 changes: 9 additions & 0 deletions ci/keycloak/operator/overlay/kind/patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: rhsso-operator
spec:
channel: alpha
name: keycloak-operator
source: operatorhubio-catalog
sourceNamespace: olm
14 changes: 14 additions & 0 deletions ci/keycloak/resources/base/keycloak.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: keycloak.org/v1alpha1
kind: Keycloak
metadata:
labels:
app: sso
name: keycloak
spec:
externalAccess:
enabled: true
instances: 1
keycloakDeploymentSpec:
imagePullPolicy: Always
postgresDeploymentSpec:
imagePullPolicy: Always
10 changes: 10 additions & 0 deletions ci/keycloak/resources/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: keycloak-system

resources:
- keycloak.yaml
- realm.yaml
- tas-client.yaml
- user.yaml
16 changes: 16 additions & 0 deletions ci/keycloak/resources/base/realm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: keycloak.org/v1alpha1
kind: KeycloakRealm
metadata:
labels:
app: sso
name: trusted-artifact-signer
spec:
instanceSelector:
matchLabels:
app: sso
realm:
displayName: Red-Hat-Trusted-Artifact-Signer
enabled: true
id: trusted-artifact-signer
realm: trusted-artifact-signer
sslRequired: none
55 changes: 55 additions & 0 deletions ci/keycloak/resources/base/tas-client.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apiVersion: keycloak.org/v1alpha1
kind: KeycloakClient
metadata:
labels:
app: sso
name: trusted-artifact-signer
spec:
client:
attributes:
request.object.signature.alg: RS256
user.info.response.signature.alg: RS256
clientAuthenticatorType: client-secret
clientId: trusted-artifact-signer
defaultClientScopes:
- profile
- email
description: Client for Red Hat Trusted Artifact Signer authentication
directAccessGrantsEnabled: true
implicitFlowEnabled: false
name: trusted-artifact-signer
protocol: openid-connect
protocolMappers:
- config:
claim.name: email
id.token.claim: "true"
jsonType.label: String
user.attribute: email
userinfo.token.claim: "true"
name: email
protocol: openid-connect
protocolMapper: oidc-usermodel-property-mapper
- config:
claim.name: email-verified
id.token.claim: "true"
user.attribute: emailVerified
userinfo.token.claim: "true"
name: email-verified
protocol: openid-connect
protocolMapper: oidc-usermodel-property-mapper
- config:
claim.name: aud
claim.value: trusted-artifact-signer
id.token.claim: "true"
access.token.claim: "true"
userinfo.token.claim: "true"
name: audience
protocol: openid-connect
protocolMapper: oidc-hardcoded-claim-mapper
publicClient: true
standardFlowEnabled: true
redirectUris:
- "*"
realmSelector:
matchLabels:
app: sso
21 changes: 21 additions & 0 deletions ci/keycloak/resources/base/user.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
apiVersion: keycloak.org/v1alpha1
kind: KeycloakUser
metadata:
labels:
app: sso
name: jdoe
spec:
realmSelector:
matchLabels:
app: sso
user:
email: jdoe@redhat.com
enabled: true
emailVerified: true
credentials:
- type: "password"
value: "secure"
firstName: Jane
lastName: Doe
username: jdoe
21 changes: 21 additions & 0 deletions ci/keycloak/resources/example-user.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: keycloak.org/v1alpha1
kind: KeycloakUser
metadata:
labels:
app: sso
name: UPDATE
namespace: keycloak-system
spec:
realmSelector:
matchLabels:
app: sso
user:
credentials:
- type: password
value: UPDATE
email: user@email.com
emailVerified: true
enabled: true
firstName: UPDATE
lastName: UPDATE
username: UPDATE
12 changes: 12 additions & 0 deletions ci/keycloak/resources/overlay/kind/keycloak-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: keycloak-internal
spec:
selector:
app: keycloak
component: keycloak
ports:
- protocol: TCP
port: 80
targetPort: 8080
8 changes: 8 additions & 0 deletions ci/keycloak/resources/overlay/kind/keycloak_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: keycloak.org/v1alpha1
kind: Keycloak
metadata:
name: keycloak
spec:
externalAccess:
enabled: false

12 changes: 12 additions & 0 deletions ci/keycloak/resources/overlay/kind/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: keycloak-system

resources:
- ../../base
- keycloak-svc.yaml

patches:
- path: keycloak_patch.yaml
- path: realm_patch.yaml
7 changes: 7 additions & 0 deletions ci/keycloak/resources/overlay/kind/realm_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: keycloak.org/v1alpha1
kind: KeycloakRealm
metadata:
name: trusted-artifact-signer
spec:
realm:
sslRequired: none
11 changes: 2 additions & 9 deletions ci/openshift/tas-keycloak-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,20 @@ check_pod_status() {

# Install SSO Operator and Keycloak service
install_sso_keycloak() {
pushd /tmp
git clone https://github.com/securesign/sigstore-ocp
git fetch -a -v
cd sigstore-ocp
git checkout main
oc apply --kustomize keycloak/operator/base
oc apply --kustomize ci/keycloak/operator/base
check_pod_status "keycloak-system" "rhsso-operator"
# Check the return value from the function
if [ $? -ne 0 ]; then
echo "Pod status check failed. Exiting the script."
exit 1
fi
oc apply --kustomize keycloak/resources/base
oc apply --kustomize ci/keycloak/resources/base
check_pod_status "keycloak-system" "keycloak-postgresql"
# Check the return value from the function
if [ $? -ne 0 ]; then
echo "Pod status check failed. Exiting the script."
exit 1
fi
cd ../ && rm -rf sigstore-ocp
popd
}

# Install Red Hat SSO Operator and setup Keycloak service
Expand Down
4 changes: 2 additions & 2 deletions hack/up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ sleep 1
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.25.0/olm.yaml

#install keycloak from Kind overlay
kubectl create --kustomize ${HOME}/git/sigstore-ocp/keycloak/operator/overlay/kind
kubectl create --kustomize ci/keycloak/operator/overlay/kind
until [ ! -z "$(kubectl get pod -l name=keycloak-operator -n keycloak-system 2>/dev/null)" ]
do
echo "Waiting for keycloak operator. Pods in keycloak-system namespace:"
kubectl get pods -n keycloak-system
sleep 10
done
kubectl create --kustomize ${HOME}/git/sigstore-ocp/keycloak/resources/overlay/kind
kubectl create --kustomize ci/keycloak/resources/overlay/kind
until [[ $( oc get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system 2>/dev/null) == "true" ]]
do
printf "Waiting for keycloak deployment. \n Keycloak ready: %s \n" $(oc get keycloak keycloak -o jsonpath='{.status.ready}' -n keycloak-system)
Expand Down
Loading