Skip to content

Commit

Permalink
fix: refactor namespaces, publish release files to github release
Browse files Browse the repository at this point in the history
  • Loading branch information
teodor-pripoae committed Apr 25, 2023
1 parent 2506d98 commit 016399c
Show file tree
Hide file tree
Showing 15 changed files with 141 additions and 137 deletions.
29 changes: 17 additions & 12 deletions .github/workflows/build_and_release.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
name: build and release

on:
push:
branches:
- build
# release:
# types: [published]
release:
types: [published]

env:
# TAG: "${{ github.ref_name }}"
TAG: "v0.1.0"
TAG: "${{ github.ref_name }}"
jobs:
installing_linting_building:
build:
runs-on: ubuntu-latest
steps:
- name: Clone repository
Expand All @@ -26,11 +22,20 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.PAT }}
- name: Set version
run: |
echo "VERSION=${TAG//v/}" >>${GITHUB_ENV}
- name: Generate release yaml
run: make release
- name: Build docker image
run: |
make docker-build
make docker-push
# - name: Build manifests
# run: |
# make manifests
- name: Upload file to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.PAT }}
file: config/release/static.yaml
asset_name: release.yaml
tag: ${{ env.TAG }}
overwrite: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ Dockerfile.cross
*.swp
*.swo
*~
config/release
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 0.0.11
VERSION ?= 0.1.0-dev

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
Expand Down Expand Up @@ -169,6 +169,8 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi
.PHONY: static
static: manifests kustomize
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
mkdir -p config/release
$(KUSTOMIZE) build config/default > config/release/static.yaml

##@ Build Dependencies

Expand Down
20 changes: 9 additions & 11 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Adds namespace to all resources.
namespace: app-secrets-operator-system
namespace: app-secrets

# Value of this field is prepended to the
# names of all resources, e.g. a deployment named
# "wordpress" becomes "alices-wordpress".
# Note that it should also match with the prefix (text before '-') of the namespace
# field above.
namePrefix: app-secrets-operator-
namePrefix: app-secrets-

# Labels to add to all resources and selectors.
#commonLabels:
# someName: someValue

bases:
- ../crd
- ../rbac
- ../manager
- ../crd
- ../rbac
- ../manager
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
#- ../webhook
Expand All @@ -25,12 +25,10 @@ bases:
#- ../prometheus

patchesStrategicMerge:
# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
- manager_auth_proxy_patch.yaml


# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
- manager_auth_proxy_patch.yaml

# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
Expand Down
80 changes: 40 additions & 40 deletions config/default/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
name: controller
namespace: system
spec:
template:
Expand All @@ -13,43 +13,43 @@ spec:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
- ppc64le
- s390x
- key: kubernetes.io/os
operator: In
values:
- linux
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
- ppc64le
- s390x
- key: kubernetes.io/os
operator: In
values:
- linux
containers:
- name: kube-rbac-proxy
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- "ALL"
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.13.1
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"
- "--logtostderr=true"
- "--v=0"
ports:
- containerPort: 8443
protocol: TCP
name: https
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 5m
memory: 64Mi
- name: manager
args:
- "--health-probe-bind-address=:8081"
- "--metrics-bind-address=127.0.0.1:8080"
- "--leader-elect"
- name: kube-rbac-proxy
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- "ALL"
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.13.1
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"
- "--logtostderr=true"
- "--v=0"
ports:
- containerPort: 8443
protocol: TCP
name: https
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 5m
memory: 64Mi
- name: manager
args:
- "--health-probe-bind-address=:8081"
- "--metrics-bind-address=127.0.0.1:8080"
- "--leader-elect"
4 changes: 2 additions & 2 deletions config/default/manager_config_patch.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
name: controller
namespace: system
spec:
template:
spec:
containers:
- name: manager
- name: manager
4 changes: 2 additions & 2 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: docker.io/teodor-pripoae/app-secrets-operator
newTag: v0.0.11
newName: ghcr.io/teodor-pripoae/app-secrets-operator
newTag: v0.0.12
78 changes: 39 additions & 39 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
kind: Namespace
metadata:
labels:
control-plane: controller-manager
control-plane: controller
app.kubernetes.io/name: namespace
app.kubernetes.io/instance: system
app.kubernetes.io/component: manager
Expand All @@ -14,27 +14,27 @@ metadata:
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
name: controller
namespace: system
labels:
control-plane: controller-manager
control-plane: controller
app.kubernetes.io/name: deployment
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/instance: controller
app.kubernetes.io/component: manager
app.kubernetes.io/created-by: app-secrets-operator
app.kubernetes.io/part-of: app-secrets-operator
app.kubernetes.io/managed-by: kustomize
spec:
selector:
matchLabels:
control-plane: controller-manager
control-plane: controller
replicas: 1
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: manager
labels:
control-plane: controller-manager
control-plane: controller
spec:
# TODO(user): Uncomment the following code to configure the nodeAffinity expression
# according to the platforms which are supported by your solution.
Expand Down Expand Up @@ -66,37 +66,37 @@ spec:
# seccompProfile:
# type: RuntimeDefault
containers:
- command:
- /manager
args:
- --leader-elect
image: controller:latest
name: manager
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- "ALL"
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
# TODO(user): Configure the resources accordingly based on the project requirements.
# More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 10m
memory: 64Mi
serviceAccountName: controller-manager
- command:
- /manager
args:
- --leader-elect
image: controller:latest
name: manager
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- "ALL"
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
# TODO(user): Configure the resources accordingly based on the project requirements.
# More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 10m
memory: 64Mi
serviceAccountName: controller
terminationGracePeriodSeconds: 10
11 changes: 5 additions & 6 deletions config/manifests/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# These resources constitute the fully configured set of manifests
# used to generate the 'manifests/' directory in a bundle.
resources:
- bases/app-secrets-operator.clusterserviceversion.yaml
- ../default
- ../samples
- ../scorecard

- bases/app-secrets-operator.clusterserviceversion.yaml
- ../default
- ../samples
- ../scorecard
# [WEBHOOK] To enable webhooks, uncomment all the sections with [WEBHOOK] prefix.
# Do NOT uncomment sections with prefix [CERTMANAGER], as OLM does not support cert-manager.
# These patches remove the unnecessary "cert" volume and its manager container volumeMount.
Expand All @@ -14,7 +13,7 @@ resources:
# group: apps
# version: v1
# kind: Deployment
# name: controller-manager
# name: controller
# namespace: system
# patch: |-
# # Remove the manager container's "cert" volumeMount, since OLM will create and mount a set of certs.
Expand Down
9 changes: 4 additions & 5 deletions config/prometheus/monitor.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@

# Prometheus Monitor Service (Metrics)
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
control-plane: controller-manager
control-plane: controller
app.kubernetes.io/name: servicemonitor
app.kubernetes.io/instance: controller-manager-metrics-monitor
app.kubernetes.io/instance: controller-metrics-monitor
app.kubernetes.io/component: metrics
app.kubernetes.io/created-by: app-secrets-operator
app.kubernetes.io/part-of: app-secrets-operator
app.kubernetes.io/managed-by: kustomize
name: controller-manager-metrics-monitor
name: controller-metrics-monitor
namespace: system
spec:
endpoints:
Expand All @@ -23,4 +22,4 @@ spec:
insecureSkipVerify: true
selector:
matchLabels:
control-plane: controller-manager
control-plane: controller
Loading

0 comments on commit 016399c

Please sign in to comment.