Skip to content

Commit

Permalink
Add config for konflux-workspaces in staging (#4040)
Browse files Browse the repository at this point in the history
* add config for konflux-workspaces in staging

This adds the necessary configuration for konflux-workspaces to be
deployed into staging environments.  Production environments support
will come in a separate PR once this has been verified to be working and
stable.

Signed-off-by: Andy Sadler <[email protected]>

* Changing application name and deleting from production

Signed-off-by: David Peraza <[email protected]>

---------

Signed-off-by: Andy Sadler <[email protected]>
Signed-off-by: David Peraza <[email protected]>
Co-authored-by: Andy Sadler <[email protected]>
  • Loading branch information
dperaza4dustbit and sadlerap authored Jul 10, 2024
1 parent 0a22d62 commit fbb40f6
Show file tree
Hide file tree
Showing 46 changed files with 1,402 additions and 0 deletions.
1 change: 1 addition & 0 deletions argo-cd-apps/base/host/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ resources:
- segment-bridge
- ingresscontroller
- smee
- workspaces
components:
- ../../k-components/deploy-to-host-cluster-merge-generator
- ../../k-components/inject-argocd-namespace
6 changes: 6 additions & 0 deletions argo-cd-apps/base/host/workspaces/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- workspaces.yaml
components:
- ../../../k-components/inject-infra-deployments-repo-details
41 changes: 41 additions & 0 deletions argo-cd-apps/base/host/workspaces/workspaces.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: workspaces
spec:
generators:
- merge:
mergeKeys:
- nameNormalized
generators:
- clusters:
values:
sourceRoot: components/workspaces
environment: staging
clusterDir: ""
- list:
elements: []
template:
metadata:
name: workspaces-{{nameNormalized}}
spec:
project: default
source:
path: '{{values.sourceRoot}}/{{values.environment}}/{{values.clusterDir}}'
repoURL: https://github.com/redhat-appstudio/infra-deployments.git
targetRevision: main
destination:
namespace: konflux-workspaces
server: '{{server}}'
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
retry:
limit: -1
backoff:
duration: 10s
factor: 2
maxDuration: 3m
6 changes: 6 additions & 0 deletions argo-cd-apps/overlays/development/delete-applications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,9 @@ kind: ApplicationSet
metadata:
name: gitops
$patch: delete
---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: workspaces
$patch: delete
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ metadata:
name: gitops
$patch: delete
---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: workspaces
$patch: delete
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ metadata:
name: quality-dashboard
$patch: delete
---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: workspaces
$patch: delete
5 changes: 5 additions & 0 deletions components/ui/base/proxy/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ http {
proxy_read_timeout 30m;
}

location /apis/workspaces.konflux.io/ {
# Konflux Workspaces
proxy_pass http://workspaces-rest-api-server.workspaces-system.svc.cluster.local/;
}

location /wss/k8s/ {
# Kube-API websockets
proxy_pass http://api.toolchain-host-operator.svc.cluster.local/;
Expand Down
5 changes: 5 additions & 0 deletions components/workspaces/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- operator/config/default
- server/config/default
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: internalworkspaces.workspaces.konflux.io
spec:
group: workspaces.konflux.io
names:
kind: InternalWorkspace
listKind: InternalWorkspaceList
plural: internalworkspaces
singular: internalworkspace
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .spec.visibility
name: Visibility
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: InternalWorkspace is the Schema for the workspaces API
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: InternalWorkspaceSpec defines the desired state of Workspace
properties:
displayName:
type: string
owner:
description: UserInfo contains information about a user identity
properties:
jwtInfo:
description: JwtInfo contains information extracted from the user
JWT Token
properties:
email:
type: string
sub:
type: string
userId:
type: string
required:
- email
- sub
- userId
type: object
required:
- jwtInfo
type: object
visibility:
enum:
- community
- private
type: string
required:
- displayName
- owner
- visibility
type: object
status:
description: InternalWorkspaceStatus defines the observed state of Workspace
properties:
conditions:
items:
description: "Condition contains details for one aspect of the current
state of this API Resource.\n---\nThis struct is intended for
direct use as an array at the field path .status.conditions. For
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
observations of a foo's current state.\n\t // Known .status.conditions.type
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
\ // other fields\n\t}"
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: |-
type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
owner:
description: Owner contains information on the owner
properties:
username:
type: string
type: object
space:
description: Space contains information about the underlying Space
properties:
isHome:
type: boolean
name:
type: string
required:
- isHome
- name
type: object
type: object
type: object
served: true
storage: true
subresources:
status: {}
20 changes: 20 additions & 0 deletions components/workspaces/base/operator/config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- bases/workspaces.konflux.io_internalworkspaces.yaml
#+kubebuilder:scaffold:crdkustomizeresource

patches: []
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- patches/webhook_in_workspaces.yaml
#+kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- patches/cainjection_in_workspaces.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

# the following config is for teaching kustomize how to do kustomization for CRDs.
configurations:
- kustomizeconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file is for teaching kustomize how to substitute name and namespace reference in CRD
nameReference:
- kind: Service
version: v1
fieldSpecs:
- kind: CustomResourceDefinition
version: v1
group: apiextensions.k8s.io
path: spec/conversion/webhook/clientConfig/service/name

namespace:
- kind: CustomResourceDefinition
version: v1
group: apiextensions.k8s.io
path: spec/conversion/webhook/clientConfig/service/namespace
create: false

varReference:
- path: metadata/annotations
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# The following patch adds a directive for certmanager to inject CA into the CRD
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
name: workspaces.workspaces.io
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# The following patch enables a conversion webhook for the CRD
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: workspaces.workspaces.io
spec:
conversion:
strategy: Webhook
webhook:
clientConfig:
service:
namespace: system
name: webhook-service
path: /convert
conversionReviewVersions:
- v1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: workspaces-system
namePrefix: workspaces-
resources:
- ../crd
- ../rbac
- ../manager
patches:
- path: manager_auth_proxy_patch.yaml
Loading

0 comments on commit fbb40f6

Please sign in to comment.