-
Notifications
You must be signed in to change notification settings - Fork 8
feat: multicluster support #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
butler54
wants to merge
6
commits into
validatedpatterns:main
Choose a base branch
from
butler54:generalize-secrets
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ac803d1
feat: enable multi-cluster support as an option in the pattern
butler54 a0d25ab
Merge branch 'main' into generalize-secrets
butler54 f46a708
chore: markdown linting fixes
butler54 952c432
chore: black linting errors
butler54 ab6cb41
chore: remediate linting errors
butler54 1d199ed
fix: add support for no secret store backend
butler54 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
63 changes: 63 additions & 0 deletions
63
charts/coco-supported/hello-openshift/templates/_helpers.tpl
This file contains hidden or 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,63 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "hello-openshift.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "hello-openshift.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "hello-openshift.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "hello-openshift.labels" -}} | ||
helm.sh/chart: {{ include "hello-openshift.chart" . }} | ||
{{ include "hello-openshift.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "hello-openshift.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "hello-openshift.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Determine runtime class name based on cluster platform | ||
Returns "kata-remote" for Azure/AWS, "kata-cc" for other platforms | ||
*/}} | ||
{{- define "hello-openshift.runtimeClassName" -}} | ||
{{- if or (eq .Values.global.clusterPlatform "Azure") (eq .Values.global.clusterPlatform "AWS") -}} | ||
kata-remote | ||
{{- else -}} | ||
kata-cc | ||
{{- end -}} | ||
{{- end }} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Chart-specific values | ||
# Common values are inherited from values-global.yaml | ||
|
||
# Global values used by this chart (overridden by values-global.yaml) | ||
global: | ||
coco: | ||
runtimeClassName: kata-remote | ||
clusterPlatform: "" # Cluster platform: "Azure" or "AWS" - determines runtime class |
This file contains hidden or 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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# Chart-specific values | ||
# Common values are inherited from values-global.yaml | ||
|
||
# Global values used by this chart (overridden by values-global.yaml) | ||
global: | ||
coco: | ||
runtimeClassName: kata-remote | ||
runtimeClassName: "" # Runtime class for confidential containers |
This file contains hidden or 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 |
---|---|---|
@@ -1,10 +1,8 @@ | ||
{{ if .Values.sandbox.deploy }} | ||
apiVersion: kataconfiguration.openshift.io/v1 | ||
kind: KataConfig | ||
metadata: | ||
annotations: | ||
argocd.argoproj.io/sync-wave: "100" | ||
name: default-kata-config | ||
spec: | ||
enablePeerPods: true | ||
{{ end }} | ||
enablePeerPods: {{ if or (eq .Values.global.clusterPlatform "Azure") (eq .Values.global.clusterPlatform "AWS") }}true{{ else }}false{{ end }} |
This file contains hidden or 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 |
---|---|---|
|
@@ -19,5 +19,4 @@ spec: | |
dataFrom: | ||
- extract: | ||
key: {{ .Values.sandbox.sshKey }} | ||
|
||
{{ end }} | ||
{{- end }} |
This file contains hidden or 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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
# Chart-specific values | ||
# Common values are inherited from values-global.yaml | ||
|
||
# Global values used by this chart (overridden by values-global.yaml) | ||
global: | ||
cocoUpstream: true | ||
cocoConverged: true | ||
clusterPlatform: "" # Cluster platform: "Azure" or "AWS" | ||
|
||
# Secret store configuration (overridden by values-global.yaml) | ||
secretStore: | ||
name: vault-backend | ||
kind: ClusterSecretStore | ||
|
||
|
||
name: "" | ||
kind: "" | ||
|
||
# Sandbox-specific configuration | ||
sandbox: | ||
deploy: true | ||
sshKey: secret/data/global/sshKey | ||
azure: true | ||
peerpodsCreds: secret/data/global/azure | ||
# These variables today limit to one cluster | ||
# revise using imperative framework to infer from cluster vars | ||
# Strongly advised to override in values-global.yaml or values-{cluster-group}.yaml |
This file contains hidden or 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,6 @@ | ||
apiVersion: v2 | ||
description: Deploy and configure policies for sandboxed containers and propagate data from the hub cluster to the managed clusters. | ||
keywords: | ||
- pattern | ||
name: sandbox-policies | ||
version: 0.0.1 |
This file contains hidden or 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,3 @@ | ||
# Sandboxed policies | ||
|
||
Configure and propagate the policies, in particular the initdata, from the 'hub' cluster to the spoke cluster. |
68 changes: 68 additions & 0 deletions
68
charts/hub/sandbox-policies/templates/hub-to-spoke-initdata-policy.yaml
This file contains hidden or 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,68 @@ | ||
--- | ||
apiVersion: policy.open-cluster-management.io/v1 | ||
kind: Policy | ||
metadata: | ||
name: hub-to-spoke-initdata-policy | ||
namespace: imperative | ||
annotations: | ||
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true | ||
spec: | ||
remediationAction: enforce | ||
disabled: false | ||
policy-templates: | ||
- objectDefinition: | ||
apiVersion: policy.open-cluster-management.io/v1 | ||
kind: ConfigurationPolicy | ||
metadata: | ||
name: hub-to-spoke-initdata-cp | ||
namespace: imperative | ||
spec: | ||
remediationAction: enforce | ||
severity: medium | ||
namespaceSelector: | ||
include: | ||
- imperative | ||
object-templates: | ||
- complianceType: mustonlyhave | ||
objectDefinition: | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: initdata | ||
namespace: imperative | ||
data: | ||
INITDATA: '{{ `{{hub fromConfigMap "imperative" "initdata" "INITDATA" hub}}` }}' | ||
|
||
--- | ||
apiVersion: policy.open-cluster-management.io/v1 | ||
kind: PlacementBinding | ||
metadata: | ||
name: hub-to-spoke-initdata-placement-binding | ||
namespace: imperative | ||
annotations: | ||
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true | ||
placementRef: | ||
name: hub-to-spoke-initdata-placement-rule | ||
kind: PlacementRule | ||
apiGroup: apps.open-cluster-management.io | ||
subjects: | ||
- name: hub-to-spoke-initdata-policy | ||
kind: Policy | ||
apiGroup: policy.open-cluster-management.io | ||
|
||
--- | ||
apiVersion: apps.open-cluster-management.io/v1 | ||
kind: PlacementRule | ||
metadata: | ||
name: hub-to-spoke-initdata-placement-rule | ||
namespace: imperative | ||
spec: | ||
clusterConditions: | ||
- status: 'True' | ||
type: ManagedClusterConditionAvailable | ||
clusterSelector: | ||
matchExpressions: | ||
# Only apply to spoke clusters (exclude local-cluster which is typically the hub) | ||
- key: name | ||
operator: NotIn | ||
values: ["local-cluster"] |
This file contains hidden or 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 hidden or 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,11 @@ | ||
|
||
# Chart-specific values | ||
# Common values are inherited from values-global.yaml | ||
|
||
# Global values used by this chart (overridden by values-global.yaml) | ||
global: | ||
clusterPlatform: "" # Cluster platform: "Azure" or "AWS" | ||
coco: | ||
azure: | ||
defaultVMFlavour: "Standard_DC2as_v5" | ||
VMFlavours: "Standard_DC2as_v5,Standard_DC4as_v5,Standard_DC8as_v5,Standard_DC16as_v5" |
18 changes: 10 additions & 8 deletions
18
...trustee/templates/kbs-passphrase-eso.yaml → ...ts/hub/trustee/templates/dynamic-eso.yaml
This file contains hidden or 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 |
---|---|---|
@@ -1,23 +1,25 @@ | ||
{{- if ne .Values.global.secretStore.backend "none" }} | ||
{{- range .Values.kbs.secretResources }} | ||
--- | ||
apiVersion: "external-secrets.io/v1beta1" | ||
kind: ExternalSecret | ||
metadata: | ||
annotations: | ||
argocd.argoproj.io/sync-wave: "1" | ||
name: kbs-passphrase-eso | ||
namespace: {{ .Values.kbs.deployNS }} | ||
name: {{ .name }}-eso | ||
namespace: trustee-operator-system | ||
spec: | ||
refreshInterval: 15s | ||
secretStoreRef: | ||
name: {{ .Values.secretStore.name }} | ||
kind: {{ .Values.secretStore.kind }} | ||
data: | ||
name: {{ $.Values.secretStore.name }} | ||
kind: {{ $.Values.secretStore.kind }} | ||
target: | ||
name: passphrase | ||
name: {{ .name }} | ||
template: | ||
type: Opaque | ||
dataFrom: | ||
- extract: | ||
key: {{ .Values.kbs.passphrase }} | ||
{{- end }} | ||
key: {{ .key }} | ||
{{- end }} | ||
{{- end }} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit could be squashed with
ac803d1be8f411d1fe9e066598bec79d68239ed9