-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from MoOyeg/main
Added Feature for Image and Pipeline Signing
- Loading branch information
Showing
48 changed files
with
2,260 additions
and
16 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,4 @@ | |
- name: 'Install the ACS Post Content' | ||
include_role: | ||
name: "ocp4-post-acs" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: 'Extend Original Demo for Image and TaskRun Signing' | ||
hosts: localhost | ||
connection: local | ||
tasks: | ||
- name: 'Install NooBaa' | ||
include_role: | ||
name: "ocp4-install-noobaa" | ||
|
||
- name: 'Install and configure Quay' | ||
include_role: | ||
name: "ocp4-install-quay" | ||
|
||
- name: 'Install and Enable the infra for Signing and Tekton Chaining' | ||
include_role: | ||
name: "ocp4-install-signing" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
noobaa_storage_class: "" | ||
noobaa_size: "50Gi" | ||
backing_store_name: "noobaa-pv-backing-store" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
- import_tasks: noobaa-create.yaml |
125 changes: 125 additions & 0 deletions
125
bootstrap/roles/ocp4-install-noobaa/tasks/noobaa-create.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
- name: Get cluster version | ||
k8s_info: | ||
api_version: config.openshift.io/v1 | ||
kind: ClusterVersion | ||
name: version | ||
register: r_cluster_version | ||
|
||
- name: Set ocp4_cluster_version fact | ||
set_fact: | ||
ocp4_cluster_version: "{{ r_cluster_version.resources[0].status.history[0].version }}" | ||
|
||
- name: Obtain Channel from Version | ||
set_fact: | ||
ocp4_channel: "{{ ocp4_cluster_version.split('.') }}" | ||
|
||
- name: Set Openshift Channel | ||
set_fact: | ||
ocp4_channel: "stable-{{ ocp4_channel[0] + '.' + ocp4_channel[1] }}" | ||
|
||
- name: Print OpenShift version | ||
debug: | ||
msg: "{{ ocp4_channel }}" | ||
|
||
- name: Adapt to the openshift_cluster_version LESS than 4.9 | ||
when: ocp4_cluster_version is version_compare('4.9', '<') | ||
block: | ||
- name: Create OpenShift Objects to install Noobaa | ||
k8s: | ||
state: present | ||
definition: "{{ lookup('template', item ) | from_yaml }}" | ||
loop: | ||
- ./templates/odf-namespace.yaml.j2 | ||
- ./templates/operatorgroup-storage.yaml.j2 | ||
- ./templates/ocs-subscription.yaml.j2 | ||
|
||
- name: Wait for NooBaa CRD to exist | ||
kubernetes.core.k8s_info: | ||
api_version: "apiextensions.k8s.io/v1beta1" | ||
kind: CustomResourceDefinition | ||
name: "noobaas.noobaa.io" | ||
register: crds | ||
until: crds.resources|length > 0 | ||
retries: 30 | ||
delay: 10 | ||
|
||
- name: Adapt to the openshift_cluster_version MORE than 4.9 | ||
when: ocp4_cluster_version is version_compare('4.9', '>=') | ||
block: | ||
- name: Create OpenShift Objects to install Noobaa | ||
k8s: | ||
state: present | ||
definition: "{{ lookup('template', item ) | from_yaml }}" | ||
loop: | ||
- ./templates/odf-namespace.yaml.j2 | ||
- ./templates/operatorgroup-storage.yaml.j2 | ||
- ./templates/odf-subscription.yaml.j2 | ||
|
||
- name: Wait for NooBaa CRD to exist | ||
kubernetes.core.k8s_info: | ||
api_version: "apiextensions.k8s.io/v1" | ||
kind: CustomResourceDefinition | ||
name: "noobaas.noobaa.io" | ||
register: crds | ||
until: crds.resources|length > 0 | ||
retries: 30 | ||
delay: 10 | ||
|
||
- name: Create Noobaa Object | ||
k8s: | ||
state: present | ||
definition: "{{ lookup('template', item ) | from_yaml }}" | ||
loop: | ||
- ./templates/noobaa-object.yaml.j2 | ||
|
||
- name: Wait Until NooBaa Object is Ready | ||
shell: | | ||
oc get noobaas.noobaa.io/noobaa -n openshift-storage -o jsonpath='{.status.phase}' | ||
register: noobaa_status | ||
retries: 10 | ||
delay: 20 | ||
until: | ||
- noobaa_status.stdout == "Ready" | ||
|
||
- name: Get Default Openshift Storage Class | ||
shell: | | ||
oc get sc -o=jsonpath='{.items[?(@.metadata.annotations.storageclass\.kubernetes\.io/is-default-class=="true")].metadata.name}' | ||
register: default_openshift_storage_class | ||
when: noobaa_storage_class == "" | ||
|
||
- name: Get any other Storage Class | ||
shell: | | ||
oc get sc -o name | head -n 1 | cut -d "/" -f2 | ||
register: other_openshift_storage_class | ||
when: (default_openshift_storage_class.stdout |default("") == "" ) and (noobaa_storage_class == "") | ||
|
||
- name: Use default storage class if it was set | ||
ansible.builtin.set_fact: | ||
noobaa_storage_class: "{{ default_openshift_storage_class.stdout }}" | ||
when: (default_openshift_storage_class.stdout |default("") != "" ) and (noobaa_storage_class == "") | ||
|
||
- name: Try other possible storage class if no defined/default storage class | ||
ansible.builtin.set_fact: | ||
noobaa_storage_class: "{{ other_openshift_storage_class.stdout }}" | ||
when: (default_openshift_storage_class.stdout |default("") == "" ) and (noobaa_storage_class == "") and (other_openshift_storage_class|default("") != "") | ||
|
||
- name: Create NooBaa Backing Store | ||
k8s: | ||
state: present | ||
definition: "{{ lookup('template', item ) | from_yaml }}" | ||
loop: | ||
- ./templates/noobaa-backingstore.yaml.j2 | ||
|
||
- name: Wait Until NooBaa Object is Ready | ||
shell: | | ||
oc get BackingStore/"{{ backing_store_name }}" -n openshift-storage -o jsonpath='{.status.phase}' | ||
register: backing_store | ||
retries: 10 | ||
delay: 20 | ||
until: | ||
- backing_store.stdout == "Ready" | ||
|
||
- name: Patch Bucket Class with Backing Store | ||
shell: | | ||
oc patch bucketclass noobaa-default-bucket-class --patch '{"spec":{"placementPolicy":{"tiers":[{"backingStores":["{{backing_store_name}}"]}]}}}' --type merge -n openshift-storage | ||
17 changes: 17 additions & 0 deletions
17
bootstrap/roles/ocp4-install-noobaa/templates/noobaa-backingstore.yaml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: noobaa.io/v1alpha1 | ||
kind: BackingStore | ||
metadata: | ||
finalizers: | ||
- noobaa.io/finalizer | ||
labels: | ||
app: noobaa | ||
name: noobaa-pv-backing-store | ||
namespace: openshift-storage | ||
spec: | ||
pvPool: | ||
numVolumes: 1 | ||
resources: | ||
requests: | ||
storage: {{ noobaa_size }} | ||
storageClass: {{ noobaa_storage_class }} | ||
type: pv-pool |
15 changes: 15 additions & 0 deletions
15
bootstrap/roles/ocp4-install-noobaa/templates/noobaa-object.yaml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: noobaa.io/v1alpha1 | ||
kind: NooBaa | ||
metadata: | ||
name: noobaa | ||
namespace: openshift-storage | ||
spec: | ||
dbResources: | ||
requests: | ||
cpu: '0.1' | ||
memory: 1Gi | ||
dbType: postgres | ||
coreResources: | ||
requests: | ||
cpu: '0.1' | ||
memory: 1Gi |
11 changes: 11 additions & 0 deletions
11
bootstrap/roles/ocp4-install-noobaa/templates/ocs-subscription.yaml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: ocs-operator | ||
namespace: openshift-storage | ||
spec: | ||
channel: {{ ocp4_channel }} | ||
installPlanApproval: Automatic | ||
name: ocs-operator | ||
source: redhat-operators | ||
sourceNamespace: openshift-marketplace |
8 changes: 8 additions & 0 deletions
8
bootstrap/roles/ocp4-install-noobaa/templates/odf-namespace.yaml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
kind: Namespace | ||
apiVersion: v1 | ||
metadata: | ||
name: openshift-storage | ||
labels: | ||
kubernetes.io/metadata.name: openshift-storage | ||
spec: {} | ||
|
13 changes: 13 additions & 0 deletions
13
bootstrap/roles/ocp4-install-noobaa/templates/odf-subscription.yaml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
labels: | ||
operators.coreos.com/odf-operator.openshift-storage: '' | ||
name: odf-operator | ||
namespace: openshift-storage | ||
spec: | ||
channel: {{ ocp4_channel }} | ||
installPlanApproval: Automatic | ||
name: odf-operator | ||
source: redhat-operators | ||
sourceNamespace: openshift-marketplace |
8 changes: 8 additions & 0 deletions
8
bootstrap/roles/ocp4-install-noobaa/templates/operatorgroup-storage.yaml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: operators.coreos.com/v1 | ||
kind: OperatorGroup | ||
metadata: | ||
name: openshift-storage-test | ||
namespace: openshift-storage | ||
spec: | ||
targetNamespaces: | ||
- openshift-storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
quay_project_name: quay-demo | ||
quay_admin_username: quayadmin | ||
quay_admin_email: [email protected] | ||
quay_admin_password: quaypass123 | ||
quay_registry_name: demo-registry | ||
quay_org_name: cicd-demo | ||
quay_secret_name: quay-robot-secret | ||
quay_repositories: | ||
- spring-petclinic-dev | ||
- spring-petclinic-stage | ||
quay_robot_account: demo_robot | ||
pipeline_namespace: cicd | ||
csrf_pattern: ".*window.__token\ =\ '(.*)';.*" | ||
#Can obtain status codes from Swagger of quay route/api/v1/discovery | ||
quay_user_found_success_status_code: 200 | ||
quay_org_not_found_error_code: 404 | ||
quay_org_found_success_status_code: 200 | ||
quay_org_created_success_status_code: 201 | ||
quay_repo_not_found_error_code: 404 | ||
quay_repo_found_success_status_code: 200 | ||
quay_repo_created_success_status_code: 201 | ||
quay_robot_not_found_error_code: 400 | ||
quay_robot_found_success_status_code: 200 | ||
quay_robot_created_success_status_code: 201 | ||
quay_perm_success_status_code: 200 | ||
secret_required_namespaces: | ||
- cicd | ||
- devsecops-dev | ||
- devsecops-qa |
Oops, something went wrong.