Skip to content

Commit

Permalink
ci(rbac): add OwnerReferencesPermissionEnforcement in kind cluster, t…
Browse files Browse the repository at this point in the history
…o simulate openshift cluster (#822)

Signed-off-by: cndoit18 <cndoit18@outlook.com>
  • Loading branch information
cndoit18 committed Dec 7, 2021
1 parent 008767f commit b088d17
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 9 deletions.
27 changes: 27 additions & 0 deletions .github/kind_permission.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
- |
kind: ClusterConfiguration
apiServer:
extraArgs:
enable-admission-plugins: "OwnerReferencesPermissionEnforcement"
extraMounts:
- containerPath: /var/lib/etcd
hostPath: /tmp/lib/etcd
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
- role: worker
- role: worker
17 changes: 8 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,12 @@ jobs:

# https://github.com/kubernetes-sigs/kind/releases
k8sVersion:
- "1.19.11"
- "1.20.7"
- "1.21.2"
- "1.22.0"

ingress:
- "1.0.1"
- "1.0.5"

samples:
- "full_stack.yaml"
Expand Down Expand Up @@ -182,7 +181,7 @@ jobs:
version: v0.11.0
node_image: kindest/node:v${{ matrix.k8sVersion }}
cluster_name: harbor
config: .github/kind.yaml
config: .github/kind_permission.yaml

- name: Install CertManager v${{ matrix.certManager }}
run: |
Expand All @@ -197,7 +196,7 @@ jobs:
- name: build harbor-operator
run: |
make manifests docker-build IMG=${dockerImage} GIT_COMMIT=${{ github.sha }}
make generate docker-build IMG=${dockerImage} GIT_COMMIT=${{ github.sha }}
kind load docker-image ${dockerImage} --name harbor
- name: install harbor-operator
Expand Down Expand Up @@ -344,11 +343,11 @@ jobs:
matrix:
# https://github.com/jetstack/cert-manager/tags
certManager:
- "1.2.0"
- "1.4.4"

# https://snapcraft.io/microk8s
k8sVersion:
- "1.20.7"
- "1.22.0"

samples:
- "full_stack.yaml"
Expand Down Expand Up @@ -394,7 +393,7 @@ jobs:
- name: Install Contour
run: |
kubectl apply -f https://raw.githubusercontent.com/projectcontour/contour/release-1.18/examples/render/contour.yaml
kubectl apply -f https://github.com/projectcontour/contour/raw/v1.19.1/examples/render/contour.yaml
sleep 5
kubectl patch daemonsets -n projectcontour envoy -p '{"spec":{"template":{"spec":{"nodeSelector":{"ingress-ready":"true"},"tolerations":[{"key":"node-role.kubernetes.io/master","operator":"Equal","effect":"NoSchedule"}]}}}}'
sleep 5
Expand Down Expand Up @@ -554,10 +553,10 @@ jobs:

# https://snapcraft.io/microk8s
k8sVersion:
- "1.21.2"
- "1.22.0"

ingress:
- "0.48.1"
- "1.0.5"

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ certmanager: helm jetstack
--namespace $(CERTMANAGER_NAMESPACE) \
--version v1.4.3 \
--set installCRDs=true
kubectl wait --namespace $(CERTMANAGER_NAMESPACE) --for=condition=ready pod --timeout="60s" --all


.PHONY: jetstack
jetstack:
Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/controllers/cache/resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func (rm *redisResourceManager) GetCacheCR(ctx context.Context, harborcluster *g
Replicas: int32(rm.GetServerReplica()),
Resources: resources,
Storage: redisOp.RedisStorage{
KeepAfterDeletion: true,
PersistentVolumeClaim: pvc,
},
Image: image,
Expand Down

0 comments on commit b088d17

Please sign in to comment.