From ad48b933069bece7ad6a74bf297d6a2dc189953b Mon Sep 17 00:00:00 2001 From: Celia Amador Date: Tue, 25 Nov 2025 09:38:47 +0100 Subject: [PATCH] Migrate API from v1alpha1 to v1beta1 --- libs/cypress/fixtures/auth/organization.ts | 4 ++- .../fixtures/enrollmentRequests/index.ts | 9 +++--- libs/cypress/fixtures/fleets/initialFleets.ts | 9 +++--- .../repositories/initialRepositories.ts | 3 +- libs/cypress/support/constants.ts | 1 + libs/cypress/support/interceptors/auth.ts | 3 +- libs/cypress/support/interceptors/devices.ts | 3 +- .../interceptors/enrollmentRequests.ts | 3 +- libs/cypress/support/interceptors/fleets.ts | 3 +- .../support/interceptors/repositories.ts | 3 +- .../models/ImageApplicationProviderSpec.ts | 2 +- libs/types/scripts/openapi-typescript.js | 2 +- .../AuthProvider/CreateAuthProvider/utils.ts | 3 +- libs/ui-components/src/constants.ts | 2 +- proxy/auth/aap.go | 4 +-- proxy/auth/api_client.go | 14 +++++----- proxy/auth/auth.go | 28 +++++++++---------- proxy/auth/common.go | 14 +++++----- proxy/auth/k8s.go | 4 +-- proxy/auth/oauth2.go | 4 +-- proxy/auth/oidc.go | 4 +-- proxy/auth/openshift.go | 4 +-- proxy/go.mod | 2 +- proxy/go.sum | 8 +++--- 24 files changed, 74 insertions(+), 62 deletions(-) create mode 100644 libs/cypress/support/constants.ts diff --git a/libs/cypress/fixtures/auth/organization.ts b/libs/cypress/fixtures/auth/organization.ts index f24c944c1..57b3da926 100644 --- a/libs/cypress/fixtures/auth/organization.ts +++ b/libs/cypress/fixtures/auth/organization.ts @@ -1,5 +1,7 @@ +import { API_VERSION } from '../../support/constants'; + const defaultOrg = { - apiVersion: 'v1alpha1', + apiVersion: API_VERSION, kind: 'Organization', metadata: { name: 'default', diff --git a/libs/cypress/fixtures/enrollmentRequests/index.ts b/libs/cypress/fixtures/enrollmentRequests/index.ts index a5bd039ea..f5c684546 100644 --- a/libs/cypress/fixtures/enrollmentRequests/index.ts +++ b/libs/cypress/fixtures/enrollmentRequests/index.ts @@ -1,4 +1,5 @@ import { ConditionStatus, ConditionType } from '@flightctl/types'; +import { API_VERSION } from '../../support/constants'; const approvedErStatus = { approval: { @@ -22,7 +23,7 @@ const approvedErStatus = { const getErList = (onlyPending: boolean) => [ { - apiVersion: 'v1alpha1', + apiVersion: API_VERSION, kind: 'EnrollmentRequest', metadata: { creationTimestamp: '2024-04-10T11:48:43Z', @@ -35,7 +36,7 @@ const getErList = (onlyPending: boolean) => status: approvedErStatus, }, { - apiVersion: 'v1alpha1', + apiVersion: API_VERSION, kind: 'EnrollmentRequest', metadata: { creationTimestamp: '2024-04-10T12:15:31Z', @@ -48,7 +49,7 @@ const getErList = (onlyPending: boolean) => status: { conditions: [] }, }, { - apiVersion: 'v1alpha1', + apiVersion: API_VERSION, kind: 'EnrollmentRequest', metadata: { creationTimestamp: '2024-04-10T09:31:04Z', @@ -61,7 +62,7 @@ const getErList = (onlyPending: boolean) => status: approvedErStatus, }, { - apiVersion: 'v1alpha1', + apiVersion: API_VERSION, kind: 'EnrollmentRequest', metadata: { creationTimestamp: '2024-10-10T12:15:31Z', diff --git a/libs/cypress/fixtures/fleets/initialFleets.ts b/libs/cypress/fixtures/fleets/initialFleets.ts index 01537e684..afcb79e59 100644 --- a/libs/cypress/fixtures/fleets/initialFleets.ts +++ b/libs/cypress/fixtures/fleets/initialFleets.ts @@ -1,8 +1,9 @@ import { Fleet } from '@flightctl/types'; +import { API_VERSION } from '../../support/constants'; const basicFleets: Fleet[] = [ { - apiVersion: 'v1alpha1', + apiVersion: API_VERSION, kind: 'Fleet', metadata: { creationTimestamp: '2024-04-10T12:11:54Z', @@ -48,11 +49,11 @@ const basicFleets: Fleet[] = [ applicationStatus: {}, summaryStatus: {}, updateStatus: {}, - } + }, }, }, { - apiVersion: 'v1alpha1', + apiVersion: API_VERSION, kind: 'Fleet', metadata: { creationTimestamp: '2024-04-10T12:13:58Z', @@ -106,7 +107,7 @@ const basicFleets: Fleet[] = [ applicationStatus: {}, summaryStatus: {}, updateStatus: {}, - } + }, }, }, ]; diff --git a/libs/cypress/fixtures/repositories/initialRepositories.ts b/libs/cypress/fixtures/repositories/initialRepositories.ts index 9bb40f5a1..f9d578ae5 100644 --- a/libs/cypress/fixtures/repositories/initialRepositories.ts +++ b/libs/cypress/fixtures/repositories/initialRepositories.ts @@ -1,8 +1,9 @@ import { ConditionStatus, ConditionType, RepoSpecType, Repository } from '@flightctl/types'; +import { API_VERSION } from '../../support/constants'; const repoList: Repository[] = [ { - apiVersion: 'v1alpha1', + apiVersion: API_VERSION, kind: 'Repository', metadata: { creationTimestamp: '2024-04-30T14:05:53Z', diff --git a/libs/cypress/support/constants.ts b/libs/cypress/support/constants.ts new file mode 100644 index 000000000..207c79c9f --- /dev/null +++ b/libs/cypress/support/constants.ts @@ -0,0 +1 @@ +export const API_VERSION = 'v1beta1'; diff --git a/libs/cypress/support/interceptors/auth.ts b/libs/cypress/support/interceptors/auth.ts index a1ed3ceae..c3ec7b584 100644 --- a/libs/cypress/support/interceptors/auth.ts +++ b/libs/cypress/support/interceptors/auth.ts @@ -1,4 +1,5 @@ import { defaultOrg } from '../../fixtures/auth/organization'; +import { API_VERSION } from '../constants'; const loadInterceptors = () => { cy.intercept('GET', '/api/login/info', (req) => { @@ -18,7 +19,7 @@ const loadInterceptors = () => { req.reply({ statusCode: 200, body: { - apiVersion: 'v1alpha1', + apiVersion: API_VERSION, kind: 'OrganizationList', metadata: {}, items: [defaultOrg], diff --git a/libs/cypress/support/interceptors/devices.ts b/libs/cypress/support/interceptors/devices.ts index 056dfd4e2..0f29a708c 100644 --- a/libs/cypress/support/interceptors/devices.ts +++ b/libs/cypress/support/interceptors/devices.ts @@ -1,7 +1,8 @@ import { Device, PatchRequest } from '@flightctl/types'; +import { API_VERSION } from '../constants'; const buildDevicesResponse = (devices: Device[]) => ({ - apiVersion: 'v1alpha1', + apiVersion: API_VERSION, items: devices, kind: 'DeviceList', metadata: {}, diff --git a/libs/cypress/support/interceptors/enrollmentRequests.ts b/libs/cypress/support/interceptors/enrollmentRequests.ts index 0cdf13abb..5def00c9c 100644 --- a/libs/cypress/support/interceptors/enrollmentRequests.ts +++ b/libs/cypress/support/interceptors/enrollmentRequests.ts @@ -1,8 +1,9 @@ import { getErList } from '../../fixtures'; import { EnrollmentRequest } from '@flightctl/types'; +import { API_VERSION } from '../constants'; const buildErResponse = (enrollmentRequests: EnrollmentRequest[]) => ({ - apiVersion: 'v1alpha1', + apiVersion: API_VERSION, items: enrollmentRequests, kind: 'EnrollmentRequestList', metadata: {}, diff --git a/libs/cypress/support/interceptors/fleets.ts b/libs/cypress/support/interceptors/fleets.ts index daf75da85..3f3456721 100644 --- a/libs/cypress/support/interceptors/fleets.ts +++ b/libs/cypress/support/interceptors/fleets.ts @@ -1,8 +1,9 @@ import { basicFleets } from '../../fixtures/fleets'; import { Fleet } from '@flightctl/types'; +import { API_VERSION } from '../constants'; const buildFleetResponse = (fleets: Fleet[]) => ({ - apiVersion: 'v1alpha1', + apiVersion: API_VERSION, items: fleets, kind: 'FleetList', metadata: {}, diff --git a/libs/cypress/support/interceptors/repositories.ts b/libs/cypress/support/interceptors/repositories.ts index 281b68da8..0f1e29e37 100644 --- a/libs/cypress/support/interceptors/repositories.ts +++ b/libs/cypress/support/interceptors/repositories.ts @@ -1,8 +1,9 @@ import { Repository } from '@flightctl/types'; import { repoList } from '../../fixtures'; +import { API_VERSION } from '../constants'; const buildRepositoriesResponse = (repositories: Repository[]) => ({ - apiVersion: 'v1alpha1', + apiVersion: API_VERSION, items: repositories, kind: 'RepositoryList', metadata: {}, diff --git a/libs/types/models/ImageApplicationProviderSpec.ts b/libs/types/models/ImageApplicationProviderSpec.ts index 8f814ceff..f19b4dacc 100644 --- a/libs/types/models/ImageApplicationProviderSpec.ts +++ b/libs/types/models/ImageApplicationProviderSpec.ts @@ -7,7 +7,7 @@ import type { ApplicationResources } from './ApplicationResources'; import type { ApplicationVolumeProviderSpec } from './ApplicationVolumeProviderSpec'; export type ImageApplicationProviderSpec = (ApplicationVolumeProviderSpec & { /** - * Reference to the container image for the application package. + * Reference to the OCI image or artifact for the application package. */ image: string; /** diff --git a/libs/types/scripts/openapi-typescript.js b/libs/types/scripts/openapi-typescript.js index 3e38c84da..103941e51 100644 --- a/libs/types/scripts/openapi-typescript.js +++ b/libs/types/scripts/openapi-typescript.js @@ -17,7 +17,7 @@ const processJsonAPI = (jsonString) => { }; async function main() { - const swaggerUrl = 'https://raw.githubusercontent.com/flightctl/flightctl/main/api/v1alpha1/openapi.yaml'; + const swaggerUrl = 'https://raw.githubusercontent.com/flightctl/flightctl/main/api/v1beta1/openapi.yaml'; const output = path.resolve(__dirname, '../tmp-types'); const response = await fetch(swaggerUrl); const data = await response.text(); diff --git a/libs/ui-components/src/components/AuthProvider/CreateAuthProvider/utils.ts b/libs/ui-components/src/components/AuthProvider/CreateAuthProvider/utils.ts index b79cb9338..f286160b8 100644 --- a/libs/ui-components/src/components/AuthProvider/CreateAuthProvider/utils.ts +++ b/libs/ui-components/src/components/AuthProvider/CreateAuthProvider/utils.ts @@ -25,6 +25,7 @@ import { } from './types'; import { validKubernetesDnsSubdomain } from '../../form/validations'; import { DynamicAuthProviderSpec, ProviderType } from '../../../types/extraTypes'; +import { API_VERSION } from '../../../constants'; export const getAssignmentTypeLabel = ( type: AuthOrganizationAssignment['type'] | AuthRoleAssignment['type'] | undefined, @@ -316,7 +317,7 @@ export const getAuthProvider = (values: AuthProviderFormValues): AuthProvider => } return { - apiVersion: 'v1alpha1', + apiVersion: API_VERSION, kind: 'AuthProvider', metadata: { name: values.name, diff --git a/libs/ui-components/src/constants.ts b/libs/ui-components/src/constants.ts index 20a0bba44..792a0710f 100644 --- a/libs/ui-components/src/constants.ts +++ b/libs/ui-components/src/constants.ts @@ -1,5 +1,5 @@ const APP_TITLE = 'Edge Manager'; -const API_VERSION = 'v1alpha1'; +const API_VERSION = 'v1beta1'; const PAGE_SIZE = 15; const EVENT_PAGE_SIZE = 200; // It's 500 in OCP console diff --git a/proxy/auth/aap.go b/proxy/auth/aap.go index 432bde499..688af09ce 100644 --- a/proxy/auth/aap.go +++ b/proxy/auth/aap.go @@ -10,7 +10,7 @@ import ( "github.com/flightctl/flightctl-ui/bridge" "github.com/flightctl/flightctl-ui/config" "github.com/flightctl/flightctl-ui/log" - "github.com/flightctl/flightctl/api/v1alpha1" + "github.com/flightctl/flightctl/api/v1beta1" "github.com/openshift/osincli" ) @@ -50,7 +50,7 @@ func (c *AAPRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { return resp, nil } -func getAAPAuthHandler(provider *v1alpha1.AuthProvider, aapSpec *v1alpha1.AapProviderSpec) (*AAPAuthHandler, error) { +func getAAPAuthHandler(provider *v1beta1.AuthProvider, aapSpec *v1beta1.AapProviderSpec) (*AAPAuthHandler, error) { providerName := extractProviderName(provider) // Validate required fields diff --git a/proxy/auth/api_client.go b/proxy/auth/api_client.go index 5ebb1e11c..f0d6b3dad 100644 --- a/proxy/auth/api_client.go +++ b/proxy/auth/api_client.go @@ -12,14 +12,14 @@ import ( "github.com/flightctl/flightctl-ui/config" "github.com/flightctl/flightctl-ui/log" - "github.com/flightctl/flightctl/api/v1alpha1" + "github.com/flightctl/flightctl/api/v1beta1" ) // k8s service account prefix const k8sServiceAccountPrefix = "system:serviceaccount:" // exchangeTokenWithApiServer allows us to perform the token exchange through the Flight Control API -func exchangeTokenWithApiServer(apiTlsConfig *tls.Config, providerName string, tokenReq *v1alpha1.TokenRequest) (*v1alpha1.TokenResponse, error) { +func exchangeTokenWithApiServer(apiTlsConfig *tls.Config, providerName string, tokenReq *v1beta1.TokenRequest) (*v1beta1.TokenResponse, error) { client := &http.Client{ Transport: &http.Transport{ TLSClientConfig: apiTlsConfig, @@ -68,7 +68,7 @@ func exchangeTokenWithApiServer(apiTlsConfig *tls.Config, providerName string, t if resp.StatusCode != http.StatusOK { // Try to parse as JSON first (OAuth2 errors are usually JSON) - var tokenResp v1alpha1.TokenResponse + var tokenResp v1beta1.TokenResponse if err := json.Unmarshal(body, &tokenResp); err == nil { // Successfully parsed as JSON, check for OAuth2 error fields if tokenResp.Error != nil { @@ -85,7 +85,7 @@ func exchangeTokenWithApiServer(apiTlsConfig *tls.Config, providerName string, t } // Status is OK, parse as JSON - var tokenResp v1alpha1.TokenResponse + var tokenResp v1beta1.TokenResponse if err := json.Unmarshal(body, &tokenResp); err != nil { return nil, fmt.Errorf("failed to parse API server token response: %w (body: %s)", err, string(body)) } @@ -154,7 +154,7 @@ func getUserInfoFromApiServer(apiTlsConfig *tls.Config, token string) (string, e if resp.StatusCode != http.StatusOK { // Try to parse as JSON first - var userInfoResp v1alpha1.UserInfoResponse + var userInfoResp v1beta1.UserInfoResponse if err := json.Unmarshal(body, &userInfoResp); err == nil { // Successfully parsed as JSON, check for error field if userInfoResp.Error != nil { @@ -167,7 +167,7 @@ func getUserInfoFromApiServer(apiTlsConfig *tls.Config, token string) (string, e } // Status is OK, parse as JSON - var userInfoResp v1alpha1.UserInfoResponse + var userInfoResp v1beta1.UserInfoResponse if err := json.Unmarshal(body, &userInfoResp); err != nil { return "", fmt.Errorf("failed to parse userinfo response: %w (body: %s)", err, string(body)) } @@ -191,7 +191,7 @@ func getUserInfoFromApiServer(apiTlsConfig *tls.Config, token string) (string, e } // convertTokenResponseToTokenData converts TokenResponse to proxy TokenData -func convertTokenResponseToTokenData(tokenResp *v1alpha1.TokenResponse, providerName string) (TokenData, *int64) { +func convertTokenResponseToTokenData(tokenResp *v1beta1.TokenResponse, providerName string) (TokenData, *int64) { tokenData := TokenData{ Provider: providerName, } diff --git a/proxy/auth/auth.go b/proxy/auth/auth.go index 22edc9c12..25b7ac2b7 100644 --- a/proxy/auth/auth.go +++ b/proxy/auth/auth.go @@ -9,7 +9,7 @@ import ( "github.com/flightctl/flightctl-ui/config" "github.com/flightctl/flightctl-ui/log" - "github.com/flightctl/flightctl/api/v1alpha1" + "github.com/flightctl/flightctl/api/v1beta1" ) type ExpiresInResp struct { @@ -27,7 +27,7 @@ type RedirectResponse struct { type AuthHandler struct { provider AuthProvider apiTlsConfig *tls.Config - authConfigData *v1alpha1.AuthConfig + authConfigData *v1beta1.AuthConfig } func NewAuth(apiTlsConfig *tls.Config) (*AuthHandler, error) { @@ -51,7 +51,7 @@ func NewAuth(apiTlsConfig *tls.Config) (*AuthHandler, error) { } // findProviderConfig finds a provider config by name from the auth config -func findProviderConfig(authConfig *v1alpha1.AuthConfig, providerName string) (*v1alpha1.AuthProvider, error) { +func findProviderConfig(authConfig *v1beta1.AuthConfig, providerName string) (*v1beta1.AuthProvider, error) { if authConfig == nil || authConfig.Providers == nil { return nil, fmt.Errorf("no providers configured") } @@ -67,7 +67,7 @@ func findProviderConfig(authConfig *v1alpha1.AuthConfig, providerName string) (* // getProviderInstance creates a provider instance by fetching the latest auth config // Returns both the provider instance and the provider config to avoid duplicate API calls -func (a *AuthHandler) getProviderInstance(providerName string) (AuthProvider, *v1alpha1.AuthProvider, error) { +func (a *AuthHandler) getProviderInstance(providerName string) (AuthProvider, *v1beta1.AuthProvider, error) { authConfig, err := getAuthInfo(a.apiTlsConfig) if err != nil { return nil, nil, fmt.Errorf("failed to get auth config: %w", err) @@ -146,7 +146,7 @@ func (a *AuthHandler) getProviderInstance(providerName string) (AuthProvider, *v } // getClientIdFromProviderConfig extracts the client_id from a provider config -func getClientIdFromProviderConfig(providerConfig *v1alpha1.AuthProvider) (string, error) { +func getClientIdFromProviderConfig(providerConfig *v1beta1.AuthProvider) (string, error) { providerTypeStr, err := providerConfig.Spec.Discriminator() if err != nil { return "", fmt.Errorf("failed to determine provider type: %w", err) @@ -270,7 +270,7 @@ func (a AuthHandler) Login(w http.ResponseWriter, r *http.Request) { return } - var providerConfig *v1alpha1.AuthProvider + var providerConfig *v1beta1.AuthProvider provider, providerConfig, err = a.getProviderInstance(providerName) if err != nil { log.GetLogger().WithError(err).Warnf("Could not find provider: %s", providerName) @@ -373,8 +373,8 @@ func (a AuthHandler) Login(w http.ResponseWriter, r *http.Request) { } redirectURI := config.BaseUiUrl + "/callback" - tokenReq := &v1alpha1.TokenRequest{ - GrantType: v1alpha1.AuthorizationCode, + tokenReq := &v1beta1.TokenRequest{ + GrantType: v1beta1.AuthorizationCode, ClientId: clientId, Code: &loginParams.Code, CodeVerifier: &loginParams.CodeVerifier, @@ -413,7 +413,7 @@ func (a AuthHandler) Refresh(w http.ResponseWriter, r *http.Request) { } // Get provider to determine routing - var providerConfig *v1alpha1.AuthProvider + var providerConfig *v1beta1.AuthProvider provider, providerConfig, err := a.getProviderInstance(tokenData.Provider) if err != nil { log.GetLogger().WithError(err).Warnf("Failed to get provider: %s", tokenData.Provider) @@ -440,8 +440,8 @@ func (a AuthHandler) Refresh(w http.ResponseWriter, r *http.Request) { return } - tokenReq := &v1alpha1.TokenRequest{ - GrantType: v1alpha1.RefreshToken, + tokenReq := &v1beta1.TokenRequest{ + GrantType: v1beta1.RefreshToken, ClientId: clientId, RefreshToken: &tokenData.RefreshToken, } @@ -459,7 +459,7 @@ func (a AuthHandler) Refresh(w http.ResponseWriter, r *http.Request) { } // handleOAuthErrorResponse handles OAuth2 error responses from token exchange/refresh -func handleOAuthErrorResponse(w http.ResponseWriter, tokenResp *v1alpha1.TokenResponse, defaultMessage string) { +func handleOAuthErrorResponse(w http.ResponseWriter, tokenResp *v1beta1.TokenResponse, defaultMessage string) { if tokenResp != nil && tokenResp.Error != nil { errorDesc := "" if tokenResp.ErrorDescription != nil { @@ -607,7 +607,7 @@ func (a AuthHandler) Logout(w http.ResponseWriter, r *http.Request) { } } -func getAuthInfo(apiTlsConfig *tls.Config) (*v1alpha1.AuthConfig, error) { +func getAuthInfo(apiTlsConfig *tls.Config) (*v1beta1.AuthConfig, error) { client := &http.Client{Transport: &http.Transport{ TLSClientConfig: apiTlsConfig, }} @@ -636,7 +636,7 @@ func getAuthInfo(apiTlsConfig *tls.Config) (*v1alpha1.AuthConfig, error) { return nil, err } - authConfig := &v1alpha1.AuthConfig{} + authConfig := &v1beta1.AuthConfig{} err = json.Unmarshal(body, authConfig) if err != nil { log.GetLogger().WithError(err).Warn("Failed to unmarshal auth config") diff --git a/proxy/auth/common.go b/proxy/auth/common.go index 0f323c467..4ee4bb0d2 100644 --- a/proxy/auth/common.go +++ b/proxy/auth/common.go @@ -18,17 +18,17 @@ import ( "github.com/flightctl/flightctl-ui/common" "github.com/flightctl/flightctl-ui/config" "github.com/flightctl/flightctl-ui/log" - "github.com/flightctl/flightctl/api/v1alpha1" + "github.com/flightctl/flightctl/api/v1beta1" "github.com/openshift/osincli" ) // Provider type constants - use backend constants instead of hardcoding var ( - ProviderTypeK8s = string(v1alpha1.K8s) - ProviderTypeOIDC = string(v1alpha1.Oidc) - ProviderTypeAAP = string(v1alpha1.Aap) - ProviderTypeOAuth2 = string(v1alpha1.Oauth2) - ProviderTypeOpenShift = string(v1alpha1.Openshift) + ProviderTypeK8s = string(v1beta1.K8s) + ProviderTypeOIDC = string(v1beta1.Oidc) + ProviderTypeAAP = string(v1beta1.Aap) + ProviderTypeOAuth2 = string(v1beta1.Oauth2) + ProviderTypeOpenShift = string(v1beta1.Openshift) ) // Default claim constants @@ -643,7 +643,7 @@ func getMapKeys(m map[string]interface{}) []string { } // extractProviderName extracts the provider name from AuthProvider metadata -func extractProviderName(provider *v1alpha1.AuthProvider) string { +func extractProviderName(provider *v1beta1.AuthProvider) string { if provider != nil && provider.Metadata.Name != nil { return *provider.Metadata.Name } diff --git a/proxy/auth/k8s.go b/proxy/auth/k8s.go index 9178d692b..45016847f 100644 --- a/proxy/auth/k8s.go +++ b/proxy/auth/k8s.go @@ -10,7 +10,7 @@ import ( "github.com/flightctl/flightctl-ui/bridge" "github.com/flightctl/flightctl-ui/config" "github.com/flightctl/flightctl-ui/log" - "github.com/flightctl/flightctl/api/v1alpha1" + "github.com/flightctl/flightctl/api/v1beta1" "github.com/lestrrat-go/jwx/v2/jwt" ) @@ -196,7 +196,7 @@ func (t *TokenAuthProvider) GetLoginRedirectURL(codeChallenge string) string { } // getK8sAuthHandler creates a new K8s token authentication handler -func getK8sAuthHandler(provider *v1alpha1.AuthProvider, k8sSpec *v1alpha1.K8sProviderSpec) (*TokenAuthProvider, error) { +func getK8sAuthHandler(provider *v1beta1.AuthProvider, k8sSpec *v1beta1.K8sProviderSpec) (*TokenAuthProvider, error) { providerName := extractProviderName(provider) // Use API TLS config since we're calling the FlightCtl API to validate tokens diff --git a/proxy/auth/oauth2.go b/proxy/auth/oauth2.go index af1ed7a3b..c280d947f 100644 --- a/proxy/auth/oauth2.go +++ b/proxy/auth/oauth2.go @@ -7,7 +7,7 @@ import ( "github.com/flightctl/flightctl-ui/bridge" "github.com/flightctl/flightctl-ui/config" - "github.com/flightctl/flightctl/api/v1alpha1" + "github.com/flightctl/flightctl/api/v1beta1" "github.com/openshift/osincli" ) @@ -23,7 +23,7 @@ type OAuth2AuthHandler struct { } // getOAuth2AuthHandler creates an OAuth2 handler using explicit endpoints -func getOAuth2AuthHandler(provider *v1alpha1.AuthProvider, oauth2Spec *v1alpha1.OAuth2ProviderSpec) (*OAuth2AuthHandler, error) { +func getOAuth2AuthHandler(provider *v1beta1.AuthProvider, oauth2Spec *v1beta1.OAuth2ProviderSpec) (*OAuth2AuthHandler, error) { providerName := extractProviderName(provider) if oauth2Spec.AuthorizationUrl == "" || oauth2Spec.TokenUrl == "" || oauth2Spec.UserinfoUrl == "" || oauth2Spec.ClientId == "" || oauth2Spec.Scopes == nil || len(*oauth2Spec.Scopes) == 0 { diff --git a/proxy/auth/oidc.go b/proxy/auth/oidc.go index 005afd240..5b561c862 100644 --- a/proxy/auth/oidc.go +++ b/proxy/auth/oidc.go @@ -11,7 +11,7 @@ import ( "github.com/flightctl/flightctl-ui/bridge" "github.com/flightctl/flightctl-ui/config" "github.com/flightctl/flightctl-ui/log" - "github.com/flightctl/flightctl/api/v1alpha1" + "github.com/flightctl/flightctl/api/v1beta1" "github.com/openshift/osincli" ) @@ -34,7 +34,7 @@ type oidcServerResponse struct { EndSessionEndpoint string `json:"end_session_endpoint"` } -func getOIDCAuthHandler(provider *v1alpha1.AuthProvider, oidcSpec *v1alpha1.OIDCProviderSpec) (*OIDCAuthHandler, error) { +func getOIDCAuthHandler(provider *v1beta1.AuthProvider, oidcSpec *v1beta1.OIDCProviderSpec) (*OIDCAuthHandler, error) { providerName := extractProviderName(provider) if oidcSpec.Issuer == "" { diff --git a/proxy/auth/openshift.go b/proxy/auth/openshift.go index fac3b0065..79442475c 100644 --- a/proxy/auth/openshift.go +++ b/proxy/auth/openshift.go @@ -12,7 +12,7 @@ import ( "github.com/flightctl/flightctl-ui/bridge" "github.com/flightctl/flightctl-ui/config" "github.com/flightctl/flightctl-ui/log" - "github.com/flightctl/flightctl/api/v1alpha1" + "github.com/flightctl/flightctl/api/v1beta1" "github.com/openshift/osincli" ) @@ -34,7 +34,7 @@ type openshiftOAuthDiscovery struct { } // getOpenShiftAuthHandlerFromSpec creates an OpenShift auth handler from OpenShiftProviderSpec -func getOpenShiftAuthHandlerFromSpec(provider *v1alpha1.AuthProvider, openshiftSpec *v1alpha1.OpenShiftProviderSpec) (*OpenShiftAuthHandler, error) { +func getOpenShiftAuthHandlerFromSpec(provider *v1beta1.AuthProvider, openshiftSpec *v1beta1.OpenShiftProviderSpec) (*OpenShiftAuthHandler, error) { providerName := extractProviderName(provider) // Determine the API server URL - prefer ClusterControlPlaneUrl, fallback to authorization URL base diff --git a/proxy/go.mod b/proxy/go.mod index bf9b22b92..25c261d29 100644 --- a/proxy/go.mod +++ b/proxy/go.mod @@ -5,7 +5,7 @@ go 1.24.0 toolchain go1.24.6 require ( - github.com/flightctl/flightctl v1.0.0-main.0.20251119121430-1919682154b5 + github.com/flightctl/flightctl v1.0.0-main.0.20251125075421-bbc6daa7c2e7 github.com/gorilla/handlers v1.5.2 github.com/gorilla/mux v1.8.1 github.com/gorilla/websocket v1.5.3 diff --git a/proxy/go.sum b/proxy/go.sum index ee4b81127..e9f5833a9 100644 --- a/proxy/go.sum +++ b/proxy/go.sum @@ -12,8 +12,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvw github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/flightctl/flightctl v1.0.0-main.0.20251119121430-1919682154b5 h1:aLP6In+L7qRtubwket/8wdHj9C2RnubgX2hlhey5iog= -github.com/flightctl/flightctl v1.0.0-main.0.20251119121430-1919682154b5/go.mod h1:V9peeoF0VazgcV19mzGsFHhaNp1GY3LdQSx452LXF3k= +github.com/flightctl/flightctl v1.0.0-main.0.20251125075421-bbc6daa7c2e7 h1:jDjB/bWu8NRhZErSW7jc2U0o3aRZUBL8oiEHpq1um+0= +github.com/flightctl/flightctl v1.0.0-main.0.20251125075421-bbc6daa7c2e7/go.mod h1:Gi6cCJ4Jg42yooeBq3cCUpsBvUbWct8US92JEYX7fc4= github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/getkin/kin-openapi v0.132.0 h1:3ISeLMsQzcb5v26yeJrBcdTCEQTag36ZjaGk7MIRUwk= @@ -112,8 +112,8 @@ github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= -github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=