Skip to content

Commit

Permalink
Use best practices for namespaces in kustomization
Browse files Browse the repository at this point in the history
This change will allow users that reference these kustomizations to more
easily run this in any namespace of their choosing. Whenever namespaces
are included in base resources, any patches also require the original
namespace to be referenced in said patch.

In regards to ClusterRoles/ClusterRoleBindings, kustomize will
automatically add the namespace where it is required automatically.

To allow the release artifacts to continue to set the tekton-pipelines
namespace in it's output, the namespace has been set specifically for
the release kustomziation.
  • Loading branch information
drGrove authored and tekton-robot committed Nov 16, 2023
1 parent 4657821 commit 45ff947
Show file tree
Hide file tree
Showing 20 changed files with 4 additions and 26 deletions.
2 changes: 0 additions & 2 deletions config/base/100-api-serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 16,6 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: api
namespace: tekton-pipelines
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand All @@ -39,7 38,6 @@ metadata:
subjects:
- kind: ServiceAccount
name: api
namespace: tekton-pipelines
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
2 changes: 0 additions & 2 deletions config/base/100-watcher-serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 16,6 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: watcher
namespace: tekton-pipelines
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down Expand Up @@ -55,7 54,6 @@ metadata:
subjects:
- kind: ServiceAccount
name: watcher
namespace: tekton-pipelines
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
2 changes: 0 additions & 2 deletions config/base/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 16,6 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: api
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: tekton-results-api
spec:
Expand Down Expand Up @@ -98,7 97,6 @@ apiVersion: v1
kind: Service
metadata:
name: api-service
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: tekton-results-api
spec:
Expand Down
3 changes: 0 additions & 3 deletions config/base/config-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 16,6 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: info
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: tekton-results-info
data:
Expand All @@ -31,7 30,6 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: info
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: tekton-results-info
rules:
Expand All @@ -48,7 46,6 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: info
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: tekton-results-info
subjects:
Expand Down
1 change: 0 additions & 1 deletion config/base/config-leader-election.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 15,6 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: config-leader-election
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: tekton-results-leader-election
data:
Expand Down
1 change: 0 additions & 1 deletion config/base/config-logging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 15,6 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: config-logging
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: tekton-results-logging
data:
Expand Down
1 change: 0 additions & 1 deletion config/base/config-observability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 16,6 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: config-observability
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: tekton-results-observability
data:
Expand Down
1 change: 0 additions & 1 deletion config/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 25,6 @@ resources:
configMapGenerator:
# Create a ConfigMap containing the API configs.
- name: api-config
namespace: tekton-pipelines
files:
- env/config
options:
Expand Down
2 changes: 0 additions & 2 deletions config/base/watcher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 16,6 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: watcher
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: tekton-results-watcher
spec:
Expand Down Expand Up @@ -81,7 80,6 @@ apiVersion: v1
kind: Service
metadata:
name: watcher
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: tekton-results-watcher
spec:
Expand Down
3 changes: 0 additions & 3 deletions config/components/local-db/201-sql-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 16,6 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: postgres
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: tekton-results-postgres
data:
Expand All @@ -26,7 25,6 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgres
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: tekton-results-postgres
spec:
Expand Down Expand Up @@ -77,7 75,6 @@ apiVersion: v1
kind: Service
metadata:
name: postgres-service
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: tekton-results-postgres
spec:
Expand Down
1 change: 0 additions & 1 deletion config/components/local-db/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 16,6 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: api
namespace: tekton-pipelines
spec:
template:
spec:
Expand Down
1 change: 0 additions & 1 deletion config/components/local-db/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 26,4 @@ patches:
- target:
kind: Deployment
name: api
namespace: tekton-pipelines
path: api.yaml
1 change: 0 additions & 1 deletion config/components/logs-file/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 15,6 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: api
namespace: tekton-pipelines
spec:
template:
spec:
Expand Down
1 change: 0 additions & 1 deletion config/components/logs-file/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 25,3 @@ patches:
target:
kind: Deployment
name: api
namespace: tekton-pipelines
1 change: 0 additions & 1 deletion config/components/logs-file/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 15,6 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: logs
namespace: tekton-pipelines
spec:
resources:
requests:
Expand Down
1 change: 1 addition & 0 deletions config/overlays/base-only/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 17,7 @@
# Creates a Kustomization that deploys Results with no database or logs storage.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: tekton-pipelines
resources:
- ../../base
components:
Expand Down
1 change: 1 addition & 0 deletions config/overlays/default-local-db/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 17,7 @@
# Creates a Kustomization that deploys Results with a local PostGres database.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: tekton-pipelines
resources:
- ../../base
components:
Expand Down
1 change: 1 addition & 0 deletions config/overlays/logs-local-db/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 18,7 @@
# and log storage backed by a PersistentVolumeClaim
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: tekton-pipelines
resources:
- ../../base
components:
Expand Down
1 change: 1 addition & 0 deletions release/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 2,7 @@
# the release process to label all resources with the proper version.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: tekton-pipelines
resources:
- ../config/overlays/default-local-db
labels:
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/kustomize/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

resources:
- ../../../config/overlays/default-local-db
- rbac.yaml
Expand All @@ -22,11 21,9 @@ patches:
version: v1
kind: Deployment
name: tekton-results-watcher
namespace: tekton-pipelines
path: watcher.yaml
- target:
version: v1
kind: Service
name: tekton-results-api-service
namespace: tekton-pipelines
path: api-service.yaml

0 comments on commit 45ff947

Please sign in to comment.