Skip to content

Commit

Permalink
Rebased against main
Browse files Browse the repository at this point in the history
  • Loading branch information
liamfallon committed Nov 14, 2024
1 parent 775fa5c commit 442d071
Show file tree
Hide file tree
Showing 47 changed files with 684 additions and 3 deletions.
3 changes: 0 additions & 3 deletions pkg/registry/porch/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,6 @@ func (w *watcher) sendWatchEvent(ev watch.Event) {
// TODO: Handle the case that the watch channel is full?
w.resultChan <- ev
w.totalSent += 1
if (w.totalSent % 100) == 0 {
klog.Infof("watch %p: total sent: %d", w, w.totalSent)
}
}

// OnPackageRevisionChange is the callback called when a PackageRevision changes.
Expand Down
27 changes: 27 additions & 0 deletions pkg/repository/testdata/update/local/Kptfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: backend
annotations:
config.kubernetes.io/local-config: "true"
upstream:
type: git
git:
repo: https://github.com/droot/pkg-catalog.git
directory: basens
ref: basens/v0
upstreamLock:
type: git
git:
repo: https://github.com/droot/pkg-catalog.git
directory: basens
ref: basens/v0
commit: b3e1d439516a5e8d49adc0c82d3e95578570dbfa
info:
description: kpt package for provisioning namespace
pipeline:
mutators:
- image: gcr.io/kpt-fn/set-namespace:v0.3.4
configPath: package-context.yaml
- image: gcr.io/kpt-fn/apply-replacements:v0.1.0
configPath: update-rolebinding.yaml
21 changes: 21 additions & 0 deletions pkg/repository/testdata/update/local/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# basens

## Description
kpt package for provisioning namespace

## Usage

### Fetch the package
`kpt pkg get REPO_URI[.git]/PKG_PATH[@VERSION] basens`
Details: https://kpt.dev/reference/cli/pkg/get/

### View package content
`kpt pkg tree basens`
Details: https://kpt.dev/reference/cli/pkg/tree/

### Apply the package
```
kpt live init basens
kpt live apply basens --reconcile-timeout=2m --output=table
```
Details: https://kpt.dev/reference/cli/live/
5 changes: 5 additions & 0 deletions pkg/repository/testdata/update/local/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: Namespace
metadata: # kpt-merge: example
name: backend
spec: {}
8 changes: 8 additions & 0 deletions pkg/repository/testdata/update/local/package-context.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: kptfile.kpt.dev
annotations:
config.kubernetes.io/local-config: "true"
data:
name: backend
9 changes: 9 additions & 0 deletions pkg/repository/testdata/update/local/resourcequota.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ResourceQuota
metadata: # kpt-merge: example/default
name: default
namespace: backend
spec:
hard:
cpu: "40"
memory: 40G
13 changes: 13 additions & 0 deletions pkg/repository/testdata/update/local/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata: # kpt-merge: example/app-admin
name: app-admin
namespace: backend
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: app-admin
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: backend.admin@bigco.com
20 changes: 20 additions & 0 deletions pkg/repository/testdata/update/local/update-rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: fn.kpt.dev/v1alpha1
kind: ApplyReplacements
metadata: # kpt-merge: example/update-rolebinding
name: update-rolebinding
annotations:
config.kubernetes.io/local-config: "true"
replacements:
- source:
kind: ConfigMap
name: kptfile.kpt.dev
fieldPath: data.name
targets:
- select:
name: app-admin
kind: RoleBinding
fieldPaths:
- subjects.[kind=Group].name
options:
delimiter: '.'
index: 0
14 changes: 14 additions & 0 deletions pkg/repository/testdata/update/original/Kptfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: basens
annotations:
config.kubernetes.io/local-config: "true"
info:
description: kpt package for provisioning namespace
pipeline:
mutators:
- image: gcr.io/kpt-fn/set-namespace:v0.3.4
configPath: package-context.yaml
- image: gcr.io/kpt-fn/apply-replacements:v0.1.0
configPath: update-rolebinding.yaml
21 changes: 21 additions & 0 deletions pkg/repository/testdata/update/original/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# basens

## Description
kpt package for provisioning namespace

## Usage

### Fetch the package
`kpt pkg get REPO_URI[.git]/PKG_PATH[@VERSION] basens`
Details: https://kpt.dev/reference/cli/pkg/get/

### View package content
`kpt pkg tree basens`
Details: https://kpt.dev/reference/cli/pkg/tree/

### Apply the package
```
kpt live init basens
kpt live apply basens --reconcile-timeout=2m --output=table
```
Details: https://kpt.dev/reference/cli/live/
5 changes: 5 additions & 0 deletions pkg/repository/testdata/update/original/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: Namespace
metadata:
name: example
spec: {}
8 changes: 8 additions & 0 deletions pkg/repository/testdata/update/original/package-context.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: kptfile.kpt.dev
annotations:
config.kubernetes.io/local-config: "true"
data:
name: example
9 changes: 9 additions & 0 deletions pkg/repository/testdata/update/original/resourcequota.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ResourceQuota
metadata:
name: default
namespace: example
spec:
hard:
cpu: "40"
memory: 40G
13 changes: 13 additions & 0 deletions pkg/repository/testdata/update/original/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: app-admin
namespace: example
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: app-admin
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: example.admin@bigco.com
20 changes: 20 additions & 0 deletions pkg/repository/testdata/update/original/update-rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: fn.kpt.dev/v1alpha1
kind: ApplyReplacements
metadata:
name: update-rolebinding
annotations:
config.kubernetes.io/local-config: "true"
replacements:
- source:
kind: ConfigMap
name: kptfile.kpt.dev
fieldPath: data.name
targets:
- select:
name: app-admin
kind: RoleBinding
fieldPaths:
- subjects.[kind=Group].name
options:
delimiter: '.'
index: 0
27 changes: 27 additions & 0 deletions pkg/repository/testdata/update/updated/Kptfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: backend
annotations:
config.kubernetes.io/local-config: "true"
upstream:
type: git
git:
repo: https://github.com/droot/pkg-catalog.git
directory: basens
ref: basens/v0
upstreamLock:
type: git
git:
repo: https://github.com/droot/pkg-catalog.git
directory: basens
ref: basens/v0
commit: b3e1d439516a5e8d49adc0c82d3e95578570dbfa
info:
description: kpt package for provisioning namespace
pipeline:
mutators:
- image: gcr.io/kpt-fn/set-namespace:v0.3.4
configPath: package-context.yaml
- image: gcr.io/kpt-fn/apply-replacements:v0.1.0
configPath: update-rolebinding.yaml
21 changes: 21 additions & 0 deletions pkg/repository/testdata/update/updated/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# basens

## Description
kpt package for provisioning namespace

## Usage

### Fetch the package
`kpt pkg get REPO_URI[.git]/PKG_PATH[@VERSION] basens`
Details: https://kpt.dev/reference/cli/pkg/get/

### View package content
`kpt pkg tree basens`
Details: https://kpt.dev/reference/cli/pkg/tree/

### Apply the package
```
kpt live init basens
kpt live apply basens --reconcile-timeout=2m --output=table
```
Details: https://kpt.dev/reference/cli/live/
5 changes: 5 additions & 0 deletions pkg/repository/testdata/update/updated/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: Namespace
metadata: # kpt-merge: example
name: backend
spec: {}
8 changes: 8 additions & 0 deletions pkg/repository/testdata/update/updated/package-context.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: kptfile.kpt.dev
annotations:
config.kubernetes.io/local-config: "true"
data:
name: backend
9 changes: 9 additions & 0 deletions pkg/repository/testdata/update/updated/resourcequota.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ResourceQuota
metadata: # kpt-merge: example/default
name: default
namespace: backend
spec:
hard:
cpu: "40"
memory: 60G
13 changes: 13 additions & 0 deletions pkg/repository/testdata/update/updated/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata: # kpt-merge: example/app-admin
name: app-admin
namespace: backend
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: app-admin
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: backend.admin@bigco.com
20 changes: 20 additions & 0 deletions pkg/repository/testdata/update/updated/update-rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: fn.kpt.dev/v1alpha1
kind: ApplyReplacements
metadata: # kpt-merge: example/update-rolebinding
name: update-rolebinding
annotations:
config.kubernetes.io/local-config: "true"
replacements:
- source:
kind: ConfigMap
name: kptfile.kpt.dev
fieldPath: data.name
targets:
- select:
name: app-admin
kind: RoleBinding
fieldPaths:
- subjects.[kind=Group].name
options:
delimiter: '.'
index: 0
14 changes: 14 additions & 0 deletions pkg/repository/testdata/update/upstream/Kptfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: basens
annotations:
config.kubernetes.io/local-config: "true"
info:
description: kpt package for provisioning namespace
pipeline:
mutators:
- image: gcr.io/kpt-fn/set-namespace:v0.3.4
configPath: package-context.yaml
- image: gcr.io/kpt-fn/apply-replacements:v0.1.0
configPath: update-rolebinding.yaml
21 changes: 21 additions & 0 deletions pkg/repository/testdata/update/upstream/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# basens

## Description
kpt package for provisioning namespace

## Usage

### Fetch the package
`kpt pkg get REPO_URI[.git]/PKG_PATH[@VERSION] basens`
Details: https://kpt.dev/reference/cli/pkg/get/

### View package content
`kpt pkg tree basens`
Details: https://kpt.dev/reference/cli/pkg/tree/

### Apply the package
```
kpt live init basens
kpt live apply basens --reconcile-timeout=2m --output=table
```
Details: https://kpt.dev/reference/cli/live/
5 changes: 5 additions & 0 deletions pkg/repository/testdata/update/upstream/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: Namespace
metadata:
name: example
spec: {}
8 changes: 8 additions & 0 deletions pkg/repository/testdata/update/upstream/package-context.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: kptfile.kpt.dev
annotations:
config.kubernetes.io/local-config: "true"
data:
name: example
9 changes: 9 additions & 0 deletions pkg/repository/testdata/update/upstream/resourcequota.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ResourceQuota
metadata:
name: default
namespace: example
spec:
hard:
cpu: "40"
memory: 60G
Loading

0 comments on commit 442d071

Please sign in to comment.