Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

WIP: Openshift 3 Rebase PR #15

Open
wants to merge 72 commits into
base: openshift
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
97343bc
Use default imagePullPolicy (was IfNotPresent)
noseka1 Jul 9, 2020
a4f37e4
Remove redundant WORKER_CONTAINER_IMAGE_PULL_POLICY setting
noseka1 Jul 14, 2020
903c986
Resource rules must supply at least one api group
noseka1 Jul 10, 2020
e41564c
Fix kustomize panic: runtime error: index out of range [-1]
noseka1 Jul 11, 2020
10df6f4
Cannot set blockOwnerDeletion due to wrong resource Kind
noseka1 Jul 11, 2020
a2b8dcc
Refactor airflowbase_types and airflowcluster_types
noseka1 Jul 18, 2020
e531a85
Reorder imports in airflowcluster_types.go by goimports
noseka1 Jul 18, 2020
e0485f9
Use Airflow container images provided by OpenDataHub
noseka1 Jul 18, 2020
3e7cdbd
Use OpenDataHub images for e2e tests
noseka1 Jul 19, 2020
6b9a857
Use Red Hat's PosgreSQL container image
noseka1 Jul 9, 2020
2cc992b
The path "config/crds" does not exist
noseka1 Jul 11, 2020
e2b2960
Add service objects for UI and Flower
noseka1 Jul 11, 2020
55f9713
Add livenessProbe and readinessProbe for Flower
noseka1 Jul 11, 2020
a87b378
Allow KubernetesExecutor to create pods
noseka1 Jul 12, 2020
856978e
Allow UI to retrieve worker pod logs
noseka1 Jul 13, 2020
e992449
Refactor to allow adding further templates conditionally
noseka1 Jul 14, 2020
a41bf98
Add route for Airflow UI
noseka1 Jul 14, 2020
d6cc836
Add route for Flower
noseka1 Jul 14, 2020
8ee7687
Remove deprecated airflow_home config setting
noseka1 Jul 15, 2020
cbfc9d0
Fix e2e tests
noseka1 Jul 18, 2020
42aa729
Explicitly specify Airflow example branch
noseka1 Jul 19, 2020
45c8311
Use Red Hat's MySQL container image
noseka1 Jul 19, 2020
3141d57
Allow KubernetesPodOperator to create pods
noseka1 Jul 19, 2020
2ff0d18
Use container image with the specific 1.10.11 tag
noseka1 Jul 22, 2020
ac34473
Update to Airflow 1.10.12
noseka1 Aug 28, 2020
c19cf3d
Allow OAuth redirect URI
noseka1 Aug 21, 2020
3c4a27d
Manage user authentication via operator
noseka1 Aug 30, 2020
3c3b8aa
Add the auto-generated CRD code
noseka1 Aug 30, 2020
ebc3da9
Add Templates to controll AICoE CI (#6)
vpavlin Aug 21, 2020
aedf39b
Include Kubernetes templates in the container image
noseka1 Dec 21, 2020
3164123
Fix Airflow operator RBAC
noseka1 Dec 21, 2020
e27c497
Update docker-airflow image to 1.10.12-1
noseka1 Jan 8, 2021
7c9b832
Merge pull request #7 from noseka1/openshift-3
noseka1 Jan 8, 2021
b1e91b5
Fix Airflow operator pod killed by OOMKiller
noseka1 Feb 3, 2021
c7bb1b8
Increase the memory limit to 300Mi (150Mi was not sufficient)
noseka1 Feb 21, 2021
69f9357
Rename config params user_registration_role -> userRegistrationRole,
noseka1 Feb 20, 2021
802c70f
Use default imagePullPolicy (was IfNotPresent)
noseka1 Jul 9, 2020
6790c53
Remove redundant WORKER_CONTAINER_IMAGE_PULL_POLICY setting
noseka1 Jul 14, 2020
0d408f7
Fix kustomize panic: runtime error: index out of range [-1]
noseka1 Jul 11, 2020
3aa2b0e
Refactor airflowbase_types and airflowcluster_types
noseka1 Jul 18, 2020
904fc05
Use Airflow container images provided by OpenDataHub
noseka1 Jul 18, 2020
3b5f807
Use OpenDataHub images for e2e tests
noseka1 Jul 19, 2020
53f3fe2
Use Red Hat's PosgreSQL container image
noseka1 Jul 9, 2020
c2a79e3
Add service objects for UI and Flower
noseka1 Jul 11, 2020
01c8998
Add livenessProbe and readinessProbe for Flower
noseka1 Jul 11, 2020
7695a13
Allow KubernetesExecutor to create pods
noseka1 Jul 12, 2020
eddf60e
Allow UI to retrieve worker pod logs
noseka1 Jul 13, 2020
5b2fc53
Refactor to allow adding further templates conditionally
noseka1 Jul 14, 2020
b907133
Add route for Airflow UI
noseka1 Jul 14, 2020
f803688
Add route for Flower
noseka1 Jul 14, 2020
9032142
Remove deprecated airflow_home config setting
noseka1 Jul 15, 2020
5950722
Fix e2e tests
noseka1 Jul 18, 2020
7beea48
Explicitly specify Airflow example branch
noseka1 Jul 19, 2020
73d43f9
Use Red Hat's MySQL container image
noseka1 Jul 19, 2020
a49f9db
Allow KubernetesPodOperator to create pods
noseka1 Jul 19, 2020
2bdd344
Use container image with the specific 1.10.11 tag
noseka1 Jul 22, 2020
954430f
Update to Airflow 1.10.12
noseka1 Aug 28, 2020
5dcf33b
Allow OAuth redirect URI
noseka1 Aug 21, 2020
802c979
Manage user authentication via operator
noseka1 Aug 30, 2020
a17a03b
Add the auto-generated CRD code
noseka1 Aug 30, 2020
2bf7c54
Fix Airflow operator RBAC
noseka1 Dec 21, 2020
c2abf51
Update docker-airflow image to 1.10.12-1
noseka1 Jan 8, 2021
4103ade
Fix Airflow operator pod killed by OOMKiller
noseka1 Feb 3, 2021
e496854
Increase the memory limit to 300Mi (150Mi was not sufficient)
noseka1 Feb 21, 2021
f761093
Rename config params user_registration_role -> userRegistrationRole,
noseka1 Feb 20, 2021
16228ba
Add Airflow UI service
VedantMahabaleshwarkar Apr 13, 2020
01cb954
Update kustomization.yaml
VedantMahabaleshwarkar Apr 14, 2020
5aef641
Added Routes for AirflowUI and CeleryUI (#1)
VedantMahabaleshwarkar Apr 15, 2020
2ef1e72
add ssl to route template by default (#8)
wseaton Jan 29, 2021
7530486
add a config option for ignoring git SSL verification (#10)
wseaton Feb 12, 2021
248ec77
update git-sync container and make it configurable (#13)
wseaton Feb 25, 2021
4f9be60
Merge branch 'openshift' into openshift-3
wseaton Mar 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 5 additions & 33 deletions api/v1alpha1/airflowbase_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,12 @@ import (

// defaults and constant strings
const (
DefaultMySQLImage = "mysql"
DefaultMySQLVersion = "5.7"
DefaultPostgresImage = "postgres"
DefaultPostgresVersion = "10"
defaultUIImage = "gcr.io/airflow-operator/airflow"
defaultUIVersion = "1.10.2"
defaultFlowerVersion = "1.10.2"
defaultNFSVersion = "0.8"
DefaultMySQLImage = "registry.redhat.io/rhel8/mysql-80"
DefaultMySQLVersion = "latest"
DefaultPostgresImage = "registry.redhat.io/rhel8/postgresql-12"
DefaultPostgresVersion = "latest"
defaultNFSImage = "k8s.gcr.io/volume-nfs"
defaultNFSVersion = "0.8"
defaultSQLProxyImage = "gcr.io/cloud-airflow-public/airflow-sqlproxy"
defaultSQLProxyVersion = "1.8.0"
defaultSchedule = "0 0 0 ? * * *`" // daily@midnight
Expand Down Expand Up @@ -279,31 +276,6 @@ func validStorageProvider(provider string) bool {
return false
}

// AirflowUISpec defines the attributes to deploy Airflow UI component
type AirflowUISpec struct {
// Image defines the AirflowUI Docker image.
// +optional
Image string `json:"image,omitempty"`
// Version defines the AirflowUI Docker image version.
// +optional
Version string `json:"version,omitempty"`
// Replicas defines the number of running Airflow UI instances in a cluster
// +optional
Replicas int32 `json:"replicas,omitempty"`
// Resources is the resource requests and limits for the pods.
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
// enableroutes: true enables routes for the AirflowUI and CeleryUI
// +optional, enable on OpenShift clusters only
EnableRoutes bool `json:"enableroutes,omitempty"`
}

func (s *AirflowUISpec) validate(fp *field.Path) field.ErrorList {
errs := field.ErrorList{}
//errs = append(errs, s.Resources.validate(fp.Child("resources"))...)
return errs
}

// NFSStoreSpec defines the attributes to deploy Airflow Storage component
type NFSStoreSpec struct {
// Image defines the NFS Docker image.
Expand Down
76 changes: 68 additions & 8 deletions api/v1alpha1/airflowcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ const (
defaultRedisImage = "redis"
defaultRedisVersion = "4.0"
defaultRedisPort = "6379"
defaultWorkerImage = "gcr.io/airflow-operator/airflow"
defaultSchedulerImage = "gcr.io/airflow-operator/airflow"
defaultFlowerImage = "gcr.io/airflow-operator/airflow"
GitsyncImage = "k8s.gcr.io/git-sync/git-sync"
GitsyncVersion = "v3.2.2"
defaultFlowerImage = "quay.io/opendatahub/docker-airflow"
defaultFlowerVersion = "1.10.12-1"
defaultSchedulerImage = "quay.io/opendatahub/docker-airflow"
defaultSchedulerVersion = "1.10.12-1"
defaultUIImage = "quay.io/opendatahub/docker-airflow"
defaultUIVersion = "1.10.12-1"
defaultWorkerImage = "quay.io/opendatahub/docker-airflow"
defaultWorkerVersion = "1.10.12-1"
GCSsyncImage = "gcr.io/cloud-airflow-releaser/gcs-syncd"
GCSsyncVersion = "cloud_composer_service_2018-05-23-RC0"
ExecutorLocal = "Local"
Expand All @@ -46,8 +51,6 @@ const (
ExecutorK8s = "Kubernetes"
defaultExecutor = ExecutorLocal
defaultBranch = "master"
defaultWorkerVersion = "1.10.2"
defaultSchedulerVersion = "1.10.2"
defaultWorkerForceRoot = "false"
)

Expand Down Expand Up @@ -189,9 +192,9 @@ type FlowerSpec struct {
// Resources is the resource requests and limits for the pods.
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
// enableroutes: true enables routes for the AirflowUI and CeleryUI
// +optional, enable on OpenShift clusters only
EnableRoutes bool `json:"enableroutes,omitempty"`
// EnableRoutes exposes Flower via OpenShit route.
// +optional
EnableRoutes bool `json:"enableRoutes,omitempty"`
}

func (s *FlowerSpec) validate(fp *field.Path) field.ErrorList {
Expand Down Expand Up @@ -221,6 +224,50 @@ func (s *SchedulerSpec) validate(fp *field.Path) field.ErrorList {
return field.ErrorList{}
}

// AirflowUISpec defines the attributes to deploy Airflow UI component
type AirflowUISpec struct {
// Image defines the AirflowUI Docker image.
// +optional
Image string `json:"image,omitempty"`
// Version defines the AirflowUI Docker image version.
// +optional
Version string `json:"version,omitempty"`
// Replicas defines the number of running Airflow UI instances in a cluster
// +optional
Replicas int32 `json:"replicas,omitempty"`
// Resources is the resource requests and limits for the pods.
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
// EnableRoutes exposes the Airflow UI via OpenShit route.
// +optional
EnableRoutes bool `json:"enableRoutes,omitempty"`
// Authentication defines the user authentication for Airflow UI.
// +optional
Authentication *AirflowUIAuthentication `json:"authentication,omitempty"`
}

func (s *AirflowUISpec) validate(fp *field.Path) field.ErrorList {
errs := field.ErrorList{}
//errs = append(errs, s.Resources.validate(fp.Child("resources"))...)
if s == nil {
return errs
}
ui := field.NewPath("spec", "ui")
if s.Authentication != nil {
var allowedAuthTypes = []string{"none", "database", "openshift"}
allowed := false
for _, authType := range allowedAuthTypes {
if authType == s.Authentication.Type {
allowed = true
}
}
if !allowed {
errs = append(errs, field.NotSupported(ui.Child("authentication", "type"), s.Authentication.Type, allowedAuthTypes))
}
}
return errs
}

// WorkerSpec defines the attributes and desired state of Airflow workers
type WorkerSpec struct {
// Image defines the Airflow worker Docker image.
Expand Down Expand Up @@ -432,6 +479,19 @@ type MemoryStoreStatus struct {
status.ComponentMeta `json:",inline"`
}

// AirflowUIAuthentication defines the user authentication for Airflow UI
type AirflowUIAuthentication struct {
// Choose the authentication type. Available types are: none, database, openshift
// (none = no login required, database = users stored in the database can log in,
// openshift = users with valid OpenShift credentials can log in).
Type string `json:"type,omitempty"`
// Select the Airflow role that is assigned to the user when first registered in the
// database. This setting directly translates to the AUTH_USER_REGISTRATION_ROLE setting
// in webserver_config.py. Airflow ships with a set of roles by default: Admin, User, Op,
// Viewer, Public.
UserRegistrationRole string `json:"userRegistrationRole,omitempty"`
}

// AirflowClusterStatus defines the observed state of AirflowCluster
type AirflowClusterStatus struct {
status.Meta `json:",inline"`
Expand Down
20 changes: 20 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 22 additions & 6 deletions config/crd/bases/airflow.apache.org_airflowclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -946,9 +946,8 @@ spec:
flower:
description: Spec for Flower component.
properties:
enableroutes:
description: 'enableroutes: true enables routes for the AirflowUI
and CeleryUI'
enableRoutes:
description: EnableRoutes exposes Flower via OpenShit route.
type: boolean
image:
description: Image defines the Flower Docker image.
Expand Down Expand Up @@ -1455,9 +1454,26 @@ spec:
ui:
description: Spec for Airflow UI component.
properties:
enableroutes:
description: 'enableroutes: true enables routes for the AirflowUI
and CeleryUI'
authentication:
description: Authentication defines the user authentication for
Airflow UI.
properties:
type:
description: 'Choose the authentication type. Available types
are: none, database, openshift (none = no login required,
database = users stored in the database can log in, openshift
= users with valid OpenShift credentials can log in).'
type: string
userRegistrationRole:
description: 'Select the Airflow role that is assigned to the
user when first registered in the database. This setting directly
translates to the AUTH_USER_REGISTRATION_ROLE setting in webserver_config.py.
Airflow ships with a set of roles by default: Admin, User,
Op, Viewer, Public.'
type: string
type: object
enableRoutes:
description: EnableRoutes exposes the Airflow UI via OpenShit route.
type: boolean
image:
description: Image defines the AirflowUI Docker image.
Expand Down
15 changes: 15 additions & 0 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

resources:
- manager.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
Expand Down
27 changes: 13 additions & 14 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,17 @@ spec:
control-plane: controller-manager
spec:
containers:
- command:
- /manager
args:
- --enable-leader-election
image: controller:latest
name: manager
imagePullPolicy: Always
resources:
limits:
cpu: 100m
memory: 300Mi
requests:
cpu: 100m
memory: 20Mi
- command:
- /manager
args:
- --enable-leader-election
image: controller:latest
name: manager
resources:
limits:
cpu: 100m
memory: 300Mi
requests:
cpu: 100m
memory: 300Mi
terminationGracePeriodSeconds: 10
54 changes: 54 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,32 @@ rules:
- patch
- update
- watch
- apiGroups:
- ""
resources:
- pods
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- pods/exec
verbs:
- create
- get
- apiGroups:
- ""
resources:
- pods/log
verbs:
- get
- list
- apiGroups:
- ""
resources:
Expand Down Expand Up @@ -67,6 +93,14 @@ rules:
- patch
- update
- watch
- apiGroups:
- airflow.apache.org
resources:
- airflowbases/finalizers
verbs:
- get
- patch
- update
- apiGroups:
- airflow.apache.org
resources:
Expand All @@ -88,6 +122,14 @@ rules:
- patch
- update
- watch
- apiGroups:
- airflow.apache.org
resources:
- airflowclusters/finalizers
verbs:
- get
- patch
- update
- apiGroups:
- airflow.apache.org
resources:
Expand Down Expand Up @@ -144,6 +186,18 @@ rules:
- patch
- update
- watch
- apiGroups:
- rbac.authorization.k8s.io
resources:
- roles
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- route.openshift.io
resources:
Expand Down
6 changes: 4 additions & 2 deletions controllers/airflowbase_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"

"encoding/base64"
"time"

alpha1 "github.com/apache/airflow-on-k8s-operator/api/v1alpha1"
"github.com/apache/airflow-on-k8s-operator/controllers/application"
"github.com/apache/airflow-on-k8s-operator/controllers/common"
Expand All @@ -44,7 +46,6 @@ import (
"sigs.k8s.io/controller-reconciler/pkg/reconciler"
"sigs.k8s.io/controller-reconciler/pkg/reconciler/manager/k8s"
"sigs.k8s.io/controller-runtime/pkg/manager"
"time"
)

// AirflowBaseReconciler reconciles a AirflowBase object
Expand All @@ -54,7 +55,8 @@ type AirflowBaseReconciler struct {
Scheme *runtime.Scheme
}

// +kubebuilder:rbac:groups=airflow.apache.org,resources=airflowbases;airflowbases/finalizers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=airflow.apache.org,resources=airflowbases,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=airflow.apache.org,resources=airflowbases/finalizers,verbs=get;update;patch
// +kubebuilder:rbac:groups=airflow.apache.org,resources=airflowbases/status,verbs=get;update;patch

// Reconcile - Dummy TODO remove this
Expand Down
Loading