-
Notifications
You must be signed in to change notification settings - Fork 1
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 #22 from appuio/disallow-docker-build-strategy
Disallow docker build strategy
- Loading branch information
Showing
6 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
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
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,22 @@ | ||
local common = import 'common.libsonnet'; | ||
local kap = import 'lib/kapitan.libjsonnet'; | ||
local kube = import 'lib/kube.libjsonnet'; | ||
local resourceLocker = import 'lib/resource-locker.libjsonnet'; | ||
local inv = kap.inventory(); | ||
// The hiera parameters for the component | ||
local params = inv.parameters.appuio_cloud; | ||
|
||
// See https://docs.openshift.com/container-platform/4.8/cicd/builds/securing-builds-by-strategy.html#builds-disabling-build-strategy-globally_securing-builds-by-strategy | ||
local bindingToPatch = kube.ClusterRoleBinding('system:build-strategy-docker-binding'); | ||
|
||
local disallowDockerBuildStrategyPatch = { | ||
annotations: { | ||
'rbac.authorization.kubernetes.io/autoupdate': 'false', | ||
}, | ||
subjects: [], | ||
}; | ||
|
||
{ | ||
[if params.disallowDockerBuildStrategy then '15_disallow_docker_build_strategy_patch']: | ||
resourceLocker.Patch(bindingToPatch, disallowDockerBuildStrategyPatch), | ||
} |
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
61 changes: 61 additions & 0 deletions
61
tests/golden/defaults/appuio-cloud/appuio-cloud/15_disallow_docker_build_strategy_patch.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,61 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
labels: | ||
name: system-build-strategy-docker-binding-manager | ||
name: system-build-strategy-docker-binding-manager | ||
namespace: syn-resource-locker | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
labels: | ||
name: syn-resource-locker-ystem-build-strategy-docker-binding-manager | ||
name: syn-resource-locker-ystem-build-strategy-docker-binding-manager | ||
rules: | ||
- apiGroups: | ||
- rbac.authorization.k8s.io | ||
resources: | ||
- clusterrolebindings | ||
verbs: | ||
- get | ||
- list | ||
- patch | ||
- watch | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
labels: | ||
name: syn-resource-locker-ystem-build-strategy-docker-binding-manager | ||
name: syn-resource-locker-ystem-build-strategy-docker-binding-manager | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: syn-resource-locker-ystem-build-strategy-docker-binding-manager | ||
subjects: | ||
- kind: ServiceAccount | ||
name: system-build-strategy-docker-binding-manager | ||
namespace: syn-resource-locker | ||
--- | ||
apiVersion: redhatcop.redhat.io/v1alpha1 | ||
kind: ResourceLocker | ||
metadata: | ||
annotations: | ||
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true | ||
labels: | ||
name: system-build-strategy-docker-binding | ||
name: system-build-strategy-docker-binding | ||
namespace: syn-resource-locker | ||
spec: | ||
patches: | ||
- id: patch1 | ||
patchTemplate: "\"annotations\":\n \"rbac.authorization.kubernetes.io/autoupdate\"\ | ||
: \"false\"\n\"subjects\": []" | ||
patchType: application/strategic-merge-patch+json | ||
targetObjectRef: | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
name: system:build-strategy-docker-binding | ||
serviceAccountRef: | ||
name: system-build-strategy-docker-binding-manager |