Skip to content

Commit 7e9c168

Browse files
rurikudohirokuni-kitaharadependabot[bot]gajan@jp.ibm.comstevemar
authored
upgrade to version 0.2.5 (#19)
* remove all camel case filenames (IBM#327) * Bump ssri from 8.0.0 to 8.0.1 in /docs (IBM#328) Bumps [ssri](https://github.com/npm/ssri) from 8.0.0 to 8.0.1. - [Release notes](https://github.com/npm/ssri/releases) - [Changelog](https://github.com/npm/ssri/blob/latest/CHANGELOG.md) - [Commits](npm/ssri@v8.0.0...v8.0.1) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump lodash from 4.17.19 to 4.17.21 in /docs (IBM#330) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](lodash/lodash@4.17.19...4.17.21) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * support sigstore verification and refactor shield codes for future capability (IBM#331) * sigstore update * add sigstore verification & fix dryrun issues * use remote fulcio.pem for sigstore verification * fix sigstore test * update sigstore codes * fix common profile request pattern type * fix CRD dryrun codes to support building with the latest grpc codes * initial commit for inspector * 1st shot of inspector * add result CRD for inspector * temp commit * add .gitignore to inspector * temp commit * split reqcontext into 2 new contexts * fix resource context * add checker * use 2 handlers in webhook instead of calling api * merge fix/sigstore branch into dev/refactoer * make verifiers pluggable & create a sample implementation of verifier * fix some secret values * fix testcases and add resource handler tests * fix e2e test * fix scripts * fix Makefile * fix operator config * remove unused directory * finalize refactoring * finalize refactoring * Feature: Integrated keyless signing and verification mechnism that uses sigstore/cosgin with IShield * disable inspector and checker codes * disable inspector and checker codes * add audit mode for cmd * Fix/sign yaml (IBM#332) * Feature: Integrated keyless signing and verification mechnism that uses sigstore/cosgin with IShield * Feature: Integrated keyless signing and verification mechnism that uses sigstore/cosgin with IShield, added message matching, bundle verification steps, compress annotations, refactor * fix cmd/pkg/yamlsign/util.go * fix bundle annotation mask * fix sigstore bundle verification * remove unused constants in audit package * observer go.mod * add image verification config to shield config * remove debug message * Fix/sign yaml (IBM#333) * Feature: Integrated keyless signing and verification mechnism that uses sigstore/cosgin with IShield, added message matching, bundle verification steps, compress annotations, refactor * merged with dev/refactor * refactored code for signing and verifying yaml, removed unused code * Added comments to refer to original code * Removed license * fixed fetching signed payload * Removed license * Fixed command line help text * Fixed command line help text * enable image verification (IBM#334) * fix image verification result (IBM#335) * Dev/refactor update (IBM#336) * resolve conflict * fix image decision result * fix image verification condition * fix logger to enable session trace * fix check_functions.go functions and test cases Co-authored-by: [email protected] <[email protected]> Co-authored-by: Ruriko Kudo <[email protected]> * Added tests code for signing and verifying YAML (IBM#337) * Added tests code for signing and verifying YAML * Added tests code for signing and verifying YAML * Fix/upgrade 0 2.0 (IBM#338) * Upgrading to version 2.0.0 * Upgrade bundle to 0.2.0 * removed unnecessary dir/file Signed-off-by: ruriko <[email protected]> * removed unnecessary dir/file Signed-off-by: ruriko <[email protected]> * Preparing to move to new integrity shield (IBM#344) * Initial commit * init commit * add request handler logic * update go.mod * put all func * added request handler and main functions (#2) * add remote request handler * remove unused file * remove tls.crt from secret.yaml * change to use new constraints * remove unused func * remove unused values * remove unused values * rename parameter and package * update request handler * add ishield config * add error handling * fix mutation check * refactor main.go/struct * add allow/inScopeNamespace check * add config * fix to use ENV parameter * fix inScopeNamespace and config name * change the way of loading shield/reqhandler config * support apiGroup match * support label/namespaceSelector match * change config name Signed-off-by: ruriko <[email protected]> * enable opa/gatekeeper admission controller (#4) (#5) * enable to use opa/gatekeeper Signed-off-by: ruriko <[email protected]> * include shield config in rego policy Signed-off-by: ruriko <[email protected]> * update rego policy Signed-off-by: ruriko <[email protected]> * update default setting in rego policy Signed-off-by: ruriko <[email protected]> Co-authored-by: Ruriko Kudo <[email protected]> * reorganized code (#6) * reorganized code Signed-off-by: ruriko <[email protected]> * rename module name * change config name Signed-off-by: ruriko <[email protected]> * update README.md Signed-off-by: ruriko <[email protected]> * change config name in admission controller Signed-off-by: ruriko <[email protected]> * Update Readme (#7) * update README.md Signed-off-by: ruriko <[email protected]> * add an image Signed-off-by: ruriko <[email protected]> * fix README.md Signed-off-by: ruriko <[email protected]> * fix typo Signed-off-by: ruriko <[email protected]> * Update README.md * Update README.md * update README and fix config name Signed-off-by: ruriko <[email protected]> * update README Signed-off-by: ruriko <[email protected]> * update README Signed-off-by: ruriko <[email protected]> Co-authored-by: Yuji Watanabe <[email protected]> * [ImgBot] Optimize images (#8) /docs/ishield-scenario.png -- 146.35kb -> 104.24kb (28.77%) Signed-off-by: ImgBotApp <[email protected]> Co-authored-by: ImgBotApp <[email protected]> * use latest k8s-manifest-sigstore (#9) * update to use latest k8s-manifest-sigstore Signed-off-by: ruriko <[email protected]> * fix parameters Signed-off-by: ruriko <[email protected]> * fix to handle nil request handler config Signed-off-by: ruriko <[email protected]> * enable log/mode settings (#10) * support log config Signed-off-by: ruriko <[email protected]> * support detect mode Signed-off-by: ruriko <[email protected]> * update rego policy to support detect mode Signed-off-by: ruriko <[email protected]> * change to use same log format with k8s-manifest-sigstore * fix log level in deployment Signed-off-by: ruriko <[email protected]> * add K8S_MANIFEST_SIGSTORE_LOG_LEVEL Signed-off-by: ruriko <[email protected]> * fix K8S_MANIFEST_SIGSTORE_LOG_LEVEL Signed-off-by: ruriko <[email protected]> * fix conflict Signed-off-by: ruriko <[email protected]> * enable event/status update (#11) * enable mip status update Signed-off-by: ruriko <[email protected]> * fix mip status update Signed-off-by: ruriko <[email protected]> * enable deny event Signed-off-by: ruriko <[email protected]> * change violations limit Signed-off-by: ruriko <[email protected]> * update rego policy (#12) Signed-off-by: ruriko <[email protected]> * Support operator and observer (#13) * add initial code generated by operator-sdk Signed-off-by: ruriko <[email protected]> * add operator Signed-off-by: ruriko <[email protected]> * add observer Signed-off-by: ruriko <[email protected]> * fix public key loading Signed-off-by: ruriko <[email protected]> * update operator to deploy observer Signed-off-by: ruriko <[email protected]> * add utility scripts * fix observer bug Signed-off-by: ruriko <[email protected]> * add flag for installing observer Signed-off-by: ruriko <[email protected]> * fix observer log and enable to show provenance log Signed-off-by: ruriko <[email protected]> * add operator bundle * update version of k8s-manifest-sigstore * fix log scripts Signed-off-by: ruriko <[email protected]> * fix to delete cluster scope Signed-off-by: ruriko <[email protected]> * fix operator to check constraint template crd is available * update k8s-manifest-sigstore version and update server to generate deny events Signed-off-by: ruriko <[email protected]> * fix event and constraint template Signed-off-by: ruriko <[email protected]> * fix constraint template Signed-off-by: ruriko <[email protected]> * refine server role Signed-off-by: ruriko <[email protected]> * fix error handling Signed-off-by: ruriko <[email protected]> * update k8s-manifest-sigstore version Signed-off-by: ruriko <[email protected]> * enable to verify pgp/x509 signature Signed-off-by: ruriko <[email protected]> * update observer to export results to verifyresourcestatus Signed-off-by: ruriko <[email protected]> * update go.mod Signed-off-by: ruriko <[email protected]> * update go.mod Signed-off-by: ruriko <[email protected]> * handle nil observer config Signed-off-by: ruriko <[email protected]> * fix lint error Signed-off-by: ruriko <[email protected]> * rename inspector to observer and fix observer config Signed-off-by: ruriko <[email protected]> * enable constraint config to control enforce/inform mode per constraint (#14) * fix typo Signed-off-by: ruriko <[email protected]> * update to enforce/observe according to constraint config Signed-off-by: ruriko <[email protected]> * enable image verification Signed-off-by: ruriko <[email protected]> * rename ishield-server to shield and change dir structure Signed-off-by: ruriko <[email protected]> * rename dir Signed-off-by: ruriko <[email protected]> * organize dir/files Signed-off-by: ruriko <[email protected]> * organize dir/files Signed-off-by: ruriko <[email protected]> Co-authored-by: Steve Martinelli <[email protected]> Co-authored-by: Yuji Watanabe <[email protected]> Co-authored-by: imgbot[bot] <31301654+imgbot[bot]@users.noreply.github.com> Co-authored-by: ImgBotApp <[email protected]> * fix go.mod error and update crd version Signed-off-by: ruriko <[email protected]> * update apiVersion of IntegrityShield CRD to v1 (IBM#345) * change IntegrityShield CRD apiVersion to v1 Signed-off-by: Hirokuni-Kitahara1 <[email protected]> * update Makefile Signed-off-by: Hirokuni-Kitahara1 <[email protected]> * fix default value in CR (IBM#349) Signed-off-by: ruriko <[email protected]> * enable to use private rekor server (IBM#350) Signed-off-by: ruriko <[email protected]> * enable image verification with a cosign verify-manifest function (IBM#346) * add image package and implement image profile Signed-off-by: Hirokuni-Kitahara1 <[email protected]> * update image verification Signed-off-by: Hirokuni-Kitahara1 <[email protected]> * add sample constraint with image profile Signed-off-by: Hirokuni-Kitahara1 <[email protected]> * update image verify codes Signed-off-by: Hirokuni-Kitahara1 <[email protected]> * update image verify codes Signed-off-by: Hirokuni-Kitahara1 <[email protected]> * fix small err in cr Signed-off-by: ruriko <[email protected]> * enforce/inform mode can be set for each constraint (IBM#351) * move constraint enforce setting into constraint parameter Signed-off-by: ruriko <[email protected]> * update operator-sdk version Signed-off-by: ruriko <[email protected]> * changed to appropriate name/parameters (IBM#352) * rename custom resource for reporting observation results Signed-off-by: ruriko <[email protected]> * fix action param name Signed-off-by: ruriko <[email protected]> * update bundle Signed-off-by: ruriko <[email protected]> * remove 'server' from all parameters Signed-off-by: ruriko <[email protected]> * fix value in local cr Signed-off-by: ruriko <[email protected]> * change api and observer roles to the minimum privileges (IBM#353) Signed-off-by: ruriko <[email protected]> * updated request handler (IBM#354) * enable inScopeUsers Signed-off-by: ruriko <[email protected]> * fix err message Signed-off-by: ruriko <[email protected]> * resolve cosign warning message Signed-off-by: ruriko <[email protected]> * add e2e test (IBM#355) * fix crd scope Signed-off-by: ruriko <[email protected]> * add e2e-test Signed-off-by: ruriko <[email protected]> * remove unneeded files Signed-off-by: ruriko <[email protected]> * remove unneeded variable Signed-off-by: ruriko <[email protected]> * Unit test/prep move (IBM#356) * add unit-test Signed-off-by: ruriko <[email protected]> * fix Makefile for unit-test Signed-off-by: ruriko <[email protected]> * fix image registry name in unit-test Signed-off-by: ruriko <[email protected]> * Fixes to make travis build complete successfully * Fixes to make travis build complete successfully * update makefile Signed-off-by: ruriko <[email protected]> * Fixes to make travis build complete successfully - fixed image push script * update observer (IBM#358) * add image verification to observer Signed-off-by: ruriko <[email protected]> * add param to change provenance option, update observer result detail for web ui Signed-off-by: ruriko <[email protected]> * fix operator Signed-off-by: ruriko <[email protected]> * update csv Signed-off-by: ruriko <[email protected]> * remove vulnerable pacakge Signed-off-by: ruriko <[email protected]> * resolve conflicts Signed-off-by: ruriko <[email protected]> * add variable for operator channel Signed-off-by: ruriko <[email protected]> * resolve conflicts Signed-off-by: ruriko <[email protected]> Co-authored-by: hirokuni-kitahara <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]> Co-authored-by: Steve Martinelli <[email protected]> Co-authored-by: Yuji Watanabe <[email protected]> Co-authored-by: imgbot[bot] <31301654+imgbot[bot]@users.noreply.github.com> Co-authored-by: ImgBotApp <[email protected]> Co-authored-by: Hiro Kitahara <[email protected]> Co-authored-by: OpenShift Merge Robot <[email protected]>
1 parent 848169b commit 7e9c168

File tree

515 files changed

+22761
-30342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

515 files changed

+22761
-30342
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ jobs:
8181
- stage: publish
8282
name: "Publish the image to quay with an official version/sha tag and publish entry to integration pipeline stage"
8383
if: env(ENABLE_PUBLISH) = true AND branch =~ /^release-[0-9]+\..*$/
84-
#type = push AND branch = master
8584
script:
8685
- |
8786
make init

CatalogSource.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: operators.coreos.com/v1alpha1
2+
kind: CatalogSource
3+
metadata:
4+
name: new-integrity-shield-operator-catalog
5+
namespace: openshift-marketplace # olm
6+
spec:
7+
displayName: Integrity Shield++ Operator
8+
image: gcr.io/clean-resource-318209/integrity-shield-operator-index:0.2.5
9+
publisher: IBM
10+
sourceType: grpc
11+
updateStrategy:
12+
registryPoll:
13+
interval: 45m

Makefile

Lines changed: 110 additions & 137 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 65 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,76 @@
1-
# Integrity Shield (IShield)
2-
3-
Integrity Shield is a tool for built-in preventive integrity control for regulated cloud workloads. It includes signature based configuration drift prevention based on [Admission Webhook](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/) on Kubernetes cluster.
1+
# integrity-shield
2+
Integrity Shield is a tool for built-in preventive integrity control for regulated cloud workloads. It provides signature-based assurance of integrity for Kubernetes resources at cluster side.
43

5-
## Goal
6-
7-
The goal of Integrity Shield is to provide assurance of the integrity of Kubernetes resources.
8-
9-
Resources on a Kubernetes cluster are defined in various form of artifacts such as YAML files, Helm charts, Operator, etc., but those artifacts may be altered maliciously or unintentionally before deploying them to cluster.
10-
This could be an integrity issue. For example, some artifact may be modified to inject malicous scripts and configurations inside in stealthy manner, then admininstrator may be in risk of deploying it without knowing the falsification.
11-
12-
Integrity Shield (IShield) provides signature-based assurance of integrity for Kubernetes resources at cluster side. IShield works as an Admission Controller which handles all incoming Kubernetes admission requests, verifies if the requests attached a signature, and blocks any unauthorized requests according to the shield policy before actually persisting in etcd. will helps cluster adminstrator to ensure
13-
- Allow to deploy authorized application pakcages only
14-
- Allow to use signed deployment params only
15-
- Zero-drift in resource configuration unless allowed explicitly
16-
- Perform all integrity verification on cluster (admission controller, not in client side)
17-
- Handle variations in application packaging and deployment (Helm /Operator /YAML / OLM Channel) with no modification in app installer
18-
4+
Integrity Shield works with OPA/Gatekeeper, verifies if the requests attached a signature, and blocks any unauthorized requests according to the constraint before actually persisting in etcd.
5+
Also, you can use the [admission controller](./webhook/admission-controller/README.md) instead of OPA/Gatekeeper.
196

207
![Scenario](./docs/ishield-scenario.png)
218

22-
## Quick Start
23-
See [Quick Start](./docs/README_QUICK.md)
9+
## integrity shield api
2410

25-
## Supported Platforms
11+
Integrity shield api includes the main logic to verify admission requests.
12+
Integrity shield api receives a k8s resource from OPA/Gatekeeper, validates the resource which is included in the admission request based on the profile and sends the verification result to OPA/Gatekeeper.
13+
Integrity shield api uses [k8s-manifest-sigstore](https://github.com/sigstore/k8s-manifest-sigstore) internally to verify k8s manifest.
2614

27-
Integrity Shield works as Kubernetes Admission Controller using Mutating Admission Webhook, and it can run on any Kubernetes cluster by design.
28-
IShield can be deployed with operator. We have verified the feasibility on the following platforms:
15+
You can enable the protection by integrity shield with a few simple steps.
16+
Please see [Usage](./shield/README.md).
2917

30-
- [RedHat OpenShift 4.5 and 4.6](https://www.openshift.com/)
31-
- [RedHat OpenShift 4.3 on IBM Cloud (ROKS)](https://www.openshift.com/products/openshift-ibm-cloud)
32-
- [IBM Kuberenetes Service (IKS)](https://www.ibm.com/cloud/container-service/) 1.17.14
33-
- [Minikube v1.19.1](https://kubernetes.io/docs/setup/learning-environment/minikube/)
18+
## gatekeeper constraint
19+
Integrity shield works with OPA/Gatekeeper by installing ConstraintTemplate(`template-manifestintegrityconstraint.yaml` ).
20+
We use [constraint framework](https://open-policy-agent.github.io/gatekeeper/website/docs/howto/#constraints) of OPA/Gatekeeper to define the resources to be protected.
3421

35-
## How Integrity Shield works
36-
- Resources to be protected in each namespace can be defined in the custom resource called `ResourceSigningProfile`. For example, the following snippet shows an example definition of protected resources in a namespace. This `ResourceSigningProfile` resource includes the matching rule for specifiying resources to such as ConfigMap, Depoloyment, and Service in a namespace `secure-ns`, which is protected by , so any matched request to create/update those resources are verified with signature. (see [Define Protected Resources](./docs/README_FOR_RESOURCE_SIGNING_PROFILE.md))
37-
38-
```yaml
39-
apiVersion: apis.integrityshield.io/v1alpha1
40-
kind: ResourceSigningProfile
41-
metadata:
42-
name: sample-rsp
43-
spec:
44-
targetNamespaceSelector:
45-
include:
46-
- "secure-ns"
47-
exclude:
48-
- "kube-*"
49-
protectRules:
50-
- match:
51-
- kind: ConfigMap
22+
For example, the following snippet shows an example definition of protected resources in a namespace.
23+
```
24+
apiVersion: constraints.gatekeeper.sh/v1beta1
25+
kind: ManifestIntegrityConstraint
26+
metadata:
27+
name: deployment-constraint
28+
spec:
29+
match:
30+
kinds:
31+
- kinds: ["Deployment"]
32+
apiGroups: ["apps"]
33+
namespaces:
34+
- "sample-ns"
35+
parameters:
36+
inScopeObjects:
37+
- name: sample-app
38+
signers:
39+
40+
ignoreFields:
41+
- objects:
5242
- kind: Deployment
53-
- kind: Service
54-
```
55-
56-
- Adminssion request to the protected resources is blocked at Mutating Admission Webhook, and the request is allowed only when the valid signature on the resource in the request is provided.
57-
- Signer can be defined for each namespace independently. Signer for cluster-scope resources can be also defined. (see [Signer Configuration](./docs/README_SIGNER_CONFIG.md).)
58-
- Signature is provided in the form of separate signature resource or annotation attached to the resource. (see [How to Sign Resources](./docs/README_RESOURCE_SIGNATURE.md))
59-
- Integrity Shield admission controller is installed in a dedicated namespace (e.g. `integrity-shield-operator-system` in this document). It can be installed by operator. (see [Integrity Shield Custom Resource](./docs/README_ISHIELD_OPERATOR_CR.md) for detail install options.)
60-
43+
fields:
44+
- spec.replicas
45+
```
46+
`ManifestIntegrityConstraint` resource includes the parameters field. In the parameters field, you can configure the profile for verifying resources such as ignoreFields for allowing some requests that match this rule, signers, and so on.
47+
48+
## admission controller
49+
This is an admission controller for verifying k8s manifest with sigstore signing. You can use this admission controller instead of OPA/Gatekeeper.
50+
In this case, you can decide which resources to be protected in the custom resource called `ManifestIntegrityProfile` instead of OPA/Gatekeeper constraint.
51+
52+
The following snippet is an example of `ManifestIntegrityProfile`.
53+
```
54+
apiVersion: apis.integrityshield.io/v1alpha1
55+
kind: ManifestIntegrityProfile
56+
metadata:
57+
name: profile-configmap
58+
spec:
59+
match:
60+
kinds:
61+
- kinds:
62+
- ConfigMap
63+
namespaces:
64+
- sample-ns
65+
parameters:
66+
ignoreFields:
67+
- fields:
68+
- data.comment
69+
objects:
70+
- kind: ConfigMap
71+
signers:
72+
73+
```
6174

62-
## Quick Start
63-
See [Quick Start](./docs/README_QUICK.md)
75+
You can set up the admission controller with a few simple steps. Please see [admission controller](./webhook/admission-controller/README.md).
6476

65-
<!---
66-
Date: 8/18/2021
67-
-->

build/build_bundle.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,6 @@ elif [ "${ISHIELD_ENV}" = "local" ]; then
143143
fi
144144
echo "Completed building bundle and index"
145145

146-
targetFile="${SHIELD_OP_DIR}/bundle.Dockerfile"
147-
licenseFile="${SHIELD_OP_DIR}/license.txt"
146+
targetFile="${SHIELD_OP_DIR}bundle.Dockerfile"
147+
licenseFile="${SHIELD_OP_DIR}license.txt"
148148
$ISHIELD_REPO_ROOT/build/add_license.sh $targetFile $licenseFile

build/build_images.sh

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ if [ -z "$ISHIELD_REPO_ROOT" ]; then
4242
exit 1
4343
fi
4444

45-
if [ -z "$ISHIELD_SERVER_IMAGE_NAME_AND_VERSION" ]; then
46-
echo "ISHIELD_SERVER_IMAGE_NAME_AND_VERSION is empty. Please set IShield build env settings."
45+
if [ -z "$ISHIELD_API_IMAGE_NAME_AND_VERSION" ]; then
46+
echo "ISHIELD_API_IMAGE_NAME_AND_VERSION is empty. Please set IShield build env settings."
4747
exit 1
4848
fi
4949

50-
if [ -z "$ISHIELD_LOGGING_IMAGE_NAME_AND_VERSION" ]; then
51-
echo "ISHIELD_LOGGING_IMAGE_NAME_AND_VERSION is empty. Please set IShield build env settings."
50+
if [ -z "$ISHIELD_ADMISSION_CONTROLLER_IMAGE_NAME_AND_VERSION" ]; then
51+
echo "ISHIELD_ADMISSION_CONTROLLER_IMAGE_NAME_AND_VERSION is empty. Please set IShield build env settings."
5252
exit 1
5353
fi
5454

@@ -57,6 +57,11 @@ if [ -z "$ISHIELD_OBSERVER_IMAGE_NAME_AND_VERSION" ]; then
5757
exit 1
5858
fi
5959

60+
# if [ -z "$ISHIELD_INSPECTOR_IMAGE_NAME_AND_VERSION" ]; then
61+
# echo "ISHIELD_INSPECTOR_IMAGE_NAME_AND_VERSION is empty. Please set IShield build env settings."
62+
# exit 1
63+
# fi
64+
6065
if [ -z "$ISHIELD_OPERATOR_IMAGE_NAME_AND_VERSION" ]; then
6166
echo "ISHIELD_OPERATOR_IMAGE_NAME_AND_VERSION is empty. Please set IShield build env settings."
6267
exit 1
@@ -68,35 +73,27 @@ if [ -z "$ISHIELD_OPERATOR" ]; then
6873
fi
6974

7075

71-
SERVICE_NAME=ishield-server
72-
73-
74-
BASEDIR=./deployment
75-
DOCKERFILE=./image/Dockerfile
76-
LOGG_BASEDIR=${ISHIELD_REPO_ROOT}/logging/
77-
OBSV_BASEDIR=${ISHIELD_REPO_ROOT}/observer/
78-
OPERATOR_BASEDIR=${ISHIELD_REPO_ROOT}/integrity-shield-operator/
79-
80-
# Build ishield-server image
76+
# Build ishield-api image
8177
echo -----------------------------
82-
echo [1/4] Building ishield-server image.
83-
cd ${ISHIELD_REPO_ROOT}/shield
78+
echo [1/4] Building ishield-api image.
79+
cd ${SHIELD_DIR}
80+
go mod tidy
8481
exit_status=$?
8582
if [ $exit_status -ne 0 ]; then
8683
echo "failed"
8784
exit 1
8885
fi
89-
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o image/${SERVICE_NAME} ./cmd/${SERVICE_NAME}
86+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags="-s -w" -a -o build/_bin/ishield-api ./
9087
exit_status=$?
9188
if [ $exit_status -ne 0 ]; then
9289
echo "failed"
9390
exit 1
9491
fi
9592

9693
if [ "$NO_CACHE" = true ] ; then
97-
docker build -f ${DOCKERFILE} -t ${ISHIELD_SERVER_IMAGE_NAME_AND_VERSION} image/ --no-cache
94+
docker build -t ${ISHIELD_API_IMAGE_NAME_AND_VERSION} . --no-cache
9895
else
99-
docker build -f ${DOCKERFILE} -t ${ISHIELD_SERVER_IMAGE_NAME_AND_VERSION} image/
96+
docker build -t ${ISHIELD_API_IMAGE_NAME_AND_VERSION} .
10097
fi
10198

10299
exit_status=$?
@@ -108,19 +105,26 @@ echo done.
108105
echo -----------------------------
109106
echo ""
110107

111-
# Build ishield-logging image
108+
# Build ishield-ac-server image
112109
echo -----------------------------
113-
echo [2/4] Building ishield-logging image.
114-
cd ${LOGG_BASEDIR}
110+
echo [2/4] Building ishield-ac-server image.
111+
cd ${SHIELD_AC_DIR}
112+
go mod tidy
113+
exit_status=$?
114+
if [ $exit_status -ne 0 ]; then
115+
echo "failed"
116+
exit 1
117+
fi
118+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags="-s -w" -o build/_bin/k8s-manifest-sigstore ./
115119
exit_status=$?
116120
if [ $exit_status -ne 0 ]; then
117121
echo "failed"
118122
exit 1
119123
fi
120124
if [ "$NO_CACHE" = true ] ; then
121-
docker build -t ${ISHIELD_LOGGING_IMAGE_NAME_AND_VERSION} ${LOGG_BASEDIR} --no-cache
125+
docker build -t ${ISHIELD_ADMISSION_CONTROLLER_IMAGE_NAME_AND_VERSION} . --no-cache
122126
else
123-
docker build -t ${ISHIELD_LOGGING_IMAGE_NAME_AND_VERSION} ${LOGG_BASEDIR}
127+
docker build -t ${ISHIELD_ADMISSION_CONTROLLER_IMAGE_NAME_AND_VERSION} .
124128
fi
125129

126130
exit_status=$?
@@ -135,42 +139,41 @@ echo ""
135139
# Build ishield-observer image
136140
echo -----------------------------
137141
echo [3/4] Building ishield-observer image.
138-
cd ${OBSV_BASEDIR}
142+
cd ${SHIELD_OBSERVER_DIR}
143+
go mod tidy
139144
exit_status=$?
140145
if [ $exit_status -ne 0 ]; then
141146
echo "failed"
142147
exit 1
143148
fi
144-
145-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags="-s -w" -a -o build/_output/bin/${ISHIELD_OBSERVER} main.go
146-
147-
if [ "$NO_CACHE" = true ] ; then
148-
docker build -t ${ISHIELD_OBSERVER_IMAGE_NAME_AND_VERSION} ${OBSV_BASEDIR} --no-cache
149-
else
150-
docker build -t ${ISHIELD_OBSERVER_IMAGE_NAME_AND_VERSION} ${OBSV_BASEDIR}
151-
fi
152-
149+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags="-s -w" -a -o build/_bin/ishield-observer ./
153150
exit_status=$?
154151
if [ $exit_status -ne 0 ]; then
155152
echo "failed"
156153
exit 1
157154
fi
158-
echo done.
159-
echo -----------------------------
160-
echo ""
155+
if [ "$NO_CACHE" = true ] ; then
156+
docker build -t ${ISHIELD_OBSERVER_IMAGE_NAME_AND_VERSION} . --no-cache
157+
else
158+
docker build -t ${ISHIELD_OBSERVER_IMAGE_NAME_AND_VERSION} .
159+
fi
161160

162161
# Build integrity-shield-operator image
163162
echo -----------------------------
164163
echo [4/4] Building integrity-shield-operator image.
165-
cd ${OPERATOR_BASEDIR}
164+
cd ${SHIELD_OP_DIR}
165+
go mod tidy
166+
exit_status=$?
167+
if [ $exit_status -ne 0 ]; then
168+
echo "failed"
169+
exit 1
170+
fi
171+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags="-s -w" -a -o build/_output/bin/integrity-shield-operator main.go
166172
exit_status=$?
167173
if [ $exit_status -ne 0 ]; then
168174
echo "failed"
169175
exit 1
170176
fi
171-
172-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags="-s -w" -a -o build/_output/bin/${ISHIELD_OPERATOR} main.go
173-
174177
if [ "$NO_CACHE" = true ] ; then
175178
docker build . -t ${ISHIELD_OPERATOR_IMAGE_NAME_AND_VERSION} --no-cache
176179
else
@@ -182,6 +185,7 @@ if [ $exit_status -ne 0 ]; then
182185
echo "failed"
183186
exit 1
184187
fi
188+
185189
echo done.
186190
echo -----------------------------
187191
echo ""

build/check-bundle-deployment-local.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ echo "-------------------------------------------------"
2424
echo "Check if operator bundle deployed correctly."
2525
echo "Let's wait for integrity-shield-operator-bundle to be depoyed..."
2626
while true; do
27-
ISHIELD_STATUS=$(kubectl get pod -n ${ISHIELD_OP_NS} 2>/dev/null | grep integrity-shield-operator | awk '{print $3}')
27+
ISHIELD_STATUS=$(kubectl get pod -n ${ISHIELD_NS} 2>/dev/null | grep integrity-shield-operator | awk '{print $3}')
2828
if [[ "$ISHIELD_STATUS" == "Running" ]]; then
2929
echo
3030
echo -n "===== Integrity Shield operator has started, let's continue with testing e2e. ====="

build/clean-e2e-bundle-test-local.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ set -e
1818

1919
echo "E2E TEST BUNDLE CLEAN GOES HERE!"
2020

21-
if [ -z "$ISHIELD_OP_NS" ]; then
22-
echo "ISHIELD_OP_NS is empty. Please set env."
21+
if [ -z "$ISHIELD_NS" ]; then
22+
echo "ISHIELD_NS is empty. Please set env."
2323
exit 1
2424
fi
2525

@@ -42,7 +42,7 @@ echo "Testing BUNDLE_INDEX_IMAGE: $BUNDLE_INDEX_IMAGE"
4242
echo ""
4343
echo "-------------------------------------------------"
4444

45-
NS_EXIST=$(kubectl get ns | grep ${ISHIELD_OP_NS} | cut -d' ' -f1)
45+
NS_EXIST=$(kubectl get ns | grep ${ISHIELD_NS} | cut -d' ' -f1)
4646

4747

4848
if [ ! -z $NS_EXIST ]; then
@@ -51,16 +51,16 @@ apiVersion: operators.coreos.com/v1
5151
kind: OperatorGroup
5252
metadata:
5353
name: operatorgroup
54-
namespace: ${ISHIELD_OP_NS}
54+
namespace: ${ISHIELD_NS}
5555
spec:
5656
targetNamespaces:
57-
- ${ISHIELD_OP_NS}
57+
- ${ISHIELD_NS}
5858
---
5959
apiVersion: operators.coreos.com/v1alpha1
6060
kind: Subscription
6161
metadata:
6262
name: integrity-shield-operator
63-
namespace: ${ISHIELD_OP_NS}
63+
namespace: ${ISHIELD_NS}
6464
spec:
6565
channel: alpha
6666
name: integrity-shield-operator

0 commit comments

Comments
 (0)